Replace with null string option, ran source through indent again

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@243 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
Chris Allegretta 2000-10-26 01:44:42 +00:00
parent a0e957bc0d
commit bd9e7c3c36
13 changed files with 594 additions and 574 deletions

2
BUGS
View File

@ -2,6 +2,7 @@
certain col values. (9) [FIXED]
- edit_refresh() and update_line() do not handle selecting text when the
cursor is beyond COLS (10) [FIXED]
- no way to do a replace with the empty string (11). [FIXED, yay!]
- Moving to the end of a line when close to a multiple of COLS and at
least COLS * 2 does not make the screen jump early like it would for
if we were around COLS (bugs in edit_refresh, update_line) (13)
@ -70,7 +71,6 @@
- Marked cutting sometimes leaves a newline in the file unintelligently,
such as when all of a line is selected but the mark doesn't proceed to
the new line. (8) { Is this an issue? compare to pico 3.5 }
- no way to do a replace with the empty string (11).
- Spelling support is not elegant like pico's integration of the 'spell'
program. Nano only uses ispell (for now) (12).
- In replace, there is no way to accept the default replace string. (27)

View File

@ -1,4 +1,7 @@
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.
- global.c
toggle_init()
- Added #ifdef around toggle_regex_msg to get rid of compiler

11
cut.c
View File

