"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Christian Weisgerber <naddy@mips.inka.de>
Subject:
Re: switch printing newline on exit to
To:
gameoftrees@openbsd.org
Date:
Fri, 20 Jan 2023 21:33:12 +0100

Download raw body.

Thread
Tracey Emery:

> Then what about this. It seems to just work in both cases.

> --- tog/tog.c
> +++ tog/tog.c
> @@ -9438,7 +9438,6 @@ main(int argc, char *argv[])
>  	}
>  
>  	endwin();
> -	putchar('\n');
>  	if (cmd_argv) {
>  		int i;
>  		for (i = 0; i < argc; i++)

No, this brings us full circle to the original state of affairs
where you quit tog and then there is leftover stuff on the bottom
line to the right of your shell prompt (if alternate screen switching
is disabled).

I tried to steal what vi(1) does, comment and all, see below, but
that doesn't work as expected.  As soon as I call refresh() before
endwin(), the screen is cleared.  I don't understand why this
happens.  Maybe it's related to tog's use of panels, which vi doesn't
have?

--- tog/tog.c
+++ tog/tog.c
@@ -9437,8 +9437,16 @@ main(int argc, char *argv[])
 			error = cmd->cmd_main(argc, cmd_argv ? cmd_argv : argv);
 	}
 
+	/*
+         * When we quit, scroll the screen up a single line
+         * so we don't lose any information.
+         */
+	move(0, 0);
+	deleteln();
+	move(LINES - 1, 0);
+	refresh();
+
 	endwin();
-	putchar('\n');
 	if (cmd_argv) {
 		int i;
 		for (i = 0; i < argc; i++)

-- 
Christian "naddy" Weisgerber                          naddy@mips.inka.de