]> git.wh0rd.org Git - nano.git/commitdiff
revert previously added extra calls to move_mbright(); it's more
authorDavid Lawrence Ramsey <pooka109@gmail.com>
Fri, 14 Jan 2005 21:59:01 +0000 (21:59 +0000)
committerDavid Lawrence Ramsey <pooka109@gmail.com>
Fri, 14 Jan 2005 21:59:01 +0000 (21:59 +0000)
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
src/nano.c
src/winio.c

index 9afb2ef26825f4fef460b6405629047b1b7fc3df..bcda6dc8a87de7c4b9d172d6d9b0ec4f6e94876a 100644 (file)
@@ -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);
index d1016fe26b07f97feb1737e04665985361d07750..0031f1a226de968df47e9db229a3d2ed5ac46180 100644 (file)
@@ -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')
index ad4f5c54147a991ca2d497b05726e1947914f46a..83a2331084be706f8c4ef8b49296e3f0ee835ff1 100644 (file)
@@ -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);