nano-devel
[Top][All Lists]
Advanced

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

Re: [Nano-devel] [PATCH] browser: keep selection despite of change in nu


From: Benno Schulenberg
Subject: Re: [Nano-devel] [PATCH] browser: keep selection despite of change in number of files in cwd
Date: Thu, 05 May 2016 19:55:21 +0200

Hello Rishabh,

On Thu, May 5, 2016, at 14:29, Rishabh Dave wrote:
> I have attached a fix for the bug #47812: adding or deleting files can
> change the selected one in the browser
> (http://savannah.gnu.org/bugs/?47812). Basically, code
> increments/decrements 'selected' by amount of increase/decrease in
> number of files on a refresh.

That doesn't sound right.  How do you know that the selected file
is after the ones that were added or deleted?  If the selected one
is somewhere at the beginning of the list and files are deleted or
added somewhere near the tail of the list, the selection shouldn't
change at all.

No.  What I was thinking was: use the prev_dir mechanism.  Call
it sitting_on or something.  Where now 'kbinput = KEY_WINCH' is
set, set instead sitting_on and goto change_browser_directory.
(We're not changing directory, so it will need a new name.)  Then
browser_select_dirname will again select the exact same filename
no matter where it moved in the list, up, down, or stayed put.
When the file has disappeared, then browser_select_dirname should
return simply the value of selected -- or selected - 1, as you
suggest below.  After that you can delete the duplicate code in
the first occurrence of 'if (kbinput == KEY_WINCH)'.

> There is one side effect though, which may actually be plus point: If
> selected file disappears (and if we refresh), then 'selected'
> decrements by one (i.e. previous directory becomes selected file).
> Drawback because of "the principle of minimum necessary change".
> However, I feel it's good because moving cursor would alert (more to
> the) user of loss of selected file (as movement of selected section is
> more visible than change of file under the selection).

That last part is good reasoning: a conspicuous change is good
when the selected one disappeared.

Benno

-- 
http://www.fastmail.com - Or how I learned to stop worrying and
                          love email again




reply via email to

[Prev in Thread] Current Thread [Next in Thread]