mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-26 22:59:38 +03:00
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
This commit is contained in:
parent
d24fbb760d
commit
7801d7bed9
@ -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);
|
||||
|
11
src/nano.c
11
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')
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user