Changed PICO_MSGS to PICO_MODE and strings

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@288 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
Chris Allegretta 2000-11-17 01:37:39 +00:00
parent 5b1faac336
commit bf9a8cc23d
8 changed files with 32 additions and 30 deletions

View File

@ -14,7 +14,7 @@ CVS Code -
pointers. New function not_found_msg in search.c for displaying
truncated strings in satusbar when the string is not found
(-pedantic fixes by Rocco Corsi). We disable this feature when
using PICO_MSGS (-p).
using PICO_MODE (-p).
- New spelling code by Rocco Corsi. New functions
do_int_speller, do_alt_speller, changes to do_spell in nano.c,
New functions search_init_globals and do_replace_loop, changes
@ -28,6 +28,8 @@ CVS Code -
- Fixed value being input in statusbar during a search or replace
and CASE_SENSITIVE or the other search is called and the
string being typed in is blown away. Reported by Ken Tyler.
- Changed PICO_MSGS flag to PICO_MODE, changed help strings
accordingly.
- files.c:
do_writeout()
- Change strcpy to answer to mallocstrcpy.

View File

@ -125,7 +125,7 @@ void toggle_init(void)
toggle_autoindent_msg = _("Auto indent");
toggle_suspend_msg = _("Suspend");
toggle_nohelp_msg = _("Help mode");
toggle_picomode_msg = _("Pico messages");
toggle_picomode_msg = _("Pico mode");
toggle_mouse_msg = _("Mouse support");
toggle_cuttoend_msg = _("Cut to end");
#ifdef HAVE_REGEX_H
@ -142,7 +142,7 @@ void toggle_init(void)
toggle_init_one(&toggles[3], TOGGLE_NOHELP_KEY, toggle_nohelp_msg,
NO_HELP);
toggle_init_one(&toggles[4], TOGGLE_PICOMODE_KEY, toggle_picomode_msg,
PICO_MSGS);
PICO_MODE);
toggle_init_one(&toggles[5], TOGGLE_WRAP_KEY, toggle_wrap_msg,
NO_WRAP);
toggle_init_one(&toggles[6], TOGGLE_MOUSE_KEY, toggle_mouse_msg,
@ -207,7 +207,7 @@ void shortcut_init(void)
nano_cancel_msg = _("Cancel the current function");
#endif
if (ISSET(PICO_MSGS))
if (ISSET(PICO_MODE))
sc_init_one(&main_list[0], NANO_HELP_KEY, _("Get Help"),
nano_help_msg, 0, NANO_HELP_FKEY, 0, VIEW, do_help);
else
@ -218,7 +218,7 @@ void shortcut_init(void)
sc_init_one(&main_list[1], NANO_EXIT_KEY, _("Exit"),
nano_exit_msg, 0, NANO_EXIT_FKEY, 0, VIEW, do_exit);
if (ISSET(PICO_MSGS))
if (ISSET(PICO_MODE))
sc_init_one(&main_list[2], NANO_WRITEOUT_KEY, _("WriteOut"),
nano_writeout_msg,
0, NANO_WRITEOUT_FKEY, 0, NOVIEW, do_writeout_void);
@ -227,7 +227,7 @@ void shortcut_init(void)
nano_goto_msg,
NANO_ALT_G, NANO_GOTO_FKEY, 0, VIEW, do_gotoline_void);
if (ISSET(PICO_MSGS))
if (ISSET(PICO_MODE))
sc_init_one(&main_list[3], NANO_JUSTIFY_KEY, _("Justify"),
nano_justify_msg, 0, NANO_JUSTIFY_FKEY, 0,
NOVIEW, do_justify);
@ -302,7 +302,7 @@ void shortcut_init(void)
sc_init_one(&main_list[22], NANO_TAB_KEY, _("Tab"),
nano_tab_msg, 0, 0, 0, NOVIEW, do_tab);
if (ISSET(PICO_MSGS))
if (ISSET(PICO_MODE))
sc_init_one(&main_list[23], NANO_REPLACE_KEY, _("Replace"),
nano_replace_msg,
NANO_ALT_R, NANO_REPLACE_FKEY, 0, NOVIEW, do_replace);
@ -315,7 +315,7 @@ void shortcut_init(void)
nano_enter_msg,
0, KEY_ENTER, NANO_CONTROL_M, NOVIEW, do_enter_void);
if (ISSET(PICO_MSGS))
if (ISSET(PICO_MODE))
sc_init_one(&main_list[25], NANO_GOTO_KEY, _("Goto Line"),
nano_goto_msg,
NANO_ALT_G, NANO_GOTO_FKEY, 0, VIEW, do_gotoline_void);

