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

Undesired cursor movement when pressing Enter #78

Open DrChr opened 3 years ago

DrChr commented 3 years ago

Hi, I just started having a look at ztree-dir and it seems very neat, but I ran in to an annoying UX issue.

This issue might belong here, or maybe I should create a separate one - please just let me know in that case.

I'm using ztree that I just installed from melpa (20191108.2234), please let me know if I should test with another version.

Here's how to reproduce:

This makes Emacs show a second window, where the second window shows the selected file. However, the cursor in the window for the ztree-dir has now moved (up a number of lines). This is very annoying.

I'm able to reproduce this with a 'clean' Emacs setup, so it shouldn't depend on my local configuration. I.e. I also reproduced this issue after having started Emacs using the following command: $ emacs -q --eval "(package-initialize)"

Originally posted by @DrChr in https://github.com/fourier/ztree/issues/69#issuecomment-711759369

I was able to repreduce the issue again. I had installed 20210215. To be on the safe side I also restarted Emacs as per above. To check which version I was really using, I did 'C-h f ztree-dir' and got: ~/.emacs.d-org/elpa/ztree-20210215.2111/ztree-dir.el

If you have problems reproduce it, let me know. I think you might need:

DrChr commented 3 years ago

Two screenshots below for illustration. Guess I didn't need lots of lines in the buffer. Hmm.

Screenshot before pressing 'Enter'. image

Screenshort after pressing 'Entter'. image

fourier commented 3 years ago

I was able to reproduce it. It only happens when the new window overlaps the point (cursor) position. In this case Emacs is moving point to some other place above. Not sure what I can do here. I can recommend to open a window before hitting the enter. In this case the cursor will always be visible (as the file will be open in already opened window). It doesn't matter if you do vertical or horizontal split - important that the new window configuration will not overlap a cursor.

DrChr commented 3 years ago

Perhaps do a recenter, in such a way that the cursor position does not overlap, before opening the new window?

On Sun, 21 Feb 2021, 19:57 Alexey Veretennikov, notifications@github.com wrote:

I was able to reproduce it. It only happens when the new window overlaps the point (cursor) position. In this case Emacs is moving point to some other place above. Not sure what I can do here. I can recommend to open a window before hitting the enter. In this case the cursor will always be visible (as the file will be open in already opened window). It doesn't matter if you do vertical or horizontal split - important that the new window configuration will not overlap a cursor.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/fourier/ztree/issues/78#issuecomment-782907112, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLVYV6WXJ7BPG24JT6BFBTTAFJRTANCNFSM4X7BNEDA .

fourier commented 3 years ago

Try (setq ztree-dir-move-focus t). It will move the focus after pressing Enter but will keep the file name visible in ztree-dir buffer. I'll think how to solve it, so no attempts helped :)