Made previous s/r values editable text

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@250 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Chris Allegretta 2000-10-31 05:10:10 +00:00
parent f754eaadd2
commit 105da33276
9 changed files with 168 additions and 171 deletions

View File

@ -1,9 +1,13 @@
CVS Code -
- Ran source through indent -kr again. Make everything pretty.
- Added "replace with null" option. ^N in replace. New alias
NANO_NULL_KEY, and code in do_replace to check for it. Readded
NANO_NULL_KEY case to search_init code.
- Changed behavior of "search" and "replace" prompts to make all
previous values editable. This change was made so that you can
replace with the null string without needing a special key for it.
changed code in search_init(), do_replace(), nanogetstr (see below).
- global.c
- New global replace_list_2, for 2nd half of the replace dialog
("Replace with:"), has fewer options than first half because
they were inapropriate.
toggle_init()
- Added #ifdef around toggle_regex_msg to get rid of compiler
warning.
@ -23,12 +27,15 @@ CVS Code -
- Removed redundant code involving processing replacemenet string.
Converted if statements to switch statements.
- Optimizations by Rocco Corsi.
- Removed code for deleted shortcuts from in replace_list_2.
do_search()
- Converted if statements to one switch statement.
- winio.c
nanogetstr()
- Added check for 343 in while loop to get rid of getting "locked"
into statusbar" bug in odd $TERMs like iris-ansi.
- Changed check to return -2 on "enter" from answer == ""
to answer == def.
nanoget_repaint()
- New function, removes about 30 lines of duplicate code in
nanogetstr().

View File

