Moved --loadoninsert to --multibuffer and -F, --enable-extra defines --enable-multibuffer

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@727 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Chris Allegretta 2001-07-14 19:32:47 +00:00
parent a212acf100
commit 355fbe5770
13 changed files with 706 additions and 859 deletions

View File

@ -52,13 +52,15 @@ Cvs code -
ISSET and then using SET or UNSET when we want a simple toggle
for a flag.
- Added multiple buffer capability (God help us). New configure
option --enable-loadoninsert (-L), changes to do_insertfile(),
option --enable-multibuffer (-F), changes to do_insertfile(),
do_insertfile_void(), toggle_init(), do_gotoline(), edit_update(),
and write_file(), new functions add_open_file(),
open_file_change_name(), load_open_file(), open_file_dup_search(),
open_file_dup_fix(), open_prevfile(), open_nextfile(),
close_open_file(), get_full_path(), die_save_file(), etc.
(David Lawrence Ramsey).
- Using --enable-extra automatically defines --enable-multibuffer
changes to version() and configure.in.
- Makefile.am:
- Include ABOUT-NLS and the new THANKS files to the distributed list.
- THANKS:

4
README
View File

@ -65,8 +65,8 @@ Current Status
of wrap margin based on window size.
+ Write marked text to separate file (^O after selecting with ^^).
+ Append to file (Meta-A at write file menu).
+ Multiple file buffers! (--enable-loadoninsert configure option,
--loadoninsert, -L cmdline flag, Meta-L toggle, then ^R to load).
+ Multiple file buffers! (--enable-multibuffer configure option,
--multibuffer, -F cmdline flag, Meta-F toggle, then ^R to load).
+ Better compatibility with Pico. Mouse mode now supports clicking
shortcuts and files in browser, search toggles that are Pico
extensions moved to Meta keys so as to not interfere with Pico

View File

@ -55,7 +55,7 @@
#undef DISABLE_MOUSE
/* Define this to load files upon inserting them, and allow switching between them; this is disabled if NANO_SMALL is defined */
#undef ENABLE_LOADONINSERT
#undef ENABLE_MULTIBUFFER
/* Define this to use the .nanorc file */
#undef ENABLE_NANORC

11
aclocal.m4 vendored
View File

@ -344,7 +344,7 @@ main ()
# Ulrich Drepper <drepper@cygnus.com>, 1995.
#
# This file can be copied and used freely without restrictions. It can
# be used in projects which are not available under the GNU Public License
# be used in projects which are not available under the GNU General Public License
# but which still want to provide support for the GNU gettext functionality.
# Please note that the actual code is *not* freely available.
@ -523,6 +523,7 @@ return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", ""
ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
case "$ac_given_srcdir" in
.) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
/*) top_srcdir="$ac_given_srcdir" ;;
@ -530,9 +531,9 @@ return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", ""
esac
if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
rm -f "$ac_dir/POTFILES"
echo creating "$ac_dir/POTFILES"
test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES"
echo creating "$ac_dir/Makefile"
test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
fi
;;
@ -693,7 +694,7 @@ strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
# Ulrich Drepper <drepper@cygnus.com>, 1996.
#
# This file can be copied and used freely without restrictions. It can
# be used in projects which are not available under the GNU Public License
# be used in projects which are not available under the GNU General Public License
# but which still want to provide support for the GNU gettext functionality.
# Please note that the actual code is *not* freely available.
@ -856,7 +857,7 @@ AC_DEFUN([AM_LANGINFO_CODESET],
# Ulrich Drepper <drepper@cygnus.com>, 1995.
#
# This file can be copied and used freely without restrictions. It can
# be used in projects which are not available under the GNU Public License
# be used in projects which are not available under the GNU General Public License
# but which still want to provide support for the GNU gettext functionality.
# Please note that the actual code is *not* freely available.

View File

@ -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. */
#undef C_ALLOCA
@ -89,7 +89,7 @@
#undef DISABLE_MOUSE
/* Define this to load files upon inserting them, and allow switching between them; this is disabled if NANO_SMALL is defined */
#undef ENABLE_LOADONINSERT
#undef ENABLE_MULTIBUFFER
/* Define this to use the .nanorc file */
#undef ENABLE_NANORC

