Commit Graph

42 Commits

Author SHA1 Message Date
christos 4fd19b1be2 Add an LLVM fuzzing wrapper for the portable libedit (Christian Holler) 2021-09-10 13:33:45 +00:00
abhinav c3d00a7d30 PR lib/54510: Fix file completion inside quotes which broke in rev 1.53
While there also fix handling character appending in the file completions when
inside quotes. For example when inside a quote, if the completion is a directory then
append a '/' but don't close the quote. On the other hand when inside a quote if the
completion is a file name and it is the only match then we can close the quote.
2019-09-08 05:50:58 +00:00
abhinav c93cba3ab2 Perform quoting of filename completions when there are multiple matches as well
Quoting of special characters in filename completion was implemented for single match
case, this enables it for multiple matches as well. For example:

$ touch 'foo bar'
$ touch 'foo baz'
$ ls fo<TAB>
autocompletes to =>
$ ls foo\ ba
hitting <TAB> again shows:
foo bar foo baz

This required unescaping escape sequences generated during last completion
in order to find the word to complete.

While there, also update the test to include cases for multiple matches.

Reviewed by christos
2019-03-31 03:04:57 +00:00
abhinav 2afc179c8f Handle filename autocompletion when the cursor is at a backslash or quote character
For example, handle following case:
	$ touch 'foo bar'
	$ ls foo\<TAB> --> $ ls foo\ bar

Also add test cases for this.

Thanks to Christos for review
2018-05-04 16:39:14 +00:00
abhinav 92a9b5c3ba Add copyright and rcs header to the test program.
Also, remove a test case which was not supposed to be there.
(While that test case works with the changes I committed, testing that
 test case with the test program is not possible in its current form. I'm
 working on that.)
2017-10-15 19:17:30 +00:00
abhinav fa61555626 Add support for escaping special characters when doing filename completion.
For instance if the file name is "foo bar":
$ ls foo<TAB>
should get autocompleted to:
$ ls foo\ bar

Works for similar other characters too, which need escaping.

Also, add an accompanying test program to ensure the escaping is correct
in various scenarios (within quotes, without quotes, with other special characeters)

Thanks to Christos for reviews, help and feedback.
2017-10-15 18:59:00 +00:00
christos 4e541d85ca Start removing the WIDECHAR ifdefs; building without it has stopped working
anyway. (Ingo Schwarze)
2016-03-23 22:27:48 +00:00
christos e7df8a2227 convert to 2 clause 2016-02-29 00:54:19 +00:00
christos 22383670cc whitespace and header sorting changes (Ingo Schwarze). No functional changes. 2016-02-17 19:47:49 +00:00
christos 42e2a4d875 Compile with WIDECHAR the same way the main Makefile does (Ingo Schwarze) 2016-02-15 21:38:07 +00:00
christos 20efb692ab cast gotsig because it is long on some systems. 2014-06-18 20:12:15 +00:00
christos cfca73c1f8 Initialize res (Kamil Dudka) 2011-11-18 20:30:01 +00:00
christos 436299cdac need err.h now 2011-08-04 14:33:05 +00:00
christos 8cf227343c - check and don't cast malloc return
- more wide function use
2011-07-28 01:08:58 +00:00
christos 0da54e076e add history testing code. 2011-07-27 02:18:00 +00:00
christos b354315033 unbreak readline history. 2010-09-16 20:08:51 +00:00
christos 72c00e4a7a \033 is more portable than \e still. 2010-04-18 21:17:47 +00:00
christos b77d4fa5c5 From Jess Thrysoee: call setlocale so we can test UTF-8 2010-04-15 00:50:46 +00:00
roy 98eb889579 Userland now builds and uses terminfo instead of termcap.
OK: core@, jdc@
2010-02-03 15:34:37 +00:00
christos 73eda9fe27 rename historyw -> history_w for consistency.
add wide tst code and make it the default.
2010-01-03 18:27:10 +00:00
christos 537657ed45 Use the proper prompt printing function. 2009-07-17 12:25:52 +00:00
christos c8754a5b44 Implement literal prompt sequences. Now someone can implement
RL_PROMPT_START_LITERAL/RL_PROMPT_END_LITERAL :-)
2009-03-31 17:38:27 +00:00
rpaulo 1399def216 Rename TEST/test.c to avoid problems when doing a cleandir on case-insensitive
file systems.
ok'ed christos.
2006-08-31 20:20:38 +00:00
lukem ac636bd17a Don't use non-standard uint or u_int. 2005-06-01 11:37:52 +00:00
lukem beb8208a11 fix for WARNS=3 2005-05-28 12:03:22 +00:00
christos 308097fac3 Make signal handler safe. From Michael Knudsen, many thanks. 2005-05-18 00:50:24 +00:00
lukem cbb69f7013 update for function name change 2003-12-08 12:03:01 +00:00
lukem a9beb0e443 Tokenization function enhancements:
* Make tok_init(), tok_end(), tok_reset(), tok_line() and tok_str()
  publically available in <histedit.h>
* Documented the public functions in editline(3)
* Renamed tok_line() -> tok_str()
* Added new tok_line() which takes a "const LineInfo *" instead of
  "const char *" (the former has "cursor" information), and optionally
  return the argv index ("int *cursorc") and offset within that index
  ("int *cursorv").  This means that completion routines can use the
  tokenization code to crack the line and easily find which word the
  cursor is at.  (mmm, context sensitive completion :)
* Fixed TEST/test.c when using "continuation" lines (unmatched quote
  or \ at EOL), and added some more DEBUG messages including highlighting
  where the cursor is (with a `_').
2003-12-05 13:37:48 +00:00
christos 99e15c71d0 I got tired of typing a cc line. 2003-10-16 21:41:46 +00:00
agc eb7c1594f1 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22280, verified by myself.
2003-08-07 16:42:00 +00:00
soren 642c31b4a3 Remove extraneous \n's in {err,warn}{,x}. 2002-08-09 10:01:53 +00:00
christos 8a47c9318b make sure this compiles cleanly and works. 2002-03-23 23:39:18 +00:00
christos 0e0ac6b723 - constify; passes all gcc and lint strict checks.
- add config.h [Jason Evans], to create a portable version of libedit that
  can be easily compiled on other OS's.
2002-03-18 16:00:50 +00:00
lukem e4b166ade0 convert to new style guide 2000-09-04 23:36:41 +00:00
lukem 250f2917a0 fix id header... 1999-09-21 00:07:03 +00:00
simonb 1528b77539 More trailing white space. 1999-07-02 15:14:07 +00:00
christos 9f2cd5c8ff Show the simpler way. 1998-05-20 01:38:53 +00:00
christos 116d3cb1aa Fix for api changes. 1998-05-20 01:12:25 +00:00
lukem 3431200c6f make this compile with the new libedit history() 1997-10-23 06:35:42 +00:00
lukem 2543e3e651 RCSid police
editline first appeared in 4.4BSD not NetBSD1.0
1997-01-11 06:47:47 +00:00
christos 95b0e87b48 Added history load and save to file functions. 1995-10-15 19:42:05 +00:00
cgd 6dc2f1db52 libedit! 1994-05-06 06:01:42 +00:00