From 009ecfd7e6151d457056617004a691216d0f9851 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Fri, 26 Apr 2019 19:07:33 +0200 Subject: [PATCH] src/tokenizer: Add ":@" to the list of non-path-component chars This makes kill-path-component stop there. Fixes #5841. --- src/tokenizer.cpp | 2 +- tests/bind.expect | 17 +++++++++++++++++ tests/bind.expect.out | 2 ++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/tokenizer.cpp b/src/tokenizer.cpp index 883a04afc..d2fbe0fdb 100644 --- a/src/tokenizer.cpp +++ b/src/tokenizer.cpp @@ -638,7 +638,7 @@ bool move_word_state_machine_t::consume_char_punctuation(wchar_t c) { bool move_word_state_machine_t::is_path_component_character(wchar_t c) { // Always treat separators as first. All this does is ensure that we treat ^ as a string // character instead of as stderr redirection, which I hypothesize is usually what is desired. - return tok_is_string_character(c, true) && !std::wcschr(L"/={,}'\"", c); + return tok_is_string_character(c, true) && !std::wcschr(L"/={,}'\":@", c); } bool move_word_state_machine_t::consume_char_path_components(wchar_t c) { diff --git a/tests/bind.expect b/tests/bind.expect index 6f9e97e52..ffe28ef8e 100644 --- a/tests/bind.expect +++ b/tests/bind.expect @@ -271,3 +271,20 @@ expect_prompt -re {ctrl-o seen} { } unmatched { puts stderr "ctrl-o not seen" } + +# \x17 is ctrl-w. +send "echo git@github.com:fish-shell/fish-shell" +send "\x17\x17\r" +expect_prompt -re {git@github.com:} { + puts "ctrl-w stops at :" +} unmatched { + puts stderr "ctrl-w does not stop at :" +} + +send "echo git@github.com:fish-shell/fish-shell" +send "\x17\x17\x17\r" +expect_prompt -re {git@} { + puts "ctrl-w stops at @" +} unmatched { + puts stderr "ctrl-w does not stop at @" +} diff --git a/tests/bind.expect.out b/tests/bind.expect.out index 55667d0f6..3e8f30c2b 100644 --- a/tests/bind.expect.out +++ b/tests/bind.expect.out @@ -20,3 +20,5 @@ emacs transpose words, 100ms timeout: short delay emacs transpose words, 100ms timeout: long delay ctrl-v seen ctrl-o seen +ctrl-w stops at : +ctrl-w stops at @