tweaks: remove some cluttering conditional compilation

master
Benno Schulenberg 2016-12-09 13:31:04 +01:00
parent 2fa93ae999
commit a4044a7e5d
1 changed files with 7 additions and 24 deletions

View File

@ -56,10 +56,7 @@ void do_page_up(void)
/* If the cursor is less than a page away from the top of the file, /* If the cursor is less than a page away from the top of the file,
* put it at the beginning of the first line. */ * put it at the beginning of the first line. */
if (openfile->current->lineno == 1 || ( if (openfile->current->lineno == 1 || (!ISSET(SOFTWRAP) &&
#ifndef NANO_TINY
!ISSET(SOFTWRAP) &&
#endif
openfile->current->lineno <= editwinrows - 2)) { openfile->current->lineno <= editwinrows - 2)) {
do_first_line(); do_first_line();
return; return;
@ -67,10 +64,7 @@ void do_page_up(void)
/* 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 if (!ISSET(SMOOTH_SCROLL)) {
if (!ISSET(SMOOTH_SCROLL))
#endif
{
openfile->current = openfile->edittop; openfile->current = openfile->edittop;
openfile->placewewant = openfile->current_y = 0; openfile->placewewant = openfile->current_y = 0;
} }
@ -83,7 +77,7 @@ void do_page_up(void)
if (ISSET(SOFTWRAP) && openfile->current) { if (ISSET(SOFTWRAP) && openfile->current) {
skipped += strlenpt(openfile->current->data) / editwincols; skipped += strlenpt(openfile->current->data) / editwincols;
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "do_page_up: i = %d, skipped = %d based on line %ld len %lu\n", fprintf(stderr, "paging up: i = %d, skipped = %d based on line %ld len %lu\n",
i, skipped, (long)openfile->current->lineno, (unsigned long)strlenpt(openfile->current->data)); i, skipped, (long)openfile->current->lineno, (unsigned long)strlenpt(openfile->current->data));
#endif #endif
} }
@ -93,11 +87,6 @@ void do_page_up(void)
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. */
adjust_viewport(STATIONARY); adjust_viewport(STATIONARY);
refresh_needed = TRUE; refresh_needed = TRUE;
@ -117,10 +106,7 @@ void do_page_down(void)
/* 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 if (!ISSET(SMOOTH_SCROLL)) {
if (!ISSET(SMOOTH_SCROLL))
#endif
{
openfile->current = openfile->edittop; openfile->current = openfile->edittop;
openfile->placewewant = openfile->current_y = 0; openfile->placewewant = openfile->current_y = 0;
} }
@ -130,7 +116,7 @@ void do_page_down(void)
for (i = mustmove; i > 0 && openfile->current != openfile->filebot; i--) { for (i = mustmove; i > 0 && openfile->current != 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 %lu\n", (unsigned long)openfile->current->lineno); fprintf(stderr, "paging down: moving to line %lu\n", (unsigned long)openfile->current->lineno);
#endif #endif
} }
@ -424,11 +410,8 @@ void do_up(bool scroll_only)
/* If we're at the top of the file, or if scroll_only is TRUE and /* If we're at the top of the file, or if scroll_only is TRUE and
* the top of the file is onscreen, get out. */ * the top of the file is onscreen, get out. */
if (openfile->current == openfile->fileage if (openfile->current == openfile->fileage ||
#ifndef NANO_TINY (scroll_only && openfile->edittop == openfile->fileage))
|| (scroll_only && openfile->edittop == openfile->fileage)
#endif
)
return; return;
assert(ISSET(SOFTWRAP) || openfile->current_y == openfile->current->lineno - openfile->edittop->lineno); assert(ISSET(SOFTWRAP) || openfile->current_y == openfile->current->lineno - openfile->edittop->lineno);