@ -74,6 +74,7 @@ int mark_beginx; /* X value in the string to start */
shortcut main_list[MAIN_LIST_LEN];
shortcut whereis_list[WHEREIS_LIST_LEN];
shortcut replace_list[REPLACE_LIST_LEN];
shortcut replace_list_2[REPLACE_LIST_LEN]; /* 2nd half of replace dialog */
shortcut goto_list[GOTO_LIST_LEN];
shortcut writefile_list[WRITEFILE_LIST_LEN];
shortcut help_list[HELP_LIST_LEN];
@ -361,10 +362,21 @@ void shortcut_init(void)
_("Goto Line"), nano_goto_msg, 0, 0, 0, VIEW,
do_gotoline_void);
sc_init_one(&replace_list[5], NANO_NULL_KEY, _("Null Str"),
sc_init_one(&replace_list[5], NANO_CANCEL_KEY, _("Cancel"),
nano_cancel_msg, 0, 0, 0, VIEW, 0);
sc_init_one(&replace_list_2[0], NANO_FIRSTLINE_KEY, _("First Line"),
nano_firstline_msg, 0, 0, 0, VIEW, do_first_line);
sc_init_one(&replace_list_2[1], NANO_LASTLINE_KEY, _("Last Line"),
nano_lastline_msg, 0, 0, 0, VIEW, do_last_line);
sc_init_one(&replace_list_2[2], NANO_NULL_KEY, _("Null Str"),
nano_null_msg, 0, 0, 0, VIEW, 0);
sc_init_one(&replace_list[6], NANO_CANCEL_KEY, _("Cancel"),
sc_init_one(&replace_list_2[3], NANO_CANCEL_KEY, _("Cancel"),
nano_cancel_msg, 0, 0, 0, VIEW, 0);

3
nano.h
View File

@ -240,7 +240,8 @@ know what you're doing */
#define MAIN_LIST_LEN 26
#define MAIN_VISIBLE 12
#define WHEREIS_LIST_LEN 6
#define REPLACE_LIST_LEN 7
#define REPLACE_LIST_LEN 6
#define REPLACE_LIST_2_LEN 4
#define GOTO_LIST_LEN 3
#define WRITEFILE_LIST_LEN 1
#define HELP_LIST_LEN 3

View File

@ -209,30 +209,28 @@ Usage: nano [option] +LINE <file>\n\
{"Replaced %d occurences", 176},
{"Replaced 1 occurence", 177},
{"Replace Cancelled", 178},
{"Nothing Happens", 179},
{"Replace with [%s]", 180},
{"Replace with", 181},
{"Replace this instance?", 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},
{"Replace with", 179},
{"Replace this instance?", 180},
{"Enter line number", 181},
{"Aborted", 182},
{"Come on, be reasonable", 183},
{"Only %d lines available, skipping to last line", 184},
{"actual_x_from_start for xplus=%d returned %d\n", 185},
{"input '%c' (%d)\n", 186},
{"New Buffer", 187},
{" File: ...", 188},
{"Modified", 189},
{"Moved to (%d, %d) in edit buffer\n", 190},
{"current->data = \"%s\"\n", 191},
{"I got \"%s\"\n", 192},
{"Yes", 193},
{"All", 194},
{"No", 195},
{"do_cursorpos: linepct = %f, bytepct = %f\n", 196},
{"line %d of %d (%.0f%%), character %d of %d (%.0f%%)", 197},
{"Dumping file buffer to stderr...\n", 198},
{"Dumping cutbuffer to stderr...\n", 199},
{"Dumping a buffer to stderr...\n", 200},
};
int _msg_tbl_length = 202;
int _msg_tbl_length = 200;

BIN
po/es.gmo

Binary file not shown.

View File

@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2000-10-27 01:45-0400\n"
"POT-Creation-Date: 2000-10-31 00:04-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"
@ -107,292 +107,292 @@ msgstr ""
msgid "File exists, OVERWRITE ?"
msgstr ""
#: global.c:123
#: global.c:124
msgid "Constant cursor position"
msgstr ""
#: global.c:124
#: global.c:125
msgid "Auto indent"
msgstr ""
#: global.c:125
#: global.c:126
msgid "Suspend"
msgstr ""
#: global.c:126
#: global.c:127
msgid "Help mode"
msgstr ""
#: global.c:127
#: global.c:128
msgid "Pico messages"
msgstr ""
#: global.c:128
#: global.c:129
msgid "Mouse support"
msgstr ""
#: global.c:129
#: global.c:130
msgid "Cut to end"
msgstr ""
#: global.c:131
#: global.c:132
msgid "Regular expressions"
msgstr ""
#: global.c:133
#: global.c:134
msgid "Auto wrap"
msgstr ""
#: global.c:175
#: global.c:176
msgid "Invoke the help menu"
msgstr ""
#: global.c:176
#: global.c:177
msgid "Write the current file to disk"
msgstr ""
#: global.c:177
#: global.c:178
msgid "Exit from nano"
msgstr ""
#: global.c:178
#: global.c:179
msgid "Goto a specific line number"
msgstr ""
#: global.c:179
#: global.c:180
msgid "Justify the current paragraph"
msgstr ""
#: global.c:180
#: global.c:181
msgid "Replace text within the editor"
msgstr ""
#: global.c:181
#: global.c:182
msgid "Insert another file into the current one"
msgstr ""
#: global.c:182
#: global.c:183
msgid "Search for text within the editor"
msgstr ""
#: global.c:183
#: global.c:184
msgid "Move to the previous screen"
msgstr ""
#: global.c:184
#: global.c:185
msgid "Move to the next screen"
msgstr ""
#: global.c:185
#: global.c:186
msgid "Cut the current line and store it in the cutbuffer"
msgstr ""
#: global.c:186
#: global.c:187
msgid "Uncut from the cutbuffer into the current line"
msgstr ""
#: global.c:187
#: global.c:188
msgid "Show the posititon of the cursor"
msgstr ""
#: global.c:188
#: global.c:189
msgid "Invoke the spell checker (if available)"
msgstr ""
#: global.c:189
#: global.c:190
msgid "Move up one line"
msgstr ""
#: global.c:190
#: global.c:191
msgid "Move down one line"
msgstr ""
#: global.c:191
#: global.c:192
msgid "Move forward one character"
msgstr ""
#: global.c:192
#: global.c:193
msgid "Move back one character"
msgstr ""
#: global.c:193
#: global.c:194
msgid "Move to the beginning of the current line"
msgstr ""
#: global.c:194
#: global.c:195
msgid "Move to the end of the current line"
msgstr ""
#: global.c:195
#: global.c:196
msgid "Go to the first line of the file"
msgstr ""
#: global.c:196
#: global.c:197
msgid "Go to the last line of the file"
msgstr ""
#: global.c:197
#: global.c:198
msgid "Refresh (redraw) the current screen"
msgstr ""
#: global.c:198
#: global.c:199
msgid "Mark text at the current cursor location"
msgstr ""
#: global.c:199
#: global.c:200
msgid "Delete the character under the cursor"
msgstr ""
#: global.c:201
#: global.c:202
msgid "Delete the character to the left of the cursor"
msgstr ""
#: global.c:202
#: global.c:203
msgid "Insert a tab character"
msgstr ""
#: global.c:203
#: global.c:204
msgid "Insert a carriage return at the cursor position"
msgstr ""
#: global.c:205
#: global.c:206
msgid "Make the current search or replace case (in)sensitive"
msgstr ""
#: global.c:206
#: global.c:207
msgid "Cancel the current function"
msgstr ""
#: global.c:207
#: global.c:208
msgid "Use the null string, \"\""
msgstr ""
#: global.c:211 global.c:323 global.c:400
#: global.c:212 global.c:324 global.c:412
msgid "Get Help"
msgstr ""
#: global.c:214 global.c:222
#: global.c:215 global.c:223
msgid "WriteOut"
msgstr ""
#: global.c:218 global.c:389
#: global.c:219 global.c:401
msgid "Exit"
msgstr ""
#: global.c:226 global.c:319 global.c:341 global.c:361
#: global.c:227 global.c:320 global.c:342 global.c:362
msgid "Goto Line"
msgstr ""
#: global.c:231 global.c:310
#: global.c:232 global.c:311
msgid "Justify"
msgstr ""
#: global.c:235 global.c:306 global.c:337
#: global.c:236 global.c:307 global.c:338
msgid "Replace"
msgstr ""
#: global.c:239
#: global.c:240
msgid "Read File"
msgstr ""
#: global.c:243
#: global.c:244
msgid "Where Is"
msgstr ""
#: global.c:247 global.c:381
#: global.c:248 global.c:393
msgid "Prev Page"
msgstr ""
#: global.c:251 global.c:385
#: global.c:252 global.c:397
msgid "Next Page"
msgstr ""
#: global.c:255
#: global.c:256
msgid "Cut Text"
msgstr ""
#: global.c:258
#: global.c:259
msgid "UnCut Txt"
msgstr ""
#: global.c:262
#: global.c:263
msgid "Cur Pos"
msgstr ""
#: global.c:266
#: global.c:267
msgid "To Spell"
msgstr ""
#: global.c:270
#: global.c:271
msgid "Up"
msgstr ""
#: global.c:273
#: global.c:274
msgid "Down"
msgstr ""
#: global.c:276
#: global.c:277
msgid "Forward"
msgstr ""
#: global.c:279
#: global.c:280
msgid "Back"
msgstr ""
#: global.c:282
#: global.c:283
msgid "Home"
msgstr ""
#: global.c:285
#: global.c:286
msgid "End"
msgstr ""
#: global.c:288
#: global.c:289
msgid "Refresh"
msgstr ""
#: global.c:291
#: global.c:292
msgid "Mark Text"
msgstr ""
#: global.c:294
#: global.c:295
msgid "Delete"
msgstr ""
#: global.c:298
#: global.c:299
msgid "Backspace"
msgstr ""
#: global.c:302
#: global.c:303
msgid "Tab"
msgstr ""
#: global.c:314
#: global.c:315
msgid "Enter"
msgstr ""
#: global.c:327 global.c:348 global.c:371
#: global.c:328 global.c:349 global.c:370 global.c:383
msgid "First Line"
msgstr ""
#: global.c:330 global.c:351 global.c:374
#: global.c:331 global.c:352 global.c:373 global.c:386
msgid "Last Line"
msgstr ""
#: global.c:333 global.c:354
#: global.c:334 global.c:355
msgid "Case Sens"
msgstr ""
#: global.c:344 global.c:367 global.c:377 global.c:393 global.c:397
#: global.c:403 winio.c:971
#: global.c:345 global.c:365 global.c:379 global.c:389 global.c:405
#: global.c:409 global.c:415 winio.c:974
msgid "Cancel"
msgstr ""
#: global.c:357
#: global.c:358
msgid "No Replace"
msgstr ""
#: global.c:364
#: global.c:376
msgid "Null Str"
msgstr ""
@ -733,31 +733,31 @@ msgstr ""
msgid "I got Alt-%c! (%d)\n"
msgstr ""
#: search.c:77
#: search.c:79
#, c-format
msgid "Case Sensitive Regexp Search%s%s"
msgstr ""
#: search.c:79
#: search.c:81
#, c-format
msgid "Regexp Search%s%s"
msgstr ""
#: search.c:81
#: search.c:83
#, c-format
msgid "Case Sensitive Search%s%s"
msgstr ""
#: search.c:83
#: search.c:85
#, c-format
msgid "Search%s%s"
msgstr ""
#: search.c:86
#: search.c:88
msgid " (to replace)"
msgstr ""
#: search.c:94
#: search.c:96
msgid "Search Cancelled"
msgstr ""
@ -774,43 +774,32 @@ msgstr ""
msgid "Replaced 1 occurence"
msgstr ""
#: search.c:396 search.c:429
#: search.c:396 search.c:427
msgid "Replace Cancelled"
msgstr ""
#. They used ^N in the search field, shame on them.
#. Any Dungeon fans out there?
#: search.c:413
msgid "Nothing Happens"
msgstr ""
#: search.c:421
#, c-format
msgid "Replace with [%s]"
msgstr ""
#: search.c:423
msgid "Replace with"
msgstr ""
#: search.c:474
#: search.c:461
msgid "Replace this instance?"
msgstr ""
#. Ask for it
#: search.c:535
#: search.c:522
msgid "Enter line number"
msgstr ""
#: search.c:537
#: search.c:524
msgid "Aborted"
msgstr ""
#: search.c:557
#: search.c:544
msgid "Come on, be reasonable"
msgstr ""
#: search.c:562
#: search.c:549
#, c-format
msgid "Only %d lines available, skipping to last line"
msgstr ""
@ -825,62 +814,62 @@ msgstr ""
msgid "input '%c' (%d)\n"
msgstr ""
#: winio.c:424
#: winio.c:427
msgid "New Buffer"
msgstr ""
#: winio.c:427
#: winio.c:430
msgid " File: ..."
msgstr ""
#: winio.c:435
#: winio.c:438
msgid "Modified"
msgstr ""
#: winio.c:887
#: winio.c:890
#, c-format
msgid "Moved to (%d, %d) in edit buffer\n"
msgstr ""
#: winio.c:898
#: winio.c:901
#, c-format
msgid "current->data = \"%s\"\n"
msgstr ""
#: winio.c:941
#: winio.c:944
#, c-format
msgid "I got \"%s\"\n"
msgstr ""
#: winio.c:966
#: winio.c:969
msgid "Yes"
msgstr ""
#: winio.c:968
#: winio.c:971
msgid "All"
msgstr ""
#: winio.c:970
#: winio.c:973
msgid "No"
msgstr ""
#: winio.c:1107
#: winio.c:1110
#, c-format
msgid "do_cursorpos: linepct = %f, bytepct = %f\n"
msgstr ""
#: winio.c:1111
#: winio.c:1114
msgid "line %d of %d (%.0f%%), character %d of %d (%.0f%%)"
msgstr ""
#: winio.c:1239
#: winio.c:1242
msgid "Dumping file buffer to stderr...\n"
msgstr ""
#: winio.c:1241
#: winio.c:1244
msgid "Dumping cutbuffer to stderr...\n"
msgstr ""
#: winio.c:1243
#: winio.c:1246
msgid "Dumping a buffer to stderr...\n"
msgstr ""

View File

@ -47,7 +47,7 @@ extern shortcut *shortcut_list;
extern shortcut main_list[MAIN_LIST_LEN], whereis_list[WHEREIS_LIST_LEN];
extern shortcut replace_list[REPLACE_LIST_LEN], goto_list[GOTO_LIST_LEN];
extern shortcut writefile_list[WRITEFILE_LIST_LEN], help_list[HELP_LIST_LEN];
extern shortcut spell_list[SPELL_LIST_LEN];
extern shortcut spell_list[SPELL_LIST_LEN], replace_list_2[REPLACE_LIST_LEN];
#ifdef HAVE_REGEX_H
extern int use_regexp, regexp_compiled;

View File

@ -64,14 +64,16 @@ void regexp_cleanup()
int search_init(int replacing)
{
int i;
char buf[BUFSIZ];
/* char buf[BUFSIZ]; */
char *prompt, *reprompt = "";
/*
if (last_search[0]) {
snprintf(buf, BUFSIZ, " [%s]", last_search);
} else {
buf[0] = '\0';
}
*/
if (ISSET(USE_REGEXP) && ISSET(CASE_SENSITIVE))
prompt = _("Case Sensitive Regexp Search%s%s");
@ -86,8 +88,8 @@ int search_init(int replacing)
reprompt = _(" (to replace)");
i = statusq(replacing ? replace_list : whereis_list,
replacing ? REPLACE_LIST_LEN : WHEREIS_LIST_LEN, "",
prompt, reprompt, buf);
replacing ? REPLACE_LIST_LEN : WHEREIS_LIST_LEN, last_search,
prompt, reprompt, "");
/* Cancel any search, or just return with no previous search */
if ((i == -1) || (i < 0 && !last_search[0])) {
@ -121,9 +123,7 @@ int search_init(int replacing)
} else if (i == NANO_FROMSEARCHTOGOTO_KEY) {
do_gotoline_void();
return -3;
} else if (i == NANO_NULL_KEY) /* They hit ^N! */
strncpy(last_search, "", 132);
else { /* First line key, etc. */
} else { /* First line key, etc. */
do_early_abort();
return -3;
}
@ -407,20 +407,18 @@ int do_replace(void)
return 0;
}
if (!strcmp(answer, "")) {
/* They used ^N in the search field, shame on them.
Any Dungeon fans out there? */
statusbar(_("Nothing Happens"));
replace_abort();
return 0;
}
strncpy(prevanswer, answer, 132);
if (strcmp(last_replace, "")) /* There's a previous replace str */
i = statusq(replace_list, REPLACE_LIST_LEN, "",
/*
if (strcmp(last_replace, "")) * There's a previous replace str *
i = statusq(replace_list_2, REPLACE_LIST_2_LEN, "",
_("Replace with [%s]"), last_replace);
else
i = statusq(replace_list, REPLACE_LIST_LEN, "", _("Replace with"));
i = statusq(replace_list_2, REPLACE_LIST_2_LEN, "", _("Replace with"));
*/
i = statusq(replace_list_2, REPLACE_LIST_2_LEN, last_replace,
_("Replace with"));
switch (i) {
case -1: /* Aborted enter */
@ -435,17 +433,6 @@ int do_replace(void)
case NANO_NULL_KEY: /* They want the null string */
strcpy(last_replace, "");
break;
case NANO_CASE_KEY: /* They asked for case sensitivity */
if (ISSET(CASE_SENSITIVE))
UNSET(CASE_SENSITIVE);
else
SET(CASE_SENSITIVE);
do_replace();
return 0;
case NANO_FROMSEARCHTOGOTO_KEY: /* Oops, they want goto line... */
do_gotoline_void();
return 0;
default:
if (i != -2) { /* First page, last page, for example
could get here */

View File

@ -395,7 +395,10 @@ int nanogetstr(char *buf, char *def, shortcut s[], int slen, int start_x)
strncpy(answer, inputbuf, 132);
if (!strcmp(answer, ""))
/* Now that the text is editable instead of bracketed, we have to
check for answer == def, instead of answer == "" */
/* if (!strcmp(answer, "")) */
if (!strcmp(answer, def))
return -2;
else
return 0;