Repository navigation
add stable keyboard scrolling to vim floating preview popups - #5114
coriocactus wants to merge 1 commit into
Conversation
80f3c87 to
dd89b90
Compare
dd89b90 to
3d67758
Compare
There was a problem hiding this comment.
Pull request overview
Adds keyboard (and mouse wheel) scrolling support for Vim popupwin-based floating preview windows in ALE, plus sizing stabilization to prevent resize jitter while scrolling. NeoVim floating previews are unchanged.
Changes:
- Introduces a Vim popup
filter(normal-mode filtermode) to handle<C-n>/<C-p>,<C-d>/<C-u>, mouse wheel, and<Esc>for floating preview popups. - Adds “managed” width/height locking for Vim popups when users haven’t provided explicit size limits.
- Adds a new Vader test suite covering scrolling behavior, boundary clamping, closing on escape, passthrough keys, and size locking; updates docs accordingly.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
autoload/ale/floating_preview.vim |
Implements popup filter, scroll/clamp logic, and managed size locking/reset for Vim popup previews. |
doc/ale.txt |
Documents the new scrolling keys and sizing behavior for Vim popup previews and how to override the filter. |
test/test_floating_preview_popupwin.vader |
Adds coverage for popup filter behavior, scroll boundaries, escape close, and size stability during scrolling. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I'll paste this in every open PR: We finally managed to migrate CI checks for Windows from AppVeyor to GitHub Actions, and we've updated the minimum supported Vim version to 8.2. (Thought Vim 8.0 might happen to work for some.) In order to get checks to run again for a PR you'll need to rebase or merge. |
e514c40 to
3ad02af
Compare
3ad02af to
39ff78d
Compare
39ff78d to
df9465f
Compare
|
How to try out this pull-request:
mkdir pr5114
cd pr5114/
cargo init
fn main() {
let x = 42;
let y: String = x;
}
|
Vim floating previews for hover and
ALEDetailcan't be scrolled from the keyboard. When the text is longer than the popup, the only way to read the rest is the mouse, andmoved: 'any'closes the popup on any cursor motion.This adds a popup filter, used in Normal mode only:
CTRL-E/CTRL-Yby a line,CTRL-D/CTRL-Uby half a page,CTRL-F/CTRL-Bby a page.<Esc>closes the preview.How it works:
CTRL-DorCTRL-Uinside the popup withwin_execute(). Vim stops these at the start and end of the text, wrapped or not, so the popup never scrolls into blank space and its height never changes. ALE doesn't do any scroll math of its own. The filter redraws after each scroll: without that, Vim 8.2.4843 scrolls wrapped text one line too far when keys arrive faster than redraws (found by the Vim 8.2 Windows CI job).minwidthto the widest line, unless the user has setminwidthormaxwidth. The check is gated onhas('patch-9.2.0419'), so it can be deleted when ALE's minimum Vim version passes that patch.filtering:ale_floating_preview_popup_optsstill replaces it.Neovim floating windows are unchanged.
Tests cover line, half-page and full-page scrolling with stops at both ends, reaching the end of wrapped text, keys passing through when nothing needs scrolling, other keys passing through,
<Esc>, the width fix, and user width options being kept. One test sends keys throughfeedkeys()to check that Vim really delivers them to the filter in Normal mode. They pass on Vim 8.2 and 9.2. On Neovim they are skipped, because it has nopopupwin.