diff --git a/ChangeLog b/ChangeLog index f65c8db9..3fc59b9f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ that is taking too long. This fixes Savannah bug #47439. * src/winio.c (do_replace_highlight): Rename this to 'spotlight', for clarity, and for contrast with 'do_replace/do_replace_loop'. + * src/winio.c (spotlight): Rename a variable for clarity. 2016-03-29 Benno Schulenberg * src/nano.c (main), src/text.c (do_justify, do_verbatim_input), diff --git a/src/winio.c b/src/winio.c index 9c33f3a6..8287ed5c 100644 --- a/src/winio.c +++ b/src/winio.c @@ -3151,16 +3151,15 @@ void disable_nodelay(void) * expect word to have tabs and control characters expanded. */ void spotlight(bool active, const char *word) { - size_t y = xplustabs(), word_len = strlenpt(word); + size_t word_len = strlenpt(word), room; - y = get_page_start(y) + COLS - y; - /* Now y is the number of columns that we can display on this - * line. */ + /* Compute the number of columns that are available for the word. */ + room = COLS + get_page_start(xplustabs()) - xplustabs(); - assert(y > 0); + assert(room > 0); - if (word_len > y) - y--; + if (word_len > room) + room--; reset_cursor(); wnoutrefresh(edit); @@ -3172,9 +3171,9 @@ void spotlight(bool active, const char *word) if (word_len == 0) waddch(edit, ' '); else - waddnstr(edit, word, actual_x(word, y)); + waddnstr(edit, word, actual_x(word, room)); - if (word_len > y) + if (word_len > room) waddch(edit, '$'); if (active)