reedline icon indicating copy to clipboard operation
reedline copied to clipboard

Revert resize handling removal

Open sholderbach opened this issue 3 years ago • 8 comments

Attempt to test if bringing the basic resize behavior back will improve the situation in some terminals that implicitly resize on startup

Tries to fix #477

  • Revert "remove anims and resize repaint (#451)"
  • Remove animations again

sholderbach avatar Sep 12 '22 20:09 sholderbach

i just check this out and built it and have the animated clock. I'm so confused.

fdncred avatar Sep 13 '22 12:09 fdncred

Sorry my bad, I got the logic mentally backwards.

sholderbach avatar Sep 13 '22 20:09 sholderbach

I've tested this, and i solves the right prompt problem. I vote get it in, and progress from here. There are some issues still that are annotated by todo/fix in code:

https://github.com/nushell/reedline/blob/main/src/painting/painter.rs#L383 https://github.com/nushell/reedline/blob/main/src/painting/painter.rs#L387

These probably needs attention :) I did try look into it. Logging/tracing would be useful I think @sholderbach, @fdncred would that be desired i could cook somthing up?

dbuch avatar Sep 18 '22 18:09 dbuch

@dbuch oh, please do look at this. I'd love to land this but it's really trading one problem for another. however, if I knew you planned to work on the remaining issues I personally would feel much more comfortable landing this one with the hopes that you could cook something up to make it better. note, I have no fantasy that you can or would fix everything but we generally approve iterative approaches to solving "hard" issues like this. So, yes, please cook something up. :)

fdncred avatar Sep 18 '22 18:09 fdncred

@fdncred Okay, I'll try. I still think this piece should be merged, do you know what the trade are? This PR is after all - afaik - fairly okay now that amimation isn't restored again.

Next step, for me atleast, would be to implement some logging preferably to some file.

dbuch avatar Sep 18 '22 18:09 dbuch

@dbuch I think if you run this PR and resize left and right and diagonally left and right, you'll see artifacts. Now if you do the same thing before this PR, there are probably less artifacts with resizing. However the tradeoff with before this PR is that sometimes you start nu and you get a prompt at the top of the screen, hit enter and all of a sudden the prompt is in the center of the screen.

fdncred avatar Sep 18 '22 19:09 fdncred

@fdncred you are right! I use kitty, and because (i think) i use HDPI and kitty resizes late i get that prompt in the middle. But only at the beginning. But the cause of this is likely because of invalid row calculation when shrinking down. I'll investigate abit more.

dbuch avatar Sep 18 '22 20:09 dbuch

A fresh set of eyes looking at this problem is absolutely welcome! @dbuch

In my experimentation the resizing artifacts were especially pronounced when there was content close to the bottom of the screen + wrapping of text. Also the choice of terminal emulator had some influence on the severity of the visual artifacts. While kitty for example seems to hold of until sending the resize event, alacritty seemed to eagerly send events that were not properly handled by reedline.

Having optional tracing to study what is happening would be great, especially maybe with timing information to tweak how our event loop reacts to those things (https://github.com/nushell/reedline/blob/7d721a10e802f768889b0a6e4dd44f69f163ad9c/src/engine.rs#L40-L50, https://github.com/nushell/reedline/blob/7d721a10e802f768889b0a6e4dd44f69f163ad9c/src/engine.rs#L484-L499). My memory is failing me what problem I was trying to observe but in one case I couldn't reproduce a certain behavior while launching reedline from lldb.

sholderbach avatar Sep 18 '22 20:09 sholderbach

PR has no direct connection to current problems or codebase. Closing despite some interesting discussion

sholderbach avatar Oct 05 '23 21:10 sholderbach