Skip to content
This repository has been archived by the owner on Jun 17, 2023. It is now read-only.

Undesired cursor movement when pressing Enter #78

Open
DrChr opened this issue Feb 21, 2021 · 4 comments
Open

Undesired cursor movement when pressing Enter #78

DrChr opened this issue Feb 21, 2021 · 4 comments

Comments

@DrChr
Copy link

DrChr commented Feb 21, 2021

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:

  • Have Emacs show a single buffer, i.e. C-x 1
  • M-x ztree-dir (for some directory)
  • Move the cursor down a bit, e.g. do PgDn, and press Enter (ztree-perform-action)

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 #69 (comment)

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:

  • not be at the bottom of the buffer
  • e.g. press enter on a text file that's opened in a new buffer
@DrChr
Copy link
Author

DrChr commented Feb 21, 2021

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
Copy link
Owner

fourier commented Feb 21, 2021

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
Copy link
Author

DrChr commented Feb 21, 2021 via email

@fourier
Copy link
Owner

fourier commented Feb 21, 2021

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 :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants