mirror of git://git.sv.gnu.org/nano.git
make the "smart home" routines handle multibyte blank characters
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2250 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
parent
4c6956b433
commit
8a31afdc55
11
ChangeLog
11
ChangeLog
|
@ -97,11 +97,12 @@ CVS code -
|
|||
control_mbrep(), control_wrep(), mbwidth(), mb_cur_max(), and
|
||||
make_mbchar(); changes to is_blank_char() (moved to chars.c),
|
||||
is_cntrl_char() (moved to chars.c), parse_char() (renamed
|
||||
parse_mbchar() and moved to chars.c), do_verbatim_input(),
|
||||
do_delete(), do_tab(), do_input(), do_output(), get_buffer(),
|
||||
unget_input(), unget_kbinput(), get_input(), parse_kbinput(),
|
||||
unparse_kbinput(), parse_verbatim_kbinput(),
|
||||
do_statusbar_input(), do_statusbar_verbatim_kbinput(),
|
||||
parse_mbchar() and moved to chars.c), do_home(),
|
||||
do_verbatim_input(), do_delete(), do_tab(), do_input(),
|
||||
do_output(), get_buffer(), unget_input(), unget_kbinput(),
|
||||
get_input(), parse_kbinput(), unparse_kbinput(),
|
||||
parse_verbatim_kbinput(), do_statusbar_input(),
|
||||
do_statusbar_home(), do_statusbar_verbatim_kbinput(),
|
||||
do_statusbar_output(), and display_string(); removal of
|
||||
buffer_to_keys() and keys_to_buffer(). (DLR)
|
||||
- cut.c:
|
||||
|
|
22
src/move.c
22
src/move.c
|
@ -57,10 +57,26 @@ void do_home(void)
|
|||
#ifndef NANO_SMALL
|
||||
if (ISSET(SMART_HOME)) {
|
||||
size_t current_x_save = current_x;
|
||||
char *blank_mb = charalloc(mb_cur_max());
|
||||
int blank_mb_len;
|
||||
|
||||
for (current_x = 0; is_blank_char(current->data[current_x]) &&
|
||||
current->data[current_x] != '\0'; current_x++)
|
||||
;
|
||||
current_x = 0;
|
||||
|
||||
while (current->data[current_x] != '\0') {
|
||||
blank_mb_len = parse_mbchar(current->data + current_x,
|
||||
blank_mb
|
||||
#ifdef NANO_WIDE
|
||||
, NULL
|
||||
#endif
|
||||
, NULL);
|
||||
|
||||
if (!is_blank_mbchar(blank_mb))
|
||||
break;
|
||||
|
||||
current_x += blank_mb_len;
|
||||
}
|
||||
|
||||
free(blank_mb);
|
||||
|
||||
if (current_x == current_x_save ||
|
||||
current->data[current_x] == '\0')
|
||||
|
|
24
src/winio.c
24
src/winio.c
|
@ -1803,9 +1803,27 @@ void do_statusbar_home(void)
|
|||
#ifndef NANO_SMALL
|
||||
if (ISSET(SMART_HOME)) {
|
||||
size_t statusbar_x_save = statusbar_x;
|
||||
for (statusbar_x = 0; is_blank_char(answer[statusbar_x]) &&
|
||||
statusbar_x < statusbar_xend; statusbar_x++)
|
||||
;
|
||||
char *blank_mb = charalloc(mb_cur_max());
|
||||
int blank_mb_len;
|
||||
|
||||
statusbar_x = 0;
|
||||
|
||||
while (statusbar_x < statusbar_xend) {
|
||||
blank_mb_len = parse_mbchar(answer + statusbar_x,
|
||||
blank_mb
|
||||
#ifdef NANO_WIDE
|
||||
, NULL
|
||||
#endif
|
||||
, NULL);
|
||||
|
||||
if (!is_blank_mbchar(blank_mb))
|
||||
break;
|
||||
|
||||
statusbar_x += blank_mb_len;
|
||||
}
|
||||
|
||||
free(blank_mb);
|
||||
|
||||
if (statusbar_x == statusbar_x_save ||
|
||||
statusbar_x == statusbar_xend)
|
||||
statusbar_x = 0;
|
||||
|
|
Loading…
Reference in New Issue