mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-14 14:03:58 +00:00
Add backward-char-passive
This commit is contained in:
parent
3980e46d3a
commit
1adbec2d37
4 changed files with 17 additions and 10 deletions
|
@ -119,6 +119,7 @@ const INPUT_FUNCTION_METADATA: &[InputFunctionMetadata] = &[
|
||||||
make_md(L!("and"), ReadlineCmd::FuncAnd),
|
make_md(L!("and"), ReadlineCmd::FuncAnd),
|
||||||
make_md(L!("backward-bigword"), ReadlineCmd::BackwardBigword),
|
make_md(L!("backward-bigword"), ReadlineCmd::BackwardBigword),
|
||||||
make_md(L!("backward-char"), ReadlineCmd::BackwardChar),
|
make_md(L!("backward-char"), ReadlineCmd::BackwardChar),
|
||||||
|
make_md(L!("backward-char-passive"), ReadlineCmd::BackwardCharPassive),
|
||||||
make_md(L!("backward-delete-char"), ReadlineCmd::BackwardDeleteChar),
|
make_md(L!("backward-delete-char"), ReadlineCmd::BackwardDeleteChar),
|
||||||
make_md(L!("backward-jump"), ReadlineCmd::BackwardJump),
|
make_md(L!("backward-jump"), ReadlineCmd::BackwardJump),
|
||||||
make_md(L!("backward-jump-till"), ReadlineCmd::BackwardJumpTill),
|
make_md(L!("backward-jump-till"), ReadlineCmd::BackwardJumpTill),
|
||||||
|
|
|
@ -34,6 +34,7 @@ pub enum ReadlineCmd {
|
||||||
EndOfLine,
|
EndOfLine,
|
||||||
ForwardChar,
|
ForwardChar,
|
||||||
BackwardChar,
|
BackwardChar,
|
||||||
|
BackwardCharPassive,
|
||||||
ForwardSingleChar,
|
ForwardSingleChar,
|
||||||
ForwardCharPassive,
|
ForwardCharPassive,
|
||||||
ForwardWord,
|
ForwardWord,
|
||||||
|
|
|
@ -2497,6 +2497,14 @@ impl ReaderData {
|
||||||
self.update_buff_pos(elt, Some(el.position() - 1));
|
self.update_buff_pos(elt, Some(el.position() - 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
rl::BackwardCharPassive => {
|
||||||
|
let (elt, el) = self.active_edit_line();
|
||||||
|
if el.position() != 0 {
|
||||||
|
if elt == EditableLineTag::SearchField || !self.is_navigating_pager_contents() {
|
||||||
|
self.update_buff_pos(elt, Some(el.position() - 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
rl::ForwardChar | rl::ForwardSingleChar => {
|
rl::ForwardChar | rl::ForwardSingleChar => {
|
||||||
let (elt, el) = self.active_edit_line();
|
let (elt, el) = self.active_edit_line();
|
||||||
if self.is_navigating_pager_contents() {
|
if self.is_navigating_pager_contents() {
|
||||||
|
@ -2513,12 +2521,10 @@ impl ReaderData {
|
||||||
}
|
}
|
||||||
rl::ForwardCharPassive => {
|
rl::ForwardCharPassive => {
|
||||||
let (elt, el) = self.active_edit_line();
|
let (elt, el) = self.active_edit_line();
|
||||||
if self.is_navigating_pager_contents() {
|
if !self.is_at_end(el) {
|
||||||
// Do nothing
|
if elt == EditableLineTag::SearchField || !self.is_navigating_pager_contents() {
|
||||||
} else if self.is_at_end(el) {
|
self.update_buff_pos(elt, Some(el.position() + 1));
|
||||||
// Do nothing
|
}
|
||||||
} else {
|
|
||||||
self.update_buff_pos(elt, Some(el.position() + 1));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rl::BackwardKillWord | rl::BackwardKillPathComponent | rl::BackwardKillBigword => {
|
rl::BackwardKillWord | rl::BackwardKillPathComponent | rl::BackwardKillBigword => {
|
||||||
|
@ -4504,6 +4510,7 @@ fn command_ends_paging(c: ReadlineCmd, focused_on_search_field: bool) -> bool {
|
||||||
| rl::CompleteAndSearch
|
| rl::CompleteAndSearch
|
||||||
| rl::HistoryPager
|
| rl::HistoryPager
|
||||||
| rl::BackwardChar
|
| rl::BackwardChar
|
||||||
|
| rl::BackwardCharPassive
|
||||||
| rl::ForwardChar
|
| rl::ForwardChar
|
||||||
| rl::ForwardCharPassive
|
| rl::ForwardCharPassive
|
||||||
| rl::ForwardSingleChar
|
| rl::ForwardSingleChar
|
||||||
|
|
|
@ -104,13 +104,11 @@ isolated-tmux capture-pane -p
|
||||||
# CHECK: prompt 7> echo suggest nothing
|
# CHECK: prompt 7> echo suggest nothing
|
||||||
|
|
||||||
isolated-tmux send-keys C-u 'bind \cs forward-char-passive' Enter C-l
|
isolated-tmux send-keys C-u 'bind \cs forward-char-passive' Enter C-l
|
||||||
isolated-tmux send-keys C-u 'bind \cp backward-char' Enter C-l
|
isolated-tmux send-keys C-u 'bind \cb backward-char-passive' Enter C-l
|
||||||
isolated-tmux send-keys C-u 'echo do not accept this' Enter C-l
|
isolated-tmux send-keys C-u 'echo do not accept this' Enter C-l
|
||||||
tmux-sleep
|
tmux-sleep
|
||||||
isolated-tmux send-keys 'echo do not accept thi' C-p C-p Delete C-p C-s 'h'
|
isolated-tmux send-keys 'echo do not accept thi' C-b C-b Delete C-b C-s 'h'
|
||||||
tmux-sleep
|
tmux-sleep
|
||||||
isolated-tmux send-keys C-s C-s C-s 'x'
|
isolated-tmux send-keys C-s C-s C-s 'x'
|
||||||
tmux-sleep
|
|
||||||
isolated-tmux capture-pane -p
|
isolated-tmux capture-pane -p
|
||||||
tmux-sleep
|
|
||||||
# CHECK: prompt 10> echo do not accept thix
|
# CHECK: prompt 10> echo do not accept thix
|
||||||
|
|
Loading…
Reference in a new issue