Commit bd9e7c3c authored by Chris Allegretta's avatar Chris Allegretta
Browse files

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
parent a0e957bc
Showing with 607 additions and 587 deletions
+607 -587
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
certain col values. (9) [FIXED] certain col values. (9) [FIXED]
- edit_refresh() and update_line() do not handle selecting text when the - edit_refresh() and update_line() do not handle selecting text when the
cursor is beyond COLS (10) [FIXED] 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 - 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 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) if we were around COLS (bugs in edit_refresh, update_line) (13)
...@@ -70,7 +71,6 @@ ...@@ -70,7 +71,6 @@
- Marked cutting sometimes leaves a newline in the file unintelligently, - 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 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 } 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' - Spelling support is not elegant like pico's integration of the 'spell'
program. Nano only uses ispell (for now) (12). program. Nano only uses ispell (for now) (12).
- In replace, there is no way to accept the default replace string. (27) - In replace, there is no way to accept the default replace string. (27)
......
CVS Code - 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 - global.c
toggle_init() toggle_init()
- Added #ifdef around toggle_regex_msg to get rid of compiler - Added #ifdef around toggle_regex_msg to get rid of compiler
......
...@@ -123,7 +123,7 @@ void cut_marked_segment(filestruct * top, int top_x, filestruct * bot, ...@@ -123,7 +123,7 @@ void cut_marked_segment(filestruct * top, int top_x, filestruct * bot,
filebot = top; filebot = top;
} }
} }
if (top->lineno < edittop->lineno) if (top->lineno < edittop->lineno)
edit_update(top, CENTER); edit_update(top, CENTER);
} }
#endif #endif
...@@ -152,20 +152,17 @@ int do_cut_text(void) ...@@ -152,20 +152,17 @@ int do_cut_text(void)
} }
/* Must let cutbuffer get blown away first before we do this... */ /* Must let cutbuffer get blown away first before we do this... */
if (fileptr == filebot && !ISSET(MARK_ISSET)) if (fileptr == filebot && !ISSET(MARK_ISSET))
return 0; return 0;
#ifndef NANO_SMALL #ifndef NANO_SMALL
if (ISSET(CUT_TO_END) && !ISSET(MARK_ISSET)) { if (ISSET(CUT_TO_END) && !ISSET(MARK_ISSET)) {
if (current_x == strlen(current->data)) if (current_x == strlen(current->data)) {
{
do_delete(); do_delete();
SET(KEEP_CUTBUFFER); SET(KEEP_CUTBUFFER);
marked_cut = 2; marked_cut = 2;
return 1; return 1;
} } else {
else
{
SET(MARK_ISSET); SET(MARK_ISSET);
SET(KEEP_CUTBUFFER); SET(KEEP_CUTBUFFER);
...@@ -227,7 +224,7 @@ int do_cut_text(void) ...@@ -227,7 +224,7 @@ int do_cut_text(void)
tmp = fileptr; tmp = fileptr;
fileage = fileptr; fileage = fileptr;
add_to_cutbuffer(fileptr->prev); add_to_cutbuffer(fileptr->prev);
totsize--; /* get the newline */ totsize--; /* get the newline */
totlines--; totlines--;
fileptr->prev = NULL; fileptr->prev = NULL;
current = fileptr; current = fileptr;
...@@ -247,10 +244,10 @@ int do_cut_text(void) ...@@ -247,10 +244,10 @@ int do_cut_text(void)
(fileptr->next)->prev = fileptr->prev; (fileptr->next)->prev = fileptr->prev;
current = fileptr->next; current = fileptr->next;
totlines--; totlines--;
totsize--; /* get the newline */ totsize--; /* get the newline */
} /* No longer an else here, because we never get here anymore... }
No need to cut the magic line, as it's empty */ /* 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); add_to_cutbuffer(fileptr);
} }
...@@ -404,7 +401,7 @@ int do_uncut_text(void) ...@@ -404,7 +401,7 @@ int do_uncut_text(void)
i = editbot->lineno; i = editbot->lineno;
renumber(newbuf); renumber(newbuf);
if (i < newend->lineno) if (i < newend->lineno)
edit_update(fileptr, CENTER); edit_update(fileptr, CENTER);
dump_buffer_reverse(fileptr); dump_buffer_reverse(fileptr);
......
...@@ -336,7 +336,7 @@ int write_file(char *name, int tmp) ...@@ -336,7 +336,7 @@ int write_file(char *name, int tmp)
if (ISSET(TEMP_OPT)) { if (ISSET(TEMP_OPT)) {
UNSET(TEMP_OPT); UNSET(TEMP_OPT);
return do_writeout(1); return do_writeout(1);
} }
statusbar(_("Could not open file for writing: %s"), statusbar(_("Could not open file for writing: %s"),
strerror(errno)); strerror(errno));
return -1; return -1;
...@@ -346,7 +346,8 @@ int write_file(char *name, int tmp) ...@@ -346,7 +346,8 @@ int write_file(char *name, int tmp)
dump_buffer(fileage); dump_buffer(fileage);
while (fileptr != NULL && fileptr->next != NULL) { while (fileptr != NULL && fileptr->next != NULL) {
/* Next line is so we discount the "magic line" */ /* 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)); size = write(fd, fileptr->data, strlen(fileptr->data));
if (size == -1) { if (size == -1) {
...@@ -446,14 +447,11 @@ int do_writeout(int exiting) ...@@ -446,14 +447,11 @@ int do_writeout(int exiting)
strncpy(answer, filename, 132); strncpy(answer, filename, 132);
if ((exiting) && (ISSET(TEMP_OPT))) { if ((exiting) && (ISSET(TEMP_OPT))) {
if (filename[0]) if (filename[0]) {
{
i = write_file(answer, 0); i = write_file(answer, 0);
display_main_list(); display_main_list();
return i; return i;
} } else {
else
{
UNSET(TEMP_OPT); UNSET(TEMP_OPT);
do_exit(); do_exit();
......
...@@ -83,9 +83,9 @@ toggle toggles[TOGGLE_LEN]; ...@@ -83,9 +83,9 @@ toggle toggles[TOGGLE_LEN];
/* Regular expressions */ /* Regular expressions */
#ifdef HAVE_REGEX_H #ifdef HAVE_REGEX_H
regex_t search_regexp; /* Global to store compiled search regexp */ regex_t search_regexp; /* Global to store compiled search regexp */
regmatch_t regmatches[10]; /* Match positions for parenthetical regmatch_t regmatches[10]; /* Match positions for parenthetical
subexpressions, max of 10 */ subexpressions, max of 10 */
#endif #endif
/* Initialize a struct *without* our lovely braces =( */ /* Initialize a struct *without* our lovely braces =( */
...@@ -117,7 +117,7 @@ void toggle_init(void) ...@@ -117,7 +117,7 @@ void toggle_init(void)
*toggle_nohelp_msg, *toggle_picomode_msg, *toggle_mouse_msg, *toggle_nohelp_msg, *toggle_picomode_msg, *toggle_mouse_msg,
*toggle_cuttoend_msg, *toggle_wrap_msg; *toggle_cuttoend_msg, *toggle_wrap_msg;
#ifdef HAVE_REGEX_H #ifdef HAVE_REGEX_H
char *toggle_regexp_msg; char *toggle_regexp_msg;
#endif #endif
toggle_const_msg = _("Constant cursor position"); toggle_const_msg = _("Constant cursor position");
...@@ -128,29 +128,29 @@ void toggle_init(void) ...@@ -128,29 +128,29 @@ void toggle_init(void)
toggle_mouse_msg = _("Mouse support"); toggle_mouse_msg = _("Mouse support");
toggle_cuttoend_msg = _("Cut to end"); toggle_cuttoend_msg = _("Cut to end");
#ifdef HAVE_REGEX_H #ifdef HAVE_REGEX_H
toggle_regexp_msg = _("Regular expressions"); toggle_regexp_msg = _("Regular expressions");
#endif #endif
toggle_wrap_msg = _("Auto wrap"); toggle_wrap_msg = _("Auto wrap");
toggle_init_one(&toggles[0], TOGGLE_CONST_KEY, toggle_const_msg, toggle_init_one(&toggles[0], TOGGLE_CONST_KEY, toggle_const_msg,
CONSTUPDATE); CONSTUPDATE);
toggle_init_one(&toggles[1], TOGGLE_AUTOINDENT_KEY, toggle_autoindent_msg, toggle_init_one(&toggles[1], TOGGLE_AUTOINDENT_KEY,
AUTOINDENT); toggle_autoindent_msg, AUTOINDENT);
toggle_init_one(&toggles[2], TOGGLE_SUSPEND_KEY, toggle_suspend_msg, toggle_init_one(&toggles[2], TOGGLE_SUSPEND_KEY, toggle_suspend_msg,
SUSPEND); SUSPEND);
toggle_init_one(&toggles[3], TOGGLE_NOHELP_KEY, toggle_nohelp_msg, toggle_init_one(&toggles[3], TOGGLE_NOHELP_KEY, toggle_nohelp_msg,
NO_HELP); NO_HELP);
toggle_init_one(&toggles[4], TOGGLE_PICOMODE_KEY, toggle_picomode_msg, toggle_init_one(&toggles[4], TOGGLE_PICOMODE_KEY, toggle_picomode_msg,
PICO_MSGS); PICO_MSGS);
toggle_init_one(&toggles[5], TOGGLE_WRAP_KEY, toggle_wrap_msg, toggle_init_one(&toggles[5], TOGGLE_WRAP_KEY, toggle_wrap_msg,
NO_WRAP); NO_WRAP);
toggle_init_one(&toggles[6], TOGGLE_MOUSE_KEY, toggle_mouse_msg, toggle_init_one(&toggles[6], TOGGLE_MOUSE_KEY, toggle_mouse_msg,
USE_MOUSE); USE_MOUSE);
toggle_init_one(&toggles[7], TOGGLE_CUTTOEND_KEY, toggle_cuttoend_msg, toggle_init_one(&toggles[7], TOGGLE_CUTTOEND_KEY, toggle_cuttoend_msg,
CUT_TO_END); CUT_TO_END);
#ifdef HAVE_REGEX_H #ifdef HAVE_REGEX_H
toggle_init_one(&toggles[8], TOGGLE_REGEXP_KEY, toggle_regexp_msg, toggle_init_one(&toggles[8], TOGGLE_REGEXP_KEY, toggle_regexp_msg,
USE_REGEXP); USE_REGEXP);
#endif #endif
#endif #endif
} }
...@@ -169,7 +169,7 @@ void shortcut_init(void) ...@@ -169,7 +169,7 @@ void shortcut_init(void)
"", *nano_mark_msg = "", *nano_delete_msg = "", *nano_mark_msg = "", *nano_delete_msg =
"", *nano_backspace_msg = "", *nano_tab_msg = "", *nano_backspace_msg = "", *nano_tab_msg =
"", *nano_enter_msg = "", *nano_case_msg = "", *nano_enter_msg = "", *nano_case_msg =
"", *nano_cancel_msg = ""; "", *nano_cancel_msg = "", *nano_null_msg = "";
#ifndef NANO_SMALL #ifndef NANO_SMALL
nano_help_msg = _("Invoke the help menu"); nano_help_msg = _("Invoke the help menu");
...@@ -204,6 +204,7 @@ void shortcut_init(void) ...@@ -204,6 +204,7 @@ void shortcut_init(void)
nano_case_msg = nano_case_msg =
_("Make the current search or replace case (in)sensitive"); _("Make the current search or replace case (in)sensitive");
nano_cancel_msg = _("Cancel the current function"); nano_cancel_msg = _("Cancel the current function");
nano_null_msg = _("Use the null string, \"\"");
#endif #endif
if (ISSET(PICO_MSGS)) if (ISSET(PICO_MSGS))
...@@ -228,7 +229,7 @@ void shortcut_init(void) ...@@ -228,7 +229,7 @@ void shortcut_init(void)
if (ISSET(PICO_MSGS)) if (ISSET(PICO_MSGS))
sc_init_one(&main_list[3], NANO_JUSTIFY_KEY, _("Justify"), sc_init_one(&main_list[3], NANO_JUSTIFY_KEY, _("Justify"),
nano_justify_msg, 0, NANO_JUSTIFY_FKEY, 0, nano_justify_msg, 0, NANO_JUSTIFY_FKEY, 0,
NOVIEW, do_justify); NOVIEW, do_justify);
else else
sc_init_one(&main_list[3], NANO_REPLACE_KEY, _("Replace"), sc_init_one(&main_list[3], NANO_REPLACE_KEY, _("Replace"),
...@@ -307,7 +308,7 @@ void shortcut_init(void) ...@@ -307,7 +308,7 @@ void shortcut_init(void)
NANO_ALT_R, NANO_REPLACE_FKEY, 0, NOVIEW, do_replace); NANO_ALT_R, NANO_REPLACE_FKEY, 0, NOVIEW, do_replace);
else else
sc_init_one(&main_list[23], NANO_JUSTIFY_KEY, _("Justify"), sc_init_one(&main_list[23], NANO_JUSTIFY_KEY, _("Justify"),
nano_justify_msg, 0, NANO_JUSTIFY_FKEY, 0, nano_justify_msg, 0, NANO_JUSTIFY_FKEY, 0,
NOVIEW, do_justify); NOVIEW, do_justify);
sc_init_one(&main_list[24], NANO_ENTER_KEY, _("Enter"), sc_init_one(&main_list[24], NANO_ENTER_KEY, _("Enter"),
...@@ -336,8 +337,9 @@ void shortcut_init(void) ...@@ -336,8 +337,9 @@ void shortcut_init(void)
sc_init_one(&whereis_list[3], NANO_OTHERSEARCH_KEY, _("Replace"), sc_init_one(&whereis_list[3], NANO_OTHERSEARCH_KEY, _("Replace"),
nano_replace_msg, 0, 0, 0, VIEW, do_replace); nano_replace_msg, 0, 0, 0, VIEW, do_replace);
sc_init_one(&whereis_list[4], NANO_FROMSEARCHTOGOTO_KEY, _("Goto Line"), sc_init_one(&whereis_list[4], NANO_FROMSEARCHTOGOTO_KEY,
nano_goto_msg, 0, 0, 0, VIEW, do_gotoline_void); _("Goto Line"), nano_goto_msg, 0, 0, 0, VIEW,
do_gotoline_void);
sc_init_one(&whereis_list[5], NANO_CANCEL_KEY, _("Cancel"), sc_init_one(&whereis_list[5], NANO_CANCEL_KEY, _("Cancel"),
nano_cancel_msg, 0, 0, 0, VIEW, 0); nano_cancel_msg, 0, 0, 0, VIEW, 0);
...@@ -355,10 +357,14 @@ void shortcut_init(void) ...@@ -355,10 +357,14 @@ void shortcut_init(void)
sc_init_one(&replace_list[3], NANO_OTHERSEARCH_KEY, _("No Replace"), sc_init_one(&replace_list[3], NANO_OTHERSEARCH_KEY, _("No Replace"),
nano_whereis_msg, 0, 0, 0, VIEW, do_search); nano_whereis_msg, 0, 0, 0, VIEW, do_search);
sc_init_one(&replace_list[4], NANO_FROMSEARCHTOGOTO_KEY, _("Goto Line"), sc_init_one(&replace_list[4], NANO_FROMSEARCHTOGOTO_KEY,
nano_goto_msg, 0, 0, 0, VIEW, do_gotoline_void); _("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); nano_cancel_msg, 0, 0, 0, VIEW, 0);
......
...@@ -57,7 +57,7 @@ int page_down(void) ...@@ -57,7 +57,7 @@ int page_down(void)
if (editbot != filebot || edittop == fileage) { if (editbot != filebot || edittop == fileage) {
current_y = 0; current_y = 0;
current = editbot; current = editbot;
if (current->prev != NULL) if (current->prev != NULL)
current = current->prev; current = current->prev;
......
...@@ -95,12 +95,12 @@ void die(char *msg, ...) ...@@ -95,12 +95,12 @@ void die(char *msg, ...)
/* if we can't save we have REAL bad problems, /* if we can't save we have REAL bad problems,
* but we might as well TRY. */ * but we might as well TRY. */
if(filename[0] == '\0') { if (filename[0] == '\0') {
write_file("nano.save", 0); write_file("nano.save", 0);
} else { } else {
char buf[BUFSIZ]; char buf[BUFSIZ];
strncpy(buf,filename,BUFSIZ); strncpy(buf, filename, BUFSIZ);
strncat(buf,".save",BUFSIZ - strlen(buf)); strncat(buf, ".save", BUFSIZ - strlen(buf));
write_file(buf, 0); write_file(buf, 0);
} }
/* Restore the old term settings */ /* Restore the old term settings */
...@@ -321,7 +321,7 @@ void usage(void) ...@@ -321,7 +321,7 @@ void usage(void)
(" -T --tabsize=[num] Set width of a tab to num\n")); (" -T --tabsize=[num] Set width of a tab to num\n"));
#ifdef HAVE_REGEX_H #ifdef HAVE_REGEX_H
printf(_ printf(_
(" -R --regexp Use regular expressions for search\n")); (" -R --regexp Use regular expressions for search\n"));
#endif #endif
printf printf
(_ (_
...@@ -399,7 +399,8 @@ void version(void) ...@@ -399,7 +399,8 @@ void version(void)
{ {
printf(_(" nano version %s by Chris Allegretta (compiled %s, %s)\n"), printf(_(" nano version %s by Chris Allegretta (compiled %s, %s)\n"),
VERSION, __TIME__, __DATE__); 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) filestruct *make_new_node(filestruct * prevnode)
...@@ -419,7 +420,7 @@ filestruct *make_new_node(filestruct * prevnode) ...@@ -419,7 +420,7 @@ filestruct *make_new_node(filestruct * prevnode)
} }
/* Splice a node into an existing filestruct */ /* 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->next = end;
new->prev = begin; new->prev = begin;
...@@ -469,7 +470,7 @@ void do_char(char ch) ...@@ -469,7 +470,7 @@ void do_char(char ch)
{ {
/* magic-line: when a character is inserted on the current magic line, /* magic-line: when a character is inserted on the current magic line,
* it means we need a new one! */ * it means we need a new one! */
if(filebot == current && current->data[0] == '\0') { if (filebot == current && current->data[0] == '\0') {
new_magicline(); new_magicline();
fix_editbot(); fix_editbot();
} }
...@@ -540,7 +541,7 @@ int do_enter(filestruct * inptr) ...@@ -540,7 +541,7 @@ int do_enter(filestruct * inptr)
*/ */
if (current_y == editwinrows - 1) { if (current_y == editwinrows - 1) {
edit_update(current, CENTER); edit_update(current, CENTER);
reset_cursor(); reset_cursor();
} else { } else {
current_y++; current_y++;
edit_refresh(); edit_refresh();
...@@ -624,7 +625,7 @@ void do_wrap(filestruct * inptr, char input_char) ...@@ -624,7 +625,7 @@ void do_wrap(filestruct * inptr, char input_char)
current_word_start_t = i_tabs; current_word_start_t = i_tabs;
while (!isspace((int) inptr->data[i]) while (!isspace((int) inptr->data[i])
&& inptr->data[i]) { && inptr->data[i]) {
i++; i++;
i_tabs++; i_tabs++;
if (inptr->data[i] < 32) if (inptr->data[i] < 32)
...@@ -763,7 +764,8 @@ void do_wrap(filestruct * inptr, char input_char) ...@@ -763,7 +764,8 @@ void do_wrap(filestruct * inptr, char input_char)
right = current_x - current_word_start; right = current_x - current_word_start;
i = current_word_start - 1; 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; current_x = current_word_start;
null_at(inptr->data, current_word_start); null_at(inptr->data, current_word_start);
...@@ -877,7 +879,7 @@ void check_wrap(filestruct * inptr, char ch) ...@@ -877,7 +879,7 @@ void check_wrap(filestruct * inptr, char ch)
/* Do not wrap if there are no words on or after wrap point. */ /* Do not wrap if there are no words on or after wrap point. */
int char_found = 0; int char_found = 0;
while (isspace((int)inptr->data[i]) && inptr->data[i]) while (isspace((int) inptr->data[i]) && inptr->data[i])
i++; i++;
if (!inptr->data[i]) if (!inptr->data[i])
...@@ -954,9 +956,9 @@ int do_backspace(void) ...@@ -954,9 +956,9 @@ int do_backspace(void)
editbot = current; editbot = current;
/* Recreate the magic line if we're deleting it AND if the /* Recreate the magic line if we're deleting it AND if the
line we're on now is NOT blank. if it is blank we line we're on now is NOT blank. if it is blank we
can just use IT for the magic line. This is how Pico can just use IT for the magic line. This is how Pico
appears to do it, in any case */ appears to do it, in any case */
if (strcmp(current->data, "")) { if (strcmp(current->data, "")) {
new_magicline(); new_magicline();
fix_editbot(); fix_editbot();
...@@ -1010,8 +1012,7 @@ int do_delete(void) ...@@ -1010,8 +1012,7 @@ int do_delete(void)
/* Please see the comment in do_basckspace if you don't understand /* Please see the comment in do_basckspace if you don't understand
this test */ this test */
if (current == filebot && strcmp(current->data, "")) if (current == filebot && strcmp(current->data, "")) {
{
new_magicline(); new_magicline();
fix_editbot(); fix_editbot();
totsize++; totsize++;
...@@ -1185,20 +1186,19 @@ void do_mouse(void) ...@@ -1185,20 +1186,19 @@ void do_mouse(void)
} }
current_x = mevent.x; current_x = mevent.x;
placewewant = current_x; placewewant = current_x;
while(foo < current_x) { while (foo < current_x) {
if(current->data[foo] == NANO_CONTROL_I) { if (current->data[foo] == NANO_CONTROL_I) {
current_x -= tabsize - (foo % tabsize); current_x -= tabsize - (foo % tabsize);
tab_found = 1; tab_found = 1;
} else if(current->data[foo] & 0x80) } else if (current->data[foo] & 0x80);
; else if (current->data[foo] < 32)
else if(current->data[foo] < 32)
current_x--; current_x--;
foo++; foo++;
} }
/* This is where tab_found comes in. I can't figure out why, /* 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 * but without it any line with a tab will place the cursor
* one character behind. Whatever, this fixes it. */ * one character behind. Whatever, this fixes it. */
if(tab_found == 1) if (tab_found == 1)
current_x++; current_x++;
if (current_x > strlen(current->data)) if (current_x > strlen(current->data))
...@@ -1227,7 +1227,7 @@ RETSIGTYPE do_suspend(int signal) ...@@ -1227,7 +1227,7 @@ RETSIGTYPE do_suspend(int signal)
sigaction(SIGTSTP, &act, NULL); sigaction(SIGTSTP, &act, NULL);
endwin(); 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); raise(SIGTSTP);
} }
...@@ -1321,14 +1321,12 @@ void signal_init(void) ...@@ -1321,14 +1321,12 @@ void signal_init(void)
if (!ISSET(SUSPEND)) { if (!ISSET(SUSPEND)) {
sigaction(SIGTSTP, &act, NULL); sigaction(SIGTSTP, &act, NULL);
} } else {
else
{
act.sa_handler = do_suspend; act.sa_handler = do_suspend;
sigaction(SIGTSTP, &act, NULL); sigaction(SIGTSTP, &act, NULL);
act.sa_handler = do_cont; act.sa_handler = do_cont;
sigaction (SIGCONT, &act, NULL); sigaction(SIGCONT, &act, NULL);
} }
...@@ -1350,8 +1348,7 @@ void window_init(void) ...@@ -1350,8 +1348,7 @@ void window_init(void)
/* And the other windows */ /* And the other windows */
topwin = newwin(2, COLS, 0, 0); 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) void mouse_init(void)
...@@ -1365,8 +1362,7 @@ void mouse_init(void) ...@@ -1365,8 +1362,7 @@ void mouse_init(void)
mousemask(BUTTON1_RELEASED, NULL); mousemask(BUTTON1_RELEASED, NULL);
mouseinterval(50); mouseinterval(50);
} } else {
else {
mousemask(0, NULL); mousemask(0, NULL);
keypad(edit, FALSE); keypad(edit, FALSE);
keypad(bottomwin, FALSE); keypad(bottomwin, FALSE);
...@@ -1500,8 +1496,8 @@ int do_justify(void) ...@@ -1500,8 +1496,8 @@ int do_justify(void)
slen = strlen(current->data); slen = strlen(current->data);
totsize += slen; totsize += slen;
if((strlenpt(current->data) > (fill)) if ((strlenpt(current->data) > (fill))
&& !no_spaces(current->data)) { && !no_spaces(current->data)) {
do { do {
int i = 0; int i = 0;
int len2 = 0; int len2 = 0;
...@@ -1516,11 +1512,12 @@ int do_justify(void) ...@@ -1516,11 +1512,12 @@ int do_justify(void)
i = slen; i = slen;
for (; i > 0; i--) { for (; i > 0; i--) {
if (isspace((int) current->data[i]) && if (isspace((int) current->data[i]) &&
((strlenpt(current->data) - strlen(current->data +i)) <= ((strlenpt(current->data) - strlen(current->data + i))
fill)) break; <= fill))
break;
} }
if (!i) if (!i)
break; break;
current->data[i] = '\0'; current->data[i] = '\0';
...@@ -1542,8 +1539,8 @@ int do_justify(void) ...@@ -1542,8 +1539,8 @@ int do_justify(void)
current = tmpline; current = tmpline;
slen -= i + 1; slen -= i + 1;
current_y++; current_y++;
} while ((strlenpt(current->data) > (fill)) } while ((strlenpt(current->data) > (fill))
&& !no_spaces(current->data)); && !no_spaces(current->data));
} }
if (current->next) if (current->next)
...@@ -1610,13 +1607,13 @@ void help_init(void) ...@@ -1610,13 +1607,13 @@ void help_init(void)
if (main_list[i].misc1 > KEY_F0 && main_list[i].misc1 <= KEY_F(64)) if (main_list[i].misc1 > KEY_F0 && main_list[i].misc1 <= KEY_F(64))
sofar += snprintf(&buf[sofar], BUFSIZ - sofar, "(F%d) ", sofar += snprintf(&buf[sofar], BUFSIZ - sofar, "(F%d) ",
main_list[i].misc1 - KEY_F0); main_list[i].misc1 - KEY_F0);
else else
sofar += snprintf(&buf[sofar], BUFSIZ - sofar, " "); sofar += snprintf(&buf[sofar], BUFSIZ - sofar, " ");
if (main_list[i].altval > 0) if (main_list[i].altval > 0)
sofar += snprintf(&buf[sofar], BUFSIZ - sofar, "(M-%c) ", sofar += snprintf(&buf[sofar], BUFSIZ - sofar, "(M-%c) ",
main_list[i].altval - 32); main_list[i].altval - 32);
else else
sofar += snprintf(&buf[sofar], BUFSIZ - sofar, " "); sofar += snprintf(&buf[sofar], BUFSIZ - sofar, " ");
...@@ -1631,12 +1628,12 @@ void help_init(void) ...@@ -1631,12 +1628,12 @@ void help_init(void)
/* And the toggles... */ /* And the toggles... */
for (i = 0; i <= TOGGLE_LEN - 1; i++) { for (i = 0; i <= TOGGLE_LEN - 1; i++) {
sofar = snprintf(buf, BUFSIZ, sofar = snprintf(buf, BUFSIZ,
"M-%c ", toggles[i].val - 32 ); "M-%c ", toggles[i].val - 32);
if (toggles[i].desc != NULL) if (toggles[i].desc != NULL)
snprintf(&buf[sofar], BUFSIZ - sofar, _("%s enable/disable"), snprintf(&buf[sofar], BUFSIZ - sofar, _("%s enable/disable"),
toggles[i].desc); toggles[i].desc);
strcat(help_text, buf); strcat(help_text, buf);
strcat(help_text, "\n"); strcat(help_text, "\n");
...@@ -1677,13 +1674,13 @@ void do_toggle(int which) ...@@ -1677,13 +1674,13 @@ void do_toggle(int which)
if (!ISSET(toggles[which].flag)) { if (!ISSET(toggles[which].flag)) {
if (toggles[which].val == TOGGLE_NOHELP_KEY || if (toggles[which].val == TOGGLE_NOHELP_KEY ||
toggles[which].val == TOGGLE_WRAP_KEY) toggles[which].val == TOGGLE_WRAP_KEY)
statusbar("%s %s", toggles[which].desc, enabled); statusbar("%s %s", toggles[which].desc, enabled);
else else
statusbar("%s %s", toggles[which].desc, disabled); statusbar("%s %s", toggles[which].desc, disabled);
} else { } else {
if (toggles[which].val == TOGGLE_NOHELP_KEY || if (toggles[which].val == TOGGLE_NOHELP_KEY ||
toggles[which].val == TOGGLE_WRAP_KEY) toggles[which].val == TOGGLE_WRAP_KEY)
statusbar("%s %s", toggles[which].desc, disabled); statusbar("%s %s", toggles[which].desc, disabled);
else else
statusbar("%s %s", toggles[which].desc, enabled); statusbar("%s %s", toggles[which].desc, enabled);
...@@ -1711,7 +1708,7 @@ int main(int argc, char *argv[]) ...@@ -1711,7 +1708,7 @@ int main(int argc, char *argv[])
int option_index = 0; int option_index = 0;
struct option long_options[] = { struct option long_options[] = {
#ifdef HAVE_REGEX_H #ifdef HAVE_REGEX_H
{"regexp", 0, 0, 'R'}, {"regexp", 0, 0, 'R'},
#endif #endif
{"version", 0, 0, 'V'}, {"version", 0, 0, 'V'},
{"const", 0, 0, 'c'}, {"const", 0, 0, 'c'},
...@@ -1925,97 +1922,95 @@ int main(int argc, char *argv[]) ...@@ -1925,97 +1922,95 @@ int main(int argc, char *argv[])
kbinput = wgetch(edit); kbinput = wgetch(edit);
if (kbinput == 27) { /* Grab Alt-key stuff first */ if (kbinput == 27) { /* Grab Alt-key stuff first */
switch (kbinput = wgetch(edit)) { switch (kbinput = wgetch(edit)) {
/* Alt-O, suddenly very important ;) */ /* Alt-O, suddenly very important ;) */
case 79: case 79:
kbinput = wgetch(edit); kbinput = wgetch(edit);
if (kbinput <= 'S' && kbinput >= 'P') if (kbinput <= 'S' && kbinput >= 'P')
kbinput = KEY_F(kbinput - 79); kbinput = KEY_F(kbinput - 79);
#ifdef DEBUG #ifdef DEBUG
else { else {
fprintf(stderr, _("I got Alt-O-%c! (%d)\n"), fprintf(stderr, _("I got Alt-O-%c! (%d)\n"),
kbinput, kbinput); kbinput, kbinput);
break; break;
} }
#endif #endif
break; break;
case 91: case 91:
switch (kbinput = wgetch(edit)) { switch (kbinput = wgetch(edit)) {
case '1': /* Alt-[-1-[0-5,7-9] = F1-F8 in X at least */ case '1': /* Alt-[-1-[0-5,7-9] = F1-F8 in X at least */
kbinput = wgetch(edit); kbinput = wgetch(edit);
if (kbinput >= '1' && kbinput <= '5') { if (kbinput >= '1' && kbinput <= '5') {
kbinput = KEY_F(kbinput - 48); kbinput = KEY_F(kbinput - 48);
wgetch(edit); wgetch(edit);
} } else if (kbinput >= '7' && kbinput <= '9') {
else if (kbinput >= '7' && kbinput <= '9') { kbinput = KEY_F(kbinput - 49);
kbinput = KEY_F(kbinput - 49); wgetch(edit);
wgetch(edit); } else if (kbinput == 126)
} kbinput = KEY_HOME;
else if (kbinput == 126)
kbinput = KEY_HOME;
#ifdef DEBUG #ifdef DEBUG
else { else {
fprintf(stderr, _("I got Alt-[-1-%c! (%d)\n"), fprintf(stderr, _("I got Alt-[-1-%c! (%d)\n"),
kbinput, kbinput); kbinput, kbinput);
break; break;
} }
#endif #endif
break; break;
case '2': /* Alt-[-2-[0,1,3,4] = F9-F12 in many terms */ case '2': /* Alt-[-2-[0,1,3,4] = F9-F12 in many terms */
kbinput = wgetch(edit); kbinput = wgetch(edit);
switch (kbinput) { switch (kbinput) {
case '0': case '0':
kbinput = KEY_F(9); kbinput = KEY_F(9);
wgetch(edit); wgetch(edit);
break; break;
case '1': case '1':
kbinput = KEY_F(10); kbinput = KEY_F(10);
wgetch(edit); wgetch(edit);
break; break;
case '3': case '3':
kbinput = KEY_F(11); kbinput = KEY_F(11);
wgetch(edit); wgetch(edit);
break; break;
case '4': case '4':
kbinput = KEY_F(12); kbinput = KEY_F(12);
wgetch(edit); wgetch(edit);
break; break;
case 126: /* Hack, make insert key do something case 126: /* Hack, make insert key do something
usefile, like insert file */ usefile, like insert file */
do_insertfile(); do_insertfile();
keyhandled = 1; keyhandled = 1;
break; break;
#ifdef DEBUG #ifdef DEBUG
default: default:
fprintf(stderr, _("I got Alt-[-2-%c! (%d)\n"), fprintf(stderr, _("I got Alt-[-2-%c! (%d)\n"),
kbinput, kbinput); kbinput, kbinput);
break; break;
#endif #endif
} }
break; break;
case '3': /* Alt-[-3 = Delete? */ case '3': /* Alt-[-3 = Delete? */
kbinput = NANO_DELETE_KEY; kbinput = NANO_DELETE_KEY;
wgetch(edit); wgetch(edit);
break; break;
case '4': /* Alt-[-4 = End? */ case '4': /* Alt-[-4 = End? */
kbinput = NANO_END_KEY; kbinput = NANO_END_KEY;
wgetch(edit); wgetch(edit);
break; break;
case '5': /* Alt-[-5 = Page Up */ case '5': /* Alt-[-5 = Page Up */
kbinput = KEY_PPAGE; kbinput = KEY_PPAGE;
wgetch(edit); wgetch(edit);
break; break;
case '6': /* Alt-[-6 = Page Down */ case '6': /* Alt-[-6 = Page Down */
kbinput = KEY_NPAGE; kbinput = KEY_NPAGE;
wgetch(edit); wgetch(edit);
break; break;
case '[': /* Alt-[-[-[A-E], F1-F5 in linux console */ case '[': /* Alt-[-[-[A-E], F1-F5 in linux console */
kbinput = wgetch(edit); kbinput = wgetch(edit);
if (kbinput >= 'A' && kbinput <= 'E') if (kbinput >= 'A' && kbinput <= 'E')
kbinput = KEY_F(kbinput - 64); kbinput = KEY_F(kbinput - 64);
break; break;
case 'A': case 'A':
kbinput = KEY_UP; kbinput = KEY_UP;
...@@ -2049,17 +2044,17 @@ int main(int argc, char *argv[]) ...@@ -2049,17 +2044,17 @@ int main(int argc, char *argv[])
for (i = 0; i <= MAIN_LIST_LEN - 1; i++) for (i = 0; i <= MAIN_LIST_LEN - 1; i++)
if (kbinput == main_list[i].altval || if (kbinput == main_list[i].altval ||
kbinput == main_list[i].altval - 32) { kbinput == main_list[i].altval - 32) {
kbinput = main_list[i].val; kbinput = main_list[i].val;
break; break;
} }
#ifndef NANO_SMALL #ifndef NANO_SMALL
/* And for toggle switches */ /* And for toggle switches */
for (i = 0; i <= TOGGLE_LEN - 1 && !keyhandled; i++) for (i = 0; i <= TOGGLE_LEN - 1 && !keyhandled; i++)
if (kbinput == toggles[i].val || if (kbinput == toggles[i].val ||
kbinput == toggles[i].val - 32) { kbinput == toggles[i].val - 32) {
do_toggle(i); do_toggle(i);
keyhandled = 1; keyhandled = 1;
break; break;
} }
#endif #endif
#ifdef DEBUG #ifdef DEBUG
...@@ -2112,11 +2107,11 @@ int main(int argc, char *argv[]) ...@@ -2112,11 +2107,11 @@ int main(int argc, char *argv[])
case -1: case -1:
case 410: /* Must ignore this, it gets sent when we resize */ case 410: /* Must ignore this, it gets sent when we resize */
#ifdef PDCURSES #ifdef PDCURSES
case 541: /* ???? */ case 541: /* ???? */
case 542: /* Control and alt in Windows *shrug* */ case 542: /* Control and alt in Windows *shrug* */
case 544: case 544:
#endif #endif
break; break;
default: default:
#ifdef DEBUG #ifdef DEBUG
......
...@@ -225,6 +225,7 @@ know what you're doing */ ...@@ -225,6 +225,7 @@ know what you're doing */
#define NANO_SUSPEND_KEY NANO_CONTROL_Z #define NANO_SUSPEND_KEY NANO_CONTROL_Z
#define NANO_ENTER_KEY NANO_CONTROL_M #define NANO_ENTER_KEY NANO_CONTROL_M
#define NANO_FROMSEARCHTOGOTO_KEY NANO_CONTROL_T #define NANO_FROMSEARCHTOGOTO_KEY NANO_CONTROL_T
#define NANO_NULL_KEY NANO_CONTROL_N
#define TOGGLE_CONST_KEY NANO_ALT_C #define TOGGLE_CONST_KEY NANO_ALT_C
#define TOGGLE_AUTOINDENT_KEY NANO_ALT_I #define TOGGLE_AUTOINDENT_KEY NANO_ALT_I
...@@ -239,7 +240,7 @@ know what you're doing */ ...@@ -239,7 +240,7 @@ know what you're doing */
#define MAIN_LIST_LEN 26 #define MAIN_LIST_LEN 26
#define MAIN_VISIBLE 12 #define MAIN_VISIBLE 12
#define WHEREIS_LIST_LEN 6 #define WHEREIS_LIST_LEN 6
#define REPLACE_LIST_LEN 6 #define REPLACE_LIST_LEN 7
#define GOTO_LIST_LEN 3 #define GOTO_LIST_LEN 3
#define WRITEFILE_LIST_LEN 1 #define WRITEFILE_LIST_LEN 1
#define HELP_LIST_LEN 3 #define HELP_LIST_LEN 3
......
...@@ -67,41 +67,43 @@ const struct _msg_ent _msg_tbl[] = { ...@@ -67,41 +67,43 @@ const struct _msg_ent _msg_tbl[] = {
{"Insert a carriage return at the cursor position", 58}, {"Insert a carriage return at the cursor position", 58},
{"Make the current search or replace case (in)sensitive", 59}, {"Make the current search or replace case (in)sensitive", 59},
{"Cancel the current function", 60}, {"Cancel the current function", 60},
{"Get Help", 61}, {"Use the null string, \"\"", 61},
{"WriteOut", 62}, {"Get Help", 62},
{"Exit", 63}, {"WriteOut", 63},
{"Goto Line", 64}, {"Exit", 64},
{"Justify", 65}, {"Goto Line", 65},
{"Replace", 66}, {"Justify", 66},
{"Read File", 67}, {"Replace", 67},
{"Where Is", 68}, {"Read File", 68},
{"Prev Page", 69}, {"Where Is", 69},
{"Next Page", 70}, {"Prev Page", 70},
{"Cut Text", 71}, {"Next Page", 71},
{"UnCut Txt", 72}, {"Cut Text", 72},
{"Cur Pos", 73}, {"UnCut Txt", 73},
{"To Spell", 74}, {"Cur Pos", 74},
{"Up", 75}, {"To Spell", 75},
{"Down", 76}, {"Up", 76},
{"Forward", 77}, {"Down", 77},
{"Back", 78}, {"Forward", 78},
{"Home", 79}, {"Back", 79},
{"End", 80}, {"Home", 80},
{"Refresh", 81}, {"End", 81},
{"Mark Text", 82}, {"Refresh", 82},
{"Delete", 83}, {"Mark Text", 83},
{"Backspace", 84}, {"Delete", 84},
{"Tab", 85}, {"Backspace", 85},
{"Enter", 86}, {"Tab", 86},
{"First Line", 87}, {"Enter", 87},
{"Last Line", 88}, {"First Line", 88},
{"Case Sens", 89}, {"Last Line", 89},
{"Cancel", 90}, {"Case Sens", 90},
{"No Replace", 91}, {"Cancel", 91},
{"No Replace", 92},
{"Null Str", 93},
{"\ {"\
\n\ \n\
Buffer written to 'nano.save'\n", 92}, Buffer written to 'nano.save'\n", 94},
{"Key illegal in VIEW mode", 93}, {"Key illegal in VIEW mode", 95},
{"\ {"\
nano help text\n\ nano help text\n\
\n\ \n\
...@@ -119,117 +121,118 @@ Escape-key sequences are notated with the Meta (M) symbol and can be entered \ ...@@ -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 \ 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 \ following keystrokes are available in the main editor window. Optional keys \
are shown in parentheses:\n\ are shown in parentheses:\n\
\n", 94}, \n", 96},
{"free_node(): free'd a node, YAY!\n", 95}, {"free_node(): free'd a node, YAY!\n", 97},
{"free_node(): free'd last node.\n", 96}, {"free_node(): free'd last node.\n", 98},
{"\ {"\
Usage: nano [GNU long option] [option] +LINE <file>\n\ Usage: nano [GNU long option] [option] +LINE <file>\n\
\n", 97}, \n", 99},
{"Option\t\tLong option\t\tMeaning\n", 98}, {"Option\t\tLong option\t\tMeaning\n", 100},
{" -T \t\t--tabsize=[num]\t\tSet width of a tab to num\n", 99}, {" -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", 100}, {" -R\t\t--regexp\t\tUse regular expressions for search\n", 102},
{" -V \t\t--version\t\tPrint version information and exit\n", 101}, {" -V \t\t--version\t\tPrint version information and exit\n", 103},
{" -c \t\t--const\t\t\tConstantly show cursor position\n", 102}, {" -c \t\t--const\t\t\tConstantly show cursor position\n", 104},
{" -h \t\t--help\t\t\tShow this message\n", 103}, {" -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", 104}, {" -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", 105}, {" -i \t\t--autoindent\t\tAutomatically indent new lines\n", 107},
{" -l \t\t--nofollow\t\tDon't follow symbolic links, overwrite\n", 106}, {" -l \t\t--nofollow\t\tDon't follow symbolic links, overwrite\n", 108},
{" -m \t\t--mouse\t\t\tEnable mouse\n", 107}, {" -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}, -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", 109}, {" -p\t \t--pico\t\t\tMake bottom 2 lines more Pico-like\n", 111},
{" -s [prog] \t--speller=[prog]\tEnable alternate speller\n", 110}, {" -s [prog] \t--speller=[prog]\tEnable alternate speller\n", 112},
{" -t \t\t--tempfile\t\tAuto save on exit, don't prompt\n", 111}, {" -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", 112}, {" -v \t\t--view\t\t\tView (read only) mode\n", 114},
{" -w \t\t--nowrap\t\tDon't wrap long lines\n", 113}, {" -w \t\t--nowrap\t\tDon't wrap long lines\n", 115},
{" -x \t\t--nohelp\t\tDon't show help window\n", 114}, {" -x \t\t--nohelp\t\tDon't show help window\n", 116},
{" -z \t\t--suspend\t\tEnable suspend\n", 115}, {" -z \t\t--suspend\t\tEnable suspend\n", 117},
{" +LINE\t\t\t\t\tStart at line number LINE\n", 116}, {" +LINE\t\t\t\t\tStart at line number LINE\n", 118},
{"\ {"\
Usage: nano [option] +LINE <file>\n\ Usage: nano [option] +LINE <file>\n\
\n", 117}, \n", 119},
{"Option\t\tMeaning\n", 118}, {"Option\t\tMeaning\n", 120},
{" -T [num]\tSet width of a tab to num\n", 119}, {" -T [num]\tSet width of a tab to num\n", 121},
{" -R\t\tUse regular expressions for search\n", 120}, {" -R\t\tUse regular expressions for search\n", 122},
{" -V \t\tPrint version information and exit\n", 121}, {" -V \t\tPrint version information and exit\n", 123},
{" -c \t\tConstantly show cursor position\n", 122}, {" -c \t\tConstantly show cursor position\n", 124},
{" -h \t\tShow this message\n", 123}, {" -h \t\tShow this message\n", 125},
{" -k \t\tLet ^K cut from cursor to end of line\n", 124}, {" -k \t\tLet ^K cut from cursor to end of line\n", 126},
{" -i \t\tAutomatically indent new lines\n", 125}, {" -i \t\tAutomatically indent new lines\n", 127},
{" -l \t\tDon't follow symbolic links, overwrite\n", 126}, {" -l \t\tDon't follow symbolic links, overwrite\n", 128},
{" -m \t\tEnable mouse\n", 127}, {" -m \t\tEnable mouse\n", 129},
{" -r [#cols] \tSet fill cols to (wrap lines at) #cols\n", 128}, {" -r [#cols] \tSet fill cols to (wrap lines at) #cols\n", 130},
{" -s [prog] \tEnable alternate speller\n", 129}, {" -s [prog] \tEnable alternate speller\n", 131},
{" -p \t\tMake bottom 2 lines more Pico-like\n", 130}, {" -p \t\tMake bottom 2 lines more Pico-like\n", 132},
{" -t \t\tAuto save on exit, don't prompt\n", 131}, {" -t \t\tAuto save on exit, don't prompt\n", 133},
{" -v \t\tView (read only) mode\n", 132}, {" -v \t\tView (read only) mode\n", 134},
{" -w \t\tDon't wrap long lines\n", 133}, {" -w \t\tDon't wrap long lines\n", 135},
{" -x \t\tDon't show help window\n", 134}, {" -x \t\tDon't show help window\n", 136},
{" -z \t\tEnable suspend\n", 135}, {" -z \t\tEnable suspend\n", 137},
{" +LINE\t\tStart at line number LINE\n", 136}, {" +LINE\t\tStart at line number LINE\n", 138},
{" nano version %s by Chris Allegretta (compiled %s, %s)\n", 137}, {" nano version %s by Chris Allegretta (compiled %s, %s)\n", 139},
{" Email: nano@nano-editor.org\tWeb: http://www.nano-editor.org\n", 138}, {" Email: nano@nano-editor.org\tWeb: http://www.nano-editor.org\n", 140},
{"Mark Set", 139}, {"Mark Set", 141},
{"Mark UNset", 140}, {"Mark UNset", 142},
{"check_wrap called with inptr->data=\"%s\"\n", 141}, {"check_wrap called with inptr->data=\"%s\"\n", 143},
{"current->data now = \"%s\"\n", 142}, {"current->data now = \"%s\"\n", 144},
{"After, data = \"%s\"\n", 143}, {"After, data = \"%s\"\n", 145},
{"Error deleting tempfile, ack!", 144}, {"Error deleting tempfile, ack!", 146},
{"Could not create a temporary filename: %s", 145}, {"Could not create a temporary filename: %s", 147},
{"Could not invoke spell program \"%s\"", 146}, {"Could not invoke spell program \"%s\"", 148},
{"Could not invoke \"ispell\"", 147}, {"Could not invoke \"ispell\"", 149},
{"Finished checking spelling", 148}, {"Finished checking spelling", 150},
{"Save modified buffer (ANSWERING \"No\" WILL DESTROY CHANGES) ? ", 149}, {"Save modified buffer (ANSWERING \"No\" WILL DESTROY CHANGES) ? ", 151},
{"Cannot resize top win", 150}, {"Cannot resize top win", 152},
{"Cannot move top win", 151}, {"Cannot move top win", 153},
{"Cannot resize edit win", 152}, {"Cannot resize edit win", 154},
{"Cannot move edit win", 153}, {"Cannot move edit win", 155},
{"Cannot resize bottom win", 154}, {"Cannot resize bottom win", 156},
{"Cannot move bottom win", 155}, {"Cannot move bottom win", 157},
{"%s enable/disable", 156}, {"%s enable/disable", 158},
{"enabled", 157}, {"enabled", 159},
{"disabled", 158}, {"disabled", 160},
{"Main: set up windows\n", 159}, {"Main: set up windows\n", 161},
{"Main: bottom win\n", 160}, {"Main: bottom win\n", 162},
{"Main: open file\n", 161}, {"Main: open file\n", 163},
{"I got Alt-O-%c! (%d)\n", 162}, {"I got Alt-O-%c! (%d)\n", 164},
{"I got Alt-[-1-%c! (%d)\n", 163}, {"I got Alt-[-1-%c! (%d)\n", 165},
{"I got Alt-[-2-%c! (%d)\n", 164}, {"I got Alt-[-2-%c! (%d)\n", 166},
{"I got Alt-[-%c! (%d)\n", 165}, {"I got Alt-[-%c! (%d)\n", 167},
{"I got Alt-%c! (%d)\n", 166}, {"I got Alt-%c! (%d)\n", 168},
{"Case Sensitive Regexp Search%s%s", 167}, {"Case Sensitive Regexp Search%s%s", 169},
{"Regexp Search%s%s", 168}, {"Regexp Search%s%s", 170},
{"Case Sensitive Search%s%s", 169}, {"Case Sensitive Search%s%s", 171},
{"Search%s%s", 170}, {"Search%s%s", 172},
{" (to replace)", 171}, {" (to replace)", 173},
{"Search Cancelled", 172}, {"Search Cancelled", 174},
{"Search Wrapped", 173}, {"Search Wrapped", 175},
{"Replaced %d occurences", 174}, {"Replaced %d occurences", 176},
{"Replaced 1 occurence", 175}, {"Replaced 1 occurence", 177},
{"Replace Cancelled", 176}, {"Replace Cancelled", 178},
{"Replace with [%s]", 177}, {"Nothing Happens", 179},
{"Replace with", 178}, {"Replace with [%s]", 180},
{"Replace this instance?", 179}, {"Replace with", 181},
{"Enter line number", 180}, {"Replace this instance?", 182},
{"Aborted", 181}, {"Enter line number", 183},
{"Come on, be reasonable", 182}, {"Aborted", 184},
{"Only %d lines available, skipping to last line", 183}, {"Come on, be reasonable", 185},
{"actual_x_from_start for xplus=%d returned %d\n", 184}, {"Only %d lines available, skipping to last line", 186},
{"input '%c' (%d)\n", 185}, {"actual_x_from_start for xplus=%d returned %d\n", 187},
{"New Buffer", 186}, {"input '%c' (%d)\n", 188},
{" File: ...", 187}, {"New Buffer", 189},
{"Modified", 188}, {" File: ...", 190},
{"Moved to (%d, %d) in edit buffer\n", 189}, {"Modified", 191},
{"current->data = \"%s\"\n", 190}, {"Moved to (%d, %d) in edit buffer\n", 192},
{"I got \"%s\"\n", 191}, {"current->data = \"%s\"\n", 193},
{"Yes", 192}, {"I got \"%s\"\n", 194},
{"All", 193}, {"Yes", 195},
{"No", 194}, {"All", 196},
{"do_cursorpos: linepct = %f, bytepct = %f\n", 195}, {"No", 197},
{"line %d of %d (%.0f%%), character %d of %d (%.0f%%)", 196}, {"do_cursorpos: linepct = %f, bytepct = %f\n", 198},
{"Dumping file buffer to stderr...\n", 197}, {"line %d of %d (%.0f%%), character %d of %d (%.0f%%)", 199},
{"Dumping cutbuffer to stderr...\n", 198}, {"Dumping file buffer to stderr...\n", 200},
{"Dumping a buffer to stderr...\n", 199}, {"Dumping cutbuffer to stderr...\n", 201},
{"Dumping a buffer to stderr...\n", 202},
}; };
int _msg_tbl_length = 199; int _msg_tbl_length = 202;
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "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" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
...@@ -55,11 +55,11 @@ msgstr "" ...@@ -55,11 +55,11 @@ msgstr ""
msgid "File to insert [from ./] " msgid "File to insert [from ./] "
msgstr "" 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" msgid "Cancelled"
msgstr "" 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 #, c-format
msgid "Could not open file for writing: %s" msgid "Could not open file for writing: %s"
msgstr "" msgstr ""
...@@ -68,42 +68,42 @@ msgstr "" ...@@ -68,42 +68,42 @@ msgstr ""
msgid "Could not open file: Path length exceeded." msgid "Could not open file: Path length exceeded."
msgstr "" msgstr ""
#: files.c:358 #: files.c:359
#, c-format #, c-format
msgid "Wrote >%s\n" msgid "Wrote >%s\n"
msgstr "" msgstr ""
#: files.c:385 #: files.c:386
#, c-format #, c-format
msgid "Could not close %s: %s" msgid "Could not close %s: %s"
msgstr "" msgstr ""
#. Try a rename?? #. Try a rename??
#: files.c:406 files.c:417 files.c:422 #: files.c:407 files.c:418 files.c:423
#, c-format #, c-format
msgid "Could not open %s for writing: %s" msgid "Could not open %s for writing: %s"
msgstr "" msgstr ""
#: files.c:428 #: files.c:429
#, c-format #, c-format
msgid "Could not set permissions %o on %s: %s" msgid "Could not set permissions %o on %s: %s"
msgstr "" msgstr ""
#: files.c:435 #: files.c:436
#, c-format #, c-format
msgid "Wrote %d lines" msgid "Wrote %d lines"
msgstr "" msgstr ""
#: files.c:467 #: files.c:465
msgid "File Name to write" msgid "File Name to write"
msgstr "" msgstr ""
#: files.c:472 #: files.c:470
#, c-format #, c-format
msgid "filename is %s" msgid "filename is %s"
msgstr "" msgstr ""
#: files.c:477 #: files.c:475
msgid "File exists, OVERWRITE ?" msgid "File exists, OVERWRITE ?"
msgstr "" msgstr ""
...@@ -263,131 +263,139 @@ msgstr "" ...@@ -263,131 +263,139 @@ msgstr ""
msgid "Cancel the current function" msgid "Cancel the current function"
msgstr "" 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" msgid "Get Help"
msgstr "" msgstr ""
#: global.c:213 global.c:221 #: global.c:214 global.c:222
msgid "WriteOut" msgid "WriteOut"
msgstr "" msgstr ""
#: global.c:217 global.c:383 #: global.c:218 global.c:389
msgid "Exit" msgid "Exit"
msgstr "" 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" msgid "Goto Line"
msgstr "" msgstr ""
#: global.c:230 global.c:309 #: global.c:231 global.c:310
msgid "Justify" msgid "Justify"
msgstr "" msgstr ""
#: global.c:234 global.c:305 global.c:336 #: global.c:235 global.c:306 global.c:337
msgid "Replace" msgid "Replace"
msgstr "" msgstr ""
#: global.c:238 #: global.c:239
msgid "Read File" msgid "Read File"
msgstr "" msgstr ""
#: global.c:242 #: global.c:243
msgid "Where Is" msgid "Where Is"
msgstr "" msgstr ""
#: global.c:246 global.c:375 #: global.c:247 global.c:381
msgid "Prev Page" msgid "Prev Page"
msgstr "" msgstr ""
#: global.c:250 global.c:379 #: global.c:251 global.c:385
msgid "Next Page" msgid "Next Page"
msgstr "" msgstr ""
#: global.c:254 #: global.c:255
msgid "Cut Text" msgid "Cut Text"
msgstr "" msgstr ""
#: global.c:257 #: global.c:258
msgid "UnCut Txt" msgid "UnCut Txt"
msgstr "" msgstr ""
#: global.c:261 #: global.c:262
msgid "Cur Pos" msgid "Cur Pos"
msgstr "" msgstr ""
#: global.c:265 #: global.c:266
msgid "To Spell" msgid "To Spell"
msgstr "" msgstr ""
#: global.c:269 #: global.c:270
msgid "Up" msgid "Up"
msgstr "" msgstr ""
#: global.c:272 #: global.c:273
msgid "Down" msgid "Down"
msgstr "" msgstr ""
#: global.c:275 #: global.c:276
msgid "Forward" msgid "Forward"
msgstr "" msgstr ""
#: global.c:278 #: global.c:279
msgid "Back" msgid "Back"
msgstr "" msgstr ""
#: global.c:281 #: global.c:282
msgid "Home" msgid "Home"
msgstr "" msgstr ""
#: global.c:284 #: global.c:285
msgid "End" msgid "End"
msgstr "" msgstr ""
#: global.c:287 #: global.c:288
msgid "Refresh" msgid "Refresh"
msgstr "" msgstr ""
#: global.c:290 #: global.c:291
msgid "Mark Text" msgid "Mark Text"
msgstr "" msgstr ""
#: global.c:293 #: global.c:294
msgid "Delete" msgid "Delete"
msgstr "" msgstr ""
#: global.c:297 #: global.c:298
msgid "Backspace" msgid "Backspace"
msgstr "" msgstr ""
#: global.c:301 #: global.c:302
msgid "Tab" msgid "Tab"
msgstr "" msgstr ""
#: global.c:313 #: global.c:314
msgid "Enter" msgid "Enter"
msgstr "" msgstr ""
#: global.c:326 global.c:346 global.c:365 #: global.c:327 global.c:348 global.c:371
msgid "First Line" msgid "First Line"
msgstr "" msgstr ""
#: global.c:329 global.c:349 global.c:368 #: global.c:330 global.c:351 global.c:374
msgid "Last Line" msgid "Last Line"
msgstr "" msgstr ""
#: global.c:332 global.c:352 #: global.c:333 global.c:354
msgid "Case Sens" msgid "Case Sens"
msgstr "" msgstr ""
#: global.c:342 global.c:361 global.c:371 global.c:387 global.c:391 #: global.c:344 global.c:367 global.c:377 global.c:393 global.c:397
#: global.c:397 winio.c:979 #: global.c:403 winio.c:971
msgid "Cancel" msgid "Cancel"
msgstr "" msgstr ""
#: global.c:355 #: global.c:357
msgid "No Replace" msgid "No Replace"
msgstr "" msgstr ""
#: global.c:364
msgid "Null Str"
msgstr ""
#: nano.c:115 #: nano.c:115
msgid "" msgid ""
"\n" "\n"
...@@ -597,57 +605,57 @@ msgstr "" ...@@ -597,57 +605,57 @@ msgstr ""
msgid " nano version %s by Chris Allegretta (compiled %s, %s)\n" msgid " nano version %s by Chris Allegretta (compiled %s, %s)\n"
msgstr "" msgstr ""
#: nano.c:402 #: nano.c:403
msgid " Email: nano@nano-editor.org\tWeb: http://www.nano-editor.org\n" msgid " Email: nano@nano-editor.org\tWeb: http://www.nano-editor.org\n"
msgstr "" msgstr ""
#: nano.c:437 #: nano.c:438
msgid "Mark Set" msgid "Mark Set"
msgstr "" msgstr ""
#: nano.c:442 #: nano.c:443
msgid "Mark UNset" msgid "Mark UNset"
msgstr "" msgstr ""
#: nano.c:868 #: nano.c:870
#, c-format #, c-format
msgid "check_wrap called with inptr->data=\"%s\"\n" msgid "check_wrap called with inptr->data=\"%s\"\n"
msgstr "" msgstr ""
#: nano.c:919 #: nano.c:921
#, c-format #, c-format
msgid "current->data now = \"%s\"\n" msgid "current->data now = \"%s\"\n"
msgstr "" msgstr ""
#: nano.c:972 #: nano.c:974
#, c-format #, c-format
msgid "After, data = \"%s\"\n" msgid "After, data = \"%s\"\n"
msgstr "" msgstr ""
#: nano.c:1042 #: nano.c:1043
msgid "Error deleting tempfile, ack!" msgid "Error deleting tempfile, ack!"
msgstr "" msgstr ""
#: nano.c:1060 #: nano.c:1061
#, c-format #, c-format
msgid "Could not create a temporary filename: %s" msgid "Could not create a temporary filename: %s"
msgstr "" msgstr ""
#: nano.c:1083 #: nano.c:1084
#, c-format #, c-format
msgid "Could not invoke spell program \"%s\"" msgid "Could not invoke spell program \"%s\""
msgstr "" msgstr ""
#. Why 32512? I dont know! #. Why 32512? I dont know!
#: nano.c:1089 #: nano.c:1090
msgid "Could not invoke \"ispell\"" msgid "Could not invoke \"ispell\""
msgstr "" msgstr ""
#: nano.c:1102 #: nano.c:1103
msgid "Finished checking spelling" msgid "Finished checking spelling"
msgstr "" msgstr ""
#: nano.c:1120 #: nano.c:1121
msgid "Save modified buffer (ANSWERING \"No\" WILL DESTROY CHANGES) ? " msgid "Save modified buffer (ANSWERING \"No\" WILL DESTROY CHANGES) ? "
msgstr "" msgstr ""
...@@ -675,52 +683,52 @@ msgstr "" ...@@ -675,52 +683,52 @@ msgstr ""
msgid "Cannot move bottom win" msgid "Cannot move bottom win"
msgstr "" msgstr ""
#: nano.c:1638 #: nano.c:1635
#, c-format #, c-format
msgid "%s enable/disable" msgid "%s enable/disable"
msgstr "" msgstr ""
#: nano.c:1650 #: nano.c:1647
msgid "enabled" msgid "enabled"
msgstr "" msgstr ""
#: nano.c:1651 #: nano.c:1648
msgid "disabled" msgid "disabled"
msgstr "" msgstr ""
#: nano.c:1881 #: nano.c:1878
msgid "Main: set up windows\n" msgid "Main: set up windows\n"
msgstr "" msgstr ""
#: nano.c:1895 #: nano.c:1892
msgid "Main: bottom win\n" msgid "Main: bottom win\n"
msgstr "" msgstr ""
#: nano.c:1901 #: nano.c:1898
msgid "Main: open file\n" msgid "Main: open file\n"
msgstr "" msgstr ""
#: nano.c:1935 #: nano.c:1932
#, c-format #, c-format
msgid "I got Alt-O-%c! (%d)\n" msgid "I got Alt-O-%c! (%d)\n"
msgstr "" msgstr ""
#: nano.c:1959 #: nano.c:1954
#, c-format #, c-format
msgid "I got Alt-[-1-%c! (%d)\n" msgid "I got Alt-[-1-%c! (%d)\n"
msgstr "" msgstr ""
#: nano.c:1992 #: nano.c:1987
#, c-format #, c-format
msgid "I got Alt-[-2-%c! (%d)\n" msgid "I got Alt-[-2-%c! (%d)\n"
msgstr "" msgstr ""
#: nano.c:2040 #: nano.c:2035
#, c-format #, c-format
msgid "I got Alt-[-%c! (%d)\n" msgid "I got Alt-[-%c! (%d)\n"
msgstr "" msgstr ""
#: nano.c:2066 #: nano.c:2061
#, c-format #, c-format
msgid "I got Alt-%c! (%d)\n" msgid "I got Alt-%c! (%d)\n"
msgstr "" msgstr ""
...@@ -735,21 +743,21 @@ msgstr "" ...@@ -735,21 +743,21 @@ msgstr ""
msgid "Regexp Search%s%s" msgid "Regexp Search%s%s"
msgstr "" msgstr ""
#: search.c:82 #: search.c:81
#, c-format #, c-format
msgid "Case Sensitive Search%s%s" msgid "Case Sensitive Search%s%s"
msgstr "" msgstr ""
#: search.c:84 #: search.c:83
#, c-format #, c-format
msgid "Search%s%s" msgid "Search%s%s"
msgstr "" msgstr ""
#: search.c:87 #: search.c:86
msgid " (to replace)" msgid " (to replace)"
msgstr "" msgstr ""
#: search.c:95 #: search.c:94
msgid "Search Cancelled" msgid "Search Cancelled"
msgstr "" msgstr ""
...@@ -766,38 +774,44 @@ msgstr "" ...@@ -766,38 +774,44 @@ msgstr ""
msgid "Replaced 1 occurence" msgid "Replaced 1 occurence"
msgstr "" msgstr ""
#: search.c:392 search.c:413 search.c:436 #: search.c:390 search.c:419 search.c:444
msgid "Replace Cancelled" msgid "Replace Cancelled"
msgstr "" 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 #, c-format
msgid "Replace with [%s]" msgid "Replace with [%s]"
msgstr "" msgstr ""
#. last_search is empty #. last_search is empty
#: search.c:434 #: search.c:442
msgid "Replace with" msgid "Replace with"
msgstr "" msgstr ""
#: search.c:475 #: search.c:485
msgid "Replace this instance?" msgid "Replace this instance?"
msgstr "" msgstr ""
#. Ask for it #. Ask for it
#: search.c:536 #: search.c:546
msgid "Enter line number" msgid "Enter line number"
msgstr "" msgstr ""
#: search.c:538 #: search.c:548
msgid "Aborted" msgid "Aborted"
msgstr "" msgstr ""
#: search.c:558 #: search.c:568
msgid "Come on, be reasonable" msgid "Come on, be reasonable"
msgstr "" msgstr ""
#: search.c:563 #: search.c:573
#, c-format #, c-format
msgid "Only %d lines available, skipping to last line" msgid "Only %d lines available, skipping to last line"
msgstr "" msgstr ""
...@@ -824,50 +838,50 @@ msgstr "" ...@@ -824,50 +838,50 @@ msgstr ""
msgid "Modified" msgid "Modified"
msgstr "" msgstr ""
#: winio.c:895 #: winio.c:887
#, c-format #, c-format
msgid "Moved to (%d, %d) in edit buffer\n" msgid "Moved to (%d, %d) in edit buffer\n"
msgstr "" msgstr ""
#: winio.c:906 #: winio.c:898
#, c-format #, c-format
msgid "current->data = \"%s\"\n" msgid "current->data = \"%s\"\n"
msgstr "" msgstr ""
#: winio.c:949 #: winio.c:941
#, c-format #, c-format
msgid "I got \"%s\"\n" msgid "I got \"%s\"\n"
msgstr "" msgstr ""
#: winio.c:974 #: winio.c:966
msgid "Yes" msgid "Yes"
msgstr "" msgstr ""
#: winio.c:976 #: winio.c:968
msgid "All" msgid "All"
msgstr "" msgstr ""
#: winio.c:978 #: winio.c:970
msgid "No" msgid "No"
msgstr "" msgstr ""
#: winio.c:1115 #: winio.c:1107
#, c-format #, c-format
msgid "do_cursorpos: linepct = %f, bytepct = %f\n" msgid "do_cursorpos: linepct = %f, bytepct = %f\n"
msgstr "" msgstr ""
#: winio.c:1119 #: winio.c:1111
msgid "line %d of %d (%.0f%%), character %d of %d (%.0f%%)" msgid "line %d of %d (%.0f%%), character %d of %d (%.0f%%)"
msgstr "" msgstr ""
#: winio.c:1247 #: winio.c:1239
msgid "Dumping file buffer to stderr...\n" msgid "Dumping file buffer to stderr...\n"
msgstr "" msgstr ""
#: winio.c:1249 #: winio.c:1241
msgid "Dumping cutbuffer to stderr...\n" msgid "Dumping cutbuffer to stderr...\n"
msgstr "" msgstr ""
#: winio.c:1251 #: winio.c:1243
msgid "Dumping a buffer to stderr...\n" msgid "Dumping a buffer to stderr...\n"
msgstr "" msgstr ""
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
static char last_search[132] = ""; /* Last string we searched for */ static char last_search[132] = ""; /* Last string we searched for */
static char last_replace[132] = ""; /* Last replacement string */ static char last_replace[132] = ""; /* Last replacement string */
static int search_last_line; static int search_last_line;
/* Regular expression helper functions */ /* Regular expression helper functions */
...@@ -66,7 +66,7 @@ int search_init(int replacing) ...@@ -66,7 +66,7 @@ int search_init(int replacing)
int i; int i;
char buf[BUFSIZ]; char buf[BUFSIZ];
char *prompt, *reprompt = ""; char *prompt, *reprompt = "";
if (last_search[0]) { if (last_search[0]) {
snprintf(buf, BUFSIZ, " [%s]", last_search); snprintf(buf, BUFSIZ, " [%s]", last_search);
} else { } else {
...@@ -74,18 +74,17 @@ int search_init(int replacing) ...@@ -74,18 +74,17 @@ int search_init(int replacing)
} }
if (ISSET(USE_REGEXP) && ISSET(CASE_SENSITIVE)) if (ISSET(USE_REGEXP) && ISSET(CASE_SENSITIVE))
prompt = _("Case Sensitive Regexp Search%s%s"); prompt = _("Case Sensitive Regexp Search%s%s");
else if (ISSET(USE_REGEXP)) else if (ISSET(USE_REGEXP))
prompt = _("Regexp Search%s%s"); prompt = _("Regexp Search%s%s");
else else if (ISSET(CASE_SENSITIVE))
if (ISSET(CASE_SENSITIVE)) prompt = _("Case Sensitive Search%s%s");
prompt = _("Case Sensitive Search%s%s");
else else
prompt = _("Search%s%s"); prompt = _("Search%s%s");
if (replacing) if (replacing)
reprompt = _(" (to replace)"); reprompt = _(" (to replace)");
i = statusq(replacing ? replace_list : whereis_list, i = statusq(replacing ? replace_list : whereis_list,
replacing ? REPLACE_LIST_LEN : WHEREIS_LIST_LEN, "", replacing ? REPLACE_LIST_LEN : WHEREIS_LIST_LEN, "",
prompt, reprompt, buf); prompt, reprompt, buf);
...@@ -98,14 +97,14 @@ int search_init(int replacing) ...@@ -98,14 +97,14 @@ int search_init(int replacing)
} else if (i == -2) { /* Same string */ } else if (i == -2) { /* Same string */
strncpy(answer, last_search, 132); strncpy(answer, last_search, 132);
#ifdef HAVE_REGEX_H #ifdef HAVE_REGEX_H
if (ISSET(USE_REGEXP)) if (ISSET(USE_REGEXP))
regexp_init(answer); regexp_init(answer);
#endif #endif
} else if (i == 0) { /* They entered something new */ } else if (i == 0) { /* They entered something new */
strncpy(last_search, answer, 132); strncpy(last_search, answer, 132);
#ifdef HAVE_REGEX_H #ifdef HAVE_REGEX_H
if (ISSET(USE_REGEXP)) if (ISSET(USE_REGEXP))
regexp_init(answer); regexp_init(answer);
#endif #endif
/* Blow away last_replace because they entered a new search /* Blow away last_replace because they entered a new search
string....uh, right? =) */ string....uh, right? =) */
...@@ -130,7 +129,8 @@ int search_init(int replacing) ...@@ -130,7 +129,8 @@ int search_init(int replacing)
return 0; return 0;
} }
filestruct *findnextstr(int quiet, filestruct * begin, int beginx, char *needle) filestruct *findnextstr(int quiet, filestruct * begin, int beginx,
char *needle)
{ {
filestruct *fileptr; filestruct *fileptr;
char *searchstr, *found = NULL, *tmp; char *searchstr, *found = NULL, *tmp;
...@@ -141,20 +141,20 @@ filestruct *findnextstr(int quiet, filestruct * begin, int beginx, char *needle) ...@@ -141,20 +141,20 @@ filestruct *findnextstr(int quiet, filestruct * begin, int beginx, char *needle)
current_x++; current_x++;
/* Are we searching the last line? (i.e. the line where search started) */ /* 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; search_last_line = 1;
/* Make sure we haven't passed the end of the string */ /* 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--; current_x--;
searchstr = &fileptr->data[current_x]; searchstr = &fileptr->data[current_x];
/* Look for needle in searchstr */ /* Look for needle in searchstr */
while (( found = strstrwrapper(searchstr, needle)) == NULL) { while ((found = strstrwrapper(searchstr, needle)) == NULL) {
/* finished processing file, get out */ /* finished processing file, get out */
if (search_last_line) { if (search_last_line) {
if (!quiet) if (!quiet)
statusbar(_("\"%s\" not found"), needle); statusbar(_("\"%s\" not found"), needle);
return NULL; return NULL;
...@@ -211,12 +211,12 @@ void search_abort(void) ...@@ -211,12 +211,12 @@ void search_abort(void)
UNSET(KEEP_CUTBUFFER); UNSET(KEEP_CUTBUFFER);
display_main_list(); display_main_list();
wrefresh(bottomwin); wrefresh(bottomwin);
if (ISSET(MARK_ISSET)) if (ISSET(MARK_ISSET))
edit_refresh_clearok(); edit_refresh_clearok();
#ifdef HAVE_REGEX_H #ifdef HAVE_REGEX_H
if (ISSET(REGEXP_COMPILED)) if (ISSET(REGEXP_COMPILED))
regexp_cleanup(); regexp_cleanup();
#endif #endif
} }
...@@ -274,8 +274,7 @@ int replace_regexp(char *string, int create_flag) ...@@ -274,8 +274,7 @@ int replace_regexp(char *string, int create_flag)
char *c; char *c;
int new_size = strlen(current->data) + 1; int new_size = strlen(current->data) + 1;
int search_match_count = regmatches[0].rm_eo - int search_match_count = regmatches[0].rm_eo - regmatches[0].rm_so;
regmatches[0].rm_so;
new_size -= search_match_count; new_size -= search_match_count;
...@@ -284,50 +283,50 @@ int replace_regexp(char *string, int create_flag) ...@@ -284,50 +283,50 @@ int replace_regexp(char *string, int create_flag)
c = last_replace; c = last_replace;
while (*c) { while (*c) {
if (*c != '\\') { if (*c != '\\') {
if (create_flag) if (create_flag)
*string++=*c; *string++ = *c;
c++; c++;
new_size++; new_size++;
} else { } else {
int num = (int)*(c+1) - (int)'0'; int num = (int) *(c + 1) - (int) '0';
if (num >= 1 && num <= 9) { if (num >= 1 && num <= 9) {
int i = regmatches[num].rm_so; int i = regmatches[num].rm_so;
if (num > search_regexp.re_nsub) { if (num > search_regexp.re_nsub) {
/* Ugh, they specified a subexpression that doesn't /* Ugh, they specified a subexpression that doesn't
exist. */ exist. */
return -1; return -1;
} }
/* Skip over the replacement expression */ /* Skip over the replacement expression */
c+=2; c += 2;
/* But add the length of the subexpression to new_size */ /* But add the length of the subexpression to new_size */
new_size += regmatches[num].rm_eo - regmatches[num].rm_so; new_size += regmatches[num].rm_eo - regmatches[num].rm_so;
/* And if create_flag is set, append the result of the /* And if create_flag is set, append the result of the
* subexpression match to the new line */ * subexpression match to the new line */
while (create_flag && i < regmatches[num].rm_eo ) while (create_flag && i < regmatches[num].rm_eo)
*string++=*(current->data + i++); *string++ = *(current->data + i++);
} else { } else {
if (create_flag) if (create_flag)
*string++=*c; *string++ = *c;
c++; c++;
new_size++; new_size++;
} }
} }
} }
if (create_flag) if (create_flag)
*string = 0; *string = 0;
return new_size; return new_size;
} }
#endif #endif
char *replace_line() char *replace_line()
{ {
char *copy, *tmp; char *copy, *tmp;
...@@ -337,22 +336,21 @@ char *replace_line() ...@@ -337,22 +336,21 @@ char *replace_line()
/* Calculate size of new line */ /* Calculate size of new line */
#ifdef HAVE_REGEX_H #ifdef HAVE_REGEX_H
if (ISSET(USE_REGEXP)) { if (ISSET(USE_REGEXP)) {
search_match_count = regmatches[0].rm_eo - search_match_count = regmatches[0].rm_eo - regmatches[0].rm_so;
regmatches[0].rm_so; new_line_size = replace_regexp(NULL, 0);
new_line_size = replace_regexp(NULL, 0); /* If they specified an invalid subexpression in the replace
/* If they specified an invalid subexpression in the replace * text, return NULL indicating an error */
* text, return NULL indicating an error */ if (new_line_size < 0)
if (new_line_size < 0) return NULL;
return NULL;
} else { } else {
#else #else
{ {
#endif #endif
search_match_count = strlen(last_search); search_match_count = strlen(last_search);
new_line_size = strlen(current->data) - strlen(last_search) + new_line_size = strlen(current->data) - strlen(last_search) +
strlen(last_replace) + 1; strlen(last_replace) + 1;
} }
/* Create buffer */ /* Create buffer */
copy = nmalloc(new_line_size); copy = nmalloc(new_line_size);
...@@ -362,10 +360,10 @@ char *replace_line() ...@@ -362,10 +360,10 @@ char *replace_line()
/* Replacement Text */ /* Replacement Text */
if (!ISSET(USE_REGEXP)) if (!ISSET(USE_REGEXP))
strcat(copy, last_replace); strcat(copy, last_replace);
#ifdef HAVE_REGEX_H #ifdef HAVE_REGEX_H
else else
(void)replace_regexp(copy + current_x, 1); (void) replace_regexp(copy + current_x, 1);
#endif #endif
/* The tail of the original line */ /* The tail of the original line */
...@@ -402,6 +400,14 @@ int do_replace(void) ...@@ -402,6 +400,14 @@ int do_replace(void)
replace_abort(); replace_abort();
return 0; 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); strncpy(prevanswer, answer, 132);
if (strcmp(last_replace, "")) { /* There's a previous replace str */ if (strcmp(last_replace, "")) { /* There's a previous replace str */
...@@ -415,6 +421,8 @@ int do_replace(void) ...@@ -415,6 +421,8 @@ int do_replace(void)
return 0; return 0;
} else if (i == 0) /* They actually entered something */ } else if (i == 0) /* They actually entered something */
strncpy(last_replace, answer, 132); 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 */ else if (i == NANO_CASE_KEY) { /* They asked for case sensitivity */
if (ISSET(CASE_SENSITIVE)) if (ISSET(CASE_SENSITIVE))
UNSET(CASE_SENSITIVE); UNSET(CASE_SENSITIVE);
...@@ -423,7 +431,7 @@ int do_replace(void) ...@@ -423,7 +431,7 @@ int do_replace(void)
do_replace(); do_replace();
return 0; 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(); do_early_abort();
replace_abort(); replace_abort();
...@@ -445,8 +453,10 @@ int do_replace(void) ...@@ -445,8 +453,10 @@ int do_replace(void)
SET(CASE_SENSITIVE); SET(CASE_SENSITIVE);
do_replace(); do_replace();
return 1; return -1;
} else { /* First line key, etc. */ } else if (i == NANO_NULL_KEY)
strcpy(last_replace, "");
else { /* First line key, etc. */
do_early_abort(); do_early_abort();
replace_abort(); replace_abort();
...@@ -478,12 +488,12 @@ int do_replace(void) ...@@ -478,12 +488,12 @@ int do_replace(void)
if (i == 2) if (i == 2)
replaceall = 1; replaceall = 1;
copy = replace_line(); copy = replace_line();
if (!copy) { if (!copy) {
statusbar("Replace failed: unknown subexpression!"); statusbar("Replace failed: unknown subexpression!");
replace_abort(); replace_abort();
return 0; return 0;
} }
/* Cleanup */ /* Cleanup */
free(current->data); free(current->data);
......
...@@ -84,11 +84,11 @@ char *strstrwrapper(char *haystack, char *needle) ...@@ -84,11 +84,11 @@ char *strstrwrapper(char *haystack, char *needle)
{ {
#ifdef HAVE_REGEX_H #ifdef HAVE_REGEX_H
if (ISSET(USE_REGEXP)) { if (ISSET(USE_REGEXP)) {
int result=regexec(&search_regexp, haystack, 10, regmatches, 0); int result = regexec(&search_regexp, haystack, 10, regmatches, 0);
if (!result) if (!result)
return haystack+regmatches[0].rm_so; return haystack + regmatches[0].rm_so;
return 0; return 0;
} }
#endif #endif
if (ISSET(CASE_SENSITIVE)) if (ISSET(CASE_SENSITIVE))
return strstr(haystack, needle); return strstr(haystack, needle);
...@@ -120,7 +120,8 @@ void *nrealloc(void *ptr, size_t howmuch) ...@@ -120,7 +120,8 @@ void *nrealloc(void *ptr, size_t howmuch)
} }
/* Append a new magic-line to filebot */ /* Append a new magic-line to filebot */
void new_magicline(void) { void new_magicline(void)
{
filebot->next = nmalloc(sizeof(filestruct)); filebot->next = nmalloc(sizeof(filestruct));
filebot->next->data = nmalloc(1); filebot->next->data = nmalloc(1);
filebot->next->data[0] = '\0'; filebot->next->data[0] = '\0';
......
...@@ -259,8 +259,8 @@ int nanogetstr(char *buf, char *def, shortcut s[], int slen, int start_x) ...@@ -259,8 +259,8 @@ int nanogetstr(char *buf, char *def, shortcut s[], int slen, int start_x)
xend = strlen(buf) + strlen(inputbuf); xend = strlen(buf) + strlen(inputbuf);
switch (kbinput) { switch (kbinput) {
/* Stuff we want to equate with <enter>, ASCII 13 */ /* Stuff we want to equate with <enter>, ASCII 13 */
case 343: case 343:
ungetch(13); /* Enter on iris-ansi $TERM, sometimes */ ungetch(13); /* Enter on iris-ansi $TERM, sometimes */
break; break;
...@@ -605,110 +605,106 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x, ...@@ -605,110 +605,106 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
#ifndef NANO_SMALL #ifndef NANO_SMALL
/* There are quite a few cases that could take place, we'll deal /* There are quite a few cases that could take place, we'll deal
* with them each in turn */ * with them each in turn */
if (ISSET(MARK_ISSET) if (ISSET(MARK_ISSET)
&& !((fileptr->lineno > mark_beginbuf->lineno && !((fileptr->lineno > mark_beginbuf->lineno
&& fileptr->lineno > current->lineno) && fileptr->lineno > current->lineno)
|| (fileptr->lineno < mark_beginbuf->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
/* If we get here we are on a line that is atleast * partially selected. The lineno checks above determined
* partially selected. The lineno checks above determined * that */
* that */ if (fileptr != mark_beginbuf && fileptr != current) {
if (fileptr != mark_beginbuf && fileptr != current) { /* We are on a completely marked line, paint it all
/* We are on a completely marked line, paint it all * inverse */
* inverse */ wattron(edit, A_REVERSE);
mvwaddnstr(edit, yval, 0, fileptr->data, COLS);
wattroff(edit, A_REVERSE);
} else if (fileptr == mark_beginbuf && fileptr == current) {
/* Special case, we're still on the same line we started
* marking -- so we call our helper function */
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);
} else {
/* To the left of us is marked */
add_marked_sameline(virt_mark_beginx, virt_cur_x,
fileptr, yval, virt_cur_x, this_page);
}
} else if (fileptr == mark_beginbuf) {
/*
* we're updating the line that was first marked
* but we're not currently on it. So we want to
* figur out which half to invert based on our
* relative line numbers.
*
* i.e. If we're above the "beginbuf" line, we want to
* mark the left side. Otherwise we're below, so we
* mark the right
*/
int target;
if (mark_beginbuf->lineno > current->lineno)
wattron(edit, A_REVERSE); wattron(edit, A_REVERSE);
mvwaddnstr(edit, yval, 0, fileptr->data, COLS);
target =
(virt_mark_beginx <
COLS - 1) ? virt_mark_beginx : COLS - 1;
mvwaddnstr(edit, yval, 0, fileptr->data, target);
if (mark_beginbuf->lineno < current->lineno)
wattron(edit, A_REVERSE);
else
wattroff(edit, A_REVERSE);
target = (COLS - 1) - virt_mark_beginx;
if (target < 0)
target = 0;
mvwaddnstr(edit, yval, virt_mark_beginx,
&fileptr->data[virt_mark_beginx], target);
if (mark_beginbuf->lineno < current->lineno)
wattroff(edit, A_REVERSE);
} else if (fileptr == current) {
/* we're on the cursors line, but it's not the first
* one we marked. Similar to the previous logic. */
int this_page_start = get_page_start_virtual(this_page),
this_page_end = get_page_end_virtual(this_page);
if (mark_beginbuf->lineno < current->lineno)
wattron(edit, A_REVERSE);
if (virt_cur_x > COLS - 2) {
mvwaddnstr(edit, yval, 0,
&fileptr->data[this_page_start],
virt_cur_x - this_page_start);
} else {
mvwaddnstr(edit, yval, 0, fileptr->data, virt_cur_x);
}
if (mark_beginbuf->lineno > current->lineno)
wattron(edit, A_REVERSE);
else
wattroff(edit, A_REVERSE); wattroff(edit, A_REVERSE);
} else if (fileptr == mark_beginbuf && fileptr == current) {
/* Special case, we're still on the same line we started
* marking -- so we call our helper function */
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);
} else {
/* To the left of us is marked */
add_marked_sameline(virt_mark_beginx, virt_cur_x,
fileptr, yval, virt_cur_x,
this_page);
}
} else if (fileptr == mark_beginbuf) {
/*
* we're updating the line that was first marked
* but we're not currently on it. So we want to
* figur out which half to invert based on our
* relative line numbers.
*
* i.e. If we're above the "beginbuf" line, we want to
* mark the left side. Otherwise we're below, so we
* mark the right
*/
int target;
if (mark_beginbuf->lineno > current->lineno)
wattron(edit, A_REVERSE);
target =
(virt_mark_beginx <
COLS - 1) ? virt_mark_beginx : COLS - 1;
mvwaddnstr(edit, yval, 0, fileptr->data, target);
if (mark_beginbuf->lineno < current->lineno)
wattron(edit, A_REVERSE);
else
wattroff(edit, A_REVERSE);
target = (COLS - 1) - virt_mark_beginx;
if (target < 0)
target = 0;
mvwaddnstr(edit, yval, virt_mark_beginx,
&fileptr->data[virt_mark_beginx], target);
if (mark_beginbuf->lineno < current->lineno)
wattroff(edit, A_REVERSE);
} else if (fileptr == current) {
/* we're on the cursors line, but it's not the first
* one we marked. Similar to the previous logic. */
int this_page_start = get_page_start_virtual(this_page),
this_page_end = get_page_end_virtual(this_page);
if (mark_beginbuf->lineno < current->lineno)
wattron(edit, A_REVERSE);
if (virt_cur_x > COLS - 2) {
mvwaddnstr(edit, yval, 0,
&fileptr->data[this_page_start],
virt_cur_x - this_page_start);
} else {
mvwaddnstr(edit, yval, 0, fileptr->data, virt_cur_x);
}
if (mark_beginbuf->lineno > current->lineno) if (virt_cur_x > COLS - 2)
wattron(edit, A_REVERSE); mvwaddnstr(edit, yval, virt_cur_x - this_page_start,
else &fileptr->data[virt_cur_x],
wattroff(edit, A_REVERSE); this_page_end - virt_cur_x);
else
if (virt_cur_x > COLS - 2) mvwaddnstr(edit, yval, virt_cur_x,
mvwaddnstr(edit, yval, virt_cur_x - this_page_start, &fileptr->data[virt_cur_x], COLS - virt_cur_x);
&fileptr->data[virt_cur_x],
this_page_end - virt_cur_x); if (mark_beginbuf->lineno > current->lineno)
else wattroff(edit, A_REVERSE);
mvwaddnstr(edit, yval, virt_cur_x,
&fileptr->data[virt_cur_x],
COLS - virt_cur_x);
if (mark_beginbuf->lineno > current->lineno)
wattroff(edit, A_REVERSE);
} }
} else } else
#endif #endif
/* Just paint the string (no mark on this line) */ /* Just paint the string (no mark on this line) */
mvwaddnstr(edit, yval, 0, &fileptr->data[start], mvwaddnstr(edit, yval, 0, &fileptr->data[start],
get_page_end_virtual(this_page) - start); get_page_end_virtual(this_page) - start);
} }
...@@ -760,9 +756,8 @@ void update_line(filestruct * fileptr, int index) ...@@ -760,9 +756,8 @@ void update_line(filestruct * fileptr, int index)
virt_cur_x--; virt_cur_x--;
if (i < mark_beginx) if (i < mark_beginx)
virt_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 */
/* Treat control characters as ^letter */
fileptr->data[pos++] = '^'; fileptr->data[pos++] = '^';
fileptr->data[pos++] = realdata[i] + 64; fileptr->data[pos++] = realdata[i] + 64;
} else { } else {
...@@ -828,12 +823,10 @@ void edit_refresh(void) ...@@ -828,12 +823,10 @@ void edit_refresh(void)
} }
/* If noloop == 1, then we already did an edit_update without finishing /* If noloop == 1, then we already did an edit_update without finishing
this function. So we don't run edit_update again */ 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); edit_update(current, CENTER);
noloop = 1; noloop = 1;
} } else if (noloop)
else if (noloop)
noloop = 0; noloop = 0;
if (lines <= editwinrows - 1) if (lines <= editwinrows - 1)
...@@ -870,8 +863,7 @@ void edit_update(filestruct * fileptr, int topmidbot) ...@@ -870,8 +863,7 @@ void edit_update(filestruct * fileptr, int topmidbot)
return; return;
temp = fileptr; temp = fileptr;
if (topmidbot == 2) if (topmidbot == 2);
;
else if (topmidbot == 0) else if (topmidbot == 0)
for (i = 0; i <= editwinrows - 1 && temp->prev != NULL; i++) for (i = 0; i <= editwinrows - 1 && temp->prev != NULL; i++)
temp = temp->prev; temp = temp->prev;
...@@ -1186,7 +1178,7 @@ int do_help(void) ...@@ -1186,7 +1178,7 @@ int do_help(void)
} }
if (i > 1) { if (i > 1) {
} }
i = 0; i = 0;
...@@ -1274,10 +1266,10 @@ void dump_buffer_reverse(filestruct * inptr) ...@@ -1274,10 +1266,10 @@ void dump_buffer_reverse(filestruct * inptr)
} }
/* Fix editbot based on the assumption that edittop is correct */ /* Fix editbot based on the assumption that edittop is correct */
void fix_editbot(void) { void fix_editbot(void)
{
int i; int i;
editbot = edittop; 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); && (editbot != filebot); i++, editbot = editbot->next);
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment