PATCH 4.6.0pre1 change panel scroll behavior
Miven Dooligan
dooligan at intergate.ca
Mon Sep 16 19:35:05 UTC 2002
Pavel, does this seem useful to you?
I know, I know, the scroll was never broken ;-)
I like it though. I think it makes the scrolling behavior look more 'pro'
or something. I never did like that scroll-by-half-page thing.
I got onto this kind of scroll behavior back in '87 scripting
animation on an Apple IIc, and I've always preferred it. It keeps things
more
visible - relative to the cursor.
[miven at coyote src]# diff -ruN mc-4.6.0-pre1/src/screen.c
mc-4.6.0-pre1-020916/src/screen.c
--- mc-4.6.0-pre1/src/screen.c Sun Aug 18 15:07:09 2002
+++ mc-4.6.0-pre1-020916/src/screen.c Mon Sep 16 11:52:47 2002
@@ -1535,14 +1535,17 @@
unselect_item (panel);
panel->selected++;
- if (panel->selected - panel->top_file == ITEMS (panel) &&
- panel_scroll_pages){
- /* Scroll window half screen */
- panel->top_file += ITEMS (panel)/2;
- if (panel->top_file > panel->count - ITEMS (panel))
- panel->top_file = panel->count - ITEMS (panel);
- paint_dir (panel);
- select_item (panel);
+ /* Here we try to keep the cursor in the middle of the panel
+ so we only hit the top and bottom when we are actually on the
+ first or last item. We have one extra check to make sure
+ there panel->count is more than the panel can hold */
+ if (panel->selected - panel->top_file > ITEMS (panel)/2 &&
+ panel->count > ITEMS (panel) && panel_scroll_pages ){
+ panel->top_file += 1;
+ if (panel->top_file > panel->count - ITEMS (panel))
+ panel->top_file = panel->count - ITEMS (panel);
+ paint_dir (panel);
+ select_item (panel);
}
select_item (panel);
}
@@ -1555,11 +1558,11 @@
unselect_item (panel);
panel->selected--;
- if (panel->selected < panel->top_file && panel_scroll_pages){
- /* Scroll window half screen */
- panel->top_file -= ITEMS (panel)/2;
- if (panel->top_file < 0) panel->top_file = 0;
- paint_dir (panel);
+
+ if ((panel->selected - panel->top_file) < ITEMS (panel)/2 &&
panel_scroll_pages ) {
+ panel->top_file -= 1;
+ if (panel->top_file < 0) panel->top_file = 0;
+ paint_dir (panel);
}
select_item (panel);
}
More information about the mc-devel
mailing list