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
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)
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
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
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"),
- 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
- 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"),
+ 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
- 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),
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),
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;
break;
#endif
case 'p':
- SET(PICO_MODE);
break;
#ifndef DISABLE_WRAPJUSTIFY
case 'r':
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) */
#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)
#ifndef DISABLE_OPERATINGDIR
{"operatingdir", 0},
#endif
- {"pico", PICO_MODE},
#ifndef DISABLE_JUSTIFY
{"quotestr", 0},
#endif
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);
#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,
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 */
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
}
}
- if (ISSET(PICO_MODE) && answer[0] == '\0')
+ if (answer[0] == '\0')
answer = mallocstrcpy(answer, last_replace);
last_replace = mallocstrcpy(last_replace, answer);
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
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);
-
- 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,
+ replace_history.current = (historytype *)&replace_history.next;
+ last_replace = mallocstrcpy(last_replace, "");
#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);
} /* 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;