From 6e9d6a08b9537c17b261f8e57a6c04bd40257c4c Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Thu, 23 Feb 2017 23:25:03 -0600
Subject: [PATCH] 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>
---
 src/winio.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/winio.c b/src/winio.c
index edbff969..16aec48f 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -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);
 
-- 
GitLab