Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Completion inserted at wrong point when window too small #2161

Closed
phikal opened this issue Jul 23, 2019 · 3 comments
Closed

Completion inserted at wrong point when window too small #2161

phikal opened this issue Jul 23, 2019 · 3 comments

Comments

@phikal
Copy link
Contributor

@phikal phikal commented Jul 23, 2019

Hi,

I was using GDB with gdb-many-windows in Emacs the other day, and I kept noticing that completions were no inserted where the cursor was when I started the insertion, but a few lines above. It seems that when Ivy rescales the minibuffer, this shrinks the size of the GUD interaction buffer, and since the point is outside of the rescaled view, it's moved up, where it inserts what I choose in the minibuffer. Notice that the cursor then returns to it's previous place, so I'm guessing that this just needs swapping the order of two operations?

Also noteworthey, "regular" (ie. with ivy-mode disabled) completion places the completion at the right point, even when frames are resized.

I couldn't find any other examples like this, except for GDB/GUD.

@abo-abo
Copy link
Owner

@abo-abo abo-abo commented Jul 24, 2019

Please add a reproduction scenario: Emacs version, some simple code to debug, window size, command sequence etc.

@phikal
Copy link
Contributor Author

@phikal phikal commented Jul 24, 2019

Sure, I'll be using Emacs 26.1 (started with -Q, default window size, ie. 80x35) but I'm suspecting that it's the same for any version.

I enable Ivy and eval (setq gdb-many-windows t).

Now I run M-x gdb, with any command line options (since these are irrelevant for this example, resulting in the frame being split into 6 frames, where the upper-left one has 6-7 visible lines, and the cursor is on the last visible line, just after the (gdb) .

Pressing <TAB>, I invoke command completion using Ivy. This would by default want to use the drop-down interface, but due to limited space the minibuffer is activated instead. This will push the point in the interaction buffer up four lines, which is where any selected completion will be added too!

Compare this now to ivy being deactivated, and the same procedure again. The completion options should now presented in their own buffer, and the chosen option will be placed after the point where the completion was invoked.

I hope this should document the issue well enough

@abo-abo
Copy link
Owner

@abo-abo abo-abo commented Aug 1, 2019

Thanks, please test. See the commit message for more info.

astoff pushed a commit to astoff/swiper that referenced this issue Jan 1, 2021
Check if there are at least `ivy-height' lines available below point
in the current winodow. If not, scroll the current window enough to
make them available.

Fixes abo-abo#2161
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants