miscellaneous minor fixes

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2833 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2005-07-08 04:53:51 +00:00
parent f8cb832b50
commit 9d8396d340
3 changed files with 56 additions and 24 deletions

View File

@ -12,8 +12,11 @@ CVS code -
- Simplify wording of nano_gotoline_msg. (Jordi)
- nano.c:
do_verbatim_input()
- If constant cursor position display is on when we finish, make
sure the cursor position is displayed properly. (DLR)
- If constant cursor position display is on, make sure the
cursor position is displayed properly when we finish. (DLR)
do_next_word()
- Rework to be more like do_prev_word(), to avoid a potential
problem if we start at the end of a line. (DLR)
do_alt_speller()
- If we can't invoke the spell checker, use sprintf() instead of
snprintf() to write the error string we return, as the one
@ -23,6 +26,9 @@ CVS code -
no longer needed, and make the error message more similar to
what the internal spell checker returns under the same
circumstances. (DLR)
do_justify()
- If constant cursor position display is on, make sure the
cursor position is displayed properly when we finish. (DLR)
allow_pending_sigwinch()
- Simplify by using the "?" operator instead of an if clause.
(DLR)
@ -45,6 +51,9 @@ CVS code -
- Blank out last_replace properly again just before displaying
the "Replace" prompt. (DLR, found by Mike Frysinger)
- winio.c:
do_statusbar_next_word()
- Rework to be more like do_statusbar_prev_word(), to avoid a
potential problem if we start at the end of a line. (DLR)
display_string()
- Display invalid multibyte sequences as Unicode 0xFFFD
(Replacement Character). (DLR)

View File

@ -1285,6 +1285,11 @@ void do_verbatim_input(void)
statusbar(_("Verbatim Input"));
/* If constant cursor position display is on, make sure the current
* cursor position will be properly displayed on the statusbar. */
if (ISSET(CONST_UPDATE))
do_cursorpos(TRUE);
/* Read in all the verbatim characters. */
kbinput = get_verbatim_kbinput(edit, &kbinput_len);
@ -1299,11 +1304,6 @@ void do_verbatim_input(void)
do_output(output, kbinput_len, TRUE);
free(output);
/* If constant cursor position display is on, make sure the current
* cursor position is properly displayed on the statusbar. */
if (ISSET(CONST_UPDATE))
do_cursorpos(TRUE);
}
void do_backspace(void)
@ -1484,7 +1484,7 @@ bool do_next_word(bool allow_punct, bool allow_update)
const filestruct *current_save = current;
char *char_mb;
int char_mb_len;
bool started_on_word = FALSE;
bool end_line = FALSE, started_on_word = FALSE;
assert(current != NULL && current->data != NULL);
@ -1492,7 +1492,7 @@ bool do_next_word(bool allow_punct, bool allow_update)
/* Move forward until we find the character after the last letter of
* the current word. */
while (current->data[current_x] != '\0') {
while (!end_line) {
char_mb_len = parse_mbchar(current->data + current_x, char_mb,
NULL, NULL);
@ -1505,15 +1505,20 @@ bool do_next_word(bool allow_punct, bool allow_update)
* started_on_word to TRUE. */
started_on_word = TRUE;
current_x += char_mb_len;
if (current->data[current_x] == '\0')
end_line = TRUE;
else
current_x += char_mb_len;
}
/* Move forward until we find the first letter of the next word. */
if (current->data[current_x] != '\0')
if (current->data[current_x] == '\0')
end_line = TRUE;
else
current_x += char_mb_len;
for (; current != NULL; current = current->next) {
while (current->data[current_x] != '\0') {
while (!end_line) {
char_mb_len = parse_mbchar(current->data + current_x,
char_mb, NULL, NULL);
@ -1522,15 +1527,21 @@ bool do_next_word(bool allow_punct, bool allow_update)
if (is_word_mbchar(char_mb, allow_punct))
break;
current_x += char_mb_len;
if (current->data[current_x] == '\0')
end_line = TRUE;
else
current_x += char_mb_len;
}
/* If we've found it, stop moving forward to the beginnings of
* subsequent lines. */
if (current->data[current_x] != '\0')
if (!end_line)
break;
current_x = 0;
if (current->next != NULL) {
end_line = FALSE;
current_x = 0;
}
}
free(char_mb);
@ -1630,12 +1641,11 @@ bool do_prev_word(bool allow_punct, bool allow_update)
/* If we haven't found it, leave the cursor at the beginning of the
* file. */
if (current == NULL) {
if (current == NULL)
current = fileage;
current_x = 0;
/* If we've found it, move backward until we find the character
* before the first letter of the previous word. */
} else if (!begin_line) {
else if (!begin_line) {
if (current_x == 0)
begin_line = TRUE;
else
@ -3414,6 +3424,11 @@ void do_justify(bool full_justify)
statusbar(_("Can now UnJustify!"));
/* If constant cursor position display is on, make sure the current
* cursor position will be properly displayed on the statusbar. */
if (ISSET(CONST_UPDATE))
do_cursorpos(TRUE);
/* Display the shortcut list with UnJustify. */
shortcut_init(TRUE);
display_main_list();

View File

@ -1912,7 +1912,7 @@ bool do_statusbar_next_word(bool allow_punct)
{
char *char_mb;
int char_mb_len;
bool started_on_word = FALSE;
bool end_line = FALSE, started_on_word = FALSE;
assert(answer != NULL);
@ -1920,7 +1920,7 @@ bool do_statusbar_next_word(bool allow_punct)
/* Move forward until we find the character after the last letter of
* the current word. */
while (answer[statusbar_x] != '\0') {
while (!end_line) {
char_mb_len = parse_mbchar(answer + statusbar_x, char_mb, NULL,
NULL);
@ -1933,14 +1933,19 @@ bool do_statusbar_next_word(bool allow_punct)
* started_on_word to TRUE. */
started_on_word = TRUE;
statusbar_x += char_mb_len;
if (answer[statusbar_x] == '\0')
end_line = TRUE;
else
statusbar_x += char_mb_len;
}
/* Move forward until we find the first letter of the next word. */
if (answer[statusbar_x] != '\0')
if (answer[statusbar_x] == '\0')
end_line = TRUE;
else
statusbar_x += char_mb_len;
while (answer[statusbar_x] != '\0') {
while (!end_line) {
char_mb_len = parse_mbchar(answer + statusbar_x, char_mb, NULL,
NULL);
@ -1949,7 +1954,10 @@ bool do_statusbar_next_word(bool allow_punct)
if (is_word_mbchar(char_mb, allow_punct))
break;
statusbar_x += char_mb_len;
if (answer[statusbar_x] == '\0')
end_line = TRUE;
else
statusbar_x += char_mb_len;
}
free(char_mb);