mirror of
https://github.com/mintycube/dmenu.git
synced 2024-10-22 14:05:48 +02:00
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:
parent
25ea08edd1
commit
0329c28407
@ -20,6 +20,15 @@ drawhighlights(struct item *item, int x, int y, int maxw)
|
|||||||
if (!(strlen(itemtext) && strlen(text)))
|
if (!(strlen(itemtext) && strlen(text)))
|
||||||
return;
|
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
|
drw_setscheme(drw, scheme[item == sel
|
||||||
? SchemeSelHighlight
|
? SchemeSelHighlight
|
||||||
: SchemeNormHighlight]);
|
: SchemeNormHighlight]);
|
||||||
|
@ -15,6 +15,15 @@ drawhighlights(struct item *item, int x, int y, int maxw)
|
|||||||
char *itemtext = item->text;
|
char *itemtext = item->text;
|
||||||
#endif // EMOJI_HIGHLIGHT_PATCH | TSV_PATCH
|
#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]);
|
drw_setscheme(drw, scheme[item == sel ? SchemeSelHighlight : SchemeNormHighlight]);
|
||||||
strcpy(tokens, text);
|
strcpy(tokens, text);
|
||||||
for (token = strtok(tokens, " "); token; token = strtok(NULL, " ")) {
|
for (token = strtok(tokens, " "); token; token = strtok(NULL, " ")) {
|
||||||
|
@ -4,6 +4,9 @@
|
|||||||
#if FZFEXPECT_PATCH
|
#if FZFEXPECT_PATCH
|
||||||
#include "fzfexpect.h"
|
#include "fzfexpect.h"
|
||||||
#endif
|
#endif
|
||||||
|
#if MULTI_SELECTION_PATCH
|
||||||
|
#include "multiselect.h"
|
||||||
|
#endif
|
||||||
#if HIGHPRIORITY_PATCH
|
#if HIGHPRIORITY_PATCH
|
||||||
#include "highpriority.h"
|
#include "highpriority.h"
|
||||||
#endif
|
#endif
|
||||||
@ -12,4 +15,4 @@
|
|||||||
#endif
|
#endif
|
||||||
#if NUMBERS_PATCH
|
#if NUMBERS_PATCH
|
||||||
#include "numbers.h"
|
#include "numbers.h"
|
||||||
#endif
|
#endif
|
||||||
|
1
patch/multiselect.h
Normal file
1
patch/multiselect.h
Normal file
@ -0,0 +1 @@
|
|||||||
|
static int issel(size_t id);
|
Loading…
Reference in New Issue
Block a user