akinsho / akinsho/toggleterm.nvim

Buffer of TUI apps are scrolled when hiding terminal or entering normal mode

Ouverte
#391 3 commentaires 1 réaction 0 personnes assignées Voir sur GitHub
Langage dominant
Lua
Étoiles
5.6k
Forks
206
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

Hi,

first of all Thank You for this plugin!

I encountered some strange behavior with "fullscreen" / TUI terminal apps like `lazy-git`, `bacon` (Rust test runner) or `ranger`:

I'll split this into two parts but I guess they are linked somehow.

### Scrolling sideways in normal mode

Whenever I toggle the terminal to be hidden or when a terminal loses focus, the apps mentioned above are scrolled to the left by the amount of characters set in `sidescrolloff`.

This also happens (though not always) when I just enter normal mode in a terminal with a TUI app running.

I think the issue is as follows:

`sidescrolloff` scrolls the buffer before the cursor reaches the edge of the buffer. When a TUI app is drawn, the cursor is at the bottom right of the buffer. When the terminal loses focus, the terminal enters normal mode. Since the cursor is at the right side of the screen, the buffer is scrolled left to fulfill the `sidescrolloff`.

When I set `sidescrolloff` to `0`, this does not happen.

Is it possible (either for the plugin or by using some sort of `on_focus` / `on_blur` hook to disable and restore the `sidescrolloff`?

### Scrolling down when hiding terminal

Even with `sidescrolloff` and `scrolloff` set to `0`, when I hide a terminal that has a "fullscreen" / TUI app running, the buffer is scrolled down by one line when I bring the terminal back up. Even stranger: when parts of the TUI get redrawn, they are now drawn one line below where they seem to belong (in fact they are drawn exactly where they should be but since everything is scrolled up by one line, it looks like they are drawn one line off)

When I enter normal mode after hiding and showing the terminal, the cursor is in the bottom left corner. I assume that for some reason the cursor moves down one line when the terminal is hidden and that this causes the buffer to be scrolled up.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.