diff --git a/src/fish_tests.cpp b/src/fish_tests.cpp index b8644e7bf..fab93be81 100644 --- a/src/fish_tests.cpp +++ b/src/fish_tests.cpp @@ -557,7 +557,7 @@ static void perf_convert_ascii() { double start = timef(); const int iters = 1024; - for (int i=0; i < iters; i++) { + for (int i = 0; i < iters; i++) { (void)str2wcstring(s); } double end = timef(); @@ -2523,7 +2523,8 @@ static void test_1_word_motion(word_motion_t motion, move_word_style_t style, static void test_word_motion() { say(L"Testing word motion"); test_1_word_motion(word_motion_left, move_word_style_punctuation, L"^echo ^hello_^world.^txt^"); - test_1_word_motion(word_motion_right, move_word_style_punctuation, L"^echo^ hello^_world^.txt^"); + test_1_word_motion(word_motion_right, move_word_style_punctuation, + L"^echo^ hello^_world^.txt^"); test_1_word_motion(word_motion_left, move_word_style_punctuation, L"echo ^foo_^foo_^foo/^/^/^/^/^ ^"); @@ -2541,6 +2542,10 @@ static void test_word_motion() { test_1_word_motion(word_motion_right, move_word_style_punctuation, L"^a^ bcd^"); test_1_word_motion(word_motion_right, move_word_style_punctuation, L"a^b^ cde^"); test_1_word_motion(word_motion_right, move_word_style_punctuation, L"^ab^ cde^"); + + test_1_word_motion(word_motion_right, move_word_style_whitespace, L"^^a-b-c^ d-e-f"); + test_1_word_motion(word_motion_right, move_word_style_whitespace, L"^a-b-c^\n d-e-f^ "); + test_1_word_motion(word_motion_right, move_word_style_whitespace, L"^a-b-c^\n\nd-e-f^ "); } /// Test is_potential_path. diff --git a/src/tokenizer.cpp b/src/tokenizer.cpp index 298def8e9..b95a5d523 100644 --- a/src/tokenizer.cpp +++ b/src/tokenizer.cpp @@ -819,7 +819,7 @@ bool move_word_state_machine_t::consume_char_whitespace(wchar_t c) { case s_always_one: { consumed = true; // always consume the first character // If it's not whitespace, only consume those from here. - if (!iswblank(c)) { + if (!iswspace(c)) { state = s_graph; } else { // If it's whitespace, keep consuming whitespace until the graphs. @@ -828,7 +828,7 @@ bool move_word_state_machine_t::consume_char_whitespace(wchar_t c) { break; } case s_blank: { - if (iswblank(c)) { + if (iswspace(c)) { consumed = true; // consumed whitespace } else { state = s_graph; @@ -836,7 +836,7 @@ bool move_word_state_machine_t::consume_char_whitespace(wchar_t c) { break; } case s_graph: { - if (!iswblank(c)) { + if (!iswspace(c)) { consumed = true; // consumed printable non-space } else { state = s_end;