Use old-style editing with PICO_MSGS enabled
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@265 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
67574f483e
commit
71844ba03a
|
@ -13,6 +13,7 @@ CVS Code -
|
|||
nightmare, changed last_search, last_replace, answer to
|
||||
pointers. New function not_found_msg in search.c for displaying
|
||||
truncated strings in satusbar when the string is not found.
|
||||
We disable this feature when using PICO_MSGS (-p).
|
||||
- files.c:
|
||||
do_writeout()
|
||||
- Change strcpy to answer to mallocstrcpy.
|
||||
|
|
|
@ -209,29 +209,30 @@ Usage: nano [option] +LINE <file>\n\
|
|||
{"Replaced %d occurences", 176},
|
||||
{"Replaced 1 occurence", 177},
|
||||
{"Replace Cancelled", 178},
|
||||
{"Replace with", 179},
|
||||
{"Replace this instance?", 180},
|
||||
{"Replace failed: unknown subexpression!", 181},
|
||||
{"Enter line number", 182},
|
||||
{"Aborted", 183},
|
||||
{"Come on, be reasonable", 184},
|
||||
{"Only %d lines available, skipping to last line", 185},
|
||||
{"actual_x_from_start for xplus=%d returned %d\n", 186},
|
||||
{"input '%c' (%d)\n", 187},
|
||||
{"New Buffer", 188},
|
||||
{" File: ...", 189},
|
||||
{"Modified", 190},
|
||||
{"Moved to (%d, %d) in edit buffer\n", 191},
|
||||
{"current->data = \"%s\"\n", 192},
|
||||
{"I got \"%s\"\n", 193},
|
||||
{"Yes", 194},
|
||||
{"All", 195},
|
||||
{"No", 196},
|
||||
{"do_cursorpos: linepct = %f, bytepct = %f\n", 197},
|
||||
{"line %d of %d (%.0f%%), character %d of %d (%.0f%%)", 198},
|
||||
{"Dumping file buffer to stderr...\n", 199},
|
||||
{"Dumping cutbuffer to stderr...\n", 200},
|
||||
{"Dumping a buffer to stderr...\n", 201},
|
||||
{"Replace with [%s]", 179},
|
||||
{"Replace with", 180},
|
||||
{"Replace this instance?", 181},
|
||||
{"Replace failed: unknown subexpression!", 182},
|
||||
{"Enter line number", 183},
|
||||
{"Aborted", 184},
|
||||
{"Come on, be reasonable", 185},
|
||||
{"Only %d lines available, skipping to last line", 186},
|
||||
{"actual_x_from_start for xplus=%d returned %d\n", 187},
|
||||
{"input '%c' (%d)\n", 188},
|
||||
{"New Buffer", 189},
|
||||
{" File: ...", 190},
|
||||
{"Modified", 191},
|
||||
{"Moved to (%d, %d) in edit buffer\n", 192},
|
||||
{"current->data = \"%s\"\n", 193},
|
||||
{"I got \"%s\"\n", 194},
|
||||
{"Yes", 195},
|
||||
{"All", 196},
|
||||
{"No", 197},
|
||||
{"do_cursorpos: linepct = %f, bytepct = %f\n", 198},
|
||||
{"line %d of %d (%.0f%%), character %d of %d (%.0f%%)", 199},
|
||||
{"Dumping file buffer to stderr...\n", 200},
|
||||
{"Dumping cutbuffer to stderr...\n", 201},
|
||||
{"Dumping a buffer to stderr...\n", 202},
|
||||
};
|
||||
|
||||
int _msg_tbl_length = 201;
|
||||
int _msg_tbl_length = 202;
|
||||
|
|
75
po/nano.pot
75
po/nano.pot
|
@ -6,7 +6,7 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2000-11-02 20:48-0500\n"
|
||||
"POT-Creation-Date: 2000-11-03 09:21-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"
|
||||
|
@ -32,7 +32,7 @@ msgstr ""
|
|||
msgid "Read %d lines"
|
||||
msgstr ""
|
||||
|
||||
#: files.c:217 search.c:148
|
||||
#: files.c:217 search.c:163
|
||||
#, c-format
|
||||
msgid "\"%s\" not found"
|
||||
msgstr ""
|
||||
|
@ -380,7 +380,7 @@ msgid "Case Sens"
|
|||
msgstr ""
|
||||
|
||||
#: global.c:344 global.c:364 global.c:375 global.c:385 global.c:401
|
||||
#: global.c:405 global.c:411 winio.c:992
|
||||
#: global.c:405 global.c:411 winio.c:993
|
||||
msgid "Cancel"
|
||||
msgstr ""
|
||||
|
||||
|
@ -729,82 +729,87 @@ msgstr ""
|
|||
msgid "I got Alt-%c! (%d)\n"
|
||||
msgstr ""
|
||||
|
||||
#: search.c:88
|
||||
#: search.c:98
|
||||
#, c-format
|
||||
msgid "Case Sensitive Regexp Search%s%s"
|
||||
msgstr ""
|
||||
|
||||
#: search.c:90
|
||||
#: search.c:100
|
||||
#, c-format
|
||||
msgid "Regexp Search%s%s"
|
||||
msgstr ""
|
||||
|
||||
#: search.c:92
|
||||
#: search.c:102
|
||||
#, c-format
|
||||
msgid "Case Sensitive Search%s%s"
|
||||
msgstr ""
|
||||
|
||||
#: search.c:94
|
||||
#: search.c:104
|
||||
#, c-format
|
||||
msgid "Search%s%s"
|
||||
msgstr ""
|
||||
|
||||
#: search.c:97
|
||||
#: search.c:107
|
||||
msgid " (to replace)"
|
||||
msgstr ""
|
||||
|
||||
#: search.c:105 search.c:274
|
||||
#: search.c:120 search.c:289
|
||||
msgid "Search Cancelled"
|
||||
msgstr ""
|
||||
|
||||
#: search.c:152
|
||||
#: search.c:167
|
||||
#, c-format
|
||||
msgid "\"%s...\" not found"
|
||||
msgstr ""
|
||||
|
||||
#: search.c:199
|
||||
#: search.c:214
|
||||
msgid "Search Wrapped"
|
||||
msgstr ""
|
||||
|
||||
#: search.c:288
|
||||
#: search.c:303
|
||||
#, c-format
|
||||
msgid "Replaced %d occurences"
|
||||
msgstr ""
|
||||
|
||||
#: search.c:290
|
||||
#: search.c:305
|
||||
msgid "Replaced 1 occurence"
|
||||
msgstr ""
|
||||
|
||||
#: search.c:426 search.c:442 search.c:456
|
||||
#: search.c:441 search.c:457 search.c:488
|
||||
msgid "Replace Cancelled"
|
||||
msgstr ""
|
||||
|
||||
#: search.c:450
|
||||
#: search.c:474
|
||||
#, c-format
|
||||
msgid "Replace with [%s]"
|
||||
msgstr ""
|
||||
|
||||
#: search.c:478 search.c:482
|
||||
msgid "Replace with"
|
||||
msgstr ""
|
||||
|
||||
#: search.c:487
|
||||
#: search.c:519
|
||||
msgid "Replace this instance?"
|
||||
msgstr ""
|
||||
|
||||
#: search.c:495
|
||||
#: search.c:527
|
||||
msgid "Replace failed: unknown subexpression!"
|
||||
msgstr ""
|
||||
|
||||
#. Ask for it
|
||||
#: search.c:548
|
||||
#: search.c:580
|
||||
msgid "Enter line number"
|
||||
msgstr ""
|
||||
|
||||
#: search.c:550
|
||||
#: search.c:582
|
||||
msgid "Aborted"
|
||||
msgstr ""
|
||||
|
||||
#: search.c:570
|
||||
#: search.c:602
|
||||
msgid "Come on, be reasonable"
|
||||
msgstr ""
|
||||
|
||||
#: search.c:575
|
||||
#: search.c:607
|
||||
#, c-format
|
||||
msgid "Only %d lines available, skipping to last line"
|
||||
msgstr ""
|
||||
|
@ -819,62 +824,62 @@ msgstr ""
|
|||
msgid "input '%c' (%d)\n"
|
||||
msgstr ""
|
||||
|
||||
#: winio.c:445
|
||||
#: winio.c:446
|
||||
msgid "New Buffer"
|
||||
msgstr ""
|
||||
|
||||
#: winio.c:448
|
||||
#: winio.c:449
|
||||
msgid " File: ..."
|
||||
msgstr ""
|
||||
|
||||
#: winio.c:456
|
||||
#: winio.c:457
|
||||
msgid "Modified"
|
||||
msgstr ""
|
||||
|
||||
#: winio.c:908
|
||||
#: winio.c:909
|
||||
#, c-format
|
||||
msgid "Moved to (%d, %d) in edit buffer\n"
|
||||
msgstr ""
|
||||
|
||||
#: winio.c:919
|
||||
#: winio.c:920
|
||||
#, c-format
|
||||
msgid "current->data = \"%s\"\n"
|
||||
msgstr ""
|
||||
|
||||
#: winio.c:962
|
||||
#: winio.c:963
|
||||
#, c-format
|
||||
msgid "I got \"%s\"\n"
|
||||
msgstr ""
|
||||
|
||||
#: winio.c:987
|
||||
#: winio.c:988
|
||||
msgid "Yes"
|
||||
msgstr ""
|
||||
|
||||
#: winio.c:989
|
||||
#: winio.c:990
|
||||
msgid "All"
|
||||
msgstr ""
|
||||
|
||||
#: winio.c:991
|
||||
#: winio.c:992
|
||||
msgid "No"
|
||||
msgstr ""
|
||||
|
||||
#: winio.c:1128
|
||||
#: winio.c:1129
|
||||
#, c-format
|
||||
msgid "do_cursorpos: linepct = %f, bytepct = %f\n"
|
||||
msgstr ""
|
||||
|
||||
#: winio.c:1132
|
||||
#: winio.c:1133
|
||||
msgid "line %d of %d (%.0f%%), character %d of %d (%.0f%%)"
|
||||
msgstr ""
|
||||
|
||||
#: winio.c:1260
|
||||
#: winio.c:1261
|
||||
msgid "Dumping file buffer to stderr...\n"
|
||||
msgstr ""
|
||||
|
||||
#: winio.c:1262
|
||||
#: winio.c:1263
|
||||
msgid "Dumping cutbuffer to stderr...\n"
|
||||
msgstr ""
|
||||
|
||||
#: winio.c:1264
|
||||
#: winio.c:1265
|
||||
msgid "Dumping a buffer to stderr...\n"
|
||||
msgstr ""
|
||||
|
|
54
search.c
54
search.c
|
@ -63,8 +63,8 @@ void regexp_cleanup()
|
|||
*/
|
||||
int search_init(int replacing)
|
||||
{
|
||||
int i;
|
||||
/* char buf[BUFSIZ]; */
|
||||
int i = 0;
|
||||
char *buf;
|
||||
char *prompt, *reprompt = "";
|
||||
|
||||
if (last_search == NULL) {
|
||||
|
@ -76,13 +76,23 @@ int search_init(int replacing)
|
|||
last_replace[0] = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
if (last_search[0]) {
|
||||
snprintf(buf, BUFSIZ, " [%s]", last_search);
|
||||
} else {
|
||||
buf[0] = '\0';
|
||||
buf = nmalloc(strlen(last_search) + 5);
|
||||
buf[0] = 0;
|
||||
|
||||
/* If using Pico messages, we do things the old fashioned way... */
|
||||
if (ISSET(PICO_MSGS)) {
|
||||
if (last_search[0]) {
|
||||
|
||||
/* We use COLS / 3 here because we need to see more on the line */
|
||||
if (strlen(last_search) > COLS / 3) {
|
||||
snprintf(buf, COLS / 3 + 3, " [%s", last_search);
|
||||
sprintf(&buf[COLS / 3 + 2], "...]");
|
||||
} else
|
||||
sprintf(buf, " [%s]", last_search);
|
||||
} else {
|
||||
buf[0] = '\0';
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if (ISSET(USE_REGEXP) && ISSET(CASE_SENSITIVE))
|
||||
prompt = _("Case Sensitive Regexp Search%s%s");
|
||||
|
@ -96,7 +106,12 @@ int search_init(int replacing)
|
|||
if (replacing)
|
||||
reprompt = _(" (to replace)");
|
||||
|
||||
i = statusq(replacing ? replace_list : whereis_list,
|
||||
if (ISSET(PICO_MSGS))
|
||||
i = statusq(replacing ? replace_list : whereis_list,
|
||||
replacing ? REPLACE_LIST_LEN : WHEREIS_LIST_LEN, "",
|
||||
prompt, reprompt, buf);
|
||||
else
|
||||
i = statusq(replacing ? replace_list : whereis_list,
|
||||
replacing ? REPLACE_LIST_LEN : WHEREIS_LIST_LEN, last_search,
|
||||
prompt, reprompt, "");
|
||||
|
||||
|
@ -418,7 +433,7 @@ int do_replace(void)
|
|||
{
|
||||
int i, replaceall = 0, numreplaced = 0, beginx;
|
||||
filestruct *fileptr, *begin;
|
||||
char *copy, *prevanswer = NULL;
|
||||
char *copy, *prevanswer = NULL, *buf = NULL;
|
||||
|
||||
i = search_init(1);
|
||||
switch (i) {
|
||||
|
@ -446,7 +461,24 @@ int do_replace(void)
|
|||
|
||||
prevanswer = mallocstrcpy(prevanswer, answer);
|
||||
|
||||
i = statusq(replace_list_2, REPLACE_LIST_2_LEN, last_replace,
|
||||
if (ISSET(PICO_MSGS)) {
|
||||
buf = nmalloc(strlen(last_replace) + 5);
|
||||
if (strcmp(last_replace, "")) {
|
||||
if (strlen(last_replace) > (COLS / 3)) {
|
||||
strncpy(buf, last_replace, COLS / 3);
|
||||
sprintf(&buf[COLS / 3 - 1], "...");
|
||||
} else
|
||||
sprintf(buf, "%s", last_replace);
|
||||
|
||||
i = statusq(replace_list_2, REPLACE_LIST_2_LEN, "",
|
||||
_("Replace with [%s]"), buf);
|
||||
}
|
||||
else
|
||||
i = statusq(replace_list_2, REPLACE_LIST_2_LEN, "",
|
||||
_("Replace with"));
|
||||
}
|
||||
else
|
||||
i = statusq(replace_list_2, REPLACE_LIST_2_LEN, last_replace,
|
||||
_("Replace with"));
|
||||
|
||||
switch (i) {
|
||||
|
|
3
winio.c
3
winio.c
|
@ -416,7 +416,8 @@ int nanogetstr(char *buf, char *def, shortcut s[], int slen, int start_x)
|
|||
|
||||
/* Now that the text is editable instead of bracketed, we have to
|
||||
check for answer == def, instead of answer == "" */
|
||||
if (!strcmp(answer, def))
|
||||
if (((ISSET(PICO_MSGS)) && !strcmp(answer, "")) ||
|
||||
((!ISSET(PICO_MSGS)) && !strcmp(answer, def)))
|
||||
return -2;
|
||||
else
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue