Index | Thread | Search

From:
Job Snijders <job@bsd.nl>
Subject:
watch: don't show previous output in 'dimmed' fashion
To:
tech@openbsd.org
Date:
Mon, 5 Oct 2026 18:32:24 +0000

Download raw body.

Thread
naddy@ pointed out that feature may cause in confusing output: on xterms
with white background the 'dimmed' text appears indistinguishable from
regular text; and a similar problem exists on the console (because the
console doesn't support dimming at all). The end result is that the
operator may see extra lines of text which actually belonged to the
previous run and has no means to visually discern old and new output.

The intention was that this would work well enough in all environments,
but I don't know how to achieve that goal. Using tigetstr() and/or
getbkgd() to figure out the environment and then construct 'dimmed' text
accordingly seems overly complicated.... For now perhaps better to zap
the feature. 

ps. some time ago deraadt@ suggested that perhaps previous output should
be made available through some keyboard shortcut so one can scrub back
and forth in the output history. iTerm2 calls this 'instant replay'
https://iterm2.com/img/screenshots/instant_replay.gif - cool idea which
might be a spiritual successor to the 'previous run as ghost output',
but I don't have the cycles to work on that right now...

OK?

Index: watch.c
===================================================================
RCS file: /cvs/src/usr.bin/watch/watch.c,v
diff -u -p -r1.39 watch.c
--- watch.c	9 Apr 2026 18:41:41 -0000	1.39
+++ watch.c	5 Oct 2026 18:16:58 -0000
@@ -305,34 +305,6 @@ display(BUFFER *cur, BUFFER *prev, highl
 	if (!prev || (cur == prev))
 		hm = HIGHLIGHT_NONE;
 
-	attron(A_DIM);
-	for (line = start_line, screen_y = 2; line < MAXLINE &&
-	    (*prev)[line][0] && screen_y < (show_rusage ? LINES - 9 : LINES);
-	    line++, screen_y++) {
-		wchar_t *prev_line, *p;
-
-		prev_line = (*prev)[line];
-
-		for (p = prev_line, cw = 0; cw < start_column; p++)
-			cw += WCWIDTH(*p);
-		screen_x = cw - start_column;
-
-		move(screen_y, screen_x);
-		while (screen_x < COLS) {
-			if (*p && *p != L'\n') {
-				cw = wcwidth(*p);
-				if (screen_x + cw >= COLS)
-					break;
-				addwch(*p++);
-				screen_x += cw;
-			} else
-				break;
-		}
-	}
-	attroff(A_DIM);
-
-	move(1, 1);
-
 	for (line = start_line, screen_y = 2;
 	    screen_y < (show_rusage ? LINES - 9 : LINES) && line < MAXLINE
 	    && (*cur)[line][0]; line++, screen_y++) {
@@ -362,7 +334,6 @@ display(BUFFER *cur, BUFFER *prev, highl
 
 		case HIGHLIGHT_NONE:
 			move(screen_y, screen_x);
-			clrtoeol();
 			while (screen_x < COLS) {
 				if (*p && *p != L'\n') {
 					cw = wcwidth(*p);