- New smooth scroll code by Ken Tyler. New flag -S, --smooth, changes to page_up() and page_down()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@778 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
0319176f2d
commit
3e3ae94084
|
@ -16,6 +16,8 @@ CVS code -
|
||||||
regardless of the original format.
|
regardless of the original format.
|
||||||
- Mac file writing supported too. Flag -M, --mac. Toggle
|
- Mac file writing supported too. Flag -M, --mac. Toggle
|
||||||
Meta-O (MacOS? OS-X? =-)
|
Meta-O (MacOS? OS-X? =-)
|
||||||
|
- New smooth scroll code by Ken Tyler. New flag -S, --smooth,
|
||||||
|
changes to page_up() and page_down().
|
||||||
- nano.c:
|
- nano.c:
|
||||||
main()
|
main()
|
||||||
- Added vars oldcurrent and oldcurrent_x to check whether cursor
|
- Added vars oldcurrent and oldcurrent_x to check whether cursor
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* config.h.in. Generated automatically from configure.in by autoheader. */
|
/* config.h.in. Generated automatically from configure.in by autoheader 2.13. */
|
||||||
|
|
||||||
/* Define if using alloca.c. */
|
/* Define if using alloca.c. */
|
||||||
#undef C_ALLOCA
|
#undef C_ALLOCA
|
||||||
|
|
20
global.c
20
global.c
|
@ -161,6 +161,8 @@ void toggle_init(void)
|
||||||
char *toggle_regexp_msg;
|
char *toggle_regexp_msg;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
char *toggle_smooth_msg;
|
||||||
|
|
||||||
toggle_const_msg = _("Constant cursor position");
|
toggle_const_msg = _("Constant cursor position");
|
||||||
toggle_autoindent_msg = _("Auto indent");
|
toggle_autoindent_msg = _("Auto indent");
|
||||||
toggle_suspend_msg = _("Suspend");
|
toggle_suspend_msg = _("Suspend");
|
||||||
|
@ -172,6 +174,8 @@ void toggle_init(void)
|
||||||
toggle_case_msg = _("Case Sensitive Search");
|
toggle_case_msg = _("Case Sensitive Search");
|
||||||
toggle_dos_msg = _("Writing file in DOS format");
|
toggle_dos_msg = _("Writing file in DOS format");
|
||||||
toggle_mac_msg = _("Writing file in Mac format");
|
toggle_mac_msg = _("Writing file in Mac format");
|
||||||
|
toggle_smooth_msg = _("Smooth scrolling");
|
||||||
|
|
||||||
#ifdef HAVE_REGEX_H
|
#ifdef HAVE_REGEX_H
|
||||||
toggle_regexp_msg = _("Regular expressions");
|
toggle_regexp_msg = _("Regular expressions");
|
||||||
#endif
|
#endif
|
||||||
|
@ -207,13 +211,15 @@ void toggle_init(void)
|
||||||
DOS_FILE, 0);
|
DOS_FILE, 0);
|
||||||
toggle_init_one(&toggles[11], TOGGLE_MAC_KEY, toggle_mac_msg,
|
toggle_init_one(&toggles[11], TOGGLE_MAC_KEY, toggle_mac_msg,
|
||||||
MAC_FILE, 0);
|
MAC_FILE, 0);
|
||||||
|
toggle_init_one(&toggles[12], TOGGLE_SMOOTH_KEY, toggle_smooth_msg,
|
||||||
|
SMOOTHSCROLL, 0);
|
||||||
|
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
toggle_init_one(&toggles[12], TOGGLE_LOAD_KEY, toggle_load_msg,
|
toggle_init_one(&toggles[13], TOGGLE_LOAD_KEY, toggle_load_msg,
|
||||||
MULTIBUFFER, 0);
|
MULTIBUFFER, 0);
|
||||||
toggle_init_one(&toggles[13], NANO_OPENPREV_KEY, nano_openprev_msg,
|
toggle_init_one(&toggles[14], NANO_OPENPREV_KEY, nano_openprev_msg,
|
||||||
0, '<');
|
0, '<');
|
||||||
toggle_init_one(&toggles[14], NANO_OPENNEXT_KEY, nano_opennext_msg,
|
toggle_init_one(&toggles[15], NANO_OPENNEXT_KEY, nano_opennext_msg,
|
||||||
0, '>');
|
0, '>');
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -331,11 +337,11 @@ void shortcut_init(int unjustify)
|
||||||
|
|
||||||
sc_init_one(&main_list[6], NANO_PREVPAGE_KEY, _("Prev Page"),
|
sc_init_one(&main_list[6], NANO_PREVPAGE_KEY, _("Prev Page"),
|
||||||
nano_prevpage_msg,
|
nano_prevpage_msg,
|
||||||
0, NANO_PREVPAGE_FKEY, KEY_PPAGE, VIEW, page_up);
|
0, NANO_PREVPAGE_FKEY, KEY_PPAGE, VIEW, do_page_up);
|
||||||
|
|
||||||
sc_init_one(&main_list[7], NANO_NEXTPAGE_KEY, _("Next Page"),
|
sc_init_one(&main_list[7], NANO_NEXTPAGE_KEY, _("Next Page"),
|
||||||
nano_nextpage_msg,
|
nano_nextpage_msg,
|
||||||
0, NANO_NEXTPAGE_FKEY, KEY_NPAGE, VIEW, page_down);
|
0, NANO_NEXTPAGE_FKEY, KEY_NPAGE, VIEW, do_page_down);
|
||||||
|
|
||||||
sc_init_one(&main_list[8], NANO_CUT_KEY, _("Cut Text"),
|
sc_init_one(&main_list[8], NANO_CUT_KEY, _("Cut Text"),
|
||||||
nano_cut_msg, 0, NANO_CUT_FKEY, 0, NOVIEW, do_cut_text);
|
nano_cut_msg, 0, NANO_CUT_FKEY, 0, NOVIEW, do_cut_text);
|
||||||
|
@ -492,11 +498,11 @@ void shortcut_init(int unjustify)
|
||||||
|
|
||||||
sc_init_one(&help_list[0], NANO_PREVPAGE_KEY, _("Prev Page"),
|
sc_init_one(&help_list[0], NANO_PREVPAGE_KEY, _("Prev Page"),
|
||||||
nano_prevpage_msg,
|
nano_prevpage_msg,
|
||||||
0, NANO_PREVPAGE_FKEY, KEY_PPAGE, VIEW, page_up);
|
0, NANO_PREVPAGE_FKEY, KEY_PPAGE, VIEW, do_page_up);
|
||||||
|
|
||||||
sc_init_one(&help_list[1], NANO_NEXTPAGE_KEY, _("Next Page"),
|
sc_init_one(&help_list[1], NANO_NEXTPAGE_KEY, _("Next Page"),
|
||||||
nano_nextpage_msg,
|
nano_nextpage_msg,
|
||||||
0, NANO_NEXTPAGE_FKEY, KEY_NPAGE, VIEW, page_down);
|
0, NANO_NEXTPAGE_FKEY, KEY_NPAGE, VIEW, do_page_down);
|
||||||
|
|
||||||
sc_init_one(&help_list[2], NANO_EXIT_KEY, _("Exit"),
|
sc_init_one(&help_list[2], NANO_EXIT_KEY, _("Exit"),
|
||||||
nano_exit_msg, 0, NANO_EXIT_FKEY, 0, VIEW, do_exit);
|
nano_exit_msg, 0, NANO_EXIT_FKEY, 0, VIEW, do_exit);
|
||||||
|
|
36
move.c
36
move.c
|
@ -34,20 +34,26 @@
|
||||||
#define _(string) (string)
|
#define _(string) (string)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void page_down_center(void)
|
void page_down(void)
|
||||||
{
|
{
|
||||||
if (editbot != filebot) {
|
if (editbot != filebot) {
|
||||||
edit_update(editbot->next, CENTER);
|
if (!ISSET(SMOOTHSCROLL)) {
|
||||||
center_cursor();
|
edit_update(editbot->next, CENTER);
|
||||||
|
center_cursor();
|
||||||
|
} else {
|
||||||
|
edit_update(editbot, NONE);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
while (current != filebot)
|
if (!ISSET(SMOOTHSCROLL)) {
|
||||||
current = current->next;
|
while (current != filebot)
|
||||||
edit_update(current, CENTER);
|
current = current->next;
|
||||||
|
edit_update(current, CENTER);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
update_cursor();
|
update_cursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
int page_down(void)
|
int do_page_down(void)
|
||||||
{
|
{
|
||||||
wrap_reset();
|
wrap_reset();
|
||||||
current_x = 0;
|
current_x = 0;
|
||||||
|
@ -124,7 +130,7 @@ int do_down(void)
|
||||||
if (current_y < editwinrows - 1 && current != editbot)
|
if (current_y < editwinrows - 1 && current != editbot)
|
||||||
current_y++;
|
current_y++;
|
||||||
else
|
else
|
||||||
page_down_center();
|
page_down();
|
||||||
|
|
||||||
update_cursor();
|
update_cursor();
|
||||||
update_line(current->prev, 0);
|
update_line(current->prev, 0);
|
||||||
|
@ -134,11 +140,15 @@ int do_down(void)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void page_up_center(void)
|
void page_up(void)
|
||||||
{
|
{
|
||||||
if (edittop != fileage) {
|
if (edittop != fileage) {
|
||||||
edit_update(edittop, CENTER);
|
if (!ISSET(SMOOTHSCROLL)) {
|
||||||
center_cursor();
|
edit_update(edittop, CENTER);
|
||||||
|
center_cursor();
|
||||||
|
} else {
|
||||||
|
edit_update(edittop->prev, NONE);
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
current_y = 0;
|
current_y = 0;
|
||||||
|
|
||||||
|
@ -146,7 +156,7 @@ void page_up_center(void)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int page_up(void)
|
int do_page_up(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -184,7 +194,7 @@ int do_up(void)
|
||||||
if (current_y > 0)
|
if (current_y > 0)
|
||||||
current_y--;
|
current_y--;
|
||||||
else
|
else
|
||||||
page_up_center();
|
page_up();
|
||||||
|
|
||||||
update_cursor();
|
update_cursor();
|
||||||
update_line(current->next, 0);
|
update_line(current->next, 0);
|
||||||
|
|
22
nano.c
22
nano.c
|
@ -420,6 +420,10 @@ void usage(void)
|
||||||
#ifdef HAVE_REGEX_H
|
#ifdef HAVE_REGEX_H
|
||||||
printf(_
|
printf(_
|
||||||
(" -R --regexp Use regular expressions for search\n"));
|
(" -R --regexp Use regular expressions for search\n"));
|
||||||
|
#endif
|
||||||
|
#ifndef NANO_SMALL
|
||||||
|
printf(_
|
||||||
|
(" -S --smooth Smooth scrolling\n"));
|
||||||
#endif
|
#endif
|
||||||
printf(_
|
printf(_
|
||||||
(" -T [num] --tabsize=[num] Set width of a tab to num\n"));
|
(" -T [num] --tabsize=[num] Set width of a tab to num\n"));
|
||||||
|
@ -487,6 +491,9 @@ void usage(void)
|
||||||
#endif
|
#endif
|
||||||
printf(_(" -T [num] Set width of a tab to num\n"));
|
printf(_(" -T [num] Set width of a tab to num\n"));
|
||||||
printf(_(" -R Use regular expressions for search\n"));
|
printf(_(" -R Use regular expressions for search\n"));
|
||||||
|
#ifndef NANO_SMALL
|
||||||
|
printf(_(" -S Smooth scrolling\n"));
|
||||||
|
#endif
|
||||||
printf(_(" -V Print version information and exit\n"));
|
printf(_(" -V Print version information and exit\n"));
|
||||||
printf(_(" -c Constantly show cursor position\n"));
|
printf(_(" -c Constantly show cursor position\n"));
|
||||||
printf(_(" -h Show this message\n"));
|
printf(_(" -h Show this message\n"));
|
||||||
|
@ -1216,7 +1223,7 @@ int do_backspace(void)
|
||||||
current = previous->next;
|
current = previous->next;
|
||||||
else
|
else
|
||||||
current = previous;
|
current = previous;
|
||||||
page_up_center();
|
page_up();
|
||||||
} else {
|
} else {
|
||||||
if (previous->next)
|
if (previous->next)
|
||||||
current = previous->next;
|
current = previous->next;
|
||||||
|
@ -2446,7 +2453,9 @@ int main(int argc, char *argv[])
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
{"multibuffer", 0, 0, 'F'},
|
{"multibuffer", 0, 0, 'F'},
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef NANO_SMALL
|
||||||
|
{"smooth", 0, 0, 'S'},
|
||||||
|
#endif
|
||||||
{0, 0, 0, 0}
|
{0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -2467,11 +2476,11 @@ int main(int argc, char *argv[])
|
||||||
#endif /* ENABLE_NANORC */
|
#endif /* ENABLE_NANORC */
|
||||||
|
|
||||||
#ifdef HAVE_GETOPT_LONG
|
#ifdef HAVE_GETOPT_LONG
|
||||||
while ((optchr = getopt_long(argc, argv, "h?DFMRT:Vabcefgijklmo:pr:s:tvwxz",
|
while ((optchr = getopt_long(argc, argv, "h?DFMRST:Vabcefgijklmo:pr:s:tvwxz",
|
||||||
long_options, &option_index)) != EOF) {
|
long_options, &option_index)) != EOF) {
|
||||||
#else
|
#else
|
||||||
while ((optchr =
|
while ((optchr =
|
||||||
getopt(argc, argv, "h?DFMRT:Vabcefgijklmo:pr:s:tvwxz")) != EOF) {
|
getopt(argc, argv, "h?DFMRST:Vabcefgijklmo:pr:s:tvwxz")) != EOF) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch (optchr) {
|
switch (optchr) {
|
||||||
|
@ -2502,6 +2511,11 @@ int main(int argc, char *argv[])
|
||||||
case 'R':
|
case 'R':
|
||||||
SET(USE_REGEXP);
|
SET(USE_REGEXP);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#ifndef NANO_SMALL
|
||||||
|
case 'S':
|
||||||
|
SET(SMOOTHSCROLL);
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
case 'V':
|
case 'V':
|
||||||
version();
|
version();
|
||||||
|
|
4
nano.h
4
nano.h
|
@ -142,6 +142,7 @@ typedef struct rcoption {
|
||||||
#define CLEAR_BACKUPSTRING (1<<20)
|
#define CLEAR_BACKUPSTRING (1<<20)
|
||||||
#define DOS_FILE (1<<21)
|
#define DOS_FILE (1<<21)
|
||||||
#define MAC_FILE (1<<22)
|
#define MAC_FILE (1<<22)
|
||||||
|
#define SMOOTHSCROLL (1<<23)
|
||||||
|
|
||||||
/* Control key sequences, changing these would be very very bad */
|
/* Control key sequences, changing these would be very very bad */
|
||||||
|
|
||||||
|
@ -277,6 +278,7 @@ know what you're doing */
|
||||||
#define TOGGLE_LOAD_KEY NANO_ALT_F
|
#define TOGGLE_LOAD_KEY NANO_ALT_F
|
||||||
#define TOGGLE_DOS_KEY NANO_ALT_D
|
#define TOGGLE_DOS_KEY NANO_ALT_D
|
||||||
#define TOGGLE_MAC_KEY NANO_ALT_O
|
#define TOGGLE_MAC_KEY NANO_ALT_O
|
||||||
|
#define TOGGLE_SMOOTH_KEY NANO_ALT_S
|
||||||
|
|
||||||
/* Toggle stuff, these static lengths need to go away RSN */
|
/* Toggle stuff, these static lengths need to go away RSN */
|
||||||
|
|
||||||
|
@ -310,7 +312,7 @@ know what you're doing */
|
||||||
|
|
||||||
#define WHEREIS_LIST_LEN (8 - NO_REGEX - NO_TOGGLES)
|
#define WHEREIS_LIST_LEN (8 - NO_REGEX - NO_TOGGLES)
|
||||||
#define REPLACE_LIST_LEN (8 - NO_REGEX - NO_TOGGLES)
|
#define REPLACE_LIST_LEN (8 - NO_REGEX - NO_TOGGLES)
|
||||||
#define TOGGLE_LEN (13 - NO_REGEX + MULTI_TOGGLES)
|
#define TOGGLE_LEN (14 - NO_REGEX + MULTI_TOGGLES)
|
||||||
#define WRITEFILE_LIST_LEN (3 - NO_BROWSER)
|
#define WRITEFILE_LIST_LEN (3 - NO_BROWSER)
|
||||||
#define INSERTFILE_LIST_LEN (2 - NO_BROWSER)
|
#define INSERTFILE_LIST_LEN (2 - NO_BROWSER)
|
||||||
#define BROWSER_LIST_LEN 4
|
#define BROWSER_LIST_LEN 4
|
||||||
|
|
|
@ -44,6 +44,9 @@
|
||||||
# Allow nano to be suspended with ^Z
|
# Allow nano to be suspended with ^Z
|
||||||
# set suspend
|
# set suspend
|
||||||
|
|
||||||
|
# Use smooth scrolling as the default
|
||||||
|
# set smooth
|
||||||
|
|
||||||
# Allow multiple file buffers (using ^R inserts into separate buffer)
|
# Allow multiple file buffers (using ^R inserts into separate buffer)
|
||||||
# You must have configured with --enable-multibuffer or --enable-extra for
|
# You must have configured with --enable-multibuffer or --enable-extra for
|
||||||
# this to work
|
# this to work
|
||||||
|
|
4
proto.h
4
proto.h
|
@ -164,7 +164,7 @@ void new_file(void);
|
||||||
void new_magicline(void);
|
void new_magicline(void);
|
||||||
void splice_node(filestruct *begin, filestruct *newnode, filestruct *end);
|
void splice_node(filestruct *begin, filestruct *newnode, filestruct *end);
|
||||||
void null_at(char *data, int index);
|
void null_at(char *data, int index);
|
||||||
void page_up_center(void);
|
void page_up(void);
|
||||||
void blank_edit(void);
|
void blank_edit(void);
|
||||||
void search_init_globals(void);
|
void search_init_globals(void);
|
||||||
void replace_abort(void);
|
void replace_abort(void);
|
||||||
|
@ -194,7 +194,7 @@ int do_insertfile_void(void), do_search(void);
|
||||||
int load_open_file(void), close_open_file(void);
|
int load_open_file(void), close_open_file(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int page_up(void), page_down(void);
|
int do_page_up(void), do_page_down(void);
|
||||||
int do_cursorpos(void), do_spell(void);
|
int do_cursorpos(void), do_spell(void);
|
||||||
int do_up(void), do_down (void), do_right(void), do_left (void);
|
int do_up(void), do_down (void), do_right(void), do_left (void);
|
||||||
int do_home(void), do_end(void), total_refresh(void), do_mark(void);
|
int do_home(void), do_end(void), total_refresh(void), do_mark(void);
|
||||||
|
|
3
rcfile.c
3
rcfile.c
|
@ -62,7 +62,8 @@ rcoption rcopts[NUM_RCOPTS] =
|
||||||
{"nowrap", NO_WRAP},
|
{"nowrap", NO_WRAP},
|
||||||
{"nohelp", NO_HELP},
|
{"nohelp", NO_HELP},
|
||||||
{"suspend", SUSPEND},
|
{"suspend", SUSPEND},
|
||||||
{"multibuffer", MULTIBUFFER}};
|
{"multibuffer", MULTIBUFFER},
|
||||||
|
{"smooth", SMOOTHSCROLL}};
|
||||||
|
|
||||||
/* We have an error in some part of the rcfile; put it on stderr and
|
/* We have an error in some part of the rcfile; put it on stderr and
|
||||||
make the user hit return to continue starting up nano */
|
make the user hit return to continue starting up nano */
|
||||||
|
|
Loading…
Reference in New Issue