- Changed do_insertfile to (a) report multibuffer status at the prompt and allowing it to be toggled, taking into account the need to keep the translatable strings, and (b) added a variable inspath to keep track of what the string was before toggling. I'm sure there's bugs, have at it
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1269 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
768e8f0810
commit
f7c6811e36
|
@ -6,6 +6,11 @@ CVS code -
|
|||
inaccuracy in the description of -Q/--quotestr. (DLR)
|
||||
- Set REG_EXTENDED in all regcomp() calls. (DLR)
|
||||
- Minor cosmetic code cleanups. (DLR)
|
||||
- Changed do_insertfile to (a) report multibuffer status at the
|
||||
prompt and allowing it to be toggled, taking into account the
|
||||
need to keep the translatable strings, and (b) added a
|
||||
variable inspath to keep track of what the string was before
|
||||
toggling. I'm sure there's bugs, have at it.
|
||||
- configure.ac:
|
||||
- Added pt_BR to ALL_LINGUAS (Jordi).
|
||||
- Changed --enable-color warning to be slightly less severe.
|
||||
|
|
46
files.c
46
files.c
|
@ -421,6 +421,10 @@ int do_insertfile(int loading_file)
|
|||
{
|
||||
int i, old_current_x = current_x;
|
||||
char *realname = NULL;
|
||||
static char *inspath = NULL;
|
||||
|
||||
if (inspath == NULL)
|
||||
inspath = mallocstrcpy(inspath, "");
|
||||
|
||||
wrap_reset();
|
||||
|
||||
|
@ -430,17 +434,33 @@ int do_insertfile(int loading_file)
|
|||
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
if (operating_dir && strcmp(operating_dir, "."))
|
||||
i = statusq(1, insertfile_list, "", _("File to insert [from %s] "),
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (ISSET(MULTIBUFFER))
|
||||
i = statusq(1, insertfile_list, inspath, _("File to insert into new buffer [from %s] "),
|
||||
operating_dir);
|
||||
else
|
||||
#endif
|
||||
i = statusq(1, insertfile_list, inspath, _("File to insert [from %s] "),
|
||||
operating_dir);
|
||||
|
||||
else
|
||||
#endif
|
||||
i = statusq(1, insertfile_list, "", _("File to insert [from ./] "));
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (ISSET(MULTIBUFFER))
|
||||
i = statusq(1, insertfile_list, inspath, _("File to insert into new buffer [from ./] "));
|
||||
else
|
||||
#endif
|
||||
i = statusq(1, insertfile_list, inspath, _("File to insert [from ./] "));
|
||||
|
||||
if (i != -1) {
|
||||
|
||||
inspath = mallocstrcpy(inspath, answer);
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("filename is %s\n"), answer);
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef DISABLE_TABCOMP
|
||||
realname = real_dir_from_tilde(answer);
|
||||
#else
|
||||
|
@ -473,6 +493,12 @@ int do_insertfile(int loading_file)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (i == TOGGLE_LOAD_KEY) {
|
||||
TOGGLE(MULTIBUFFER);
|
||||
return do_insertfile(loading_file);
|
||||
}
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
if (i == NANO_EXTCMD_KEY) {
|
||||
int ts;
|
||||
|
@ -548,6 +574,8 @@ int do_insertfile(int loading_file)
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* If we've gone off the bottom, recenter; otherwise, just redraw */
|
||||
if (current->lineno > editbot->lineno)
|
||||
edit_update(current, CENTER);
|
||||
|
@ -558,15 +586,17 @@ int do_insertfile(int loading_file)
|
|||
update_color();
|
||||
#endif
|
||||
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
display_main_list();
|
||||
return i;
|
||||
} else {
|
||||
statusbar(_("Cancelled"));
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
display_main_list();
|
||||
return 0;
|
||||
i = 0;
|
||||
}
|
||||
|
||||
free(inspath);
|
||||
inspath = NULL;
|
||||
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
display_main_list();
|
||||
return i;
|
||||
}
|
||||
|
||||
int do_insertfile_void(void)
|
||||
|
|
8
global.c
8
global.c
|
@ -325,7 +325,8 @@ void shortcut_init(int unjustify)
|
|||
"", *nano_backup_msg = "";
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
char *nano_openprev_msg = "", *nano_opennext_msg = "";
|
||||
char *nano_openprev_msg = "", *nano_opennext_msg = "",
|
||||
*nano_multibuffer_msg = "";
|
||||
#endif
|
||||
#ifdef HAVE_REGEX_H
|
||||
char *nano_regexp_msg = "", *nano_bracket_msg = "";
|
||||
|
@ -384,6 +385,7 @@ void shortcut_init(int unjustify)
|
|||
#ifdef ENABLE_MULTIBUFFER
|
||||
nano_openprev_msg = _("Open previously loaded file");
|
||||
nano_opennext_msg = _("Open next loaded file");
|
||||
nano_multibuffer_msg = _("Toggle insert into new buffer");
|
||||
#endif
|
||||
#endif /* !DISABLE_HELP */
|
||||
|
||||
|
@ -724,6 +726,10 @@ void shortcut_init(int unjustify)
|
|||
sc_init_one(&insertfile_list, NANO_EXTCMD_KEY, _("Execute Command"),
|
||||
IFHELP(nano_execute_msg, 0), 0, 0, NOVIEW, 0);
|
||||
#endif
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
sc_init_one(&insertfile_list, TOGGLE_LOAD_KEY, _("New Buffer"),
|
||||
IFHELP(nano_multibuffer_msg, 0), 0, 0, NOVIEW, 0);
|
||||
#endif
|
||||
|
||||
free_shortcutage(&spell_list);
|
||||
|
||||
|
|
Loading…
Reference in New Issue