diff --git a/ChangeLog b/ChangeLog
index 7cf25bebc5a5868941d3210da03f3f8b9cc8eaf2..f54e253867a8df0a6455867df02a3a001d9b9fec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -58,7 +58,8 @@ CVS code -
 	  do_delete(), breakable(), break_line(), do_output(),
 	  get_buffer(), unget_input(), actual_x(), strnlenpt(),
 	  display_string(), titlebar(), statusbar(), onekey(),
-	  edit_add(), and do_credits(). (David Benbennick and DLR)
+	  edit_add(), do_replace_highlight(), and do_credits(). (David
+	  Benbennick and DLR)
 	- Overhaul the high-level input routines for the statusbar to
 	  make them read the shortcut lists for functions instead of
 	  manually running them, to make nanogetstr() less complex, and
diff --git a/src/winio.c b/src/winio.c
index d32403a2f57056d9e3a2489343f10f82daa990d4..2f1962b463358d58a322eb738763db7097ba203e 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -4063,12 +4063,17 @@ void do_help(void)
 void do_replace_highlight(bool highlight_flag, const char *word)
 {
     size_t y = xplustabs();
-    size_t word_len = strlen(word);
+    size_t word_len = strlenpt(word);
 
     y = get_page_start(y) + COLS - y;
-	/* Now y is the number of characters we can display on this
+	/* Now y is the number of columns that we can display on this
 	 * line. */
 
+    assert(y > 0);
+
+    if (word_len > y)
+	y--;
+
     reset_cursor();
 
     if (highlight_flag)
@@ -4080,12 +4085,10 @@ void do_replace_highlight(bool highlight_flag, const char *word)
 	waddstr(edit, " ");
     else
 #endif
-	waddnstr(edit, word, y - 1);
+	waddnstr(edit, word, actual_x(word, y));
 
     if (word_len > y)
 	waddch(edit, '$');
-    else if (word_len == y)
-	waddch(edit, word[word_len - 1]);
 
     if (highlight_flag)
 	wattroff(edit, A_REVERSE);