8
nano.c
View File

@ -364,7 +364,7 @@ void usage(void)
(_
(" -r [#cols] --fill=[#cols] Set fill cols to (wrap lines at) #cols\n"));
printf(_
(" -p --pico Make bottom 2 lines more Pico-like\n"));
(" -p --pico Emulate Pico as closely as possible\n"));
printf(_
(" -s [prog] --speller=[prog] Enable alternate speller\n"));
printf(_
@ -401,7 +401,7 @@ void usage(void)
printf(_
(" -r [#cols] Set fill cols to (wrap lines at) #cols\n"));
printf(_(" -s [prog] Enable alternate speller\n"));
printf(_(" -p Make bottom 2 lines more Pico-like\n"));
printf(_(" -p Emulate Pico as closely as possible\n"));
printf(_(" -t Auto save on exit, don't prompt\n"));
printf(_(" -v View (read only) mode\n"));
printf(_(" -w Don't wrap long lines\n"));
@ -2008,7 +2008,7 @@ int main(int argc, char *argv[])
SET(USE_MOUSE);
break;
case 'p':
SET(PICO_MSGS);
SET(PICO_MODE);
break;
case 'r':
fill = atoi(optarg);
@ -2046,7 +2046,7 @@ int main(int argc, char *argv[])
argv0 = strrchr(argv[0], '/');
if ((argv0 && strstr(argv0, "pico"))
|| (!argv0 && strstr(argv[0], "pico")))
SET(PICO_MSGS);
SET(PICO_MODE);
/* See if there's a non-option in argv (first non-option is the
filename, if +LINE is not given) */

2
nano.h
View File

@ -98,7 +98,7 @@ typedef struct toggle {
#define MARK_ISSET (1<<3)
#define CONSTUPDATE (1<<4)
#define NO_HELP (1<<5)
#define PICO_MSGS (1<<6)
#define PICO_MODE (1<<6)
#define FOLLOW_SYMLINKS (1<<7)
#define SUSPEND (1<<8)
#define NO_WRAP (1<<9)

View File

@ -33,7 +33,7 @@ const struct _msg_ent _msg_tbl[] = {
{"Auto indent", 24},
{"Suspend", 25},
{"Help mode", 26},
{"Pico messages", 27},
{"Pico mode", 27},
{"Mouse support", 28},
{"Cut to end", 29},
{"Regular expressions", 30},
@ -138,7 +138,7 @@ Usage: nano [GNU long option] [option] +LINE <file>\n\
{" -m \t\t--mouse\t\t\tEnable mouse\n", 108},
{"\
-r [#cols] \t--fill=[#cols]\t\tSet fill cols to (wrap lines at) #cols\n", 109},
{" -p\t \t--pico\t\t\tMake bottom 2 lines more Pico-like\n", 110},
{" -p\t \t--pico\t\t\tEmulate Pico as closely as possible\n", 110},
{" -s [prog] \t--speller=[prog]\tEnable alternate speller\n", 111},
{" -t \t\t--tempfile\t\tAuto save on exit, don't prompt\n", 112},
{" -v \t\t--view\t\t\tView (read only) mode\n", 113},
@ -161,7 +161,7 @@ Usage: nano [option] +LINE <file>\n\
{" -m \t\tEnable mouse\n", 128},
{" -r [#cols] \tSet fill cols to (wrap lines at) #cols\n", 129},
{" -s [prog] \tEnable alternate speller\n", 130},
{" -p \t\tMake bottom 2 lines more Pico-like\n", 131},
{" -p \t\tEmulate Pico as closely as possible\n", 131},
{" -t \t\tAuto save on exit, don't prompt\n", 132},
{" -v \t\tView (read only) mode\n", 133},
{" -w \t\tDon't wrap long lines\n", 134},

View File

@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2000-11-16 14:53-0500\n"
"POT-Creation-Date: 2000-11-16 20:31-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -128,7 +128,7 @@ msgid "Help mode"
msgstr ""
#: global.c:128
msgid "Pico messages"
msgid "Pico mode"
msgstr ""
#: global.c:129
@ -483,7 +483,7 @@ msgid ""
msgstr ""
#: nano.c:367
msgid " -p\t \t--pico\t\t\tMake bottom 2 lines more Pico-like\n"
msgid " -p\t \t--pico\t\t\tEmulate Pico as closely as possible\n"
msgstr ""
#: nano.c:369
@ -569,7 +569,7 @@ msgid " -s [prog] \tEnable alternate speller\n"
msgstr ""
#: nano.c:404
msgid " -p \t\tMake bottom 2 lines more Pico-like\n"
msgid " -p \t\tEmulate Pico as closely as possible\n"
msgstr ""
#: nano.c:405

View File

@ -84,13 +84,13 @@ int search_init(int replacing)
/* Okay, fun time. backupstring is our holder for what is being
returned from the statusq call. Using answer for this would be tricky.
Here, if we're using PICO_MSGS, we only want nano to put the
Here, if we're using PICO_MODE, we only want nano to put the
old string back up as editable if it's not the same as last_search.
Otherwise, if we don't already have a backupstring, set it to
last_search. */
if (ISSET(PICO_MSGS)) {
if (ISSET(PICO_MODE)) {
if (backupstring == NULL || !strcmp(backupstring, last_search))
backupstring = mallocstrcpy(backupstring, "");
}
@ -98,7 +98,7 @@ int search_init(int replacing)
backupstring = mallocstrcpy(backupstring, last_search);
/* If using Pico messages, we do things the old fashioned way... */
if (ISSET(PICO_MSGS)) {
if (ISSET(PICO_MODE)) {
if (last_search[0]) {
/* We use COLS / 3 here because we need to see more on the line */
@ -314,13 +314,13 @@ int do_search(void)
}
/* The sneaky user deleted the previous search string */
if (!ISSET(PICO_MSGS) && !strcmp(answer, "")) {
if (!ISSET(PICO_MODE) && !strcmp(answer, "")) {
statusbar(_("Search Cancelled"));
search_abort();
return 0;
}
/* If answer is now == "", then PICO_MSGS is set. So, copy
/* If answer is now == "", then PICO_MODE is set. So, copy
last_search into answer... */
if (!strcmp(answer, ""))
@ -584,13 +584,13 @@ int do_replace(void)
}
/* Again, there was a previous string but they deleted it and hit enter */
if (!ISSET(PICO_MSGS) && !strcmp(answer, "")) {
if (!ISSET(PICO_MODE) && !strcmp(answer, "")) {
statusbar(_("Replace Cancelled"));
replace_abort();
return 0;
}
/* If answer is now == "", then PICO_MSGS is set. So, copy
/* If answer is now == "", then PICO_MODE is set. So, copy
last_search into answer (and prevanswer)... */
if (!strcmp(answer, "")) {
answer = mallocstrcpy(answer, last_search);
@ -600,7 +600,7 @@ int do_replace(void)
prevanswer = mallocstrcpy(prevanswer, answer);
}
if (ISSET(PICO_MSGS)) {
if (ISSET(PICO_MODE)) {
buf = nmalloc(strlen(last_replace) + 5);
if (strcmp(last_replace, "")) {
if (strlen(last_replace) > (COLS / 3)) {

View File

@ -441,8 +441,8 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
/* Now that the text is editable instead of bracketed, we have to
check for answer == def, instead of answer == "" */
if (((ISSET(PICO_MSGS)) && !strcmp(answer, "")) ||
((!ISSET(PICO_MSGS)) && !strcmp(answer, def)))
if (((ISSET(PICO_MODE)) && !strcmp(answer, "")) ||
((!ISSET(PICO_MODE)) && !strcmp(answer, def)))
return -2;
else
return 0;