mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-07-03 10:01:16 -03:00
Only expand abbreviations if cursor is directly at command token
On a commandline like "ls arg" (cursor at end) we do not expand abbrevations on enter. OTOH, on "ls " we do expand. This can be frustrating because it means that the two obvious ways to suppress abbrevation expansion (C-Space or post-expansion C-Z) cannot be used to suppress expansion of a command without arguments. (One workaround is "ls #".) Only expand-on-execute if the cursor is at the command name (no space in between). This is a strict improvement for realistic scenarios, because if there is a space, the user has already expressed the intent to not expand the abbreviation. (I hope no one is using recursive abbreviations.) Closes #8423
This commit is contained in:
@@ -3325,7 +3325,7 @@ void reader_data_t::handle_readline_command(readline_cmd_t c, readline_loop_stat
|
||||
if (command_test_result == 0 || command_test_result == PARSER_TEST_INCOMPLETE) {
|
||||
// This command is valid, but an abbreviation may make it invalid. If so, we
|
||||
// will have to test again.
|
||||
if (expand_abbreviation_as_necessary(1)) {
|
||||
if (expand_abbreviation_as_necessary(0)) {
|
||||
// Trigger syntax highlighting as we are likely about to execute this command.
|
||||
this->super_highlight_me_plenty();
|
||||
if (conf.syntax_check_ok) {
|
||||
|
||||
Reference in New Issue
Block a user