CVS code -
+- General:
+ - Add the ability to scroll up or down single lines without
+ scrolling the cursor, via Meta-- and Meta-+. Note that this
+ is disabled when NANO_SMALL is defined. New functions
+ do_scroll_up() and do_scroll_down(); changes to
+ shortcut_init(). (DLR, suggested by Mike Frysinger)
GNU nano 1.3.9 - 2005.10.23
- General:
const char *nano_prevword_msg = N_("Move backward one word");
const char *nano_wordcount_msg =
N_("Count the number of words, lines, and characters");
+ const char *nano_scrollprev_msg =
+ N_("Scroll up one line without scrolling the cursor");
+ const char *nano_scrollnext_msg =
+ N_("Scroll down one line without scrolling the cursor");
#endif
#ifndef DISABLE_JUSTIFY
const char *nano_parabegin_msg =
sc_init_one(&main_list, NANO_NO_KEY, N_("Word Count"),
IFHELP(nano_wordcount_msg, NANO_WORDCOUNT_KEY), NANO_NO_KEY,
NANO_NO_KEY, VIEW, do_wordlinechar_count);
+
+ sc_init_one(&main_list, NANO_NO_KEY, N_("ScrollPrev"),
+ IFHELP(nano_scrollprev_msg, NANO_SCROLLPREV_KEY), NANO_NO_KEY,
+ NANO_SCROLLPREV_ALTKEY, VIEW, do_scroll_up);
+
+ sc_init_one(&main_list, NANO_NO_KEY, N_("ScrollNext"),
+ IFHELP(nano_scrollnext_msg, NANO_SCROLLNEXT_KEY), NANO_NO_KEY,
+ NANO_SCROLLNEXT_ALTKEY, VIEW, do_scroll_down);
#endif
#ifndef DISABLE_JUSTIFY
}
}
+#ifndef NANO_SMALL
+void do_scroll_up(void)
+{
+ check_statusblank();
+
+#ifndef DISABLE_WRAPPING
+ wrap_reset();
+#endif
+
+ /* If the top of the file is onscreen, get out. */
+ if (openfile->edittop == openfile->fileage)
+ return;
+
+ assert(openfile->current_y == openfile->current->lineno - openfile->edittop->lineno);
+
+ /* Move the current line of the edit window up. */
+ openfile->current = openfile->current->prev;
+ openfile->current_x = actual_x(openfile->current->data,
+ openfile->placewewant);
+
+ /* Scroll the edit window up one line. */
+ edit_scroll(UP, 1);
+}
+#endif /* !NANO_SMALL */
+
void do_down(void)
{
check_statusblank();
}
}
+#ifndef NANO_SMALL
+void do_scroll_down(void)
+{
+ check_statusblank();
+
+#ifndef DISABLE_WRAPPING
+ wrap_reset();
+#endif
+
+ /* If we're at the bottom of the file, get out. */
+ if (openfile->current->next == NULL)
+ return;
+
+ assert(openfile->current_y == openfile->current->lineno - openfile->edittop->lineno);
+
+ /* Move the current line of the edit window down. */
+ openfile->current = openfile->current->next;
+ openfile->current_x = actual_x(openfile->current->data,
+ openfile->placewewant);
+
+ /* Scroll the edit window down one line. */
+ edit_scroll(DOWN, 1);
+}
+#endif /* !NANO_SMALL */
+
void do_left(void)
{
size_t pww_save = openfile->placewewant;
#define NANO_ALT_SPACE ' '
#define NANO_ALT_LPAREN '('
#define NANO_ALT_RPAREN ')'
+#define NANO_ALT_PLUS '+'
#define NANO_ALT_COMMA ','
+#define NANO_ALT_MINUS '-'
#define NANO_ALT_PERIOD '.'
#define NANO_ALT_9 '9'
#define NANO_ALT_0 '0'
#define NANO_ALT_LCARAT '<'
+#define NANO_ALT_EQUALS '='
#define NANO_ALT_RCARAT '>'
#define NANO_ALT_RBRACKET ']'
+#define NANO_ALT_USCORE '_'
#define NANO_ALT_A 'a'
#define NANO_ALT_B 'b'
#define NANO_ALT_C 'c'
#define NANO_NEXTWORD_KEY NANO_CONTROL_SPACE
#define NANO_PREVWORD_KEY NANO_ALT_SPACE
#define NANO_WORDCOUNT_KEY NANO_ALT_D
+#define NANO_SCROLLPREV_KEY NANO_ALT_MINUS
+#define NANO_SCROLLNEXT_KEY NANO_ALT_PLUS
+#define NANO_SCROLLPREV_ALTKEY NANO_ALT_USCORE
+#define NANO_SCROLLNEXT_ALTKEY NANO_ALT_EQUALS
#define NANO_CUTTILLEND_KEY NANO_CONTROL_X
#define NANO_CUTTILLEND_ALTKEY NANO_ALT_T
#define NANO_PARABEGIN_KEY NANO_CONTROL_W
void do_home(void);
void do_end(void);
void do_up(void);
+#ifndef NANO_SMALL
+void do_scroll_up(void);
+#endif
void do_down(void);
+#ifndef NANO_SMALL
+void do_scroll_down(void);
+#endif
void do_left(void);
void do_right(void);