Re: [PATCH] Help Viewer - incorrect behaviour of <up> arrrow key

Hello Grigory,

On Wed, 29 Nov 2006, Grigory Trenin wrote:

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.

I can confirm the problem.

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.

I am not convinced of that yet - see below. It's more likely
that the navigation code messes the value of 'startpoint'.

'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.

This is not true - 'currentpoint' points to the first byte of
the currently disaplyed help contents, while 'startpoint'
points to the start of the current link/topic. 'startpoint'
gets messed after one returns back from following a link.

So in my patch I replaced 'startpoint' with 'currentpoint' and
removed the 'startpoint' variable completely.

I won't apply this patch yet. I want to investigate further.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]