akinsho / akinsho/toggleterm.nvim

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

Đang mở
#391 3 bình luận 1 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Lua
Star
5.6k
Fork
206
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.