Code quality improvements

This commit is contained in:
Jacob 2023-08-07 16:34:02 +02:00
parent 680b8f57d9
commit 9cd846ebef

View file

@ -1,17 +1,18 @@
/* See LICENSE file for copyright and license details. */ /* See LICENSE file for copyright and license details. */
void drawhighlights(struct item *item, int x, int y, int w, int p, const char *ittext) { void drawhighlights(struct item *item, int x, int y, int w, int p, char *itemtext) {
int i, indent; int i, indent;
char *highlight; char *highlight;
char c; char c;
// limitation in order to prevent highlighting from drawing when the text isn't visible // limitation in order to prevent highlighting from drawing when the text isn't visible
if (columns > 5 && lines > 1) return; if (columns > 5 && lines > 1)
return;
char *itemtext = strdup(ittext); if (!(strlen(itemtext) && strlen(tx.text)))
return;
if (!(strlen(itemtext) && strlen(tx.text))) return; if (strstr(itemtext, "</"))
return;
if (strstr(itemtext, "</")) return;
for (i = 0, highlight = itemtext; *highlight && tx.text[i];) { for (i = 0, highlight = itemtext; *highlight && tx.text[i];) {
if (((fuzzy && !fstrncmp(&(*highlight), &tx.text[i], 1)) || (!fuzzy && *highlight == tx.text[i]))) { if (((fuzzy && !fstrncmp(&(*highlight), &tx.text[i], 1)) || (!fuzzy && *highlight == tx.text[i]))) {