mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 21:33:09 +00:00
Add forward-char-passive binding
This binding is akin to ForwardSingleChar but it is "passive" in that is not intended to affect the meta state of the shell: autocompletions are not accepted if the cursor is at the end of input and it does not have any effect in the completions pager.
This commit is contained in:
parent
b535213ac0
commit
df09ab598f
3 changed files with 13 additions and 0 deletions
|
@ -153,6 +153,7 @@ const INPUT_FUNCTION_METADATA: &[InputFunctionMetadata] = &[
|
|||
make_md(L!("force-repaint"), ReadlineCmd::ForceRepaint),
|
||||
make_md(L!("forward-bigword"), ReadlineCmd::ForwardBigword),
|
||||
make_md(L!("forward-char"), ReadlineCmd::ForwardChar),
|
||||
make_md(L!("forward-char-passive"), ReadlineCmd::ForwardCharPassive),
|
||||
make_md(L!("forward-jump"), ReadlineCmd::ForwardJump),
|
||||
make_md(L!("forward-jump-till"), ReadlineCmd::ForwardJumpTill),
|
||||
make_md(L!("forward-single-char"), ReadlineCmd::ForwardSingleChar),
|
||||
|
|
|
@ -35,6 +35,7 @@ pub enum ReadlineCmd {
|
|||
ForwardChar,
|
||||
BackwardChar,
|
||||
ForwardSingleChar,
|
||||
ForwardCharPassive,
|
||||
ForwardWord,
|
||||
BackwardWord,
|
||||
ForwardBigword,
|
||||
|
|
|
@ -2511,6 +2511,16 @@ impl ReaderData {
|
|||
self.update_buff_pos(elt, Some(el.position() + 1));
|
||||
}
|
||||
}
|
||||
rl::ForwardCharPassive => {
|
||||
let (elt, el) = self.active_edit_line();
|
||||
if self.is_navigating_pager_contents() {
|
||||
// Do nothing
|
||||
} else if self.is_at_end(el) {
|
||||
// Do nothing
|
||||
} else {
|
||||
self.update_buff_pos(elt, Some(el.position() + 1));
|
||||
}
|
||||
}
|
||||
rl::BackwardKillWord | rl::BackwardKillPathComponent | rl::BackwardKillBigword => {
|
||||
let style = match c {
|
||||
rl::BackwardKillBigword => MoveWordStyle::Whitespace,
|
||||
|
@ -4495,6 +4505,7 @@ fn command_ends_paging(c: ReadlineCmd, focused_on_search_field: bool) -> bool {
|
|||
| rl::HistoryPager
|
||||
| rl::BackwardChar
|
||||
| rl::ForwardChar
|
||||
| rl::ForwardCharPassive
|
||||
| rl::ForwardSingleChar
|
||||
| rl::UpLine
|
||||
| rl::DownLine
|
||||
|
|
Loading…
Reference in a new issue