[PATCH] Help Viewer - incorrect behaviour of <up> arrrow key
Grigory Trenin
gtrenin at gmail.com
Wed Nov 29 18:59:56 UTC 2006
Hello all,
While browsing MC's help, I've noticed a strange behaviour of <up> arrow
key. After I visit some topic and return back (using <right> arrow key),
the behaviour of <up> arrow key weirdly changes: instead of selecting
the previous link, it jumps to the top of the window!
Here is a detailed description how to reproduce it:
1) Open the Help Contents (press <F1>, <Tab>, <Enter>)
2) Navigate some lines forward (press <End> or <PageDown> several times)
3) Enter the selected topic (press <Enter>)
4) Return back (press <right arrow>)
5) Move to the top of Contents (press <Home>)
6) Now try navigating the Contents using the <up> and <down> arrow keys.
(for example, press <down arrow> for 5 times, then press <up arrow>).
You will notice that when you press <up arrow> key the selection
jumps to the top of window.
The problem is in the help_handle_key() function:
case KEY_UP:
case ALT ('\t'):
/* select previous link */
new_item = select_prev_link (startpoint, selected_item);
The 'startpoint' variable should be a pointer to the first byte
displayed in the Help window. But here it has a wrong value - that's
the problem. That's why select_prev_link() cannot find the link and
returns NULL, and the selection moves to the first link in the window.
I tried to find out what's wrong with the 'startpoint' variable.
I came to the conclusion that 'startpoint' is used here erroneously
instead of 'currentpoint' variable.
'currentpoint' always contains a pointer to the first byte displayed,
and it should be used here. And by the way, 'startpoint' variable
seems to be totally useless.
So in my patch I replaced 'startpoint' with 'currentpoint' and
removed the 'startpoint' variable completely.
Regards,
Grigory Trenin
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: help.patch
URL: <http://lists.midnight-commander.org/pipermail/mc-devel/attachments/20061129/cd1e9da8/attachment.ksh>
More information about the mc-devel
mailing list