2009-11-24 Chris Allegretta <chrisa@asty.org>
* move.c (do_page_up, do_page_down): Make these functions work better with soft line wrapping. * winio.c (compute_maxrows): Make maxrows calculation more accurate when all lines are > COLS. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4441 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
родитель
c82f038855
Коммит
e2df2c899d
@ -1,3 +1,8 @@
|
|||||||
|
2009-11-24 Chris Allegretta <chrisa@asty.org>
|
||||||
|
* move.c (do_page_up, do_page_down): Make these functions work better with soft
|
||||||
|
line wrapping.
|
||||||
|
* winio.c (compute_maxrows): Make maxrows calculation more accurate when all lines are > COLS.
|
||||||
|
|
||||||
2009-11-22 Chris Allegretta <chrisa@asty.org>
|
2009-11-22 Chris Allegretta <chrisa@asty.org>
|
||||||
* nano.c (main): Allow edit_refresh_needed to take effect when using --enable-tiny
|
* nano.c (main): Allow edit_refresh_needed to take effect when using --enable-tiny
|
||||||
(fixes Savannah bug 28076 reported by David Lawrence Ramsey).
|
(fixes Savannah bug 28076 reported by David Lawrence Ramsey).
|
||||||
|
25
src/move.c
25
src/move.c
@ -50,18 +50,19 @@ void do_last_line(void)
|
|||||||
/* Move up one page. */
|
/* Move up one page. */
|
||||||
void do_page_up(void)
|
void do_page_up(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i, skipped = 0;
|
||||||
|
|
||||||
/* If there's less than a page of text left on the screen, put the
|
/* If there's less than a page of text left on the screen, put the
|
||||||
* cursor at the beginning of the first line of the file, and then
|
* cursor at the beginning of the first line of the file, and then
|
||||||
* update the edit window. */
|
* update the edit window. */
|
||||||
if (openfile->current->lineno <= editwinrows - 2) {
|
if (!ISSET(SOFTWRAP) && openfile->current->lineno <= editwinrows - 2) {
|
||||||
do_first_line();
|
do_first_line();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we're not in smooth scrolling mode, put the cursor at the
|
/* If we're not in smooth scrolling mode, put the cursor at the
|
||||||
* beginning of the top line of the edit window, as Pico does. */
|
* beginning of the top line of the edit window, as Pico does. */
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
if (!ISSET(SMOOTH_SCROLL)) {
|
if (!ISSET(SMOOTH_SCROLL)) {
|
||||||
#endif
|
#endif
|
||||||
@ -71,15 +72,23 @@ void do_page_up(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (i = editwinrows - 2; i > 0 && openfile->current !=
|
for (i = editwinrows - 2; i - skipped > 0 && openfile->current !=
|
||||||
openfile->fileage; i--)
|
openfile->fileage; i--) {
|
||||||
openfile->current = openfile->current->prev;
|
openfile->current = openfile->current->prev;
|
||||||
|
if (ISSET(SOFTWRAP) && openfile->current)
|
||||||
|
skipped += strlenpt(openfile->current->data) / COLS;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
openfile->current_x = actual_x(openfile->current->data,
|
openfile->current_x = actual_x(openfile->current->data,
|
||||||
openfile->placewewant);
|
openfile->placewewant);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
fprintf(stderr, "do_page_up: openfile->current->lineno = %lu, skipped = %d\n", (unsigned long) openfile->current->lineno, skipped);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Scroll the edit window up a page. */
|
/* Scroll the edit window up a page. */
|
||||||
edit_scroll(UP_DIR, editwinrows - 2);
|
edit_scroll(UP_DIR, editwinrows - skipped - 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Move down one page. */
|
/* Move down one page. */
|
||||||
@ -107,15 +116,11 @@ void do_page_down(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
fprintf(stderr, "do_page_down: maxrows = %d\n", maxrows);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (i = maxrows - 2; i > 0 && openfile->current !=
|
for (i = maxrows - 2; i > 0 && openfile->current !=
|
||||||
openfile->filebot; i--) {
|
openfile->filebot; i--) {
|
||||||
openfile->current = openfile->current->next;
|
openfile->current = openfile->current->next;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "do_page_down: moving to line %d\n", openfile->current->lineno);
|
fprintf(stderr, "do_page_down: moving to line %lu\n", (unsigned long) openfile->current->lineno);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2949,7 +2949,8 @@ void compute_maxrows(void)
|
|||||||
|
|
||||||
maxrows = 0;
|
maxrows = 0;
|
||||||
for (n = 0; n < editwinrows && foo; n++) {
|
for (n = 0; n < editwinrows && foo; n++) {
|
||||||
maxrows += 1 - strlenpt(foo->data) / COLS;
|
maxrows ++;
|
||||||
|
n += strlenpt(foo->data) / COLS;
|
||||||
foo = foo->next;
|
foo = foo->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user