replacing: fix spotlight() to highlight words properly in softwrap mode

In softwrap mode, the entire line is onscreen, so the word is never
partially offscreen, so we always have enough columns to show it.

This fixes https://savannah.gnu.org/bugs/?50389.
Reported-by: David Lawrence Ramsey <pooka109@gmail.com>
master
David Lawrence Ramsey 2017-02-23 23:25:03 -06:00 committed by Benno Schulenberg
parent 07ebba5e99
commit 6e9d6a08b9
1 changed files with 3 additions and 2 deletions

View File

@ -3100,10 +3100,11 @@ void disable_nodelay(void)
* expect word to have tabs and control characters expanded. */
void spotlight(bool active, const char *word)
{
size_t word_len = strlenpt(word), room;
size_t word_len = strlenpt(word), room = word_len;
/* Compute the number of columns that are available for the word. */
room = editwincols + get_page_start(xplustabs()) - xplustabs();
if (!ISSET(SOFTWRAP))
room = editwincols + get_page_start(xplustabs()) - xplustabs();
assert(room > 0);