Completely removed PICO_MODE, as with the search/replace history patch we should have the extended functionality we can without being incompatible with pico

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1337 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Chris Allegretta 2003-01-05 21:47:06 +00:00
parent a65ba51b9e
commit 15c28f8b86
7 changed files with 26 additions and 111 deletions

View File

@ -1,6 +1,11 @@
CVS code -
Changes
- General:
- Completely removed PICO_MODE, as with the search/replace history
patch we should have the extended functionality we can without
being incompatible with pico. Removed all code for different
search/replace string editing and alternate shortcut list. I'm sure
I won't even have to ask for feedback on this one :-)
- Search history and replace history up/down cursor arrows, w/history
tab completion, not available w/NANO_SMALL. Changes to
statusq, others (Ken Tyler). Added shortcut to search/replace

View File

@ -215,7 +215,7 @@ void toggle_init_one(int val, const char *desc, int flag)
void toggle_init(void)
{
char *toggle_const_msg, *toggle_autoindent_msg, *toggle_suspend_msg,
*toggle_nohelp_msg, *toggle_picomode_msg, *toggle_cuttoend_msg,
*toggle_nohelp_msg, *toggle_cuttoend_msg,
*toggle_noconvert_msg, *toggle_dos_msg, *toggle_mac_msg,
*toggle_backup_msg, *toggle_smooth_msg;
#if !defined(DISABLE_MOUSE) && defined(NCURSES_MOUSE_VERSION)
@ -242,7 +242,6 @@ void toggle_init(void)
toggle_autoindent_msg = _("Auto indent");
toggle_suspend_msg = _("Suspend");
toggle_nohelp_msg = _("Help mode");
toggle_picomode_msg = _("Pico mode");
#if !defined(DISABLE_MOUSE) && defined(NCURSES_MOUSE_VERSION)
toggle_mouse_msg = _("Mouse support");
#endif
@ -266,7 +265,6 @@ void toggle_init(void)
toggle_init_one(TOGGLE_AUTOINDENT_KEY, toggle_autoindent_msg, AUTOINDENT);
toggle_init_one(TOGGLE_SUSPEND_KEY, toggle_suspend_msg, SUSPEND);
toggle_init_one(TOGGLE_NOHELP_KEY, toggle_nohelp_msg, NO_HELP);
toggle_init_one(TOGGLE_PICOMODE_KEY, toggle_picomode_msg, PICO_MODE);
#ifndef DISABLE_WRAPPING
toggle_init_one(TOGGLE_WRAP_KEY, toggle_wrap_msg, NO_WRAP);
#endif
@ -432,39 +430,21 @@ void shortcut_init(int unjustify)
IFHELP(nano_writeout_msg, 0),
NANO_WRITEOUT_FKEY, 0, NOVIEW, do_writeout_void);
if (ISSET(PICO_MODE))
sc_init_one(&main_list, NANO_JUSTIFY_KEY, _("Justify"),
sc_init_one(&main_list, NANO_JUSTIFY_KEY, _("Justify"),
IFHELP(nano_justify_msg, 0), NANO_JUSTIFY_FKEY, 0,
NOVIEW, do_justify);
else
#ifdef ENABLE_MULTIBUFFER
/* this is so we can view multiple files */
sc_init_one(&main_list, NANO_INSERTFILE_KEY, _("Read File"),
sc_init_one(&main_list, NANO_INSERTFILE_KEY, _("Read File"),
IFHELP(nano_insert_msg, 0),
NANO_INSERTFILE_FKEY, 0, VIEW, do_insertfile_void);
#else
sc_init_one(&main_list, NANO_INSERTFILE_KEY, _("Read File"),
sc_init_one(&main_list, NANO_INSERTFILE_KEY, _("Read File"),
IFHELP(nano_insert_msg, 0),
NANO_INSERTFILE_FKEY, 0, NOVIEW, do_insertfile_void);
#endif
if (ISSET(PICO_MODE))
#ifdef ENABLE_MULTIBUFFER
/* this is so we can view multiple files */
sc_init_one(&main_list, NANO_INSERTFILE_KEY, _("Read File"),
IFHELP(nano_insert_msg, 0),
NANO_INSERTFILE_FKEY, 0, VIEW, do_insertfile_void);
#else
sc_init_one(&main_list, NANO_INSERTFILE_KEY, _("Read File"),
IFHELP(nano_insert_msg, 0),
NANO_INSERTFILE_FKEY, 0, NOVIEW, do_insertfile_void);
#endif
else
sc_init_one(&main_list, NANO_REPLACE_KEY, _("Replace"),
IFHELP(nano_replace_msg, NANO_ALT_REPLACE_KEY),
NANO_REPLACE_FKEY, 0, NOVIEW, do_replace);
sc_init_one(&main_list, NANO_WHEREIS_KEY, _("Where Is"),
IFHELP(nano_whereis_msg, 0),
NANO_WHEREIS_FKEY, 0, VIEW, do_search);
@ -541,14 +521,9 @@ void shortcut_init(int unjustify)
sc_init_one(&main_list, NANO_TAB_KEY, _("Tab"),
IFHELP(nano_tab_msg, 0), 0, 0, NOVIEW, do_tab);
if (ISSET(PICO_MODE))
sc_init_one(&main_list, NANO_REPLACE_KEY, _("Replace"),
sc_init_one(&main_list, NANO_REPLACE_KEY, _("Replace"),
IFHELP(nano_replace_msg, NANO_ALT_REPLACE_KEY),
NANO_REPLACE_FKEY, 0, NOVIEW, do_replace);
else
sc_init_one(&main_list, NANO_JUSTIFY_KEY, _("Justify"),
IFHELP(nano_justify_msg, 0),
NANO_JUSTIFY_FKEY, 0, NOVIEW, do_justify);
sc_init_one(&main_list, NANO_ENTER_KEY, _("Enter"),
IFHELP(nano_enter_msg, 0),

7
nano.c
View File

@ -3007,7 +3007,6 @@ int main(int argc, char *argv[])
int startline = 0; /* Line to try and start at */
int keyhandled; /* Have we handled the keystroke yet? */
int modify_control_seq;
const char *argv0;
const shortcut *s;
#ifndef NANO_SMALL
const toggle *t;
@ -3228,7 +3227,6 @@ int main(int argc, char *argv[])
break;
#endif
case 'p':
SET(PICO_MODE);
break;
#ifndef DISABLE_WRAPJUSTIFY
case 'r':
@ -3285,11 +3283,6 @@ int main(int argc, char *argv[])
filename = charalloc(1);
filename[0] = '\0';
/* See if we were invoked with the name "pico" */
argv0 = strrchr(argv[0], '/');
if ((argv0 != NULL && strstr(argv0, "pico") != NULL)
|| (argv0 == NULL && strstr(argv[0], "pico") != NULL))
SET(PICO_MODE);
/* See if there's a non-option in argv (first non-option is the
filename, if +LINE is not given) */

1
nano.h
View File

@ -222,7 +222,6 @@ typedef struct historyheadtype {
#define MARK_ISSET (1<<3)
#define CONSTUPDATE (1<<4)
#define NO_HELP (1<<5)
#define PICO_MODE (1<<6)
#define NOFOLLOW_SYMLINKS (1<<7)
#define SUSPEND (1<<8)
#define NO_WRAP (1<<9)

View File

@ -67,7 +67,6 @@ const static rcoption rcopts[] = {
#ifndef DISABLE_OPERATINGDIR
{"operatingdir", 0},
#endif
{"pico", PICO_MODE},
#ifndef DISABLE_JUSTIFY
{"quotestr", 0},
#endif

View File

@ -118,23 +118,6 @@ int search_init(int replacing)
UNSET(CLEAR_BACKUPSTRING);
}
/* 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_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 0
/* might need again ;)*/
if (ISSET(PICO_MODE)) {
if (backupstring == NULL || !strcmp(backupstring, last_search)) {
/* backupstring = mallocstrcpy(backupstring, ""); */
backupstring = charalloc(1);
backupstring[0] = '\0';
}
} else
#endif
if (backupstring == NULL)
#ifndef NANO_SMALL
backupstring = mallocstrcpy(backupstring, search_history.current->data);
@ -143,15 +126,13 @@ int search_init(int replacing)
#endif
/* NEW TEST */
if (ISSET(PICO_MODE)) {
backupstring = mallocstrcpy(backupstring, "");
backupstring = mallocstrcpy(backupstring, "");
#ifndef NANO_SMALL
search_history.current = (historytype *)&search_history.next;
search_history.current = (historytype *)&search_history.next;
#endif
}
/* */
/* If using Pico messages, we do things the old fashioned way... */
if (ISSET(PICO_MODE) && last_search[0] != '\0') {
if (last_search[0] != '\0') {
buf = charalloc(COLS / 3 + 7);
/* We use COLS / 3 here because we need to see more on the line */
sprintf(buf, " [%.*s%s]", COLS / 3, last_search,
@ -204,7 +185,7 @@ int search_init(int replacing)
if (ISSET(USE_REGEXP))
/* If we're in Pico mode, and answer is "", use
last_search! */
regexp_init(ISSET(PICO_MODE) ? last_search : answer);
regexp_init(last_search);
#endif
break;
case 0: /* They entered something new */
@ -435,19 +416,7 @@ int do_search(void)
return 1;
}
/* The sneaky user deleted the previous search string */
if (!ISSET(PICO_MODE) && answer[0] == '\0') {
statusbar(_("Search Cancelled"));
#ifndef NANO_SMALL
search_history.current = search_history.next;
#endif
search_abort();
return 0;
}
/* If answer is now == "", then PICO_MODE is set. So, copy
last_search into answer... */
/* If answer is now == "", copy last_search into answer... */
if (answer[0] == '\0')
answer = mallocstrcpy(answer, last_search);
else
@ -628,7 +597,7 @@ int do_replace_loop(const char *prevanswer, const filestruct *begin,
}
}
if (ISSET(PICO_MODE) && answer[0] == '\0')
if (answer[0] == '\0')
answer = mallocstrcpy(answer, last_replace);
last_replace = mallocstrcpy(last_replace, answer);
@ -746,15 +715,8 @@ int do_replace(void)
update_history(&search_history, answer);
#endif /* !NANO_SMALL */
/* Again, there was a previous string, but they deleted it and hit enter */
if (!ISSET(PICO_MODE) && answer[0] == '\0') {
statusbar(_("Replace Cancelled"));
replace_abort();
return 0;
}
/* If answer is now == "", then PICO_MODE is set. So, copy
last_search into answer (and prevanswer)... */
/* If answer is now == "", copy last_search into answer
(and prevanswer)... */
if (answer[0] == '\0')
answer = mallocstrcpy(answer, last_search);
else
@ -762,35 +724,17 @@ int do_replace(void)
prevanswer = mallocstrcpy(prevanswer, last_search);
if (ISSET(PICO_MODE) && last_replace[0] != '\0') {
if (strlen(last_replace) > COLS / 3) {
char *buf = charalloc(COLS / 3 + 3);
#ifndef NANO_SMALL
replace_history.current = (historytype *)&replace_history.next;
last_replace = mallocstrcpy(last_replace, "");
#endif
strncpy(buf, last_replace, COLS / 3 - 1);
strcpy(buf + COLS / 3 - 1, "...");
i = statusq(0, replace_list_2, "",
#ifndef NANO_SMALL
&replace_history,
#endif
_("Replace with [%s]"), buf);
free(buf);
} else
i = statusq(0, replace_list_2, "",
#ifndef NANO_SMALL
&replace_history,
#endif
_("Replace with [%s]") ,last_replace);
} else {
#ifndef NANO_SMALL
replace_history.current = (historytype *)&replace_history.next;
last_replace = mallocstrcpy(last_replace, "");
#endif
i = statusq(0, replace_list_2, last_replace,
i = statusq(0, replace_list_2, last_replace,
#ifndef NANO_SMALL
&replace_history,
#endif
_("Replace with"));
}
#ifndef NANO_SMALL
if (i == 0 && strcmp(answer, ""))
update_history(&replace_history, answer);

View File

@ -464,7 +464,7 @@ int nanogetstr(int allowtabs, const char *buf, const char *def,
} /* while (kbinput ...) */
/* In Pico mode, just check for a blank answer here */
if (ISSET(PICO_MODE) && answer[0] == '\0')
if (answer[0] == '\0')
return -2;
else
return 0;