History log of /src/lib/libedit/filecomplete.c |
Revision | | Date | Author | Comments |
1.73 |
| 25-Apr-2023 |
christos | pass lint.
|
1.72 |
| 03-Feb-2023 |
christos | Add a entry point for the complete function for FreeBSD compatibility with sh.
|
1.71 |
| 30-Oct-2022 |
christos | improvements in malloc/free handling.
|
1.70 |
| 12-Mar-2022 |
christos | Fix filename autocompletion for strings like a\)b
An escaped character should unconditionally be skipped together with the character that does the escaping. For example, in "a\)b" only the ")b" part was skipped but then the loop stopped at the "\" since it's one of the characters listed in word_break. (Piotr P. Stefaniak)
|
1.69 |
| 26-Sep-2021 |
christos | - Completion should not add a quote at the end of the line to match an already quoted quote. (Piotr Stefaniak) - fix lint unconst warnings for strchr
|
1.68 |
| 05-May-2021 |
christos | PR/56147: Miroslav Lichvar: Avoid memory leak if strdup fails.
|
1.67 |
| 28-Mar-2021 |
christos | Only unescape when we are quoting and don't add a space if we are quoting (we already did) (Piotr Stefaniak)
|
1.66 |
| 28-Mar-2021 |
christos | Pass the unescaped filename the the append function so it has to do less work (for example it can call stat(2) directly (Piotr Stefaniak)
|
1.65 |
| 27-Mar-2021 |
christos | Add fn_complete2() that controls the quoting of the returned match. Before it was based on the heuristic that we were not supplied an attempted_completion_function, which worked well because programs that supplied that function were not shells and did not want/understand shell quoting. Recently though Piotr Stefaniak wanted to enhance command completion for the Bourne Shell and this could benefit quoting the returned command. This function adds an extra flags argument that controls that quoting.
|
1.64 |
| 05-Jan-2020 |
abhinav | PR lib/54510 - when user supplied completion function is there, don't unescape the string to be completed.
|
1.63 |
| 05-Jan-2020 |
tih | Summary: Remove over-simplified extraneous test
The file name matching code in libedit tries to adjust to the presence of explicit " or ' characters in the input line, but tries too hard. Remove a conditional that goes overboard, and causes the completion code to fail if a quoted string is seen before the filename to be expanded, as in
grep 'foo' bar<TAB>
Before this change, the above would not expand any possible completions, even if they existed, because it would choose to look for files whose names started with " bar".
|
1.62 |
| 10-Dec-2019 |
christos | When 'attempted_completion_function' non-NULL, with a 'single_match' match, the expected space is not being added. Problem observed with "chronyc" and "sqlite3" tab completion. That functionality got moved to escape_filename() for the !attempted_completion_function case, but the non-NULL 'attempted_completion_function' case must also be handled. (Lonnie Abelbeck)
|
1.61 |
| 09-Oct-2019 |
christos | add +1 to strlcpy's (Patrick Welche)
|
1.60 |
| 08-Oct-2019 |
christos | remore error(1) comment
|
1.59 |
| 08-Oct-2019 |
christos | Change strncpy to either memcpy (when we know the len), or strlcpy (when we used to NUL terminate explicitly.
|
1.58 |
| 08-Sep-2019 |
abhinav | 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.
|
1.57 |
| 28-Jul-2019 |
christos | PR/54415: Ricky Zhou: libedit stats completions for non-file completions Use the proper completion function and account for the character appended by the function when computing the number of columns.
|
1.56 |
| 23-Jul-2019 |
christos | PR/54399: S�ren Tempel: Uninitialized memory access in libedit history. Initialize the buffer using calloc. While here change all malloc(a * sizeof(b)) to calloc(a, sizeof(b)). XXX: should fix realloc similarly.
|
1.55 |
| 20-Apr-2019 |
abhinav | PR lib/54131 - declare the loop variable outside the for loop
|
1.54 |
| 12-Apr-2019 |
christos | PR/54117: Paavo Helde: Fix memory overrun: Account for the closing quote in memory allocation if quoted.
|
1.53 |
| 31-Mar-2019 |
abhinav | 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
|
1.52 |
| 24-Mar-2019 |
abhinav | Only quote the completion matches if we are doing filename completion
If the user supplies a value for the attempted_completion_function parameter then we cannot be sure if the completion is for filename or something else, in such a case don't attempt to quote the completion matches.
Reviewed by christos
This should address PR lib/54067
|
1.51 |
| 04-May-2018 |
christos | branches: 1.51.2; fix uninitialized
|
1.50 |
| 04-May-2018 |
abhinav | 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
|
1.49 |
| 02-May-2018 |
abhinav | Add '*' and '[' to the list of characters which need escaping during autocompletion
|
1.48 |
| 27-Oct-2017 |
abhinav | branches: 1.48.2; Add NULL check after doing memory allocation at a couple of places
ok christos@
|
1.47 |
| 15-Oct-2017 |
abhinav | 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.
|
1.46 |
| 16-Sep-2017 |
abhinav | Fix indentation (convert spaces to tab)
|
1.45 |
| 21-Apr-2017 |
abhinav | When doing filename autocompletion, append a trailing slash at the end of directory names. We already do this when there is only one completion option but in case of of multiple completion options, it wasn't being done.
ok christos@
|
1.44 |
| 31-Oct-2016 |
abhinav | branches: 1.44.2; Fix file name auto completion in one specific case.
For example if you do $mkdir -p /tmp/dir1/dir2
Then: $ls /tmp/di <TAB> auto completes to $ls /tmp/dir1/
Hitting <TAB> again auto completes to $ls /tmp/dir1/dir2
Whereas it should auto complete to $ls /tmp/dir1/dir2/
Essentially, in cases like above where you have to hit <TAB> twice to get to the match and there is only one match (because only one file/sub-directory) then auto complete doesn't work correctly. It doesn't append a trailing slash (in case of directory) or a space (in case of a file) to the match name.
I have tested file name completion in sh(1) and symbol completion in gdb after this change.
|
1.43 |
| 11-Apr-2016 |
christos | branches: 1.43.2; Char -> wchar_t from Ingo Schwarze.
|
1.42 |
| 11-Apr-2016 |
christos | more macro WIDECHAR undoing from Ingo Schwarze.
|
1.41 |
| 09-Apr-2016 |
christos | Change some 0's to NULL's from Pedro Giffuni
|
1.40 |
| 17-Feb-2016 |
christos | whitespace and header sorting changes (Ingo Schwarze). No functional changes.
|
1.39 |
| 16-Feb-2016 |
christos | More header cleanups from Ingo Schwarze.
|
1.38 |
| 16-Feb-2016 |
christos | more include file cleanup (Ingo Schwarze)
|
1.37 |
| 16-Feb-2016 |
christos | From Ingo Scharze: Let "el.h" include everything needed for struct editline, and don't include that stuff multiple times. That also improves consistency, also avoids circular inclusions, and also makes it easier to follow what is going on, even though not quite as nice. But it seems like the best we can do...
|
1.36 |
| 16-Feb-2016 |
christos | cleanup chartype.h includes (Ingo Schwarze)
|
1.35 |
| 16-Feb-2016 |
christos | cleanup inclusion of histedit.h (Ingo Schwarze)
|
1.34 |
| 18-Oct-2014 |
riz | callers's -> caller's
|
1.33 |
| 18-Oct-2014 |
snj | src is too big these days to tolerate superfluous apostrophes. It's "its", people!
|
1.32 |
| 05-Jun-2014 |
christos | branches: 1.32.2; PR/48876: Dmitriy Grigoryev: Core dump in readline lib on attempted expansion Make sure we have 2 matches before calling strcmp().
|
1.31 |
| 16-Sep-2011 |
plunky | branches: 1.31.8; 1.31.18; NULL does not need a cast, here
|
1.30 |
| 16-Aug-2011 |
christos | re-enable -Wconversion
|
1.29 |
| 29-Jul-2011 |
christos | pass -Wconversion
|
1.28 |
| 29-Jul-2011 |
christos | - fix unused params - unconditionalize vis.h
|
1.27 |
| 29-Jul-2011 |
christos | KNF return (\1); -> return \1;
|
1.26 |
| 28-Jul-2011 |
christos | kill ptr_t and ioctl_t, add * sizeof(*foo) to all allocations.
|
1.25 |
| 28-Jul-2011 |
christos | fix unused variable warnings on systems without _r functions
|
1.24 |
| 28-Jul-2011 |
christos | eliminate alloca for portability portable getpw{nam,uid}
|
1.23 |
| 06-Dec-2010 |
dholland | Improve previous to avoid changing the interface of an externally exposed function. (But note that this function is neither documented nor declared in any installed header file, and it probably should not be externally exposed.) Related to PR 44183, closes PR 44186.
|
1.22 |
| 02-Dec-2010 |
dholland | add const, from PR 44183.
|
1.21 |
| 02-Dec-2010 |
dholland | Fix up bodgy code for printing completion matches; it used to sometimes skip entries, print (null), run off the end of the array, or occasionally receive SIGSEGV, and now will, hopefully at least, do none of that.
Based in part on the patch in PR 44183 from Sergio Acereda; I also did some tidyup and fixed it to print top-to-bottom first like ls(1).
|
1.20 |
| 15-Nov-2010 |
christos | don't increment i twice in the loop. From Michael Byrnes
|
1.19 |
| 01-Jun-2010 |
christos | tidy up memory allocation and don't unnecessarily print "./" before names.
|
1.18 |
| 18-Jan-2010 |
christos | PR/42637: Joachim Kuebart: Shell tab completion crashes due to libedit stack smashing
|
1.17 |
| 30-Dec-2009 |
christos | Wide character support (UTF-8) from Johny Mattsson; currently disabled.
|
1.16 |
| 28-Dec-2009 |
christos | improve on the listing display by printing only one character after the filename not two, and no trailing blanks. I will revisit this when I write the ls-F code.
|
1.15 |
| 16-Feb-2009 |
christos | fix sign compare issues.
|
1.14 |
| 15-Feb-2009 |
christos | pass lint on _LP64.
|
1.13 |
| 26-Jan-2009 |
apb | branches: 1.13.2; Define HAVE_STRUCT_DIRENT_D_NAMLEN in config,h, and test it when deciding whether to use entry->d_namlen or strlen(entry->d_name). Addresses PR 40477 by Robert Millan.
|
1.12 |
| 11-Jan-2009 |
christos | - insert a space after the recognized string if it was an exact match - initialize properly the string used for completion. From Alex Bligh alex at alex dot org dot uk - Make char constants consistent
|
1.11 |
| 29-Apr-2008 |
martin | Convert to new 2 clause license
|
1.10 |
| 09-Nov-2006 |
christos | branches: 1.10.16; don't use alloca with ssp.
|
1.9 |
| 21-Aug-2006 |
christos | Change to a 3 clause copyright after permission of the holders.
|
1.8 |
| 03-Aug-2005 |
christos | Fix reversed test; from Gerry Swislow
|
1.7 |
| 11-Jun-2005 |
christos | PR/30500: Paul Shupak: Inconsistent definition of tilde_expand(). Provide a layer of indirection between the readline compatibility functions and our internal implementation, so that we have the freedom to change the function signature.
|
1.6 |
| 10-Jun-2005 |
christos | Bug reported from Martin Dietze:
The place to change the completion_append_character is usually somewhere in the `rl_completion_entry_function' callback which is where one usually can distinguish between file- or dir-like entries to append a slash for dirs etc.
This does no longer work since `fn_complete()' takes the `append_character' as argument before the callback is executed, so that changes to the variable `rl_completion_append_character' have in fact no effect for the current completion.
Fix by adding a function that returns the rl_completion_append_character, when it gets passed in a filename in readline emulation.
|
1.5 |
| 18-May-2005 |
christos | Make completion_matches non-static since readline wants it.
|
1.4 |
| 12-May-2005 |
christos | PR/30215: Kouichirou Hiratsuka: /bin/sh dumps core with tabcomplete Don't core-dump when trying to complete an empty line; instead assume ./
|
1.3 |
| 09-May-2005 |
dsl | Use getpwuid_r(getuid(), ...) to expand ~/.... Don't replace ~xyz with /home/xyz when expanding ~
|
1.2 |
| 07-May-2005 |
dsl | gdb directly calls filename_completion_function()
|
1.1 |
| 07-May-2005 |
dsl | Separate out the filename completion functions from the readline() code. Pass in loads of parameters instead of relying on shed-loads of global variables to modify the behaviour. The filename completion code can now be enabled by code that uses el_gets(). (eg /bin/sh)
|
1.10.16.1 |
| 18-May-2008 |
yamt | sync with head.
|
1.13.2.1 |
| 13-May-2009 |
jym | Sync with HEAD.
Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
|
1.31.18.1 |
| 10-Aug-2014 |
tls | Rebase.
|
1.31.8.1 |
| 20-Aug-2014 |
tls | Rebase to HEAD as of a few days ago.
|
1.32.2.1 |
| 13-May-2015 |
martin | Sync lib/libedit with head, requested by christos in #753:
lib/libedit/Makefile 1.53 lib/libedit/chartype.h 1.13 lib/libedit/editline.3 1.83-1.84 lib/libedit/editrc.5 1.28-1.29 lib/libedit/eln.c 1.18 lib/libedit/filecomplete.c 1.33-1.34 lib/libedit/readline.c 1.112-1.115
Man page improvements, fix overlapping strcpy, improve readline compatibility, clang build fix.
|
1.43.2.2 |
| 26-Apr-2017 |
pgoyette | Sync with HEAD
|
1.43.2.1 |
| 04-Nov-2016 |
pgoyette | Sync with HEAD
|
1.44.2.1 |
| 21-Apr-2017 |
bouyer | Sync with HEAD
|
1.48.2.1 |
| 21-May-2018 |
pgoyette | Sync with HEAD
|
1.51.2.2 |
| 13-Apr-2020 |
martin | Mostly merge changes from HEAD upto 20200411
|
1.51.2.1 |
| 10-Jun-2019 |
christos | Sync with HEAD
|