replit / codemirror-vim

Vim keybindings for CM6
https://www.npmjs.com/package/@replit/codemirror-vim
MIT License
307 stars 30 forks source link

Ex prompt scrolls page when editor is taller than visible page #187

Open firai opened 2 months ago

firai commented 2 months ago

When the CM editor is taller than the visible page/container height, opening the ex prompt puts the prompt at the bottom of the editor, and the page/container is scrolled to show the ex prompt. When the user exits the ex prompt, the page/container stays at the bottom of the editor unless a movement re-focuses the cursor. Animation2

This is in contrast to a CM editor that's shorter than the visible page/container height, which does not scroll the editor to show the ex prompt. Animation1

Is there a way to make the ex prompt appear at the bottom of the visible portion of the editor instead?

Alternatively, can the cursor be re-focused after exiting the ex prompt to scroll the page/container back up to the cursor?

This is sort of a niche use case, but unfortunately it's difficult for us to control the height of the CM editor to make sure the bottom of the CM editor is within the visible page. Ref: https://github.com/jupyterlab-contrib/jupyterlab-vim/issues/144#issuecomment-2328362350. Thanks for your consideration!

nightwing commented 2 months ago

How do you handle the built-in search and replace plugin, which seems to suffer from the same issue? We are using the editor panel functionality provided by codemirror so this may be a more general issue.

That said wouldn't it be better to display prompt at the bottom of notebook, with ability to search all cells instead of just one?