file highlight after a "cd"


The attached patch fixes the following bug, please apply it.

Sometimes when typing a "cd" command to switch from one directory to
another, a certain file in the new directory becomes highlighted. This is of
course a feature when changing to the parent directory (e.g. when you change
from /usr/local to /usr then the "local" entry has the highlight), but is
buggy as it also selects a file in some other cases as well.

Example 1: Make sure you have a "/dev/root" entry and that you have
permission to enter "/root". Type "cd /root" and then "cd /dev". In /dev,
the entry called "root" will have the focus.

Example 2: Create a directory called "/usr/lo/bin". Change into it and here
type "cd /usr/local". The focus will be on its "bin" entry.

The current code checks if the old directory up to its last slash (e.g. ""
in the 1st example and "/usr/lo" in the 2nd example) is the same as the new
directory up to this length (e.g. strcmp("/usr/local", "/usr/lo", 7), which
says they're equal), but does not check if the new directory ends here (or
as a special case: continues with a slash if it is the "/" directory).


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