From: Mark Jamsek Subject: Re: switch printing newline on exit to To: Christian Weisgerber Cc: gameoftrees@openbsd.org Date: Sun, 22 Jan 2023 19:16:05 +1100 On 23-01-21 08:59PM, Christian Weisgerber wrote: On 23-01-21 11:18AM, Dave Voutila wrote: > > Mark Jamsek writes: > > > I believe this happens because when we refresh() in main, it is after > > having deallocated our windows. As such, there is no output to be > > redrawn. It looks like the vi code performs this line deletion to move > > all lines up and insert a blank line at the bottom before releasing > > window resources, so the final refresh() still has output to send to the > > screen. > > > > A solution is to do this in the view_loop() once we know the user is > > quitting tog (Q), or killing the current window (q) when it's the last > > one remaining. In the first case, we need to check if there are other > > windows and do the line deletion on them too. In the second case, we > > also need to then make sure tog doesn't redraw the full window (i.e., > > restore the line we deleted), so we set the done flag and bypass > > a redraw. > > > > As a small optimisation, in case there is more than one window (i.e., > > the user has input Q from a nested child window), use wnoutrefresh() and > > then call doupdate(); this saves repeated screen updates. > > > > Does the below diff produce the desired behaviour? > > > > It does for me! As well as when using what naddy mentioned: > > $ xterm -xrm 'XTerm*titeInhibit: 1' ... > Yes, it does! I also tried various combinations of split-screen > layout and it all works as expected. Great! Thanks, dv and naddy, for testing with and without alternate screen buffer enabled in different layouts (we have a few combinations available :). And thanks, naddy, for the vi hint! ok to commit? -- Mark Jamsek GPG: F2FF 13DE 6A06 C471 CA80 E6E2 2930 DC66 86EE CF68