Commit 9d8396d3 authored by David Lawrence Ramsey's avatar David Lawrence Ramsey
Browse files

miscellaneous minor fixes

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2833 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 56 additions and 24 deletions
+56 -24
...@@ -12,8 +12,11 @@ CVS code - ...@@ -12,8 +12,11 @@ CVS code -
- Simplify wording of nano_gotoline_msg. (Jordi) - Simplify wording of nano_gotoline_msg. (Jordi)
- nano.c: - nano.c:
do_verbatim_input() do_verbatim_input()
- If constant cursor position display is on when we finish, make - If constant cursor position display is on, make sure the
sure the cursor position is displayed properly. (DLR) 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() do_alt_speller()
- If we can't invoke the spell checker, use sprintf() instead of - If we can't invoke the spell checker, use sprintf() instead of
snprintf() to write the error string we return, as the one snprintf() to write the error string we return, as the one
...@@ -23,6 +26,9 @@ CVS code - ...@@ -23,6 +26,9 @@ CVS code -
no longer needed, and make the error message more similar to no longer needed, and make the error message more similar to
what the internal spell checker returns under the same what the internal spell checker returns under the same
circumstances. (DLR) 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() allow_pending_sigwinch()
- Simplify by using the "?" operator instead of an if clause. - Simplify by using the "?" operator instead of an if clause.
(DLR) (DLR)
...@@ -45,6 +51,9 @@ CVS code - ...@@ -45,6 +51,9 @@ CVS code -
- Blank out last_replace properly again just before displaying - Blank out last_replace properly again just before displaying
the "Replace" prompt. (DLR, found by Mike Frysinger) the "Replace" prompt. (DLR, found by Mike Frysinger)
- winio.c: - 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_string()
- Display invalid multibyte sequences as Unicode 0xFFFD - Display invalid multibyte sequences as Unicode 0xFFFD
(Replacement Character). (DLR) (Replacement Character). (DLR)
......
...@@ -1285,6 +1285,11 @@ void do_verbatim_input(void) ...@@ -1285,6 +1285,11 @@ void do_verbatim_input(void)
statusbar(_("Verbatim Input")); 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. */ /* Read in all the verbatim characters. */
kbinput = get_verbatim_kbinput(edit, &kbinput_len); kbinput = get_verbatim_kbinput(edit, &kbinput_len);
...@@ -1299,11 +1304,6 @@ void do_verbatim_input(void) ...@@ -1299,11 +1304,6 @@ void do_verbatim_input(void)
do_output(output, kbinput_len, TRUE); do_output(output, kbinput_len, TRUE);
free(output); 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) void do_backspace(void)
...@@ -1484,7 +1484,7 @@ bool do_next_word(bool allow_punct, bool allow_update) ...@@ -1484,7 +1484,7 @@ bool do_next_word(bool allow_punct, bool allow_update)
const filestruct *current_save = current; const filestruct *current_save = current;
char *char_mb; char *char_mb;
int char_mb_len; int char_mb_len;
bool started_on_word = FALSE; bool end_line = FALSE, started_on_word = FALSE;
assert(current != NULL && current->data != NULL); assert(current != NULL && current->data != NULL);
...@@ -1492,7 +1492,7 @@ bool do_next_word(bool allow_punct, bool allow_update) ...@@ -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 /* Move forward until we find the character after the last letter of
* the current word. */ * the current word. */
while (current->data[current_x] != '\0') { while (!end_line) {
char_mb_len = parse_mbchar(current->data + current_x, char_mb, char_mb_len = parse_mbchar(current->data + current_x, char_mb,
NULL, NULL); NULL, NULL);
...@@ -1505,15 +1505,20 @@ bool do_next_word(bool allow_punct, bool allow_update) ...@@ -1505,15 +1505,20 @@ bool do_next_word(bool allow_punct, bool allow_update)
* started_on_word to TRUE. */ * started_on_word to TRUE. */
started_on_word = 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. */ /* 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; current_x += char_mb_len;
for (; current != NULL; current = current->next) { 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_len = parse_mbchar(current->data + current_x,
char_mb, NULL, NULL); char_mb, NULL, NULL);
...@@ -1522,15 +1527,21 @@ bool do_next_word(bool allow_punct, bool allow_update) ...@@ -1522,15 +1527,21 @@ bool do_next_word(bool allow_punct, bool allow_update)
if (is_word_mbchar(char_mb, allow_punct)) if (is_word_mbchar(char_mb, allow_punct))
break; 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 /* If we've found it, stop moving forward to the beginnings of
* subsequent lines. */ * subsequent lines. */
if (current->data[current_x] != '\0') if (!end_line)
break; break;
current_x = 0; if (current->next != NULL) {
end_line = FALSE;
current_x = 0;
}
} }
free(char_mb); free(char_mb);
...@@ -1630,12 +1641,11 @@ bool do_prev_word(bool allow_punct, bool allow_update) ...@@ -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 /* If we haven't found it, leave the cursor at the beginning of the
* file. */ * file. */
if (current == NULL) { if (current == NULL)
current = fileage; current = fileage;
current_x = 0;
/* If we've found it, move backward until we find the character /* If we've found it, move backward until we find the character
* before the first letter of the previous word. */ * before the first letter of the previous word. */
} else if (!begin_line) { else if (!begin_line) {
if (current_x == 0) if (current_x == 0)
begin_line = TRUE; begin_line = TRUE;
else else
...@@ -3414,6 +3424,11 @@ void do_justify(bool full_justify) ...@@ -3414,6 +3424,11 @@ void do_justify(bool full_justify)
statusbar(_("Can now UnJustify!")); 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. */ /* Display the shortcut list with UnJustify. */
shortcut_init(TRUE); shortcut_init(TRUE);
display_main_list(); display_main_list();
......
...@@ -1912,7 +1912,7 @@ bool do_statusbar_next_word(bool allow_punct) ...@@ -1912,7 +1912,7 @@ bool do_statusbar_next_word(bool allow_punct)
{ {
char *char_mb; char *char_mb;
int char_mb_len; int char_mb_len;
bool started_on_word = FALSE; bool end_line = FALSE, started_on_word = FALSE;
assert(answer != NULL); assert(answer != NULL);
...@@ -1920,7 +1920,7 @@ bool do_statusbar_next_word(bool allow_punct) ...@@ -1920,7 +1920,7 @@ bool do_statusbar_next_word(bool allow_punct)
/* Move forward until we find the character after the last letter of /* Move forward until we find the character after the last letter of
* the current word. */ * the current word. */
while (answer[statusbar_x] != '\0') { while (!end_line) {
char_mb_len = parse_mbchar(answer + statusbar_x, char_mb, NULL, char_mb_len = parse_mbchar(answer + statusbar_x, char_mb, NULL,
NULL); NULL);
...@@ -1933,14 +1933,19 @@ bool do_statusbar_next_word(bool allow_punct) ...@@ -1933,14 +1933,19 @@ bool do_statusbar_next_word(bool allow_punct)
* started_on_word to TRUE. */ * started_on_word to TRUE. */
started_on_word = 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. */ /* 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; statusbar_x += char_mb_len;
while (answer[statusbar_x] != '\0') { while (!end_line) {
char_mb_len = parse_mbchar(answer + statusbar_x, char_mb, NULL, char_mb_len = parse_mbchar(answer + statusbar_x, char_mb, NULL,
NULL); NULL);
...@@ -1949,7 +1954,10 @@ bool do_statusbar_next_word(bool allow_punct) ...@@ -1949,7 +1954,10 @@ bool do_statusbar_next_word(bool allow_punct)
if (is_word_mbchar(char_mb, allow_punct)) if (is_word_mbchar(char_mb, allow_punct))
break; break;
statusbar_x += char_mb_len; if (answer[statusbar_x] == '\0')
end_line = TRUE;
else
statusbar_x += char_mb_len;
} }
free(char_mb); free(char_mb);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment