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-d3aeb78583b8master
parent
a65ba51b9e
commit
15c28f8b86
|
@ -1,6 +1,11 @@
|
||||||
CVS code -
|
CVS code -
|
||||||
Changes
|
Changes
|
||||||
- General:
|
- 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
|
- Search history and replace history up/down cursor arrows, w/history
|
||||||
tab completion, not available w/NANO_SMALL. Changes to
|
tab completion, not available w/NANO_SMALL. Changes to
|
||||||
statusq, others (Ken Tyler). Added shortcut to search/replace
|
statusq, others (Ken Tyler). Added shortcut to search/replace
|
||||||
|
|
27
global.c
27
global.c
|
@ -215,7 +215,7 @@ void toggle_init_one(int val, const char *desc, int flag)
|
||||||
void toggle_init(void)
|
void toggle_init(void)
|
||||||
{
|
{
|
||||||
char *toggle_const_msg, *toggle_autoindent_msg, *toggle_suspend_msg,
|
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_noconvert_msg, *toggle_dos_msg, *toggle_mac_msg,
|
||||||
*toggle_backup_msg, *toggle_smooth_msg;
|
*toggle_backup_msg, *toggle_smooth_msg;
|
||||||
#if !defined(DISABLE_MOUSE) && defined(NCURSES_MOUSE_VERSION)
|
#if !defined(DISABLE_MOUSE) && defined(NCURSES_MOUSE_VERSION)
|
||||||
|
@ -242,7 +242,6 @@ void toggle_init(void)
|
||||||
toggle_autoindent_msg = _("Auto indent");
|
toggle_autoindent_msg = _("Auto indent");
|
||||||
toggle_suspend_msg = _("Suspend");
|
toggle_suspend_msg = _("Suspend");
|
||||||
toggle_nohelp_msg = _("Help mode");
|
toggle_nohelp_msg = _("Help mode");
|
||||||
toggle_picomode_msg = _("Pico mode");
|
|
||||||
#if !defined(DISABLE_MOUSE) && defined(NCURSES_MOUSE_VERSION)
|
#if !defined(DISABLE_MOUSE) && defined(NCURSES_MOUSE_VERSION)
|
||||||
toggle_mouse_msg = _("Mouse support");
|
toggle_mouse_msg = _("Mouse support");
|
||||||
#endif
|
#endif
|
||||||
|
@ -266,7 +265,6 @@ void toggle_init(void)
|
||||||
toggle_init_one(TOGGLE_AUTOINDENT_KEY, toggle_autoindent_msg, AUTOINDENT);
|
toggle_init_one(TOGGLE_AUTOINDENT_KEY, toggle_autoindent_msg, AUTOINDENT);
|
||||||
toggle_init_one(TOGGLE_SUSPEND_KEY, toggle_suspend_msg, SUSPEND);
|
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_NOHELP_KEY, toggle_nohelp_msg, NO_HELP);
|
||||||
toggle_init_one(TOGGLE_PICOMODE_KEY, toggle_picomode_msg, PICO_MODE);
|
|
||||||
#ifndef DISABLE_WRAPPING
|
#ifndef DISABLE_WRAPPING
|
||||||
toggle_init_one(TOGGLE_WRAP_KEY, toggle_wrap_msg, NO_WRAP);
|
toggle_init_one(TOGGLE_WRAP_KEY, toggle_wrap_msg, NO_WRAP);
|
||||||
#endif
|
#endif
|
||||||
|
@ -432,11 +430,9 @@ void shortcut_init(int unjustify)
|
||||||
IFHELP(nano_writeout_msg, 0),
|
IFHELP(nano_writeout_msg, 0),
|
||||||
NANO_WRITEOUT_FKEY, 0, NOVIEW, do_writeout_void);
|
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,
|
IFHELP(nano_justify_msg, 0), NANO_JUSTIFY_FKEY, 0,
|
||||||
NOVIEW, do_justify);
|
NOVIEW, do_justify);
|
||||||
else
|
|
||||||
|
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
/* this is so we can view multiple files */
|
/* this is so we can view multiple files */
|
||||||
|
@ -449,22 +445,6 @@ void shortcut_init(int unjustify)
|
||||||
NANO_INSERTFILE_FKEY, 0, NOVIEW, do_insertfile_void);
|
NANO_INSERTFILE_FKEY, 0, NOVIEW, do_insertfile_void);
|
||||||
#endif
|
#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"),
|
sc_init_one(&main_list, NANO_WHEREIS_KEY, _("Where Is"),
|
||||||
IFHELP(nano_whereis_msg, 0),
|
IFHELP(nano_whereis_msg, 0),
|
||||||
NANO_WHEREIS_FKEY, 0, VIEW, do_search);
|
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"),
|
sc_init_one(&main_list, NANO_TAB_KEY, _("Tab"),
|
||||||
IFHELP(nano_tab_msg, 0), 0, 0, NOVIEW, do_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),
|
IFHELP(nano_replace_msg, NANO_ALT_REPLACE_KEY),
|
||||||
NANO_REPLACE_FKEY, 0, NOVIEW, do_replace);
|
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"),
|
sc_init_one(&main_list, NANO_ENTER_KEY, _("Enter"),
|
||||||
IFHELP(nano_enter_msg, 0),
|
IFHELP(nano_enter_msg, 0),
|
||||||
|
|
7
nano.c
7
nano.c
|
@ -3007,7 +3007,6 @@ int main(int argc, char *argv[])
|
||||||
int startline = 0; /* Line to try and start at */
|
int startline = 0; /* Line to try and start at */
|
||||||
int keyhandled; /* Have we handled the keystroke yet? */
|
int keyhandled; /* Have we handled the keystroke yet? */
|
||||||
int modify_control_seq;
|
int modify_control_seq;
|
||||||
const char *argv0;
|
|
||||||
const shortcut *s;
|
const shortcut *s;
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
const toggle *t;
|
const toggle *t;
|
||||||
|
@ -3228,7 +3227,6 @@ int main(int argc, char *argv[])
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case 'p':
|
case 'p':
|
||||||
SET(PICO_MODE);
|
|
||||||
break;
|
break;
|
||||||
#ifndef DISABLE_WRAPJUSTIFY
|
#ifndef DISABLE_WRAPJUSTIFY
|
||||||
case 'r':
|
case 'r':
|
||||||
|
@ -3285,11 +3283,6 @@ int main(int argc, char *argv[])
|
||||||
filename = charalloc(1);
|
filename = charalloc(1);
|
||||||
filename[0] = '\0';
|
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
|
/* See if there's a non-option in argv (first non-option is the
|
||||||
filename, if +LINE is not given) */
|
filename, if +LINE is not given) */
|
||||||
|
|
1
nano.h
1
nano.h
|
@ -222,7 +222,6 @@ typedef struct historyheadtype {
|
||||||
#define MARK_ISSET (1<<3)
|
#define MARK_ISSET (1<<3)
|
||||||
#define CONSTUPDATE (1<<4)
|
#define CONSTUPDATE (1<<4)
|
||||||
#define NO_HELP (1<<5)
|
#define NO_HELP (1<<5)
|
||||||
#define PICO_MODE (1<<6)
|
|
||||||
#define NOFOLLOW_SYMLINKS (1<<7)
|
#define NOFOLLOW_SYMLINKS (1<<7)
|
||||||
#define SUSPEND (1<<8)
|
#define SUSPEND (1<<8)
|
||||||
#define NO_WRAP (1<<9)
|
#define NO_WRAP (1<<9)
|
||||||
|
|
1
rcfile.c
1
rcfile.c
|
@ -67,7 +67,6 @@ const static rcoption rcopts[] = {
|
||||||
#ifndef DISABLE_OPERATINGDIR
|
#ifndef DISABLE_OPERATINGDIR
|
||||||
{"operatingdir", 0},
|
{"operatingdir", 0},
|
||||||
#endif
|
#endif
|
||||||
{"pico", PICO_MODE},
|
|
||||||
#ifndef DISABLE_JUSTIFY
|
#ifndef DISABLE_JUSTIFY
|
||||||
{"quotestr", 0},
|
{"quotestr", 0},
|
||||||
#endif
|
#endif
|
||||||
|
|
74
search.c
74
search.c
|
@ -118,23 +118,6 @@ int search_init(int replacing)
|
||||||
UNSET(CLEAR_BACKUPSTRING);
|
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)
|
if (backupstring == NULL)
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
backupstring = mallocstrcpy(backupstring, search_history.current->data);
|
backupstring = mallocstrcpy(backupstring, search_history.current->data);
|
||||||
|
@ -143,15 +126,13 @@ int search_init(int replacing)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* NEW TEST */
|
/* NEW TEST */
|
||||||
if (ISSET(PICO_MODE)) {
|
|
||||||
backupstring = mallocstrcpy(backupstring, "");
|
backupstring = mallocstrcpy(backupstring, "");
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
search_history.current = (historytype *)&search_history.next;
|
search_history.current = (historytype *)&search_history.next;
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
/* */
|
|
||||||
/* If using Pico messages, we do things the old fashioned way... */
|
/* 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);
|
buf = charalloc(COLS / 3 + 7);
|
||||||
/* We use COLS / 3 here because we need to see more on the line */
|
/* We use COLS / 3 here because we need to see more on the line */
|
||||||
sprintf(buf, " [%.*s%s]", COLS / 3, last_search,
|
sprintf(buf, " [%.*s%s]", COLS / 3, last_search,
|
||||||
|
@ -204,7 +185,7 @@ int search_init(int replacing)
|
||||||
if (ISSET(USE_REGEXP))
|
if (ISSET(USE_REGEXP))
|
||||||
/* If we're in Pico mode, and answer is "", use
|
/* If we're in Pico mode, and answer is "", use
|
||||||
last_search! */
|
last_search! */
|
||||||
regexp_init(ISSET(PICO_MODE) ? last_search : answer);
|
regexp_init(last_search);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 0: /* They entered something new */
|
case 0: /* They entered something new */
|
||||||
|
@ -435,19 +416,7 @@ int do_search(void)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The sneaky user deleted the previous search string */
|
/* If answer is now == "", copy last_search into answer... */
|
||||||
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[0] == '\0')
|
if (answer[0] == '\0')
|
||||||
answer = mallocstrcpy(answer, last_search);
|
answer = mallocstrcpy(answer, last_search);
|
||||||
else
|
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);
|
answer = mallocstrcpy(answer, last_replace);
|
||||||
|
|
||||||
last_replace = mallocstrcpy(last_replace, answer);
|
last_replace = mallocstrcpy(last_replace, answer);
|
||||||
|
@ -746,15 +715,8 @@ int do_replace(void)
|
||||||
update_history(&search_history, answer);
|
update_history(&search_history, answer);
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_SMALL */
|
||||||
|
|
||||||
/* Again, there was a previous string, but they deleted it and hit enter */
|
/* If answer is now == "", copy last_search into answer
|
||||||
if (!ISSET(PICO_MODE) && answer[0] == '\0') {
|
(and prevanswer)... */
|
||||||
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[0] == '\0')
|
if (answer[0] == '\0')
|
||||||
answer = mallocstrcpy(answer, last_search);
|
answer = mallocstrcpy(answer, last_search);
|
||||||
else
|
else
|
||||||
|
@ -762,35 +724,17 @@ int do_replace(void)
|
||||||
|
|
||||||
prevanswer = mallocstrcpy(prevanswer, last_search);
|
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,
|
|
||||||
#endif
|
|
||||||
_("Replace with [%s]") ,last_replace);
|
|
||||||
} else {
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
replace_history.current = (historytype *)&replace_history.next;
|
replace_history.current = (historytype *)&replace_history.next;
|
||||||
last_replace = mallocstrcpy(last_replace, "");
|
last_replace = mallocstrcpy(last_replace, "");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
i = statusq(0, replace_list_2, last_replace,
|
i = statusq(0, replace_list_2, last_replace,
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
&replace_history,
|
&replace_history,
|
||||||
#endif
|
#endif
|
||||||
_("Replace with"));
|
_("Replace with"));
|
||||||
}
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
if (i == 0 && strcmp(answer, ""))
|
if (i == 0 && strcmp(answer, ""))
|
||||||
update_history(&replace_history, answer);
|
update_history(&replace_history, answer);
|
||||||
|
|
2
winio.c
2
winio.c
|
@ -464,7 +464,7 @@ int nanogetstr(int allowtabs, const char *buf, const char *def,
|
||||||
} /* while (kbinput ...) */
|
} /* while (kbinput ...) */
|
||||||
|
|
||||||
/* In Pico mode, just check for a blank answer here */
|
/* In Pico mode, just check for a blank answer here */
|
||||||
if (ISSET(PICO_MODE) && answer[0] == '\0')
|
if (answer[0] == '\0')
|
||||||
return -2;
|
return -2;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue