mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 12:32:40 +03:00
Clarify center scrolling of multi-column lists.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
a4b51c3e81
commit
1a5aff3188
@ -2094,7 +2094,7 @@ will just scroll a file at a time.
|
||||
.PP
|
||||
.I Center scrolling.
|
||||
If set, panel will scroll when the cursor reaches the middle of the
|
||||
panel, only hitting the top or bottom of the panel when actually on
|
||||
panel column, only hitting the top or bottom of the panel when actually on
|
||||
the first or last file. This behavior applies when scrolling one file
|
||||
at a time, and does not apply to the page up/down keys.
|
||||
.PP
|
||||
|
@ -2081,6 +2081,23 @@ panel_select_ext_cmd (void)
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
panel_selected_at_half (const WPanel * panel)
|
||||
{
|
||||
int lines, top;
|
||||
|
||||
lines = panel_lines (panel);
|
||||
|
||||
/* define top file of column */
|
||||
top = panel->top_file;
|
||||
if (panel->list_cols > 1)
|
||||
top += lines * ((panel->selected - top) / lines);
|
||||
|
||||
return (panel->selected - top - lines / 2);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
move_down (WPanel * panel)
|
||||
{
|
||||
@ -2102,7 +2119,7 @@ move_down (WPanel * panel)
|
||||
panel->top_file = panel->dir.len - items;
|
||||
paint_dir (panel);
|
||||
}
|
||||
else if (panels_options.scroll_center && (panel->selected - panel->top_file) > (items / 2))
|
||||
else if (panels_options.scroll_center && panel_selected_at_half (panel) > 0)
|
||||
{
|
||||
/* Scroll window when cursor is halfway down */
|
||||
panel->top_file++;
|
||||
@ -2131,8 +2148,7 @@ move_up (WPanel * panel)
|
||||
panel->top_file = 0;
|
||||
paint_dir (panel);
|
||||
}
|
||||
else if (panels_options.scroll_center
|
||||
&& (panel->selected - panel->top_file) < (panel_items (panel) / 2))
|
||||
else if (panels_options.scroll_center && panel_selected_at_half (panel) < 0)
|
||||
{
|
||||
/* Scroll window when cursor is halfway up */
|
||||
panel->top_file--;
|
||||
|
Loading…
Reference in New Issue
Block a user