Commit 913db834 authored by David Lawrence Ramsey's avatar David Lawrence Ramsey
Browse files

add DB's (modified) UTF-8 support tweaks to do_replace_highlight()

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2230 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 10 additions and 6 deletions
+10 -6
...@@ -58,7 +58,8 @@ CVS code - ...@@ -58,7 +58,8 @@ CVS code -
do_delete(), breakable(), break_line(), do_output(), do_delete(), breakable(), break_line(), do_output(),
get_buffer(), unget_input(), actual_x(), strnlenpt(), get_buffer(), unget_input(), actual_x(), strnlenpt(),
display_string(), titlebar(), statusbar(), onekey(), 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 - Overhaul the high-level input routines for the statusbar to
make them read the shortcut lists for functions instead of make them read the shortcut lists for functions instead of
manually running them, to make nanogetstr() less complex, and manually running them, to make nanogetstr() less complex, and
......
...@@ -4063,12 +4063,17 @@ void do_help(void) ...@@ -4063,12 +4063,17 @@ void do_help(void)
void do_replace_highlight(bool highlight_flag, const char *word) void do_replace_highlight(bool highlight_flag, const char *word)
{ {
size_t y = xplustabs(); size_t y = xplustabs();
size_t word_len = strlen(word); size_t word_len = strlenpt(word);
y = get_page_start(y) + COLS - y; 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. */ * line. */
assert(y > 0);
if (word_len > y)
y--;
reset_cursor(); reset_cursor();
if (highlight_flag) if (highlight_flag)
...@@ -4080,12 +4085,10 @@ void do_replace_highlight(bool highlight_flag, const char *word) ...@@ -4080,12 +4085,10 @@ void do_replace_highlight(bool highlight_flag, const char *word)
waddstr(edit, " "); waddstr(edit, " ");
else else
#endif #endif
waddnstr(edit, word, y - 1); waddnstr(edit, word, actual_x(word, y));
if (word_len > y) if (word_len > y)
waddch(edit, '$'); waddch(edit, '$');
else if (word_len == y)
waddch(edit, word[word_len - 1]);
if (highlight_flag) if (highlight_flag)
wattroff(edit, A_REVERSE); wattroff(edit, A_REVERSE);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment