fourier / ztree

Directory tree comparison mode for Emacs
http://www.emacswiki.org/emacs/ZtreeDiff
GNU General Public License v3.0
239 stars 21 forks source link

Cursor behavior (dir and diff) #59

Closed rchar01 closed 6 years ago

rchar01 commented 6 years ago

In ztree, when the cursor moves through the directory tree, it has no default position. It can be in any position in the row (column). In dired for example, after pressing n or p (move down/up) the cursor always returns to the default location (the first letter of the file name).

I do not know if this behavior is desirable in ztree, but I see two advantages:

e.g. (cursor on the same row) (cursor on bold X position)

Directory tree
==============
[-] .emacs.d
 |--[-] elpa
 |   |--[+] markdown-mode-20180124.138
 |   |--[-] org-20180219
 |   |   |--[-] etc
 |   |   |   |--[-] styles
 |   |   |   |   |----- OrgOdtContentTemplate.xml
 |   |   |   |   |----- OrgOdtStyles.xml
 [X] |   |   |   `----- README
 |   |   |   `----- ORG-NEWS

vs. (cursor on first letter of REDME file)

Directory tree
==============
[-] .emacs.d
 |--[-] elpa
 |   |--[+] markdown-mode-20180124.138
 |   |--[-] org-20180219
 |   |   |--[-] etc
 |   |   |   |--[-] styles
 |   |   |   |   |----- OrgOdtContentTemplate.xml
 |   |   |   |   |----- OrgOdtStyles.xml
 |   |   |   |   `----- [R]EADME
 |   |   |   `----- ORG-NEWS

In the Neotree module (https://github.com/jaypei/emacs-neotree), optional row highlighting is available (for better visibility).

This is just my opinion based on observations while working in dired and other modules. I'd like to know what you think about it.

fourier commented 6 years ago

You can use hl-line-mode to highlight current line.

fourier commented 6 years ago

I don't really want to change the default cursor behavior, it better to be solid agreement between users on it.

rchar01 commented 6 years ago

Don't get me wrong, I'm not going to force changes in the project. I just wanted to know your opinion on the subject.

I really like the ztree package (dir and diff) and often think of new functionalities that could make it even better.

rchar01 commented 6 years ago

Do you think it would be possible to add a function that allows users to optionally change the default cursor behavior?

(enable cursor following the file name, as in dired, by editing user init file)

fourier commented 6 years ago

I've started to implement this feature, looks like the part for ztree-dir is done, but ztree-diff is still in progress.

fourier commented 6 years ago

Implementation is done, closing the issue. @rchar01 please test and if you encounter something strange report as a new issue.

rchar01 commented 6 years ago

Thanks.