@ -157,15 +157,12 @@ int do_cut_text(void)
#ifndef NANO_SMALL
if (ISSET(CUT_TO_END) && !ISSET(MARK_ISSET)) {
if (current_x == strlen(current->data))
{
if (current_x == strlen(current->data)) {
do_delete();
SET(KEEP_CUTBUFFER);
marked_cut = 2;
return 1;
}
else
{
} else {
SET(MARK_ISSET);
SET(KEEP_CUTBUFFER);
@ -248,9 +245,9 @@ int do_cut_text(void)
current = fileptr->next;
totlines--;
totsize--; /* get the newline */
} /* No longer an else here, because we never get here anymore...
}
/* No longer an else here, because we never get here anymore...
No need to cut the magic line, as it's empty */
add_to_cutbuffer(fileptr);
}

10
files.c
View File

@ -346,7 +346,8 @@ int write_file(char *name, int tmp)
dump_buffer(fileage);
while (fileptr != NULL && fileptr->next != NULL) {
/* Next line is so we discount the "magic line" */
if(filebot == fileptr && fileptr->data[0] == '\0') break;
if (filebot == fileptr && fileptr->data[0] == '\0')
break;
size = write(fd, fileptr->data, strlen(fileptr->data));
if (size == -1) {
@ -446,14 +447,11 @@ int do_writeout(int exiting)
strncpy(answer, filename, 132);
if ((exiting) && (ISSET(TEMP_OPT))) {
if (filename[0])
{
if (filename[0]) {
i = write_file(answer, 0);
display_main_list();
return i;
}
else
{
} else {
UNSET(TEMP_OPT);
do_exit();

View File

@ -134,8 +134,8 @@ void toggle_init(void)
toggle_init_one(&toggles[0], TOGGLE_CONST_KEY, toggle_const_msg,
CONSTUPDATE);
toggle_init_one(&toggles[1], TOGGLE_AUTOINDENT_KEY, toggle_autoindent_msg,
AUTOINDENT);
toggle_init_one(&toggles[1], TOGGLE_AUTOINDENT_KEY,
toggle_autoindent_msg, AUTOINDENT);
toggle_init_one(&toggles[2], TOGGLE_SUSPEND_KEY, toggle_suspend_msg,
SUSPEND);
toggle_init_one(&toggles[3], TOGGLE_NOHELP_KEY, toggle_nohelp_msg,
@ -169,7 +169,7 @@ void shortcut_init(void)
"", *nano_mark_msg = "", *nano_delete_msg =
"", *nano_backspace_msg = "", *nano_tab_msg =
"", *nano_enter_msg = "", *nano_case_msg =
"", *nano_cancel_msg = "";
"", *nano_cancel_msg = "", *nano_null_msg = "";
#ifndef NANO_SMALL
nano_help_msg = _("Invoke the help menu");
@ -204,6 +204,7 @@ void shortcut_init(void)
nano_case_msg =
_("Make the current search or replace case (in)sensitive");
nano_cancel_msg = _("Cancel the current function");
nano_null_msg = _("Use the null string, \"\"");
#endif
if (ISSET(PICO_MSGS))
@ -336,8 +337,9 @@ void shortcut_init(void)
sc_init_one(&whereis_list[3], NANO_OTHERSEARCH_KEY, _("Replace"),
nano_replace_msg, 0, 0, 0, VIEW, do_replace);
sc_init_one(&whereis_list[4], NANO_FROMSEARCHTOGOTO_KEY, _("Goto Line"),
nano_goto_msg, 0, 0, 0, VIEW, do_gotoline_void);
sc_init_one(&whereis_list[4], NANO_FROMSEARCHTOGOTO_KEY,
_("Goto Line"), nano_goto_msg, 0, 0, 0, VIEW,
do_gotoline_void);
sc_init_one(&whereis_list[5], NANO_CANCEL_KEY, _("Cancel"),
nano_cancel_msg, 0, 0, 0, VIEW, 0);
@ -355,10 +357,14 @@ void shortcut_init(void)
sc_init_one(&replace_list[3], NANO_OTHERSEARCH_KEY, _("No Replace"),
nano_whereis_msg, 0, 0, 0, VIEW, do_search);
sc_init_one(&replace_list[4], NANO_FROMSEARCHTOGOTO_KEY, _("Goto Line"),
nano_goto_msg, 0, 0, 0, VIEW, do_gotoline_void);
sc_init_one(&replace_list[4], NANO_FROMSEARCHTOGOTO_KEY,
_("Goto Line"), nano_goto_msg, 0, 0, 0, VIEW,
do_gotoline_void);
sc_init_one(&replace_list[5], NANO_CANCEL_KEY, _("Cancel"),
sc_init_one(&replace_list[5], NANO_NULL_KEY, _("Null Str"),
nano_null_msg, 0, 0, 0, VIEW, 0);
sc_init_one(&replace_list[6], NANO_CANCEL_KEY, _("Cancel"),
nano_cancel_msg, 0, 0, 0, VIEW, 0);

61
nano.c
View File

@ -95,12 +95,12 @@ void die(char *msg, ...)
/* if we can't save we have REAL bad problems,
* but we might as well TRY. */
if(filename[0] == '\0') {
if (filename[0] == '\0') {
write_file("nano.save", 0);
} else {
char buf[BUFSIZ];
strncpy(buf,filename,BUFSIZ);
strncat(buf,".save",BUFSIZ - strlen(buf));
strncpy(buf, filename, BUFSIZ);
strncat(buf, ".save", BUFSIZ - strlen(buf));
write_file(buf, 0);
}
/* Restore the old term settings */
@ -399,7 +399,8 @@ void version(void)
{
printf(_(" nano version %s by Chris Allegretta (compiled %s, %s)\n"),
VERSION, __TIME__, __DATE__);
printf(_(" Email: nano@nano-editor.org Web: http://www.nano-editor.org\n"));
printf(_
(" Email: nano@nano-editor.org Web: http://www.nano-editor.org\n"));
}
filestruct *make_new_node(filestruct * prevnode)
@ -419,7 +420,7 @@ filestruct *make_new_node(filestruct * prevnode)
}
/* Splice a node into an existing filestruct */
void splice_node(filestruct *begin, filestruct *new, filestruct *end)
void splice_node(filestruct * begin, filestruct * new, filestruct * end)
{
new->next = end;
new->prev = begin;
@ -469,7 +470,7 @@ void do_char(char ch)
{
/* magic-line: when a character is inserted on the current magic line,
* it means we need a new one! */
if(filebot == current && current->data[0] == '\0') {
if (filebot == current && current->data[0] == '\0') {
new_magicline();
fix_editbot();
}
@ -763,7 +764,8 @@ void do_wrap(filestruct * inptr, char input_char)
right = current_x - current_word_start;
i = current_word_start - 1;
if (isspace((int)input_char) && (current_x == current_word_start)) {
if (isspace((int) input_char)
&& (current_x == current_word_start)) {
current_x = current_word_start;
null_at(inptr->data, current_word_start);
@ -877,7 +879,7 @@ void check_wrap(filestruct * inptr, char ch)
/* Do not wrap if there are no words on or after wrap point. */
int char_found = 0;
while (isspace((int)inptr->data[i]) && inptr->data[i])
while (isspace((int) inptr->data[i]) && inptr->data[i])
i++;
if (!inptr->data[i])
@ -1010,8 +1012,7 @@ int do_delete(void)
/* Please see the comment in do_basckspace if you don't understand
this test */
if (current == filebot && strcmp(current->data, ""))
{
if (current == filebot && strcmp(current->data, "")) {
new_magicline();
fix_editbot();
totsize++;
@ -1185,20 +1186,19 @@ void do_mouse(void)
}
current_x = mevent.x;
placewewant = current_x;
while(foo < current_x) {
if(current->data[foo] == NANO_CONTROL_I) {
while (foo < current_x) {
if (current->data[foo] == NANO_CONTROL_I) {
current_x -= tabsize - (foo % tabsize);
tab_found = 1;
} else if(current->data[foo] & 0x80)
;
else if(current->data[foo] < 32)
} else if (current->data[foo] & 0x80);
else if (current->data[foo] < 32)
current_x--;
foo++;
}
/* This is where tab_found comes in. I can't figure out why,
* but without it any line with a tab will place the cursor
* one character behind. Whatever, this fixes it. */
if(tab_found == 1)
if (tab_found == 1)
current_x++;
if (current_x > strlen(current->data))
@ -1227,7 +1227,7 @@ RETSIGTYPE do_suspend(int signal)
sigaction(SIGTSTP, &act, NULL);
endwin();
fprintf(stderr,"\n\n\n\n\nUse \"fg\" to return to nano\n");
fprintf(stderr, "\n\n\n\n\nUse \"fg\" to return to nano\n");
raise(SIGTSTP);
}
@ -1321,14 +1321,12 @@ void signal_init(void)
if (!ISSET(SUSPEND)) {
sigaction(SIGTSTP, &act, NULL);
}
else
{
} else {
act.sa_handler = do_suspend;
sigaction(SIGTSTP, &act, NULL);
act.sa_handler = do_cont;
sigaction (SIGCONT, &act, NULL);
sigaction(SIGCONT, &act, NULL);
}
@ -1350,8 +1348,7 @@ void window_init(void)
/* And the other windows */
topwin = newwin(2, COLS, 0, 0);
bottomwin = newwin(3 - no_help(), COLS, LINES - 3 + no_help(), 0);\
bottomwin = newwin(3 - no_help(), COLS, LINES - 3 + no_help(), 0);
}
void mouse_init(void)
@ -1365,8 +1362,7 @@ void mouse_init(void)
mousemask(BUTTON1_RELEASED, NULL);
mouseinterval(50);
}
else {
} else {
mousemask(0, NULL);
keypad(edit, FALSE);
keypad(bottomwin, FALSE);
@ -1500,7 +1496,7 @@ int do_justify(void)
slen = strlen(current->data);
totsize += slen;
if((strlenpt(current->data) > (fill))
if ((strlenpt(current->data) > (fill))
&& !no_spaces(current->data)) {
do {
int i = 0;
@ -1516,8 +1512,9 @@ int do_justify(void)
i = slen;
for (; i > 0; i--) {
if (isspace((int) current->data[i]) &&
((strlenpt(current->data) - strlen(current->data +i)) <=
fill)) break;
((strlenpt(current->data) - strlen(current->data + i))
<= fill))
break;
}
if (!i)
break;
@ -1632,7 +1629,7 @@ void help_init(void)
/* And the toggles... */
for (i = 0; i <= TOGGLE_LEN - 1; i++) {
sofar = snprintf(buf, BUFSIZ,
"M-%c ", toggles[i].val - 32 );
"M-%c ", toggles[i].val - 32);
if (toggles[i].desc != NULL)
snprintf(&buf[sofar], BUFSIZ - sofar, _("%s enable/disable"),
@ -1946,12 +1943,10 @@ int main(int argc, char *argv[])
if (kbinput >= '1' && kbinput <= '5') {
kbinput = KEY_F(kbinput - 48);
wgetch(edit);
}
else if (kbinput >= '7' && kbinput <= '9') {
} else if (kbinput >= '7' && kbinput <= '9') {
kbinput = KEY_F(kbinput - 49);
wgetch(edit);
}
else if (kbinput == 126)
} else if (kbinput == 126)
kbinput = KEY_HOME;
#ifdef DEBUG

3
nano.h
View File

@ -225,6 +225,7 @@ know what you're doing */
#define NANO_SUSPEND_KEY NANO_CONTROL_Z
#define NANO_ENTER_KEY NANO_CONTROL_M
#define NANO_FROMSEARCHTOGOTO_KEY NANO_CONTROL_T
#define NANO_NULL_KEY NANO_CONTROL_N
#define TOGGLE_CONST_KEY NANO_ALT_C
#define TOGGLE_AUTOINDENT_KEY NANO_ALT_I
@ -239,7 +240,7 @@ know what you're doing */
#define MAIN_LIST_LEN 26
#define MAIN_VISIBLE 12
#define WHEREIS_LIST_LEN 6
#define REPLACE_LIST_LEN 6
#define REPLACE_LIST_LEN 7
#define GOTO_LIST_LEN 3
#define WRITEFILE_LIST_LEN 1
#define HELP_LIST_LEN 3

View File

@ -67,41 +67,43 @@ const struct _msg_ent _msg_tbl[] = {
{"Insert a carriage return at the cursor position", 58},
{"Make the current search or replace case (in)sensitive", 59},
{"Cancel the current function", 60},
{"Get Help", 61},
{"WriteOut", 62},
{"Exit", 63},
{"Goto Line", 64},
{"Justify", 65},
{"Replace", 66},
{"Read File", 67},
{"Where Is", 68},
{"Prev Page", 69},
{"Next Page", 70},
{"Cut Text", 71},
{"UnCut Txt", 72},
{"Cur Pos", 73},
{"To Spell", 74},
{"Up", 75},
{"Down", 76},
{"Forward", 77},
{"Back", 78},
{"Home", 79},
{"End", 80},
{"Refresh", 81},
{"Mark Text", 82},
{"Delete", 83},
{"Backspace", 84},
{"Tab", 85},
{"Enter", 86},
{"First Line", 87},
{"Last Line", 88},
{"Case Sens", 89},
{"Cancel", 90},
{"No Replace", 91},
{"Use the null string, \"\"", 61},
{"Get Help", 62},
{"WriteOut", 63},
{"Exit", 64},
{"Goto Line", 65},
{"Justify", 66},
{"Replace", 67},
{"Read File", 68},
{"Where Is", 69},
{"Prev Page", 70},
{"Next Page", 71},
{"Cut Text", 72},
{"UnCut Txt", 73},
{"Cur Pos", 74},
{"To Spell", 75},
{"Up", 76},
{"Down", 77},
{"Forward", 78},
{"Back", 79},
{"Home", 80},
{"End", 81},
{"Refresh", 82},
{"Mark Text", 83},
{"Delete", 84},
{"Backspace", 85},
{"Tab", 86},
{"Enter", 87},
{"First Line", 88},
{"Last Line", 89},
{"Case Sens", 90},
{"Cancel", 91},
{"No Replace", 92},
{"Null Str", 93},
{"\
\n\
Buffer written to 'nano.save'\n", 92},
{"Key illegal in VIEW mode", 93},
Buffer written to 'nano.save'\n", 94},
{"Key illegal in VIEW mode", 95},
{"\
nano help text\n\
\n\
@ -119,117 +121,118 @@ Escape-key sequences are notated with the Meta (M) symbol and can be entered \
using either the Esc, Alt or Meta key depending on your keyboard setup. The \
following keystrokes are available in the main editor window. Optional keys \
are shown in parentheses:\n\
\n", 94},
{"free_node(): free'd a node, YAY!\n", 95},
{"free_node(): free'd last node.\n", 96},
\n", 96},
{"free_node(): free'd a node, YAY!\n", 97},
{"free_node(): free'd last node.\n", 98},
{"\
Usage: nano [GNU long option] [option] +LINE <file>\n\
\n", 97},
{"Option\t\tLong option\t\tMeaning\n", 98},
{" -T \t\t--tabsize=[num]\t\tSet width of a tab to num\n", 99},
{" -R\t\t--regexp\t\tUse regular expressions for search\n", 100},
{" -V \t\t--version\t\tPrint version information and exit\n", 101},
{" -c \t\t--const\t\t\tConstantly show cursor position\n", 102},
{" -h \t\t--help\t\t\tShow this message\n", 103},
{" -k \t\t--cut\t\t\tLet ^K cut from cursor to end of line\n", 104},
{" -i \t\t--autoindent\t\tAutomatically indent new lines\n", 105},
{" -l \t\t--nofollow\t\tDon't follow symbolic links, overwrite\n", 106},
{" -m \t\t--mouse\t\t\tEnable mouse\n", 107},
\n", 99},
{"Option\t\tLong option\t\tMeaning\n", 100},
{" -T \t\t--tabsize=[num]\t\tSet width of a tab to num\n", 101},
{" -R\t\t--regexp\t\tUse regular expressions for search\n", 102},
{" -V \t\t--version\t\tPrint version information and exit\n", 103},
{" -c \t\t--const\t\t\tConstantly show cursor position\n", 104},
{" -h \t\t--help\t\t\tShow this message\n", 105},
{" -k \t\t--cut\t\t\tLet ^K cut from cursor to end of line\n", 106},
{" -i \t\t--autoindent\t\tAutomatically indent new lines\n", 107},
{" -l \t\t--nofollow\t\tDon't follow symbolic links, overwrite\n", 108},
{" -m \t\t--mouse\t\t\tEnable mouse\n", 109},
{"\
-r [#cols] \t--fill=[#cols]\t\tSet fill cols to (wrap lines at) #cols\n", 108},
{" -p\t \t--pico\t\t\tMake bottom 2 lines more Pico-like\n", 109},
{" -s [prog] \t--speller=[prog]\tEnable alternate speller\n", 110},
{" -t \t\t--tempfile\t\tAuto save on exit, don't prompt\n", 111},
{" -v \t\t--view\t\t\tView (read only) mode\n", 112},
{" -w \t\t--nowrap\t\tDon't wrap long lines\n", 113},
{" -x \t\t--nohelp\t\tDon't show help window\n", 114},
{" -z \t\t--suspend\t\tEnable suspend\n", 115},
{" +LINE\t\t\t\t\tStart at line number LINE\n", 116},
-r [#cols] \t--fill=[#cols]\t\tSet fill cols to (wrap lines at) #cols\n", 110},
{" -p\t \t--pico\t\t\tMake bottom 2 lines more Pico-like\n", 111},
{" -s [prog] \t--speller=[prog]\tEnable alternate speller\n", 112},
{" -t \t\t--tempfile\t\tAuto save on exit, don't prompt\n", 113},
{" -v \t\t--view\t\t\tView (read only) mode\n", 114},
{" -w \t\t--nowrap\t\tDon't wrap long lines\n", 115},
{" -x \t\t--nohelp\t\tDon't show help window\n", 116},
{" -z \t\t--suspend\t\tEnable suspend\n", 117},
{" +LINE\t\t\t\t\tStart at line number LINE\n", 118},
{"\
Usage: nano [option] +LINE <file>\n\
\n", 117},
{"Option\t\tMeaning\n", 118},
{" -T [num]\tSet width of a tab to num\n", 119},
{" -R\t\tUse regular expressions for search\n", 120},
{" -V \t\tPrint version information and exit\n", 121},
{" -c \t\tConstantly show cursor position\n", 122},
{" -h \t\tShow this message\n", 123},
{" -k \t\tLet ^K cut from cursor to end of line\n", 124},
{" -i \t\tAutomatically indent new lines\n", 125},
{" -l \t\tDon't follow symbolic links, overwrite\n", 126},
{" -m \t\tEnable mouse\n", 127},
{" -r [#cols] \tSet fill cols to (wrap lines at) #cols\n", 128},
{" -s [prog] \tEnable alternate speller\n", 129},
{" -p \t\tMake bottom 2 lines more Pico-like\n", 130},
{" -t \t\tAuto save on exit, don't prompt\n", 131},
{" -v \t\tView (read only) mode\n", 132},
{" -w \t\tDon't wrap long lines\n", 133},
{" -x \t\tDon't show help window\n", 134},
{" -z \t\tEnable suspend\n", 135},
{" +LINE\t\tStart at line number LINE\n", 136},
{" nano version %s by Chris Allegretta (compiled %s, %s)\n", 137},
{" Email: nano@nano-editor.org\tWeb: http://www.nano-editor.org\n", 138},
{"Mark Set", 139},
{"Mark UNset", 140},
{"check_wrap called with inptr->data=\"%s\"\n", 141},
{"current->data now = \"%s\"\n", 142},
{"After, data = \"%s\"\n", 143},
{"Error deleting tempfile, ack!", 144},
{"Could not create a temporary filename: %s", 145},
{"Could not invoke spell program \"%s\"", 146},
{"Could not invoke \"ispell\"", 147},
{"Finished checking spelling", 148},
{"Save modified buffer (ANSWERING \"No\" WILL DESTROY CHANGES) ? ", 149},
{"Cannot resize top win", 150},
{"Cannot move top win", 151},
{"Cannot resize edit win", 152},
{"Cannot move edit win", 153},
{"Cannot resize bottom win", 154},
{"Cannot move bottom win", 155},
{"%s enable/disable", 156},
{"enabled", 157},
{"disabled", 158},
{"Main: set up windows\n", 159},
{"Main: bottom win\n", 160},
{"Main: open file\n", 161},
{"I got Alt-O-%c! (%d)\n", 162},
{"I got Alt-[-1-%c! (%d)\n", 163},
{"I got Alt-[-2-%c! (%d)\n", 164},
{"I got Alt-[-%c! (%d)\n", 165},
{"I got Alt-%c! (%d)\n", 166},
{"Case Sensitive Regexp Search%s%s", 167},
{"Regexp Search%s%s", 168},
{"Case Sensitive Search%s%s", 169},
{"Search%s%s", 170},
{" (to replace)", 171},
{"Search Cancelled", 172},
{"Search Wrapped", 173},
{"Replaced %d occurences", 174},
{"Replaced 1 occurence", 175},
{"Replace Cancelled", 176},
{"Replace with [%s]", 177},
{"Replace with", 178},
{"Replace this instance?", 179},
{"Enter line number", 180},
{"Aborted", 181},
{"Come on, be reasonable", 182},
{"Only %d lines available, skipping to last line", 183},
{"actual_x_from_start for xplus=%d returned %d\n", 184},
{"input '%c' (%d)\n", 185},
{"New Buffer", 186},
{" File: ...", 187},
{"Modified", 188},
{"Moved to (%d, %d) in edit buffer\n", 189},
{"current->data = \"%s\"\n", 190},
{"I got \"%s\"\n", 191},
{"Yes", 192},
{"All", 193},
{"No", 194},
{"do_cursorpos: linepct = %f, bytepct = %f\n", 195},
{"line %d of %d (%.0f%%), character %d of %d (%.0f%%)", 196},
{"Dumping file buffer to stderr...\n", 197},
{"Dumping cutbuffer to stderr...\n", 198},
{"Dumping a buffer to stderr...\n", 199},
\n", 119},
{"Option\t\tMeaning\n", 120},
{" -T [num]\tSet width of a tab to num\n", 121},
{" -R\t\tUse regular expressions for search\n", 122},
{" -V \t\tPrint version information and exit\n", 123},
{" -c \t\tConstantly show cursor position\n", 124},
{" -h \t\tShow this message\n", 125},
{" -k \t\tLet ^K cut from cursor to end of line\n", 126},
{" -i \t\tAutomatically indent new lines\n", 127},
{" -l \t\tDon't follow symbolic links, overwrite\n", 128},
{" -m \t\tEnable mouse\n", 129},
{" -r [#cols] \tSet fill cols to (wrap lines at) #cols\n", 130},
{" -s [prog] \tEnable alternate speller\n", 131},
{" -p \t\tMake bottom 2 lines more Pico-like\n", 132},
{" -t \t\tAuto save on exit, don't prompt\n", 133},
{" -v \t\tView (read only) mode\n", 134},
{" -w \t\tDon't wrap long lines\n", 135},
{" -x \t\tDon't show help window\n", 136},
{" -z \t\tEnable suspend\n", 137},
{" +LINE\t\tStart at line number LINE\n", 138},
{" nano version %s by Chris Allegretta (compiled %s, %s)\n", 139},
{" Email: nano@nano-editor.org\tWeb: http://www.nano-editor.org\n", 140},
{"Mark Set", 141},
{"Mark UNset", 142},
{"check_wrap called with inptr->data=\"%s\"\n", 143},
{"current->data now = \"%s\"\n", 144},
{"After, data = \"%s\"\n", 145},
{"Error deleting tempfile, ack!", 146},
{"Could not create a temporary filename: %s", 147},
{"Could not invoke spell program \"%s\"", 148},
{"Could not invoke \"ispell\"", 149},
{"Finished checking spelling", 150},
{"Save modified buffer (ANSWERING \"No\" WILL DESTROY CHANGES) ? ", 151},
{"Cannot resize top win", 152},
{"Cannot move top win", 153},
{"Cannot resize edit win", 154},
{"Cannot move edit win", 155},
{"Cannot resize bottom win", 156},
{"Cannot move bottom win", 157},
{"%s enable/disable", 158},
{"enabled", 159},
{"disabled", 160},
{"Main: set up windows\n", 161},
{"Main: bottom win\n", 162},
{"Main: open file\n", 163},
{"I got Alt-O-%c! (%d)\n", 164},
{"I got Alt-[-1-%c! (%d)\n", 165},
{"I got Alt-[-2-%c! (%d)\n", 166},
{"I got Alt-[-%c! (%d)\n", 167},
{"I got Alt-%c! (%d)\n", 168},
{"Case Sensitive Regexp Search%s%s", 169},
{"Regexp Search%s%s", 170},
{"Case Sensitive Search%s%s", 171},
{"Search%s%s", 172},
{" (to replace)", 173},
{"Search Cancelled", 174},
{"Search Wrapped", 175},
{"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},
};
int _msg_tbl_length = 199;
int _msg_tbl_length = 202;

View File

@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2000-10-24 01:12-0400\n"
"POT-Creation-Date: 2000-10-25 21:35-0400\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"
@ -55,11 +55,11 @@ msgstr ""
msgid "File to insert [from ./] "
msgstr ""
#: files.c:274 files.c:298 files.c:488 nano.c:1133
#: files.c:274 files.c:298 files.c:486 nano.c:1134
msgid "Cancelled"
msgstr ""
#: files.c:320 files.c:340 files.c:353 files.c:370 files.c:376
#: files.c:320 files.c:340 files.c:354 files.c:371 files.c:377
#, c-format
msgid "Could not open file for writing: %s"
msgstr ""
@ -68,42 +68,42 @@ msgstr ""
msgid "Could not open file: Path length exceeded."
msgstr ""
#: files.c:358
#: files.c:359
#, c-format
msgid "Wrote >%s\n"
msgstr ""
#: files.c:385
#: files.c:386
#, c-format
msgid "Could not close %s: %s"
msgstr ""
#. Try a rename??
#: files.c:406 files.c:417 files.c:422
#: files.c:407 files.c:418 files.c:423
#, c-format
msgid "Could not open %s for writing: %s"
msgstr ""
#: files.c:428
#: files.c:429
#, c-format
msgid "Could not set permissions %o on %s: %s"
msgstr ""
#: files.c:435
#: files.c:436
#, c-format
msgid "Wrote %d lines"
msgstr ""
#: files.c:467
#: files.c:465
msgid "File Name to write"
msgstr ""
#: files.c:472
#: files.c:470
#, c-format
msgid "filename is %s"
msgstr ""
#: files.c:477
#: files.c:475
msgid "File exists, OVERWRITE ?"
msgstr ""
@ -263,131 +263,139 @@ msgstr ""
msgid "Cancel the current function"
msgstr ""
#: global.c:210 global.c:322 global.c:394
#: global.c:207
msgid "Use the null string, \"\""
msgstr ""
#: global.c:211 global.c:323 global.c:400
msgid "Get Help"
msgstr ""
#: global.c:213 global.c:221
#: global.c:214 global.c:222
msgid "WriteOut"
msgstr ""
#: global.c:217 global.c:383
#: global.c:218 global.c:389
msgid "Exit"
msgstr ""
#: global.c:225 global.c:318 global.c:339 global.c:358
#: global.c:226 global.c:319 global.c:341 global.c:361
msgid "Goto Line"
msgstr ""
#: global.c:230 global.c:309
#: global.c:231 global.c:310
msgid "Justify"
msgstr ""
#: global.c:234 global.c:305 global.c:336
#: global.c:235 global.c:306 global.c:337
msgid "Replace"
msgstr ""
#: global.c:238
#: global.c:239
msgid "Read File"
msgstr ""
#: global.c:242
#: global.c:243
msgid "Where Is"
msgstr ""
#: global.c:246 global.c:375
#: global.c:247 global.c:381
msgid "Prev Page"
msgstr ""
#: global.c:250 global.c:379
#: global.c:251 global.c:385
msgid "Next Page"
msgstr ""
#: global.c:254
#: global.c:255
msgid "Cut Text"
msgstr ""
#: global.c:257
#: global.c:258
msgid "UnCut Txt"
msgstr ""
#: global.c:261
#: global.c:262
msgid "Cur Pos"
msgstr ""
#: global.c:265
#: global.c:266
msgid "To Spell"
msgstr ""
#: global.c:269
#: global.c:270
msgid "Up"
msgstr ""
#: global.c:272
#: global.c:273
msgid "Down"
msgstr ""
#: global.c:275
#: global.c:276
msgid "Forward"
msgstr ""
#: global.c:278
#: global.c:279
msgid "Back"
msgstr ""
#: global.c:281
#: global.c:282
msgid "Home"
msgstr ""
#: global.c:284
#: global.c:285
msgid "End"
msgstr ""
#: global.c:287
#: global.c:288
msgid "Refresh"
msgstr ""
#: global.c:290
#: global.c:291
msgid "Mark Text"
msgstr ""
#: global.c:293
#: global.c:294
msgid "Delete"
msgstr ""
#: global.c:297
#: global.c:298
msgid "Backspace"
msgstr ""
#: global.c:301
#: global.c:302
msgid "Tab"
msgstr ""
#: global.c:313
#: global.c:314
msgid "Enter"
msgstr ""
#: global.c:326 global.c:346 global.c:365
#: global.c:327 global.c:348 global.c:371
msgid "First Line"
msgstr ""
#: global.c:329 global.c:349 global.c:368
#: global.c:330 global.c:351 global.c:374
msgid "Last Line"
msgstr ""
#: global.c:332 global.c:352
#: global.c:333 global.c:354
msgid "Case Sens"
msgstr ""
#: global.c:342 global.c:361 global.c:371 global.c:387 global.c:391
#: global.c:397 winio.c:979
#: global.c:344 global.c:367 global.c:377 global.c:393 global.c:397
#: global.c:403 winio.c:971
msgid "Cancel"
msgstr ""
#: global.c:355
#: global.c:357
msgid "No Replace"
msgstr ""
#: global.c:364
msgid "Null Str"
msgstr ""
#: nano.c:115
msgid ""
"\n"
@ -597,57 +605,57 @@ msgstr ""
msgid " nano version %s by Chris Allegretta (compiled %s, %s)\n"
msgstr ""
#: nano.c:402
#: nano.c:403
msgid " Email: nano@nano-editor.org\tWeb: http://www.nano-editor.org\n"
msgstr ""
#: nano.c:437
#: nano.c:438
msgid "Mark Set"
msgstr ""
#: nano.c:442
#: nano.c:443
msgid "Mark UNset"
msgstr ""
#: nano.c:868
#: nano.c:870
#, c-format
msgid "check_wrap called with inptr->data=\"%s\"\n"
msgstr ""
#: nano.c:919
#: nano.c:921
#, c-format
msgid "current->data now = \"%s\"\n"
msgstr ""
#: nano.c:972
#: nano.c:974
#, c-format
msgid "After, data = \"%s\"\n"
msgstr ""
#: nano.c:1042
#: nano.c:1043
msgid "Error deleting tempfile, ack!"
msgstr ""
#: nano.c:1060
#: nano.c:1061
#, c-format
msgid "Could not create a temporary filename: %s"
msgstr ""
#: nano.c:1083
#: nano.c:1084
#, c-format
msgid "Could not invoke spell program \"%s\""
msgstr ""
#. Why 32512? I dont know!
#: nano.c:1089
#: nano.c:1090
msgid "Could not invoke \"ispell\""
msgstr ""
#: nano.c:1102
#: nano.c:1103
msgid "Finished checking spelling"
msgstr ""
#: nano.c:1120
#: nano.c:1121
msgid "Save modified buffer (ANSWERING \"No\" WILL DESTROY CHANGES) ? "
msgstr ""
@ -675,52 +683,52 @@ msgstr ""
msgid "Cannot move bottom win"
msgstr ""
#: nano.c:1638
#: nano.c:1635
#, c-format
msgid "%s enable/disable"
msgstr ""
#: nano.c:1650
#: nano.c:1647
msgid "enabled"
msgstr ""
#: nano.c:1651
#: nano.c:1648
msgid "disabled"
msgstr ""
#: nano.c:1881
#: nano.c:1878
msgid "Main: set up windows\n"
msgstr ""
#: nano.c:1895
#: nano.c:1892
msgid "Main: bottom win\n"
msgstr ""
#: nano.c:1901
#: nano.c:1898
msgid "Main: open file\n"
msgstr ""
#: nano.c:1935
#: nano.c:1932
#, c-format
msgid "I got Alt-O-%c! (%d)\n"
msgstr ""
#: nano.c:1959
#: nano.c:1954
#, c-format
msgid "I got Alt-[-1-%c! (%d)\n"
msgstr ""
#: nano.c:1992
#: nano.c:1987
#, c-format
msgid "I got Alt-[-2-%c! (%d)\n"
msgstr ""
#: nano.c:2040
#: nano.c:2035
#, c-format
msgid "I got Alt-[-%c! (%d)\n"
msgstr ""
#: nano.c:2066
#: nano.c:2061
#, c-format
msgid "I got Alt-%c! (%d)\n"
msgstr ""
@ -735,21 +743,21 @@ msgstr ""
msgid "Regexp Search%s%s"
msgstr ""
#: search.c:82
#: search.c:81
#, c-format
msgid "Case Sensitive Search%s%s"
msgstr ""
#: search.c:84
#: search.c:83
#, c-format
msgid "Search%s%s"
msgstr ""
#: search.c:87
#: search.c:86
msgid " (to replace)"
msgstr ""
#: search.c:95
#: search.c:94
msgid "Search Cancelled"
msgstr ""
@ -766,38 +774,44 @@ msgstr ""
msgid "Replaced 1 occurence"
msgstr ""
#: search.c:392 search.c:413 search.c:436
#: search.c:390 search.c:419 search.c:444
msgid "Replace Cancelled"
msgstr ""
#: search.c:409
#. They used ^N in the search field, shame on them.
#. Any Dungeon fans out there?
#: search.c:407
msgid "Nothing Happens"
msgstr ""
#: search.c:415
#, c-format
msgid "Replace with [%s]"
msgstr ""
#. last_search is empty
#: search.c:434
#: search.c:442
msgid "Replace with"
msgstr ""
#: search.c:475
#: search.c:485
msgid "Replace this instance?"
msgstr ""
#. Ask for it
#: search.c:536
#: search.c:546
msgid "Enter line number"
msgstr ""
#: search.c:538
#: search.c:548
msgid "Aborted"
msgstr ""
#: search.c:558
#: search.c:568
msgid "Come on, be reasonable"
msgstr ""
#: search.c:563
#: search.c:573
#, c-format
msgid "Only %d lines available, skipping to last line"
msgstr ""
@ -824,50 +838,50 @@ msgstr ""
msgid "Modified"
msgstr ""
#: winio.c:895
#: winio.c:887
#, c-format
msgid "Moved to (%d, %d) in edit buffer\n"
msgstr ""
#: winio.c:906
#: winio.c:898
#, c-format
msgid "current->data = \"%s\"\n"
msgstr ""
#: winio.c:949
#: winio.c:941
#, c-format
msgid "I got \"%s\"\n"
msgstr ""
#: winio.c:974
#: winio.c:966
msgid "Yes"
msgstr ""
#: winio.c:976
#: winio.c:968
msgid "All"
msgstr ""
#: winio.c:978
#: winio.c:970
msgid "No"
msgstr ""
#: winio.c:1115
#: winio.c:1107
#, c-format
msgid "do_cursorpos: linepct = %f, bytepct = %f\n"
msgstr ""
#: winio.c:1119
#: winio.c:1111
msgid "line %d of %d (%.0f%%), character %d of %d (%.0f%%)"
msgstr ""
#: winio.c:1247
#: winio.c:1239
msgid "Dumping file buffer to stderr...\n"
msgstr ""
#: winio.c:1249
#: winio.c:1241
msgid "Dumping cutbuffer to stderr...\n"
msgstr ""
#: winio.c:1251
#: winio.c:1243
msgid "Dumping a buffer to stderr...\n"
msgstr ""

View File

@ -77,8 +77,7 @@ int search_init(int replacing)
prompt = _("Case Sensitive Regexp Search%s%s");
else if (ISSET(USE_REGEXP))
prompt = _("Regexp Search%s%s");
else
if (ISSET(CASE_SENSITIVE))
else if (ISSET(CASE_SENSITIVE))
prompt = _("Case Sensitive Search%s%s");
else
prompt = _("Search%s%s");
@ -130,7 +129,8 @@ int search_init(int replacing)
return 0;
}
filestruct *findnextstr(int quiet, filestruct * begin, int beginx, char *needle)
filestruct *findnextstr(int quiet, filestruct * begin, int beginx,
char *needle)
{
filestruct *fileptr;
char *searchstr, *found = NULL, *tmp;
@ -141,17 +141,17 @@ filestruct *findnextstr(int quiet, filestruct * begin, int beginx, char *needle)
current_x++;
/* Are we searching the last line? (i.e. the line where search started) */
if ( (fileptr == begin) && (current_x < beginx) )
if ((fileptr == begin) && (current_x < beginx))
search_last_line = 1;
/* Make sure we haven't passed the end of the string */
if ( strlen(fileptr->data) < current_x )
if (strlen(fileptr->data) < current_x)
current_x--;
searchstr = &fileptr->data[current_x];
/* Look for needle in searchstr */
while (( found = strstrwrapper(searchstr, needle)) == NULL) {
while ((found = strstrwrapper(searchstr, needle)) == NULL) {
/* finished processing file, get out */
if (search_last_line) {
@ -274,8 +274,7 @@ int replace_regexp(char *string, int create_flag)
char *c;
int new_size = strlen(current->data) + 1;
int search_match_count = regmatches[0].rm_eo -
regmatches[0].rm_so;
int search_match_count = regmatches[0].rm_eo - regmatches[0].rm_so;
new_size -= search_match_count;
@ -286,11 +285,11 @@ int replace_regexp(char *string, int create_flag)
while (*c) {
if (*c != '\\') {
if (create_flag)
*string++=*c;
*string++ = *c;
c++;
new_size++;
} else {
int num = (int)*(c+1) - (int)'0';
int num = (int) *(c + 1) - (int) '0';
if (num >= 1 && num <= 9) {
int i = regmatches[num].rm_so;
@ -302,19 +301,19 @@ int replace_regexp(char *string, int create_flag)
}
/* Skip over the replacement expression */
c+=2;
c += 2;
/* But add the length of the subexpression to new_size */
new_size += regmatches[num].rm_eo - regmatches[num].rm_so;
/* And if create_flag is set, append the result of the
* subexpression match to the new line */
while (create_flag && i < regmatches[num].rm_eo )
*string++=*(current->data + i++);
while (create_flag && i < regmatches[num].rm_eo)
*string++ = *(current->data + i++);
} else {
if (create_flag)
*string++=*c;
*string++ = *c;
c++;
new_size++;
}
@ -337,8 +336,7 @@ char *replace_line()
/* Calculate size of new line */
#ifdef HAVE_REGEX_H
if (ISSET(USE_REGEXP)) {
search_match_count = regmatches[0].rm_eo -
regmatches[0].rm_so;
search_match_count = regmatches[0].rm_eo - regmatches[0].rm_so;
new_line_size = replace_regexp(NULL, 0);
/* If they specified an invalid subexpression in the replace
* text, return NULL indicating an error */
@ -365,7 +363,7 @@ char *replace_line()
strcat(copy, last_replace);
#ifdef HAVE_REGEX_H
else
(void)replace_regexp(copy + current_x, 1);
(void) replace_regexp(copy + current_x, 1);
#endif
/* The tail of the original line */
@ -402,6 +400,14 @@ int do_replace(void)
replace_abort();
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 */
@ -415,6 +421,8 @@ int do_replace(void)
return 0;
} else if (i == 0) /* They actually entered something */
strncpy(last_replace, answer, 132);
else if (i == NANO_NULL_KEY) /* They actually entered something */
strcpy(last_replace, "");
else if (i == NANO_CASE_KEY) { /* They asked for case sensitivity */
if (ISSET(CASE_SENSITIVE))
UNSET(CASE_SENSITIVE);
@ -423,7 +431,7 @@ int do_replace(void)
do_replace();
return 0;
} else if (i != -2 ) { /* First page, last page, for example could get here */
} else if (i != -2) { /* First page, last page, for example could get here */
do_early_abort();
replace_abort();
@ -445,8 +453,10 @@ int do_replace(void)
SET(CASE_SENSITIVE);
do_replace();
return 1;
} else { /* First line key, etc. */
return -1;
} else if (i == NANO_NULL_KEY)
strcpy(last_replace, "");
else { /* First line key, etc. */
do_early_abort();
replace_abort();

View File

@ -84,9 +84,9 @@ char *strstrwrapper(char *haystack, char *needle)
{
#ifdef HAVE_REGEX_H
if (ISSET(USE_REGEXP)) {
int result=regexec(&search_regexp, haystack, 10, regmatches, 0);
int result = regexec(&search_regexp, haystack, 10, regmatches, 0);
if (!result)
return haystack+regmatches[0].rm_so;
return haystack + regmatches[0].rm_so;
return 0;
}
#endif
@ -120,7 +120,8 @@ void *nrealloc(void *ptr, size_t howmuch)
}
/* Append a new magic-line to filebot */
void new_magicline(void) {
void new_magicline(void)
{
filebot->next = nmalloc(sizeof(filestruct));
filebot->next->data = nmalloc(1);
filebot->next->data[0] = '\0';

30
winio.c
View File

@ -609,8 +609,7 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
&& !((fileptr->lineno > mark_beginbuf->lineno
&& fileptr->lineno > current->lineno)
|| (fileptr->lineno < mark_beginbuf->lineno
&& fileptr->lineno < current->lineno)))
{
&& fileptr->lineno < current->lineno))) {
/* If we get here we are on a line that is atleast
* partially selected. The lineno checks above determined
* that */
@ -626,13 +625,11 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
if (virt_cur_x < virt_mark_beginx) {
/* To the right of us is marked */
add_marked_sameline(virt_cur_x, virt_mark_beginx,
fileptr, yval, virt_cur_x,
this_page);
fileptr, yval, virt_cur_x, this_page);
} else {
/* To the left of us is marked */
add_marked_sameline(virt_mark_beginx, virt_cur_x,
fileptr, yval, virt_cur_x,
this_page);
fileptr, yval, virt_cur_x, this_page);
}
} else if (fileptr == mark_beginbuf) {
/*
@ -699,8 +696,7 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
this_page_end - virt_cur_x);
else
mvwaddnstr(edit, yval, virt_cur_x,
&fileptr->data[virt_cur_x],
COLS - virt_cur_x);
&fileptr->data[virt_cur_x], COLS - virt_cur_x);
if (mark_beginbuf->lineno > current->lineno)
wattroff(edit, A_REVERSE);
@ -760,8 +756,7 @@ void update_line(filestruct * fileptr, int index)
virt_cur_x--;
if (i < mark_beginx)
virt_mark_beginx--;
}
else if (realdata[i] >= 1 && realdata[i] <= 26) {
} else if (realdata[i] >= 1 && realdata[i] <= 26) {
/* Treat control characters as ^letter */
fileptr->data[pos++] = '^';
fileptr->data[pos++] = realdata[i] + 64;
@ -828,12 +823,10 @@ void edit_refresh(void)
}
/* If noloop == 1, then we already did an edit_update without finishing
this function. So we don't run edit_update again */
if (!currentcheck && !noloop) /* Then current has run off the screen... */
{
if (!currentcheck && !noloop) { /* Then current has run off the screen... */
edit_update(current, CENTER);
noloop = 1;
}
else if (noloop)
} else if (noloop)
noloop = 0;
if (lines <= editwinrows - 1)
@ -870,8 +863,7 @@ void edit_update(filestruct * fileptr, int topmidbot)
return;
temp = fileptr;
if (topmidbot == 2)
;
if (topmidbot == 2);
else if (topmidbot == 0)
for (i = 0; i <= editwinrows - 1 && temp->prev != NULL; i++)
temp = temp->prev;
@ -1274,10 +1266,10 @@ void dump_buffer_reverse(filestruct * inptr)
}
/* Fix editbot based on the assumption that edittop is correct */
void fix_editbot(void) {
void fix_editbot(void)
{
int i;
editbot = edittop;
for(i = 0; (i <= editwinrows - 1) && (editbot->next != NULL)
for (i = 0; (i <= editwinrows - 1) && (editbot->next != NULL)
&& (editbot != filebot); i++, editbot = editbot->next);
}