highlight: do not highlight items scheduled for output ref. #20

The highlight feature by default overrides other colour schemes and
may in the process partially or fully obscure that an item has already
been output (or is scheduled for output using the multiselect patch).

In this context the highlighting does not add any valuable information
given that the user has already selected the item. Overall it seems
more user-friendly to skip drawing highlights for outputted items.
This commit is contained in:
bakkeby 2023-04-11 09:44:49 +02:00
parent 25ea08edd1
commit 0329c28407
4 changed files with 23 additions and 1 deletions

View File

@ -20,6 +20,15 @@ drawhighlights(struct item *item, int x, int y, int maxw)
if (!(strlen(itemtext) && strlen(text)))
return;
/* Do not highlight items scheduled for output */
#if MULTI_SELECTION_PATCH
if (issel(item->id))
return;
#else
if (item->out)
return;
#endif // MULTI_SELECTION_PATCH
drw_setscheme(drw, scheme[item == sel
? SchemeSelHighlight
: SchemeNormHighlight]);

View File

@ -15,6 +15,15 @@ drawhighlights(struct item *item, int x, int y, int maxw)
char *itemtext = item->text;
#endif // EMOJI_HIGHLIGHT_PATCH | TSV_PATCH
/* Do not highlight items scheduled for output */
#if MULTI_SELECTION_PATCH
if (issel(item->id))
return;
#else
if (item->out)
return;
#endif // MULTI_SELECTION_PATCH
drw_setscheme(drw, scheme[item == sel ? SchemeSelHighlight : SchemeNormHighlight]);
strcpy(tokens, text);
for (token = strtok(tokens, " "); token; token = strtok(NULL, " ")) {

View File

@ -4,6 +4,9 @@
#if FZFEXPECT_PATCH
#include "fzfexpect.h"
#endif
#if MULTI_SELECTION_PATCH
#include "multiselect.h"
#endif
#if HIGHPRIORITY_PATCH
#include "highpriority.h"
#endif
@ -12,4 +15,4 @@
#endif
#if NUMBERS_PATCH
#include "numbers.h"
#endif
#endif

1
patch/multiselect.h Normal file
View File

@ -0,0 +1 @@
static int issel(size_t id);