Skip to content

Commit

Permalink
Clean up cmd_scroll_up() and cmd_scroll_down() slightly
Browse files Browse the repository at this point in the history
  • Loading branch information
craigbarnes committed Dec 21, 2024
1 parent 461d579 commit 93ed8e9
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -1918,9 +1918,8 @@ static bool cmd_scroll_down(EditorState *e, const CommandArgs *a)
View *view = e->view;
view->vy++;

bool never_move_cursor = has_flag(a, 'M');
if (never_move_cursor) {
return true;
if (has_flag(a, 'M')) {
return true; // Don't move cursor, even at scroll margin
}

unsigned int margin = window_get_scroll_margin(e->window);
Expand Down Expand Up @@ -1983,13 +1982,10 @@ static bool cmd_scroll_up(EditorState *e, const CommandArgs *a)
{
BUG_ON(a->nr_args);
View *view = e->view;
if (view->vy) {
view->vy--;
}
view->vy -= (view->vy > 0);

bool never_move_cursor = has_flag(a, 'M');
if (never_move_cursor) {
return true;
if (has_flag(a, 'M')) {
return true; // Don't move cursor, even at scroll margin
}

const Window *window = e->window;
Expand Down

0 comments on commit 93ed8e9

Please sign in to comment.