Ticket #3130: patch-panel-scroll-center.diff
File patch-panel-scroll-center.diff, 4.0 KB (added by Miven, 11 years ago) |
---|
-
doc/man/mc.1.in
old new If set (the default), panel will scroll 2077 2077 cursor reaches the end or the beginning of the panel, otherwise it 2078 2078 will just scroll a file at a time. 2079 2079 .PP 2080 .I Center scrolling. 2081 If set, panel will scroll when the cursor reaches the middle of the 2082 panel, only hitting the top or bottom of the panel when actually on 2083 the first or last file. This behavior applies when scrolling one file 2084 at a time, and does not apply to the page up/down keys. 2085 .PP 2080 2086 .I Mouse page scrolling. 2081 2087 Controls whenever scrolling with the mouse wheel is done by pages or 2082 2088 line by line on the panels. -
src/setup.h
old new typedef struct 48 48 gboolean navigate_with_arrows; /* If TRUE: l&r arrows are used to chdir if the input line is empty */ 49 49 gboolean scroll_pages; /* If TRUE, panel is scrolled by half the display when the cursor reaches 50 50 the end or the beginning of the panel */ 51 gboolean scroll_center; /* If TRUE, scroll when the cursor hits the middle of the panel */ 51 52 gboolean mouse_move_pages; /* Scroll page/item using mouse wheel */ 52 53 gboolean filetype_mode; /* If TRUE then add per file type hilighting */ 53 54 gboolean permission_mode; /* If TRUE, we use permission hilighting */ -
src/setup.c
old new panels_options_t panels_options = { 142 142 .auto_save_setup = FALSE, 143 143 .navigate_with_arrows = FALSE, 144 144 .scroll_pages = TRUE, 145 .scroll_center = FALSE, 145 146 .mouse_move_pages = TRUE, 146 147 .filetype_mode = TRUE, 147 148 .permission_mode = FALSE, … … static const struct 400 401 { "auto_save_setup_panels", &panels_options.auto_save_setup }, 401 402 { "navigate_with_arrows", &panels_options.navigate_with_arrows }, 402 403 { "panel_scroll_pages", &panels_options.scroll_pages }, 404 { "panel_scroll_center", &panels_options.scroll_center }, 403 405 { "mouse_move_pages", &panels_options.mouse_move_pages }, 404 406 { "filetype_mode", &panels_options.filetype_mode }, 405 407 { "permission_mode", &panels_options.permission_mode }, -
src/filemanager/boxes.c
old new panel_options_box (void) 554 554 QUICK_CHECKBOX (N_("L&ynx-like motion"), &panels_options.navigate_with_arrows, 555 555 NULL), 556 556 QUICK_CHECKBOX (N_("Pa&ge scrolling"), &panels_options.scroll_pages, NULL), 557 QUICK_CHECKBOX (N_("Center &scrolling"), &panels_options.scroll_center, NULL), 557 558 QUICK_CHECKBOX (N_("&Mouse page scrolling"), &panels_options.mouse_move_pages, 558 559 NULL), 559 560 QUICK_STOP_GROUPBOX, -
src/filemanager/panel.c
old new move_down (WPanel * panel) 2019 2019 panel->top_file = panel->dir.len - ITEMS (panel); 2020 2020 paint_dir (panel); 2021 2021 } 2022 else if (panels_options.scroll_center && 2023 (panel->selected - panel->top_file) > (ITEMS (panel) / 2)) 2024 { 2025 /* Scroll window when cursor is halfway down */ 2026 panel->top_file++; 2027 if (panel->top_file > panel->dir.len - ITEMS (panel)) 2028 panel->top_file = panel->dir.len - ITEMS (panel); 2029 } 2022 2030 select_item (panel); 2023 2031 } 2024 2032 … … move_up (WPanel * panel) 2040 2048 panel->top_file = 0; 2041 2049 paint_dir (panel); 2042 2050 } 2051 else if (panels_options.scroll_center && 2052 panel->selected < (panel->top_file + ITEMS (panel) / 2)) 2053 { 2054 /* Scroll window when cursor is halfway up */ 2055 panel->top_file--; 2056 if (panel->top_file < 0) 2057 panel->top_file = 0; 2058 } 2043 2059 select_item (panel); 2044 2060 } 2045 2061