speed up character output, and fix edit_refresh() breakage
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2877 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
родитель
4d46437f87
Коммит
157ce9120b
@ -85,6 +85,10 @@ CVS code -
|
||||
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
|
||||
@ -142,6 +146,9 @@ CVS code -
|
||||
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)
|
||||
|
@ -4142,7 +4142,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
|
||||
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(). */
|
||||
@ -4173,6 +4173,8 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
|
||||
|
||||
free(char_buf);
|
||||
|
||||
openfile->placewewant = xplustabs();
|
||||
|
||||
if (do_refresh)
|
||||
edit_refresh();
|
||||
else
|
||||
|
19
src/winio.c
19
src/winio.c
@ -2139,7 +2139,7 @@ void do_statusbar_output(char *output, size_t output_len, bool
|
||||
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);
|
||||
@ -3606,35 +3606,34 @@ void edit_redraw(const filestruct *old_current, size_t old_pww)
|
||||
/* 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);
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user