-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Description
Notes from #5398
SPACES REMOVED WHEN:
* line was not wrapped
AND
* It is optimal to prefer ECH/EL
* We are not on a new bottom line
* We did not clear all this frame
OR
* We cleared all this frame
OR
* It is a new bottom line and we are on it
SPACES RE-ADDED WHEN:
* It is not optimal to prefer ECH/EL
OR
* It is a new bottom line
OR
* We cleared all this frame
AND
* It is a new bottom line and we are on it
* The line had spaces at the end.
* We deleted the spaces previously <<< NEW IN #5398
Originally posted by @DHowett-MSFT in #5398 (comment)
While we're looking at this, we'll want to investigate how to consolidate the space add/remove logic so that we can make maximal use of the buffer already passed to us (like: write it out in full if it has spaces we want to keep, etc.)
Notes from @zadjii-msft
I can't remember tbh. This screams organic growth to me - I think we first just decided to do ECH and removing spaces, when we didn't have wrapping (and spaces didn't matter). Then we did some deferring the cursor movement & not erasing optimizations in 20H1, which added cases where we wouldn't ECH. Now we're adding cases where we still need the spaces. I suppose if we'd written it from scratch now, accounting for wrapping, we'd do it better.
I'd TODO it tbh.
I bet we were trying to optimize out the cursor positioning that we'd do after a new line is printed. If we did optimize that scenario, and used ECH to erase some spaces, we also used CUF to move the cursor. However, if we couldn't do that, we'd still want to leave the cursor in the right place...
yea we probably should have just not removed them in the first place.