Jumping to the start of the current word, not to that of the preceding one.
This fixes Savannah bug #46970. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5594 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
65c7c810bc
commit
5688c160a9
|
@ -2,6 +2,9 @@
|
||||||
* src/files.c (update_poshistory): Do not add directories to the
|
* src/files.c (update_poshistory): Do not add directories to the
|
||||||
list of file positions. This fixes Savannah bug #46971.
|
list of file positions. This fixes Savannah bug #46971.
|
||||||
* src/*.c: Adjust some indentation and some line wrapping.
|
* src/*.c: Adjust some indentation and some line wrapping.
|
||||||
|
* src/prompt.c (do_statusbar_prev_word): When in the middle of a
|
||||||
|
word, jump to the start of the current word, not to the start of
|
||||||
|
the preceding one. This fixes Savannah bug #46970.
|
||||||
|
|
||||||
2016-01-25 Benno Schulenberg <bensberg@justemail.net>
|
2016-01-25 Benno Schulenberg <bensberg@justemail.net>
|
||||||
* src/files.c (update_poshistory): Handle an update of the first
|
* src/files.c (update_poshistory): Handle an update of the first
|
||||||
|
|
77
src/prompt.c
77
src/prompt.c
|
@ -472,81 +472,26 @@ void do_statusbar_next_word(void)
|
||||||
/* Move to the previous word in the prompt text. */
|
/* Move to the previous word in the prompt text. */
|
||||||
void do_statusbar_prev_word(void)
|
void do_statusbar_prev_word(void)
|
||||||
{
|
{
|
||||||
char *char_mb;
|
bool seen_a_word = FALSE, step_forward = FALSE;
|
||||||
int char_mb_len;
|
|
||||||
bool begin_line = FALSE;
|
|
||||||
|
|
||||||
assert(answer != NULL);
|
assert(answer != NULL);
|
||||||
|
|
||||||
char_mb = charalloc(mb_cur_max());
|
/* Move backward until we pass over the start of a word. */
|
||||||
|
while (statusbar_x != 0) {
|
||||||
/* Move backward until we find the character before the first letter
|
|
||||||
* of the current word. */
|
|
||||||
while (!begin_line) {
|
|
||||||
char_mb_len = parse_mbchar(answer + statusbar_x, char_mb, NULL);
|
|
||||||
|
|
||||||
/* If we've found it, stop moving backward through the current
|
|
||||||
* line. */
|
|
||||||
if (!is_word_mbchar(char_mb, FALSE))
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (statusbar_x == 0)
|
|
||||||
begin_line = TRUE;
|
|
||||||
else
|
|
||||||
statusbar_x = move_mbleft(answer, statusbar_x);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Move backward until we find the last letter of the previous
|
|
||||||
* word. */
|
|
||||||
if (statusbar_x == 0)
|
|
||||||
begin_line = TRUE;
|
|
||||||
else
|
|
||||||
statusbar_x = move_mbleft(answer, statusbar_x);
|
statusbar_x = move_mbleft(answer, statusbar_x);
|
||||||
|
|
||||||
while (!begin_line) {
|
if (is_word_mbchar(answer + statusbar_x, FALSE))
|
||||||
char_mb_len = parse_mbchar(answer + statusbar_x, char_mb, NULL);
|
seen_a_word = TRUE;
|
||||||
|
else if (seen_a_word) {
|
||||||
/* If we've found it, stop moving backward through the current
|
/* This is space now: we've overshot the start of the word. */
|
||||||
* line. */
|
step_forward = TRUE;
|
||||||
if (is_word_mbchar(char_mb, FALSE))
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (statusbar_x == 0)
|
|
||||||
begin_line = TRUE;
|
|
||||||
else
|
|
||||||
statusbar_x = move_mbleft(answer, statusbar_x);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If we've found it, move backward until we find the character
|
|
||||||
* before the first letter of the previous word. */
|
|
||||||
if (!begin_line) {
|
|
||||||
if (statusbar_x == 0)
|
|
||||||
begin_line = TRUE;
|
|
||||||
else
|
|
||||||
statusbar_x = move_mbleft(answer, statusbar_x);
|
|
||||||
|
|
||||||
while (!begin_line) {
|
|
||||||
char_mb_len = parse_mbchar(answer + statusbar_x, char_mb,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
/* If we've found it, stop moving backward through the
|
|
||||||
* current line. */
|
|
||||||
if (!is_word_mbchar(char_mb, FALSE))
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (statusbar_x == 0)
|
|
||||||
begin_line = TRUE;
|
|
||||||
else
|
|
||||||
statusbar_x = move_mbleft(answer, statusbar_x);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we've found it, move forward to the first letter of the
|
|
||||||
* previous word. */
|
|
||||||
if (!begin_line)
|
|
||||||
statusbar_x += char_mb_len;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
free(char_mb);
|
if (step_forward)
|
||||||
|
/* Move one character forward again to sit on the start of the word. */
|
||||||
|
statusbar_x = move_mbright(answer, statusbar_x);
|
||||||
|
|
||||||
update_the_bar();
|
update_the_bar();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue