nushell / reedline

A feature-rich line editor - powering Nushell
https://docs.rs/reedline/
MIT License
547 stars 152 forks source link

Slow performance when holding down enter #825

Open ymcx opened 1 month ago

ymcx commented 1 month ago

Platform Only tested on Linux, other platforms could be affected as well. Terminal software Most noticable on (or only affects?) VTE-based terminal emulators.

Press and hold down the enter key for a couple of seconds and once lifted you'll notice how Reedline keeps rendering new lines for a relatively long period of time. The regression got introduced in #675 and more precisely after adding the is_reset() check to each repaint in src/painting/painter.rs.

Steps to reproduce

  1. Open a VTE-based terminal emulator (like kgx)
  2. Press and hold down the enter key.
  3. Notice the delay until the screen stops updating after letting go of the key.

Screenshots/Screencaptures

On the left you can see how it looks like after getting rid of the is_reset() call. To better illustrate the bug, I shook the cursor once letting go of the enter key. Even though the screencap is on an older version of Reedline, the bug is still reproducible on newer versions.

https://github.com/user-attachments/assets/bcfd7b7d-5dc7-4c65-a3d5-a35554ccf4ff

fdncred commented 1 month ago

Seen it before. Experienced it. Don't like the current behavior at all. Would like to see a PR to fix it without introducing more resize artifacts.