weeding: remove the 'active' parameter from spotlight()
After the previous change, it is always TRUE and thus pointless.master
parent
c2e4f77594
commit
53865ced9d
|
@ -663,9 +663,9 @@ void total_redraw(void);
|
||||||
void total_refresh(void);
|
void total_refresh(void);
|
||||||
void do_cursorpos(bool force);
|
void do_cursorpos(bool force);
|
||||||
void do_cursorpos_void(void);
|
void do_cursorpos_void(void);
|
||||||
void spotlight(bool active, size_t from_col, size_t to_col);
|
void spotlight(size_t from_col, size_t to_col);
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
void spotlight_softwrapped(bool active, size_t from_col, size_t to_col);
|
void spotlight_softwrapped(size_t from_col, size_t to_col);
|
||||||
#endif
|
#endif
|
||||||
void do_suspend_void(void);
|
void do_suspend_void(void);
|
||||||
void disable_waiting(void);
|
void disable_waiting(void);
|
||||||
|
|
20
src/winio.c
20
src/winio.c
|
@ -2781,7 +2781,7 @@ int update_line(filestruct *fileptr, size_t index)
|
||||||
mvwaddch(edit, row, COLS - 1, '$');
|
mvwaddch(edit, row, COLS - 1, '$');
|
||||||
|
|
||||||
if (spotlighted && !inhelp)
|
if (spotlighted && !inhelp)
|
||||||
spotlight(TRUE, light_from_col, light_to_col);
|
spotlight(light_from_col, light_to_col);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -2850,7 +2850,7 @@ int update_softwrapped_line(filestruct *fileptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spotlighted && !inhelp)
|
if (spotlighted && !inhelp)
|
||||||
spotlight(TRUE, light_from_col, light_to_col);
|
spotlight(light_from_col, light_to_col);
|
||||||
|
|
||||||
return (row - starting_row);
|
return (row - starting_row);
|
||||||
}
|
}
|
||||||
|
@ -3414,9 +3414,8 @@ void enable_waiting(void)
|
||||||
nodelay(edit, FALSE);
|
nodelay(edit, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Highlight the text between from_col and to_col when active is TRUE.
|
/* Highlight the text between from_col and to_col. */
|
||||||
* Remove the highlight when active is FALSE. */
|
void spotlight(size_t from_col, size_t to_col)
|
||||||
void spotlight(bool active, size_t from_col, size_t to_col)
|
|
||||||
{
|
{
|
||||||
char *word;
|
char *word;
|
||||||
size_t word_span, room;
|
size_t word_span, room;
|
||||||
|
@ -3425,7 +3424,7 @@ void spotlight(bool active, size_t from_col, size_t to_col)
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
if (ISSET(SOFTWRAP)) {
|
if (ISSET(SOFTWRAP)) {
|
||||||
spotlight_softwrapped(active, from_col, to_col);
|
spotlight_softwrapped(from_col, to_col);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -3447,7 +3446,6 @@ void spotlight(bool active, size_t from_col, size_t to_col)
|
||||||
if (word_span > room)
|
if (word_span > room)
|
||||||
room--;
|
room--;
|
||||||
|
|
||||||
if (active)
|
|
||||||
wattron(edit, interface_color_pair[SELECTED_TEXT]);
|
wattron(edit, interface_color_pair[SELECTED_TEXT]);
|
||||||
|
|
||||||
waddnstr(edit, word, actual_x(word, room));
|
waddnstr(edit, word, actual_x(word, room));
|
||||||
|
@ -3455,7 +3453,6 @@ void spotlight(bool active, size_t from_col, size_t to_col)
|
||||||
if (word_span > room)
|
if (word_span > room)
|
||||||
waddch(edit, '$');
|
waddch(edit, '$');
|
||||||
|
|
||||||
if (active)
|
|
||||||
wattroff(edit, interface_color_pair[SELECTED_TEXT]);
|
wattroff(edit, interface_color_pair[SELECTED_TEXT]);
|
||||||
|
|
||||||
free(word);
|
free(word);
|
||||||
|
@ -3464,10 +3461,9 @@ void spotlight(bool active, size_t from_col, size_t to_col)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
/* Highlight the text between from_col and to_col when active is TRUE; remove
|
/* Highlight the text between the given columns. This will not highlight soft
|
||||||
* the highlight when active is FALSE. This will not highlight softwrapped
|
|
||||||
* line breaks, since they're not actually part of the spotlighted text. */
|
* line breaks, since they're not actually part of the spotlighted text. */
|
||||||
void spotlight_softwrapped(bool active, size_t from_col, size_t to_col)
|
void spotlight_softwrapped(size_t from_col, size_t to_col)
|
||||||
{
|
{
|
||||||
ssize_t row = openfile->current_y;
|
ssize_t row = openfile->current_y;
|
||||||
size_t leftedge = leftedge_for(from_col, openfile->current);
|
size_t leftedge = leftedge_for(from_col, openfile->current);
|
||||||
|
@ -3494,12 +3490,10 @@ void spotlight_softwrapped(bool active, size_t from_col, size_t to_col)
|
||||||
word = display_string(openfile->current->data, from_col,
|
word = display_string(openfile->current->data, from_col,
|
||||||
break_col - from_col, FALSE);
|
break_col - from_col, FALSE);
|
||||||
|
|
||||||
if (active)
|
|
||||||
wattron(edit, interface_color_pair[SELECTED_TEXT]);
|
wattron(edit, interface_color_pair[SELECTED_TEXT]);
|
||||||
|
|
||||||
waddnstr(edit, word, actual_x(word, break_col));
|
waddnstr(edit, word, actual_x(word, break_col));
|
||||||
|
|
||||||
if (active)
|
|
||||||
wattroff(edit, interface_color_pair[SELECTED_TEXT]);
|
wattroff(edit, interface_color_pair[SELECTED_TEXT]);
|
||||||
|
|
||||||
free(word);
|
free(word);
|
||||||
|
|
Loading…
Reference in New Issue