mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-15 23:22:53 +08:00
Add an initial test for fish_cursor_selection_mode
This commit is contained in:
parent
5cf67c2d61
commit
7d198fa404
@ -1049,8 +1049,8 @@ wcstring combine_command_and_autosuggestion(const wcstring &cmdline,
|
||||
}
|
||||
|
||||
bool reader_data_t::select_char_after_cursor() {
|
||||
auto val = vars().get(L"fish_select_char_after_cursor");
|
||||
return !val || val->as_string() == L"1";
|
||||
auto val = vars().get(L"fish_cursor_selection_mode");
|
||||
return !val || val->as_string() == L"inclusive";
|
||||
}
|
||||
|
||||
/// Update the cursor position.
|
||||
|
61
tests/pexpects/cursor_selection.py
Normal file
61
tests/pexpects/cursor_selection.py
Normal file
@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env python3
|
||||
from pexpect_helper import SpawnedProc
|
||||
|
||||
home, end = "\x01", "\x05"
|
||||
left, right ="\x02", "\x06"
|
||||
select, dump = "\x00", "!"
|
||||
|
||||
sp = SpawnedProc()
|
||||
sendline, expect_prompt, expect_str = sp.sendline, sp.expect_prompt, sp.expect_str
|
||||
expect_prompt()
|
||||
|
||||
sendline("bind -k nul begin-selection")
|
||||
expect_prompt()
|
||||
sendline("bind ! 'echo -n \"<$(commandline --current-selection)>\"'")
|
||||
expect_prompt()
|
||||
|
||||
sendline("set fish_cursor_selection_mode inclusive")
|
||||
|
||||
sendline(f"echo{home}{select}{dump}")
|
||||
expect_str("<e>")
|
||||
sendline(f"echo{home}{select}{right}{dump}")
|
||||
expect_str("<ec>")
|
||||
sendline(f"echo{home}{right}{select}{left}{dump}")
|
||||
expect_str("<ec>")
|
||||
|
||||
sendline(f"echo{home}{right}{select}{dump}")
|
||||
expect_str("<c>")
|
||||
sendline(f"echo{home}{right}{select}{right}{dump}")
|
||||
expect_str("<ch>")
|
||||
sendline(f"echo{home}{right}{right}{select}{left}{dump}")
|
||||
expect_str("<ch>")
|
||||
|
||||
sendline(f"echo{end}{select}{dump}")
|
||||
expect_str("<>")
|
||||
sendline(f"echo{end}{select}{left}{dump}")
|
||||
expect_str("<o>")
|
||||
sendline(f"echo{end}{left}{select}{right}{dump}")
|
||||
expect_str("<o>")
|
||||
|
||||
sendline("set fish_cursor_selection_mode exclusive")
|
||||
|
||||
sendline(f"echo{home}{select}{dump}")
|
||||
expect_str("<>")
|
||||
sendline(f"echo{home}{select}{right}{dump}")
|
||||
expect_str("<e>")
|
||||
sendline(f"echo{home}{right}{select}{left}{dump}")
|
||||
expect_str("<e>")
|
||||
|
||||
sendline(f"echo{home}{right}{select}{dump}")
|
||||
expect_str("<>")
|
||||
sendline(f"echo{home}{right}{select}{right}{dump}")
|
||||
expect_str("<c>")
|
||||
sendline(f"echo{home}{right}{right}{select}{left}{dump}")
|
||||
expect_str("<c>")
|
||||
|
||||
sendline(f"echo{end}{select}{dump}")
|
||||
expect_str("<>")
|
||||
sendline(f"echo{end}{select}{left}{dump}")
|
||||
expect_str("<o>")
|
||||
sendline(f"echo{end}{left}{select}{right}{dump}")
|
||||
expect_str("<o>")
|
Loading…
x
Reference in New Issue
Block a user