From 08cd7ef274f3894d6cc8c92223f771ccffa6b520 Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Sun, 2 Jan 2005 20:30:15 +0000
Subject: [PATCH] fix an assert, update another copyright year, and add a few
 more of DB's tweaks to fix a few minor bugs with UTF-8 display at the
 statusbar prompt

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2213 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 ChangeLog    | 10 +++++-----
 src/search.c |  4 ++--
 src/winio.c  |  4 ++--
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2fe31e63..22d53577 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -70,11 +70,11 @@ CVS code -
 	  do_statusbar_backspace(), do_statusbar_delete(),
 	  do_statusbar_cut_text(), and do_statusbar_output(). (DLR)
 	- Even more steps toward wide character/multibyte character
-	  support.  Movement and (most) cursor display at the statusbar
-	  prompt should now work properly with a string containing
-	  multibyte characters, and text display of such strings should
-	  now (mostly) work properly as well.  Changes to
-	  do_statusbar_right(), do_statusbar_left(),
+	  support.  Movement and cursor display at the statusbar prompt
+	  should now work properly with a string containing multibyte
+	  characters, and text display of such strings should now work
+	  properly as well.  Changes to search_init(),
+	  nanoget_repaint(), do_statusbar_right(), do_statusbar_left(),
 	  do_statusbar_backspace(), and do_statusbar_delete(). (David
 	  Benbennick and DLR)
 	- Implement cutting from the current position to the end of the
diff --git a/src/search.c b/src/search.c
index 7ef03809..02c054d5 100644
--- a/src/search.c
+++ b/src/search.c
@@ -2,7 +2,7 @@
 /**************************************************************************
  *   search.c                                                             *
  *                                                                        *
- *   Copyright (C) 2000-2004 Chris Allegretta                             *
+ *   Copyright (C) 2000-2005 Chris Allegretta                             *
  *   This program is free software; you can redistribute it and/or modify *
  *   it under the terms of the GNU General Public License as published by *
  *   the Free Software Foundation; either version 2, or (at your option)  *
@@ -152,7 +152,7 @@ int search_init(bool replacing, bool use_answer)
     if (last_search[0] != '\0') {
 	char *disp = display_string(last_search, 0, COLS / 3, FALSE);
 
-	buf = charalloc(COLS / 3 + 7);
+	buf = charalloc(strlen(disp) + 7);
 	/* We use COLS / 3 here because we need to see more on the
 	 * line. */
 	sprintf(buf, " [%s%s]", disp,
diff --git a/src/winio.c b/src/winio.c
index 4cc6c77e..c2fd6ef3 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -2329,9 +2329,9 @@ char *display_string(const char *buf, size_t start_col, size_t len, bool
 void nanoget_repaint(const char *buf, const char *inputbuf, size_t x)
 {
     size_t x_real = strnlenpt(inputbuf, x);
-    int wid = COLS - strlen(buf) - 2;
+    int wid = COLS - strlenpt(buf) - 2;
 
-    assert(0 <= x && x <= strlen(inputbuf));
+    assert(x <= strlen(inputbuf));
 
     wattron(bottomwin, A_REVERSE);
     blank_statusbar();
-- 
GitLab