From 7801d7bed96afb4a522421b36131e4475215fa32 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Fri, 14 Jan 2005 21:59:01 +0000 Subject: [PATCH] revert previously added extra calls to move_mbright(); it's more efficient to just add the return value of parse_char() directly instead of having move_mbright() return it (except in the cursor movement functions, which should be kept simple) git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2271 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- src/move.c | 6 ++++-- src/nano.c | 11 +++++++---- src/winio.c | 5 +++-- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/move.c b/src/move.c index 9afb2ef2..bcda6dc8 100644 --- a/src/move.c +++ b/src/move.c @@ -58,11 +58,13 @@ void do_home(void) if (ISSET(SMART_HOME)) { size_t current_x_save = current_x; char *blank_mb = charalloc(mb_cur_max()); + int blank_mb_len; current_x = 0; while (current->data[current_x] != '\0') { - parse_mbchar(current->data + current_x, blank_mb + blank_mb_len = parse_mbchar(current->data + current_x, + blank_mb #ifdef NANO_WIDE , NULL #endif @@ -71,7 +73,7 @@ void do_home(void) if (!is_blank_mbchar(blank_mb)) break; - current_x = move_mbright(current->data, current_x); + current_x += blank_mb_len; } free(blank_mb); diff --git a/src/nano.c b/src/nano.c index d1016fe2..0031f1a2 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1321,12 +1321,14 @@ void do_next_word(void) size_t pww_save = placewewant; const filestruct *current_save = current; char *char_mb = charalloc(mb_cur_max()); + int char_mb_len; assert(current != NULL && current->data != NULL); /* Skip letters in this word first. */ while (current->data[current_x] != '\0') { - parse_mbchar(current->data + current_x, char_mb + char_mb_len = parse_mbchar(current->data + current_x, + char_mb #ifdef NANO_WIDE , NULL #endif @@ -1335,13 +1337,14 @@ void do_next_word(void) if (!is_alnum_mbchar(char_mb)) break; - current_x = move_mbright(current->data, current_x); + current_x += char_mb_len; } /* Go until we find the first letter of the next word. */ for (; current != NULL; current = current->next) { while (current->data[current_x] != '\0') { - parse_mbchar(current->data + current_x, char_mb + char_mb_len = parse_mbchar(current->data + current_x, + char_mb #ifdef NANO_WIDE , NULL #endif @@ -1350,7 +1353,7 @@ void do_next_word(void) if (is_alnum_mbchar(char_mb)) break; - current_x = move_mbright(current->data, current_x); + current_x += char_mb_len; } if (current->data[current_x] != '\0') diff --git a/src/winio.c b/src/winio.c index ad4f5c54..83a23310 100644 --- a/src/winio.c +++ b/src/winio.c @@ -1804,11 +1804,12 @@ void do_statusbar_home(void) if (ISSET(SMART_HOME)) { size_t statusbar_x_save = statusbar_x; char *blank_mb = charalloc(mb_cur_max()); + int blank_mb_len; statusbar_x = 0; while (statusbar_x < statusbar_xend) { - parse_mbchar(answer + statusbar_x, + blank_mb_len = parse_mbchar(answer + statusbar_x, blank_mb #ifdef NANO_WIDE , NULL @@ -1818,7 +1819,7 @@ void do_statusbar_home(void) if (!is_blank_mbchar(blank_mb)) break; - statusbar_x = move_mbright(answer, statusbar_x); + statusbar_x += blank_mb_len; } free(blank_mb); -- 2.39.5