2010-01-12 Chris Allegretta <chrisa@asty.org>
* move.c (do_page_up, do_page_down): Fix issues with not enough scrolling down/up and cursor centering. * winio.c (edit_scroll): Remove lots of needless checking of line length for soft wrapping code. * winio.c (edit_update) - Remove extra code for when updating with old_current outside of the new buffer boundary and centering issues. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4473 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
df8c3debc8
commit
1a7a91b779
12
ChangeLog
12
ChangeLog
|
@ -1,8 +1,16 @@
|
||||||
|
2010-01-12 Chris Allegretta <chrisa@asty.org>
|
||||||
|
* move.c (do_page_up, do_page_down): Fix issues with not enough scrolling down/up
|
||||||
|
and cursor centering.
|
||||||
|
* winio.c (edit_scroll): Remove lots of needless checking of line length for
|
||||||
|
soft wrapping code.
|
||||||
|
* winio.c (edit_update) - Remove extra code for when updating with old_current outside
|
||||||
|
of the new buffer boundary and centering issues.
|
||||||
|
|
||||||
2010-01-05 Tito <farmatito@tiscali.it>
|
2010-01-05 Tito <farmatito@tiscali.it>
|
||||||
* search.c (update_history) - Fix bad length check causing search crash on armel platform.
|
* search.c (update_history): Fix bad length check causing search crash on armel platform.
|
||||||
|
|
||||||
2010-01-04 Chris Allegretta <chrisa@asty.org>
|
2010-01-04 Chris Allegretta <chrisa@asty.org>
|
||||||
* winio.c: edit_update, edit_redraw - Fix search not scrolling to the middle of the screen
|
* winio.c: edit_update, edit_redraw: Fix search not scrolling to the middle of the screen
|
||||||
(reported by alpha@qzx.com) and places where we rely on maxrows but should not.
|
(reported by alpha@qzx.com) and places where we rely on maxrows but should not.
|
||||||
|
|
||||||
2009-12-26 Jordi Mallach <jordi@gnu.org>
|
2009-12-26 Jordi Mallach <jordi@gnu.org>
|
||||||
|
|
17
src/move.c
17
src/move.c
|
@ -55,7 +55,8 @@ void do_page_up(void)
|
||||||
/* 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 (!ISSET(SOFTWRAP) && openfile->current->lineno <= editwinrows - 2) {
|
if (openfile->current->lineno == 1 || (!ISSET(SOFTWRAP) &&
|
||||||
|
openfile->current->lineno <= editwinrows - 2)) {
|
||||||
do_first_line();
|
do_first_line();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -92,7 +93,8 @@ openfile->current->lineno, strlenpt(openfile->current->data));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Scroll the edit window up a page. */
|
/* Scroll the edit window up a page. */
|
||||||
edit_scroll(UP_DIR, editwinrows - skipped - 2);
|
openfile->current_y = 0;
|
||||||
|
edit_update(NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Move down one page. */
|
/* Move down one page. */
|
||||||
|
@ -133,7 +135,8 @@ void do_page_down(void)
|
||||||
openfile->placewewant);
|
openfile->placewewant);
|
||||||
|
|
||||||
/* Scroll the edit window down a page. */
|
/* Scroll the edit window down a page. */
|
||||||
edit_scroll(DOWN_DIR, editwinrows - 2);
|
openfile->current_y = 0;
|
||||||
|
edit_update(NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef DISABLE_JUSTIFY
|
#ifndef DISABLE_JUSTIFY
|
||||||
|
@ -521,7 +524,7 @@ void do_up(
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
(ISSET(SMOOTH_SCROLL) || scroll_only) ? 1 :
|
(ISSET(SMOOTH_SCROLL) || scroll_only) ? 1 :
|
||||||
#endif
|
#endif
|
||||||
editwinrows / 2);
|
editwinrows / 2 + 1);
|
||||||
|
|
||||||
/* If we're below the first line of the edit window, update the
|
/* If we're below the first line of the edit window, update the
|
||||||
* line we were on before and the line we're on now. The former
|
* line we were on before and the line we're on now. The former
|
||||||
|
@ -590,13 +593,15 @@ void do_down(
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
|| scroll_only
|
|| scroll_only
|
||||||
#endif
|
#endif
|
||||||
)
|
) {
|
||||||
edit_scroll(DOWN_DIR,
|
edit_scroll(DOWN_DIR,
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
(ISSET(SMOOTH_SCROLL) || scroll_only) ? 1 :
|
(ISSET(SMOOTH_SCROLL) || scroll_only) ? 1 :
|
||||||
#endif
|
#endif
|
||||||
editwinrows / 2);
|
editwinrows / 2 + 1);
|
||||||
|
|
||||||
|
edit_refresh_needed = TRUE;
|
||||||
|
}
|
||||||
/* If we're above the last line of the edit window, update the line
|
/* If we're above the last line of the edit window, update the line
|
||||||
* we were on before and the line we're on now. The former needs to
|
* we were on before and the line we're on now. The former needs to
|
||||||
* be redrawn if we're not on the first page, and the latter needs
|
* be redrawn if we're not on the first page, and the latter needs
|
||||||
|
|
51
src/winio.c
51
src/winio.c
|
@ -2988,12 +2988,9 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "Softwrap: Entering check for extracuzsoft\n");
|
fprintf(stderr, "Softwrap: Entering check for extracuzsoft\n");
|
||||||
#endif
|
#endif
|
||||||
for (i = editwinrows, foo = openfile->edittop; foo && i > 0; i--, foo = foo->next) {
|
for (i = maxrows, foo = openfile->edittop; foo && i > 0; i--, foo = foo->next)
|
||||||
ssize_t len = strlenpt(foo->data) / COLS;
|
;
|
||||||
if (len > 0)
|
|
||||||
do_redraw = TRUE;
|
|
||||||
i -= len;
|
|
||||||
}
|
|
||||||
if (foo) {
|
if (foo) {
|
||||||
extracuzsoft += strlenpt(foo->data) / COLS;
|
extracuzsoft += strlenpt(foo->data) / COLS;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
@ -3001,7 +2998,6 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
|
||||||
(unsigned long) strlenpt(foo->data), (unsigned long) foo->lineno);
|
(unsigned long) strlenpt(foo->data), (unsigned long) foo->lineno);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Now account for whether the edittop line itself is >COLS, if scrolling down */
|
/* Now account for whether the edittop line itself is >COLS, if scrolling down */
|
||||||
for (foo = openfile->edittop; foo && extracuzsoft > 0; nlines++) {
|
for (foo = openfile->edittop; foo && extracuzsoft > 0; nlines++) {
|
||||||
extracuzsoft -= 1 + strlenpt(foo->data) / COLS;
|
extracuzsoft -= 1 + strlenpt(foo->data) / COLS;
|
||||||
|
@ -3013,13 +3009,6 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
|
||||||
foo = foo->next;
|
foo = foo->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (ISSET(SOFTWRAP) && direction == UP_DIR) {
|
|
||||||
for (foo = openfile->edittop, i = editwinrows; foo && i > 0; i--, foo = foo->prev) {
|
|
||||||
if (strlenpt(foo->data) / COLS > 0) {
|
|
||||||
do_redraw = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Part 1: nlines is the number of lines we're going to scroll the
|
/* Part 1: nlines is the number of lines we're going to scroll the
|
||||||
|
@ -3039,11 +3028,14 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
|
||||||
openfile->edittop = openfile->edittop->next;
|
openfile->edittop = openfile->edittop->next;
|
||||||
}
|
}
|
||||||
/* Don't over-scroll on long lines */
|
/* Don't over-scroll on long lines */
|
||||||
if (ISSET(SOFTWRAP))
|
if (ISSET(SOFTWRAP)) {
|
||||||
i -= strlenpt(openfile->edittop->data) / COLS;
|
ssize_t len = strlenpt(openfile->edittop->data) / COLS;
|
||||||
|
i -= len;
|
||||||
|
if (len > 0)
|
||||||
|
do_redraw = TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
compute_maxrows();
|
|
||||||
/* Limit nlines to the number of lines we could scroll. */
|
/* Limit nlines to the number of lines we could scroll. */
|
||||||
nlines -= i;
|
nlines -= i;
|
||||||
|
|
||||||
|
@ -3052,7 +3044,7 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
|
||||||
* call edit_refresh() beforehand if we need to. */
|
* call edit_refresh() beforehand if we need to. */
|
||||||
if (nlines == 0 || do_redraw || nlines >= editwinrows) {
|
if (nlines == 0 || do_redraw || nlines >= editwinrows) {
|
||||||
if (do_redraw || nlines >= editwinrows)
|
if (do_redraw || nlines >= editwinrows)
|
||||||
edit_refresh();
|
edit_refresh_needed = TRUE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3128,6 +3120,10 @@ void edit_redraw(filestruct *old_current, size_t pww_save)
|
||||||
openfile->edittop->lineno || openfile->current->lineno >=
|
openfile->edittop->lineno || openfile->current->lineno >=
|
||||||
openfile->edittop->lineno + maxrows) {
|
openfile->edittop->lineno + maxrows) {
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
fprintf(stderr, "edit_redraw(): line %lu was offscreen, oldcurrent = %lu edittop = %lu", openfile->current->lineno,
|
||||||
|
old_current->lineno, openfile->edittop->lineno);
|
||||||
|
#endif
|
||||||
filestruct *old_edittop = openfile->edittop;
|
filestruct *old_edittop = openfile->edittop;
|
||||||
ssize_t nlines;
|
ssize_t nlines;
|
||||||
|
|
||||||
|
@ -3162,22 +3158,11 @@ void edit_redraw(filestruct *old_current, size_t pww_save)
|
||||||
* then restore the original edittop. */
|
* then restore the original edittop. */
|
||||||
edit_update(CENTER);
|
edit_update(CENTER);
|
||||||
|
|
||||||
nlines = openfile->edittop->lineno - old_edittop->lineno;
|
|
||||||
|
|
||||||
openfile->edittop = old_edittop;
|
|
||||||
|
|
||||||
/* Update old_current if we're not on the same page as
|
/* Update old_current if we're not on the same page as
|
||||||
* before. */
|
* before. */
|
||||||
if (do_redraw)
|
if (do_redraw)
|
||||||
update_line(old_current, 0);
|
update_line(old_current, 0);
|
||||||
|
|
||||||
/* Scroll the edit window up or down until edittop is in range
|
|
||||||
* of current. */
|
|
||||||
if (nlines < 0)
|
|
||||||
edit_scroll(UP_DIR, -nlines);
|
|
||||||
else
|
|
||||||
edit_scroll(DOWN_DIR, nlines);
|
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
/* If the mark is on, update all the lines between the old first
|
/* If the mark is on, update all the lines between the old first
|
||||||
* line or old last line of the edit window (depending on
|
* line or old last line of the edit window (depending on
|
||||||
|
@ -3289,12 +3274,16 @@ void edit_update(update_type location)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; goal > 0 && foo->prev != NULL; goal--) {
|
for (; goal > 0 && foo->prev != NULL; goal--) {
|
||||||
if (ISSET(SOFTWRAP))
|
|
||||||
goal -= 1 + strlenpt(foo->data) / COLS;
|
|
||||||
foo = foo->prev;
|
foo = foo->prev;
|
||||||
|
if (ISSET(SOFTWRAP) && foo)
|
||||||
|
goal -= strlenpt(foo->data) / COLS;
|
||||||
}
|
}
|
||||||
openfile->edittop = foo;
|
openfile->edittop = foo;
|
||||||
|
#ifdef DEBUG
|
||||||
|
fprintf(stderr, "edit_udpate(), setting edittop to lineno %d\n", openfile->edittop->lineno);
|
||||||
|
#endif
|
||||||
compute_maxrows();
|
compute_maxrows();
|
||||||
|
edit_refresh_needed = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unconditionally redraw the entire screen. */
|
/* Unconditionally redraw the entire screen. */
|
||||||
|
|
Loading…
Reference in New Issue