Skip to content

Commit

Permalink
Keep cursor position in the main view when toggling rev-filter
Browse files Browse the repository at this point in the history
Note: this will work only if rev is a subset of the current branch.

This is a complement to c96dd26.
  • Loading branch information
koutcher committed Oct 16, 2024
1 parent a0f77bf commit 914c617
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion NEWS.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ Bug fixes:
Improvements:

- Open the blob corresponding to the diff line. (#1334)
- Keep cursor position when toggling file-filter in the main view.
- Keep cursor position in the main view when toggling
file-filter and rev-filter.
- Make errors visible in views showing Git output. (#1346)
- Allow different colors for all references types.
- Enable search in sections titles. (#1043)
Expand Down
6 changes: 4 additions & 2 deletions src/prompt.c
Original file line number Diff line number Diff line change
Expand Up @@ -874,8 +874,10 @@ prompt_toggle(struct view *view, const char *argv[], enum view_flag *flags)

toggle = find_option_info(option_toggles, ARRAY_SIZE(option_toggles), "", option);
if (toggle) {
if (view_has_flags(view, VIEW_FILE_FILTER) &&
!strcmp(toggle->name, "file_filter"))
if ((view_has_flags(view, VIEW_FILE_FILTER) &&
!strcmp(toggle->name, "file_filter")) ||
(view_has_flags(view, VIEW_REV_FILTER) &&
!strcmp(toggle->name, "rev_filter")))
string_copy_rev(view->env->goto_id, view->env->commit);
return prompt_toggle_option(view, argv, "", toggle, flags);
}
Expand Down

0 comments on commit 914c617

Please sign in to comment.