1423
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -31,12 +31,13 @@ AC_ARG_ENABLE(extra,
[ --enable-extra Enable extra (optional) functions, including easter eggs],
[if test x$enableval = xyes; then
AC_DEFINE(NANO_EXTRA) extra_support=yes
AC_DEFINE(ENABLE_MULTIBUFFER) multibuffer_support=yes
fi])
AC_ARG_ENABLE(loadoninsert,
[ --enable-loadoninsert Enable use of file loading on insertion, and switching between loaded files; this is disabled if --enable-tiny is used],
AC_ARG_ENABLE(multibuffer,
[ --enable-multibuffer Enable use of file loading on insertion, and switching between loaded files; this is disabled if --enable-tiny is used],
[if test x$enableval = xyes && test x$tiny_support != xyes; then
AC_DEFINE(ENABLE_LOADONINSERT) loadoninsert_support=yes
AC_DEFINE(ENABLE_MULTIBUFFER) multibuffer_support=yes
fi])
AC_ARG_ENABLE(nanorc,

18
files.c
View File

@ -48,7 +48,7 @@ void load_file(void)
{
current = fileage;
#ifdef ENABLE_LOADONINSERT
#ifdef ENABLE_MULTIBUFFER
/* add a new entry to the open_files structure, and check for
duplicate entries; if a duplicate entry was found, reload the
currently open file (it may have been changed during duplicate
@ -308,7 +308,7 @@ int do_insertfile(int loading_file)
}
#endif
#ifdef ENABLE_LOADONINSERT
#ifdef ENABLE_MULTIBUFFER
if (loading_file) {
/* update the current entry in the open_files structure; we
@ -324,7 +324,7 @@ int do_insertfile(int loading_file)
i = open_file(realname, 1, 0);
#ifdef ENABLE_LOADONINSERT
#ifdef ENABLE_MULTIBUFFER
if (loading_file)
filename = mallocstrcpy(filename, realname);
#endif
@ -333,7 +333,7 @@ int do_insertfile(int loading_file)
dump_buffer(fileage);
#ifdef ENABLE_LOADONINSERT
#ifdef ENABLE_MULTIBUFFER
if (loading_file)
load_file();
else
@ -344,7 +344,7 @@ int do_insertfile(int loading_file)
/* Here we want to rebuild the edit window */
fix_editbot();
#ifdef ENABLE_LOADONINSERT
#ifdef ENABLE_MULTIBUFFER
/* If we've loaded another file, update the titlebar's contents */
if (loading_file) {
clearok(topwin, FALSE);
@ -375,8 +375,8 @@ int do_insertfile(int loading_file)
int do_insertfile_void(void)
{
int result = 0;
#ifdef ENABLE_LOADONINSERT
result = do_insertfile(ISSET(LOADONINSERT));
#ifdef ENABLE_MULTIBUFFER
result = do_insertfile(ISSET(MULTIBUFFER));
#else
result = do_insertfile(0);
#endif
@ -385,7 +385,7 @@ int do_insertfile_void(void)
return result;
}
#ifdef ENABLE_LOADONINSERT
#ifdef ENABLE_MULTIBUFFER
/*
* Add/update an entry to the open_files filestruct. If update is
* zero, a new entry is created; otherwise, the current entry is updated.
@ -1159,7 +1159,7 @@ int do_writeout(char *path, int exiting, int append)
#endif
i = write_file(answer, 0, append, 0);
#ifdef ENABLE_LOADONINSERT
#ifdef ENABLE_MULTIBUFFER
/* if we're not about to exit, update the current entry in
the open_files structure */
if (!exiting) {

View File

@ -54,7 +54,7 @@ filestruct *editbot = NULL; /* Same for the bottom */
filestruct *filebot = NULL; /* Last node in the file struct */
filestruct *cutbuffer = NULL; /* A place to store cut text */
#ifdef ENABLE_LOADONINSERT
#ifdef ENABLE_MULTIBUFFER
filestruct *open_files = NULL; /* The list of open files */
#endif
@ -148,7 +148,7 @@ void toggle_init(void)
*toggle_cuttoend_msg, *toggle_wrap_msg, *toggle_case_msg,
*toggle_backwards_msg;
#ifdef ENABLE_LOADONINSERT
#ifdef ENABLE_MULTIBUFFER
char *toggle_load_msg, *nano_openprev_msg, *nano_opennext_msg;
#endif
@ -170,8 +170,8 @@ void toggle_init(void)
#endif
toggle_wrap_msg = _("Auto wrap");
#ifdef ENABLE_LOADONINSERT
toggle_load_msg = _("File loading on insertion");
#ifdef ENABLE_MULTIBUFFER
toggle_load_msg = _("Multiple file buffers");
nano_openprev_msg = _("Open previously loaded file");
nano_opennext_msg = _("Open next loaded file");
#endif
@ -197,9 +197,9 @@ void toggle_init(void)
toggle_init_one(&toggles[9], TOGGLE_CASE_KEY, toggle_case_msg,
CASE_SENSITIVE, 0);
#ifdef ENABLE_LOADONINSERT
#ifdef ENABLE_MULTIBUFFER
toggle_init_one(&toggles[10], TOGGLE_LOAD_KEY, toggle_load_msg,
LOADONINSERT, 0);
MULTIBUFFER, 0);
toggle_init_one(&toggles[11], NANO_OPENPREV_KEY, nano_openprev_msg,
0, '<');
toggle_init_one(&toggles[12], NANO_OPENNEXT_KEY, nano_opennext_msg,
@ -238,7 +238,7 @@ void shortcut_init(int unjustify)
nano_help_msg = _("Invoke the help menu");
nano_writeout_msg = _("Write the current file to disk");
#ifdef ENABLE_LOADONINSERT
#ifdef ENABLE_MULTIBUFFER
nano_exit_msg = _("Close currently loaded file/Exit from nano");
#else
nano_exit_msg = _("Exit from nano");
@ -284,7 +284,7 @@ void shortcut_init(int unjustify)
sc_init_one(&main_list[0], NANO_HELP_KEY, _("Get Help"),
nano_help_msg, 0, NANO_HELP_FKEY, 0, VIEW, do_help);
#ifdef ENABLE_LOADONINSERT
#ifdef ENABLE_MULTIBUFFER
if (open_files != NULL && (open_files->prev || open_files->next))
sc_init_one(&main_list[1], NANO_EXIT_KEY, _("Close"),
nano_exit_msg, 0, NANO_EXIT_FKEY, 0, VIEW, do_exit);

48
nano.c
View File

@ -126,7 +126,7 @@ void die(char *msg, ...)
isn't up to date) */
die_save_file(filename);
#ifdef ENABLE_LOADONINSERT
#ifdef ENABLE_MULTIBUFFER
/* then save all of the other loaded files, if any */
if (open_files) {
filestruct *tmp;
@ -402,10 +402,10 @@ void usage(void)
printf(_("Usage: nano [GNU long option] [option] +LINE <file>\n\n"));
printf(_("Option Long option Meaning\n"));
#ifdef ENABLE_LOADONINSERT
#ifdef ENABLE_MULTIBUFFER
printf
(_
(" -L --loadoninsert Enable file loading on insertion\n"));
(" -F --multibuffer Enable multiple file buffers\n"));
#endif
printf(_
@ -463,6 +463,9 @@ void usage(void)
#else
printf(_("Usage: nano [option] +LINE <file>\n\n"));
printf(_("Option Meaning\n"));
#ifdef ENABLE_MULTIBUFFER
printf(_(" -F Enable multiple file buffers\n"));
#endif
printf(_(" -T [num] Set width of a tab to num\n"));
printf(_(" -R Use regular expressions for search\n"));
printf(_(" -V Print version information and exit\n"));
@ -510,10 +513,12 @@ void version(void)
#ifdef NANO_EXTRA
printf(" --enable-extra");
#endif
#ifdef ENABLE_LOADONINSERT
printf(" --enable-loadoninsert");
#endif
#else
#ifdef ENABLE_MULTIBUFFER
printf(" --enable-multibuffer");
#endif /* ENABLE_MULTIBUFFER */
#endif /* NANO_EXTRA */
#ifdef ENABLE_NANORC
printf(" --enable-nanorc");
#endif
@ -1007,9 +1012,10 @@ void do_wrap(filestruct * inptr, char input_char)
space or tab, then null terminate it so we can strcat it
to hell */
while ((inptr->next->data[non] == ' '
|| inptr->next->data[non] == '\t'))
p[non] = inptr->next->data[non++];
|| inptr->next->data[non] == '\t')) {
p[non] = inptr->next->data[non];
non++;
}
p[non] = 0;
strcat(p, temp->data);
strcat(p, " ");
@ -1516,7 +1522,7 @@ int do_alt_speller(char *file_name)
do_gotoline(lineno_cur, 0);
set_modified();
#ifdef ENABLE_LOADONINSERT
#ifdef ENABLE_MULTIBUFFER
/* if we have multiple files open, the spell-checked (current) file
is now stored after the un-spell-checked file in the open_files
structure, so go back to the un-spell-checked file and close it */
@ -1572,7 +1578,7 @@ int do_exit(void)
if (!ISSET(MODIFIED)) {
#ifdef ENABLE_LOADONINSERT
#ifdef ENABLE_MULTIBUFFER
if (!close_open_file()) {
display_main_list();
return 1;
@ -1598,7 +1604,7 @@ int do_exit(void)
if (i == 1) {
if (do_writeout(filename, 1, 0) > 0) {
#ifdef ENABLE_LOADONINSERT
#ifdef ENABLE_MULTIBUFFER
if (!close_open_file()) {
display_main_list();
return 1;
@ -1610,7 +1616,7 @@ int do_exit(void)
}
} else if (i == 0) {
#ifdef ENABLE_LOADONINSERT
#ifdef ENABLE_MULTIBUFFER
if (!close_open_file()) {
display_main_list();
return 1;
@ -2382,8 +2388,8 @@ int main(int argc, char *argv[])
{"nofollow", 0, 0, 'l'},
{"tabsize", 1, 0, 'T'},
#ifdef ENABLE_LOADONINSERT
{"loadoninsert", 0, 0, 'L'},
#ifdef ENABLE_MULTIBUFFER
{"MULTIBUFFER", 0, 0, 'L'},
#endif
{0, 0, 0, 0}
@ -2415,9 +2421,9 @@ int main(int argc, char *argv[])
switch (optchr) {
#ifdef ENABLE_LOADONINSERT
#ifdef ENABLE_MULTIBUFFER
case 'L':
SET(LOADONINSERT);
SET(MULTIBUFFER);
break;
#endif
@ -2697,8 +2703,8 @@ int main(int argc, char *argv[])
break;
case 126: /* Hack, make insert key do something
useful, like insert file */
#ifdef ENABLE_LOADONINSERT
do_insertfile(ISSET(LOADONINSERT));
#ifdef ENABLE_MULTIBUFFER
do_insertfile(ISSET(MULTIBUFFER));
#else
do_insertfile(0);
#endif
@ -2767,7 +2773,7 @@ int main(int argc, char *argv[])
break;
}
break;
#ifdef ENABLE_LOADONINSERT
#ifdef ENABLE_MULTIBUFFER
case NANO_OPENPREV_KEY:
open_prevfile(0);
keyhandled = 1;

10
nano.h
View File

@ -74,7 +74,7 @@ typedef struct filestruct {
struct filestruct *next; /* Next node */
struct filestruct *prev; /* Previous node */
#ifdef ENABLE_LOADONINSERT
#ifdef ENABLE_MULTIBUFFER
struct filestruct *file; /* Current file */
int file_current_x; /* Current file's x-coordinate position */
int file_current_y; /* Current file's y-coordinate position */
@ -139,7 +139,7 @@ typedef struct rcoption {
#define CUT_TO_END (1<<17)
#define DISABLE_CURPOS (1<<18)
#define REVERSE_SEARCH (1<<19)
#define LOADONINSERT (1<<20)
#define MULTIBUFFER (1<<20)
/* Control key sequences, changing these would be very very bad */
@ -272,13 +272,13 @@ know what you're doing */
#define TOGGLE_WRAP_KEY NANO_ALT_W
#define TOGGLE_BACKWARDS_KEY NANO_ALT_B
#define TOGGLE_CASE_KEY NANO_ALT_A
#define TOGGLE_LOAD_KEY NANO_ALT_L
#define TOGGLE_LOAD_KEY NANO_ALT_F
/* Toggle stuff, these static lengths need to go away RSN */
#ifdef HAVE_REGEX_H
#ifdef ENABLE_LOADONINSERT
#ifdef ENABLE_MULTIBUFFER
#define TOGGLE_LEN 14
#else
#define TOGGLE_LEN 11
@ -288,7 +288,7 @@ know what you're doing */
#define REPLACE_LIST_LEN 8
#else
#ifdef ENABLE_LOADONINSERT
#ifdef ENABLE_MULTIBUFFER
#define TOGGLE_LEN 13
#else
#define TOGGLE_LEN 10

View File

@ -42,5 +42,7 @@
# set suspend
# Load files upon inserting them, and allow switching between them
# set loadoninsert
# You must have configured with --enable-multibuffer or --enable-extra for
# this to work
#
# set multibuffer

12
proto.h
View File

@ -51,7 +51,7 @@ extern struct stat fileinfo;
extern filestruct *current, *fileage, *edittop, *editbot, *filebot;
extern filestruct *cutbuffer, *mark_beginbuf;
#ifdef ENABLE_LOADONINSERT
#ifdef ENABLE_MULTIBUFFER
extern filestruct *open_files;
#endif
@ -96,7 +96,7 @@ int renumber_all(void);
int open_file(char *filename, int insert, int quiet);
int do_insertfile(int loading_file);
#ifdef ENABLE_LOADONINSERT
#ifdef ENABLE_MULTIBUFFER
int add_open_file(int update, int dup_fix);
#endif
@ -178,7 +178,7 @@ void do_credits(void);
int do_writeout_void(void), do_exit(void), do_gotoline_void(void);
int do_insertfile_void(void), do_search(void);
#ifdef ENABLE_LOADONINSERT
#ifdef ENABLE_MULTIBUFFER
int load_open_file(void), close_open_file(void);
#endif
@ -191,14 +191,14 @@ int do_first_line(void), do_last_line(void);
int do_replace(void), do_help(void), do_enter_void(void);
int keypad_on(WINDOW * win, int newval);
#ifdef ENABLE_LOADONINSERT
#ifdef ENABLE_MULTIBUFFER
int open_file_dup_fix(int update);
int open_prevfile(int closing_file), open_nextfile(int closing_file);
#endif
char *charalloc (size_t howmuch);
#ifdef ENABLE_LOADONINSERT
#ifdef ENABLE_MULTIBUFFER
char *get_full_path(const char *origpath);
#endif
@ -224,6 +224,6 @@ filestruct *make_new_node(filestruct * prevnode);
filestruct *findnextstr(int quiet, filestruct * begin,
int beginx, char *needle);
#ifdef ENABLE_LOADONINSERT
#ifdef ENABLE_MULTIBUFFER
filestruct *open_file_dup_search(void);
#endif