Skip to content

Commit 5ce1c4e

Browse files
committed
merge move_up/move_down into move_line_up/move_line_down
1 parent 7d3d8c1 commit 5ce1c4e

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

src/core_editor/editor.rs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ impl Editor {
6464
EditCommand::MoveToPosition { position, select } => {
6565
self.move_to_position(*position, *select)
6666
}
67-
EditCommand::MoveLineUp { select } => self.move_up(*select),
68-
EditCommand::MoveLineDown { select } => self.move_down(*select),
67+
EditCommand::MoveLineUp { select } => self.move_line_up(*select),
68+
EditCommand::MoveLineDown { select } => self.move_line_down(*select),
6969
EditCommand::MoveLeft { select } => self.move_left(*select),
7070
EditCommand::MoveRight { select } => self.move_right(*select),
7171
EditCommand::MoveWordLeft { select } => self.move_word_left(*select),
@@ -254,12 +254,14 @@ impl Editor {
254254
self.line_buffer.set_insertion_point(position)
255255
}
256256

257-
pub(crate) fn move_line_up(&mut self) {
257+
pub(crate) fn move_line_up(&mut self, select: bool) {
258+
self.update_selection_anchor(select);
258259
self.line_buffer.move_line_up();
259260
self.update_undo_state(UndoBehavior::MoveCursor);
260261
}
261262

262-
pub(crate) fn move_line_down(&mut self) {
263+
pub(crate) fn move_line_down(&mut self, select: bool) {
264+
self.update_selection_anchor(select);
263265
self.line_buffer.move_line_down();
264266
self.update_undo_state(UndoBehavior::MoveCursor);
265267
}
@@ -621,16 +623,6 @@ impl Editor {
621623
self.line_buffer.insert_str(string);
622624
}
623625

624-
fn move_up(&mut self, select: bool) {
625-
self.update_selection_anchor(select);
626-
self.line_buffer.move_line_up();
627-
}
628-
629-
fn move_down(&mut self, select: bool) {
630-
self.update_selection_anchor(select);
631-
self.line_buffer.move_line_down();
632-
}
633-
634626
fn move_left(&mut self, select: bool) {
635627
self.update_selection_anchor(select);
636628
self.line_buffer.move_left();

src/engine.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1662,7 +1662,7 @@ impl Reedline {
16621662
// If we're at the top, move to previous history
16631663
self.previous_history();
16641664
} else {
1665-
self.run_edit_commands(&[EditCommand::MoveLineUp { select: false }]);
1665+
self.editor.move_line_up(false);
16661666
}
16671667
}
16681668

@@ -1672,7 +1672,7 @@ impl Reedline {
16721672
// If we're at the top, move to previous history
16731673
self.next_history();
16741674
} else {
1675-
self.run_edit_commands(&[EditCommand::MoveLineDown { select: false }]);
1675+
self.editor.move_line_down(false);
16761676
}
16771677
}
16781678

0 commit comments

Comments
 (0)