diff options
author | William McPherson <willmcpherson2@gmail.com> | 2019-12-10 22:25:54 +1100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-12-11 12:10:52 +0100 |
commit | 4ae8d929b4c0a94e027821ecda650b20ec522270 (patch) | |
tree | d7730730e1499144c603387f81da9e720af72372 /Shell/LineEditor.h | |
parent | 244e525c73a545e9532c9ae148d8ec180b37c494 (diff) | |
download | serenity-4ae8d929b4c0a94e027821ecda650b20ec522270.zip |
Shell: Improve tab completion behaviour
A space is added if only one match is found, but we avoid adding
redundant spaces.
We complete "empty" tokens, i.e. when the cursor is at the start of the
line or in front of a space. For example:
mkdir test
cd test
touch test
chmod +x test
export PATH=/home/anon/test
Now if you press tab, or space and then tab, you will get "test". Notice
that you also get a space.
Completion is now done relative to the cursor. You can enter two words
and then go back and complete the first one.
Diffstat (limited to 'Shell/LineEditor.h')
-rw-r--r-- | Shell/LineEditor.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Shell/LineEditor.h b/Shell/LineEditor.h index 7af21e4d78..06e8c6d0ee 100644 --- a/Shell/LineEditor.h +++ b/Shell/LineEditor.h @@ -24,7 +24,7 @@ private: void insert(const String&); void insert(const char); void cut_mismatching_chars(String& completion, const String& program, size_t token_length); - void tab_complete_first_token(); + void tab_complete_first_token(const String&); void vt_save_cursor(); void vt_restore_cursor(); void vt_clear_to_end_of_line(); |