Skip to content

Commit

Permalink
Fix cc anc c$ in vi-mode
Browse files Browse the repository at this point in the history
in vim the deleted text can be pasted, while previously that didn't happen in reedline
  • Loading branch information
adaschma committed Jul 18, 2024
1 parent d9198e3 commit adfb86d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/edit_mode/vi/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,10 @@ impl Command {
},
Self::Change => {
let op = match motion {
Motion::End => Some(vec![ReedlineOption::Edit(EditCommand::ClearToLineEnd)]),
Motion::End => Some(vec![ReedlineOption::Edit(EditCommand::CutToLineEnd)]),
Motion::Line => Some(vec![
ReedlineOption::Edit(EditCommand::MoveToStart { select: false }),
ReedlineOption::Edit(EditCommand::ClearToLineEnd),
ReedlineOption::Edit(EditCommand::MoveToLineStart { select: false }),
ReedlineOption::Edit(EditCommand::CutToLineEnd),
]),
Motion::NextWord => Some(vec![ReedlineOption::Edit(EditCommand::CutWordRight)]),
Motion::NextBigWord => {
Expand Down
3 changes: 1 addition & 2 deletions src/edit_mode/vi/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,7 @@ mod tests {
#[case(&['d', 'b'], ReedlineEvent::Multiple(vec![ReedlineEvent::Edit(vec![EditCommand::CutWordLeft])]))]
#[case(&['d', 'B'], ReedlineEvent::Multiple(vec![ReedlineEvent::Edit(vec![EditCommand::CutBigWordLeft])]))]
#[case(&['c', 'c'], ReedlineEvent::Multiple(vec![
//ReedlineEvent::Edit(vec![EditCommand::CutCurrentLine]), ReedlineEvent::Repaint]))]
ReedlineEvent::Edit(vec![EditCommand::MoveToStart{select: false}]), ReedlineEvent::Edit(vec![EditCommand::ClearToLineEnd]), ReedlineEvent::Repaint]))]
ReedlineEvent::Edit(vec![EditCommand::MoveToLineStart { select: false }]), ReedlineEvent::Edit(vec![EditCommand::CutToLineEnd]), ReedlineEvent::Repaint]))]
#[case(&['c', 'w'], ReedlineEvent::Multiple(vec![ReedlineEvent::Edit(vec![EditCommand::CutWordRight]), ReedlineEvent::Repaint]))]
#[case(&['c', 'W'], ReedlineEvent::Multiple(vec![ReedlineEvent::Edit(vec![EditCommand::CutBigWordRight]), ReedlineEvent::Repaint]))]
#[case(&['c', 'e'], ReedlineEvent::Multiple(vec![ReedlineEvent::Edit(vec![EditCommand::CutWordRight]), ReedlineEvent::Repaint]))]
Expand Down

0 comments on commit adfb86d

Please sign in to comment.