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

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: tog: extend log view headline highlight
To:
Mark Jamsek <mark@jamsek.com>, Game of Trees <gameoftrees@openbsd.org>
Date:
Fri, 9 Sep 2022 09:23:33 +0200

Download raw body.

Thread
On Fri, Sep 09, 2022 at 08:23:48AM +0200, Stefan Sperling wrote:
> What do you think about not highlighting a cursor when its view is not
> in focus? I believe that would give a better visual impression.

Something like this (on top of your diff)?

It seems the ref and tree views already do this. So my patch only tweaks
the log and blame views. And the diff view doesn't have a selection cursor.

diff /home/stsp/src/got
commit - b21ed2d92fa9a52695cee221ef20b75b1a182884
path + /home/stsp/src/got
blob - 81a72cd907757863416d7c2e4b5924f8413371a0
file + tog/tog.c
--- tog/tog.c
+++ tog/tog.c
@@ -2396,11 +2396,11 @@ draw_commits(struct tog_view *view)
 	while (entry) {
 		if (ncommits >= limit - 1)
 			break;
-		if (ncommits == s->selected)
+		if (view->focussed && ncommits == s->selected)
 			wstandout(view->window);
 		err = draw_commit(view, entry->commit, entry->id,
 		    date_display_cols, author_cols);
-		if (ncommits == s->selected)
+		if (view->focussed && ncommits == s->selected)
 			wstandend(view->window);
 		if (err)
 			goto done;
@@ -5271,14 +5271,14 @@ draw_blame(struct tog_view *view)
 		wline = NULL;
 		view->maxx = MAX(view->maxx, width);
 
-		if (nprinted == s->selected_line - 1)
+		if (view->focussed && nprinted == s->selected_line - 1)
 			wstandout(view->window);
 
 		if (blame->nlines > 0) {
 			blame_line = &blame->lines[lineno - 1];
 			if (blame_line->annotated && prev_id &&
 			    got_object_id_cmp(prev_id, blame_line->id) == 0 &&
-			    !(nprinted == s->selected_line - 1)) {
+			    nprinted != s->selected_line - 1) {
 				waddstr(view->window, "        ");
 			} else if (blame_line->annotated) {
 				char *id_str;
@@ -5307,7 +5307,7 @@ draw_blame(struct tog_view *view)
 			prev_id = NULL;
 		}
 
-		if (nprinted == s->selected_line - 1)
+		if (view->focussed && nprinted == s->selected_line - 1)
 			wstandend(view->window);
 		waddstr(view->window, " ");