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_output()
+ - When adding a character, just add its length in bytes to
+ current_x instead of calling do_right(), and set placewewant
+ afterward. (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
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)
+ do_statusbar_output()
+ - When adding a character, just add its length in bytes to
+ statusbar_x instead of calling do_statusbar_right(). (DLR)
display_string()
- Display invalid multibyte sequences as Unicode 0xFFFD
(Replacement Character). (DLR)
openfile->mark_begin_x += char_buf_len;
#endif
- do_right(FALSE);
+ openfile->current_x += char_buf_len;
#ifndef DISABLE_WRAPPING
/* If we're wrapping text, we need to call edit_refresh(). */
free(char_buf);
+ openfile->placewewant = xplustabs();
+
if (do_refresh)
edit_refresh();
else
strncpy(&answer[statusbar_x], char_buf, char_buf_len);
answer_len += char_buf_len;
- do_statusbar_right();
+ statusbar_x += char_buf_len;
}
free(char_buf);
/* Refresh the screen without changing the position of lines. */
void edit_refresh(void)
{
- int nlines = 0;
- const filestruct *foo = openfile->edittop;
+ const filestruct *foo;
+ int nlines;
if (openfile->current->lineno < openfile->edittop->lineno ||
openfile->current->lineno >= openfile->edittop->lineno +
editwinrows)
- /* Put the top line of the edit window in the range of the
- * current line. */
+ /* Put the top line of the edit window in range of the current
+ * line. */
edit_update(
#ifndef NANO_SMALL
ISSET(SMOOTH_SCROLL) ? NONE :
#endif
CENTER);
+ foo = openfile->edittop;
+
#ifdef DEBUG
fprintf(stderr, "edit_refresh(): edittop->lineno = %ld\n", (long)openfile->edittop->lineno);
#endif
- while (nlines < editwinrows && foo != NULL) {
+ for (nlines = 0; nlines < editwinrows && foo != NULL; nlines++) {
update_line(foo, (foo == openfile->current) ?
openfile->current_x : 0);
foo = foo->next;
- nlines++;
}
- while (nlines < editwinrows) {
+ for (; nlines < editwinrows; nlines++)
blank_line(edit, nlines, 0, COLS);
- nlines++;
- }
reset_cursor();
wrefresh(edit);