Carl Drinkwater's backup patch, plus miscellaneous fixes by David
Benbennick and me git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1225 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
fbc7920654
commit
5db0cdc4c9
97
ChangeLog
97
ChangeLog
|
@ -16,6 +16,36 @@ CVS Code -
|
||||||
and spacing improvements. (David Benbennick)
|
and spacing improvements. (David Benbennick)
|
||||||
- Make more functions use const variables when possible. (David
|
- Make more functions use const variables when possible. (David
|
||||||
Benbennick)
|
Benbennick)
|
||||||
|
- Add Carl Drinkwater's backup file option (-B or --backup on the
|
||||||
|
command line, M-B in nano's global shortcuts). If the original
|
||||||
|
file is unchanged from when it was loaded, it is backed up to
|
||||||
|
filename~; if the original file has been changed or deleted
|
||||||
|
since it was originally loaded, it isn't backed up. The backup
|
||||||
|
file retains the permissions, owner/group, and
|
||||||
|
access/modification times of the original file. This option is
|
||||||
|
disabled when --enable-tiny is used. It will not back up
|
||||||
|
temporary files. Minor fixes to it by David Benbennick and
|
||||||
|
DLR. Changes to open_file(), add_open_file(),
|
||||||
|
load_open_file(), write_file(), and do_writeout().
|
||||||
|
- Add \n's to the ends of "filename is %s" debugging strings.
|
||||||
|
(Carl Drinkwater)
|
||||||
|
- Add the long option --quotestr as an alternative for -Q, and
|
||||||
|
--regexp as an alternative for -R; they were listed in nano's
|
||||||
|
usage information, but weren't actually in nano. Also, display
|
||||||
|
"-?" as an alternative for "-h" in nano's usage information,
|
||||||
|
put the command line options in a more consistent (i. e. mostly
|
||||||
|
alphabetical) order in nano, put the long options in a more
|
||||||
|
consistent order in rcfile.c and nanorc.sample, don't include
|
||||||
|
rcfile options if their equivalent command line options are
|
||||||
|
disabled, and remove obsolete relative option from
|
||||||
|
nanorc.sample. (DLR)
|
||||||
|
- Change "File Name to Append/Prepend" to "File Name to
|
||||||
|
Append/Prepend to". The original prompt could confusingly
|
||||||
|
imply that we are appending/prepending another file to the
|
||||||
|
current file, when we are actually appending/prepending the
|
||||||
|
current file to another file. (DLR)
|
||||||
|
- Put nano.1, nano.1.html, and nano.texi up to date. (DLR)
|
||||||
|
- Typo fixes for the ChangeLog. (David Benbennick)
|
||||||
- files.c:
|
- files.c:
|
||||||
read_file(), read_line():
|
read_file(), read_line():
|
||||||
- Rework to properly handle nulls in the input file, fix
|
- Rework to properly handle nulls in the input file, fix
|
||||||
|
@ -31,10 +61,25 @@ CVS Code -
|
||||||
writing a marked selection to a file, save and restore totsize
|
writing a marked selection to a file, save and restore totsize
|
||||||
so it isn't decreased by the size of the selection afterward.
|
so it isn't decreased by the size of the selection afterward.
|
||||||
(DLR)
|
(DLR)
|
||||||
|
do_writeout():
|
||||||
|
- Fix problem with formatstr's being defined as NULL when
|
||||||
|
--enable-tiny is used. Since formatstr isn't ever used in tiny
|
||||||
|
mode, don't bother even creating the variable. (David
|
||||||
|
Benbennick and DLR)
|
||||||
append_slash_if_dir(), input_tab():
|
append_slash_if_dir(), input_tab():
|
||||||
- Changed a variable name: lastWasTab -> lastwastab. (DLR)
|
- Changed a variable name: lastWasTab -> lastwastab. (DLR)
|
||||||
- global.c:
|
- global.c:
|
||||||
shortcut_init()
|
free_toggles():
|
||||||
|
- Only include if we're not using tiny mode. (David Benbennick)
|
||||||
|
toggle_init():
|
||||||
|
- Remove global entries for search toggles, as they aren't really
|
||||||
|
global. (DLR)
|
||||||
|
- Don't reinititialize the toggles if they've already been
|
||||||
|
initialized; it's unnecessary and even causes a segfault in
|
||||||
|
do_toggle() if Pico emulation mode is the toggle in question.
|
||||||
|
Don't free the toggles here, either; it's unnecessary after the
|
||||||
|
above change. (David Benbennick)
|
||||||
|
shortcut_init():
|
||||||
- Rework IFHELP macro (David Benbennick).
|
- Rework IFHELP macro (David Benbennick).
|
||||||
- move.c:
|
- move.c:
|
||||||
page_down(), page_up():
|
page_down(), page_up():
|
||||||
|
@ -52,6 +97,11 @@ CVS Code -
|
||||||
do_int_spell(), do_alt_spell():
|
do_int_spell(), do_alt_spell():
|
||||||
- Rework to save the marked selection before doing spell checking
|
- Rework to save the marked selection before doing spell checking
|
||||||
and restore it afterward. (DLR)
|
and restore it afterward. (DLR)
|
||||||
|
do_toggle():
|
||||||
|
- Since the search mode toggles aren't global anymore, we don't
|
||||||
|
need to explicitly block them here anymore (which will end up
|
||||||
|
blocking the global backup mode toggle, which is the same as
|
||||||
|
the backwards search toggle). (DLR)
|
||||||
main():
|
main():
|
||||||
- Rework to blank out filename manually before doing anything
|
- Rework to blank out filename manually before doing anything
|
||||||
with it, instead of calling clear_filename() in two places.
|
with it, instead of calling clear_filename() in two places.
|
||||||
|
@ -59,7 +109,15 @@ CVS Code -
|
||||||
hold a line number. (DLR)
|
hold a line number. (DLR)
|
||||||
- Properly handle multiple -r settings on the command line. (Carl
|
- Properly handle multiple -r settings on the command line. (Carl
|
||||||
Drinkwater)
|
Drinkwater)
|
||||||
|
- rcfile.c:
|
||||||
|
colortoint():
|
||||||
|
- Only include if ENABLE_COLOR is defined. (DLR)
|
||||||
- search.c:
|
- search.c:
|
||||||
|
search_init():
|
||||||
|
- Since the search mode toggles aren't global anymore, rework the
|
||||||
|
part of this function referencing them so that they still work.
|
||||||
|
(DLR)
|
||||||
|
- Remove unneeded toggles variable. (David Benbennick)
|
||||||
findnextstr():
|
findnextstr():
|
||||||
- Update the current line at current_x if we don't find a match.
|
- Update the current line at current_x if we don't find a match.
|
||||||
Also, pass current_x_find to strstrwrapper() so we know whether
|
Also, pass current_x_find to strstrwrapper() so we know whether
|
||||||
|
@ -95,7 +153,7 @@ CVS Code -
|
||||||
better on smaller terminals. (Carl Drinkwater)
|
better on smaller terminals. (Carl Drinkwater)
|
||||||
update_line():
|
update_line():
|
||||||
- When marking control characters, make sure the mark moves
|
- When marking control characters, make sure the mark moves
|
||||||
forward by two characters inctead of one. Rework control
|
forward by two characters instead of one. Rework control
|
||||||
character display routine to display newlines within the line
|
character display routine to display newlines within the line
|
||||||
(which should never occur under normal circumstances; they will
|
(which should never occur under normal circumstances; they will
|
||||||
only be there if the line had nulls in it and was unsunder()ed
|
only be there if the line had nulls in it and was unsunder()ed
|
||||||
|
@ -106,6 +164,7 @@ CVS Code -
|
||||||
with TERM=ansi). (DLR)
|
with TERM=ansi). (DLR)
|
||||||
- THANKS:
|
- THANKS:
|
||||||
- Completed a bit (Jordi).
|
- Completed a bit (Jordi).
|
||||||
|
- Fixed David Benbennick's email address (David Benbennick).
|
||||||
GNU nano 1.1.9 - 05/12/2002
|
GNU nano 1.1.9 - 05/12/2002
|
||||||
- General:
|
- General:
|
||||||
- Typos n misspellings all over the place (David Benbennick).
|
- Typos n misspellings all over the place (David Benbennick).
|
||||||
|
@ -119,7 +178,7 @@ GNU nano 1.1.9 - 05/12/2002
|
||||||
- Preliminary prepend code. This may be a bad idea, but I've
|
- Preliminary prepend code. This may be a bad idea, but I've
|
||||||
been wanting it for awhile now and we'll see how bad it messes
|
been wanting it for awhile now and we'll see how bad it messes
|
||||||
everything up. Changes to files.c:do_writeout(), write_file().
|
everything up. Changes to files.c:do_writeout(), write_file().
|
||||||
Fixes for O_CREAT & append compatibililty by David Benbennick.
|
Fixes for O_CREAT & append compatibility by David Benbennick.
|
||||||
- Change from read() and write() to file streams by Jay Carlson.
|
- Change from read() and write() to file streams by Jay Carlson.
|
||||||
Allows OS to implement read and write ahead rather than making
|
Allows OS to implement read and write ahead rather than making
|
||||||
us do it. Hopefully merged properly.
|
us do it. Hopefully merged properly.
|
||||||
|
@ -133,8 +192,8 @@ GNU nano 1.1.9 - 05/12/2002
|
||||||
to specify the type on the command line, if there's no good
|
to specify the type on the command line, if there's no good
|
||||||
filename regex to use. Global variable syntaxstr.
|
filename regex to use. Global variable syntaxstr.
|
||||||
- Changed many strcmp()s and strcpy()s to their equivalent
|
- Changed many strcmp()s and strcpy()s to their equivalent
|
||||||
'\0' conterparts (David Lawrence Ramsey).
|
'\0' counterparts (David Lawrence Ramsey).
|
||||||
- Many chanes to allow marked cutting to work with multiple
|
- Many changes to allow marked cutting to work with multiple
|
||||||
file buffers: changes to openfilestruct type in nano.h and
|
file buffers: changes to openfilestruct type in nano.h and
|
||||||
files.c (David Lawrence Ramsey).
|
files.c (David Lawrence Ramsey).
|
||||||
- Changed NANO_SMALL to ENABLE_NLS for gettext disabling
|
- Changed NANO_SMALL to ENABLE_NLS for gettext disabling
|
||||||
|
@ -162,7 +221,7 @@ GNU nano 1.1.9 - 05/12/2002
|
||||||
do_wrap()
|
do_wrap()
|
||||||
- Complete rewrite (David Benbennick).
|
- Complete rewrite (David Benbennick).
|
||||||
help_init()
|
help_init()
|
||||||
- A little les readable, a lot shorer :-) (David Benbennick).
|
- A little less readable, a lot shorter :-) (David Benbennick).
|
||||||
- Fix Meta-A not getting capitalized, and convert the ASCII
|
- Fix Meta-A not getting capitalized, and convert the ASCII
|
||||||
#s to their character equivalent.
|
#s to their character equivalent.
|
||||||
main()
|
main()
|
||||||
|
@ -187,7 +246,7 @@ GNU nano 1.1.9 - 05/12/2002
|
||||||
- Changed some syntax highlight computations for the sake of COLS.
|
- Changed some syntax highlight computations for the sake of COLS.
|
||||||
- Add in the necessary regfree() calls to stop nano from leaking
|
- Add in the necessary regfree() calls to stop nano from leaking
|
||||||
memory like a sieve when using color syntax highlighting :-)
|
memory like a sieve when using color syntax highlighting :-)
|
||||||
botombars(), onekey()
|
bottombars(), onekey()
|
||||||
- Cleanups (David Benbennick).
|
- Cleanups (David Benbennick).
|
||||||
- po/gl.po:
|
- po/gl.po:
|
||||||
- Galician translation updates (Jacobo Tarrio).
|
- Galician translation updates (Jacobo Tarrio).
|
||||||
|
@ -311,7 +370,7 @@ GNU nano 1.1.7 - 03/05/2002
|
||||||
- malloc->calloc, etc cleanups (DLR).
|
- malloc->calloc, etc cleanups (DLR).
|
||||||
- New option, noconvert (-N, --noconvert) to completely stop
|
- New option, noconvert (-N, --noconvert) to completely stop
|
||||||
the translation of files from DOS or Mac format (DLR).
|
the translation of files from DOS or Mac format (DLR).
|
||||||
- New functions wheck_writable_directory() and safe_tempnam()
|
- New functions check_writable_directory() and safe_tempnam()
|
||||||
to get around the tempnam warning. More improvements (DLR)
|
to get around the tempnam warning. More improvements (DLR)
|
||||||
Still needs testing.
|
Still needs testing.
|
||||||
- Added DOS and Mac format options to write file routine.
|
- Added DOS and Mac format options to write file routine.
|
||||||
|
@ -346,7 +405,7 @@ GNU nano 1.1.7 - 03/05/2002
|
||||||
- Added call to AM_ACLOCAL_INCLUDE.
|
- Added call to AM_ACLOCAL_INCLUDE.
|
||||||
- files.c:
|
- files.c:
|
||||||
read_byte()
|
read_byte()
|
||||||
- Added check for conrol characters (indicative of a binary
|
- Added check for control characters (indicative of a binary
|
||||||
file), set NO_CONVERT if found (fixes by DLR).
|
file), set NO_CONVERT if found (fixes by DLR).
|
||||||
do_insertfile()
|
do_insertfile()
|
||||||
- Added support for -o in prompt (Steven Kneizys).
|
- Added support for -o in prompt (Steven Kneizys).
|
||||||
|
@ -380,7 +439,7 @@ GNU nano 1.1.7 - 03/05/2002
|
||||||
- Fixes for various search issues (Ken Tyler)
|
- Fixes for various search issues (Ken Tyler)
|
||||||
- winio.c:
|
- winio.c:
|
||||||
do_cursorpos()
|
do_cursorpos()
|
||||||
- Rewritten to show col place as well as charcter place, without
|
- Rewritten to show col place as well as character place, without
|
||||||
needing an entirely separate flag.
|
needing an entirely separate flag.
|
||||||
bottombars(), onekey()
|
bottombars(), onekey()
|
||||||
- Make bottom list dynamic with screen size (Guus Sliepen & Chris).
|
- Make bottom list dynamic with screen size (Guus Sliepen & Chris).
|
||||||
|
@ -428,7 +487,7 @@ GNU nano 1.1.7 - 03/05/2002
|
||||||
|
|
||||||
nano-1.1.6 - 01/25/2002
|
nano-1.1.6 - 01/25/2002
|
||||||
- General
|
- General
|
||||||
- Add Meta-A as alternate keyystroke for ^^ for people with
|
- Add Meta-A as alternate keystroke for ^^ for people with
|
||||||
non-US keyboards.
|
non-US keyboards.
|
||||||
- Add Alt-G (NANO_ALT_GOTO_KEY) as alternate for goto dir in
|
- Add Alt-G (NANO_ALT_GOTO_KEY) as alternate for goto dir in
|
||||||
browser.
|
browser.
|
||||||
|
@ -473,7 +532,7 @@ nano-1.1.6 - 01/25/2002
|
||||||
- nano.h:
|
- nano.h:
|
||||||
- Changed color struct slightly, because of previous issue with
|
- Changed color struct slightly, because of previous issue with
|
||||||
applying color painting in order, the "str" portion was
|
applying color painting in order, the "str" portion was
|
||||||
uselss. Renamed "val" in colortype to "start", added "end"
|
useless. Renamed "val" in colortype to "start", added "end"
|
||||||
for multi-line color strings.
|
for multi-line color strings.
|
||||||
- rcfile.c:
|
- rcfile.c:
|
||||||
General
|
General
|
||||||
|
@ -482,7 +541,7 @@ nano-1.1.6 - 01/25/2002
|
||||||
- Re-indented.
|
- Re-indented.
|
||||||
- Added stdarg.h to includes.
|
- Added stdarg.h to includes.
|
||||||
rcfile_error()
|
rcfile_error()
|
||||||
- Now automatically prpends the "error in line blah at foo"
|
- Now automatically prepends the "error in line blah at foo"
|
||||||
message to error messages.
|
message to error messages.
|
||||||
parse_colors()
|
parse_colors()
|
||||||
- Added section for computing "end" section.
|
- Added section for computing "end" section.
|
||||||
|
@ -548,7 +607,7 @@ nano-1.1.5 - 01/05/2002
|
||||||
suspending nano on the Hurd.
|
suspending nano on the Hurd.
|
||||||
help_init()
|
help_init()
|
||||||
- Typo fixes in help strings (Jordi).
|
- Typo fixes in help strings (Jordi).
|
||||||
- New variable helplen needes cause currslen is not always
|
- New variable helplen needed cause currslen is not always
|
||||||
the length we want (bug found by David Lawrence Ramsey).
|
the length we want (bug found by David Lawrence Ramsey).
|
||||||
- Typo in file switch string (found by David Lawrence Ramsey).
|
- Typo in file switch string (found by David Lawrence Ramsey).
|
||||||
main()
|
main()
|
||||||
|
@ -870,8 +929,8 @@ nano-1.1.0 - 07/15/2001
|
||||||
--enable-nanorc is used. Tons of new funcs, most notably
|
--enable-nanorc is used. Tons of new funcs, most notably
|
||||||
do_rcfile() called from nano.c:main(). Added much needed
|
do_rcfile() called from nano.c:main(). Added much needed
|
||||||
function ncalloc(), will have to go through source code later
|
function ncalloc(), will have to go through source code later
|
||||||
and change the aproproate calls which used nmalloc for lack of
|
and change the appropriate calls which used nmalloc for lack of
|
||||||
an apropriate calloc function *** FIXME ***
|
an appropriate calloc function *** FIXME ***
|
||||||
- After "Alternate" spell checker is called, cursor is repositioned on
|
- After "Alternate" spell checker is called, cursor is repositioned on
|
||||||
the same line as before ^T was pressed.
|
the same line as before ^T was pressed.
|
||||||
- Moved config.h up in all .c files #include list (Albert Chin).
|
- Moved config.h up in all .c files #include list (Albert Chin).
|
||||||
|
@ -885,10 +944,10 @@ nano-1.1.0 - 07/15/2001
|
||||||
and justify being disabled. This allows us to compile out the
|
and justify being disabled. This allows us to compile out the
|
||||||
-r flag if neither are set, and will also allow us to comment
|
-r flag if neither are set, and will also allow us to comment
|
||||||
out -W when it is written.
|
out -W when it is written.
|
||||||
- Allow fill to take a negative value ot signify a "from right side"
|
- Allow fill to take a negative value to signify a "from right side"
|
||||||
value. This allows the value to vary with the screen size yet
|
value. This allows the value to vary with the screen size yet
|
||||||
still be correct. New static value wrap_at to minimize code
|
still be correct. New static value wrap_at to minimize code
|
||||||
inpact. Updated man page and info file.
|
impact. Updated man page and info file.
|
||||||
- Allow file appending. New shortcut list nano_insertfile_list (since
|
- Allow file appending. New shortcut list nano_insertfile_list (since
|
||||||
insert and write routines can't share shortcut lists anymore),
|
insert and write routines can't share shortcut lists anymore),
|
||||||
new args to do_writeout and write_file called append, and of source
|
new args to do_writeout and write_file called append, and of source
|
||||||
|
@ -963,7 +1022,7 @@ nano-1.1.0 - 07/15/2001
|
||||||
down, etc, and add the consistent ^C to exit (Jim Knoble).
|
down, etc, and add the consistent ^C to exit (Jim Knoble).
|
||||||
do_writeout()
|
do_writeout()
|
||||||
- New code to allow writing selected text to a separate file.
|
- New code to allow writing selected text to a separate file.
|
||||||
When this is done, the current state is prserved.
|
When this is done, the current state is preserved.
|
||||||
write_file()
|
write_file()
|
||||||
- New arg, nonamechange, means whether or not to update the
|
- New arg, nonamechange, means whether or not to update the
|
||||||
current filename after writing the file out.
|
current filename after writing the file out.
|
||||||
|
|
3
THANKS
3
THANKS
|
@ -29,8 +29,7 @@ Miquel Vidal <miquel@sindominio.net> Catalan Translator
|
||||||
Pauli Virtanen <pauli.virtanen@saunalahti.fi> Finnish Translator
|
Pauli Virtanen <pauli.virtanen@saunalahti.fi> Finnish Translator
|
||||||
|
|
||||||
Ben Armstrong <synrg@sanctuary.nslug.ns.ca> Negative -r value idea, code
|
Ben Armstrong <synrg@sanctuary.nslug.ns.ca> Negative -r value idea, code
|
||||||
David Benbennick dbenbenn@polygon.math.cornell.edu>
|
David Benbennick <dbenbenn@math.cornell.edu> Misc fixes and enhancements
|
||||||
Misc fixes and enhancements
|
|
||||||
Thomas Dickey <dickey@herndon4.his.com> Curses help and advice
|
Thomas Dickey <dickey@herndon4.his.com> Curses help and advice
|
||||||
Sven Guckes <guckes@math.fu-berlin.de> Advice and Advocacy
|
Sven Guckes <guckes@math.fu-berlin.de> Advice and Advocacy
|
||||||
Jim Knoble <jmknoble@pobox.com> Pico compat for browser
|
Jim Knoble <jmknoble@pobox.com> Pico compat for browser
|
||||||
|
|
2
TODO
2
TODO
|
@ -5,7 +5,7 @@ For version 1.2:
|
||||||
- Single line scroll up/down? [DONE]
|
- Single line scroll up/down? [DONE]
|
||||||
- Color syntax highlighting? (certainly seems like there's a demand for it.)
|
- Color syntax highlighting? (certainly seems like there's a demand for it.)
|
||||||
- .nanorc [DONE]
|
- .nanorc [DONE]
|
||||||
- Backup making (filename~)?
|
- Backup making (filename~)? [DONE]
|
||||||
- Search (etc) string history [1.2]
|
- Search (etc) string history [1.2]
|
||||||
- Implement Pico's -j and -g flags, as they are pretty easy to do. [DONE]
|
- Implement Pico's -j and -g flags, as they are pretty easy to do. [DONE]
|
||||||
- Make mouse support work with clicking on the shortcuts (-m). Must
|
- Make mouse support work with clicking on the shortcuts (-m). Must
|
||||||
|
|
159
files.c
159
files.c
|
@ -28,6 +28,7 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <utime.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
@ -356,6 +357,9 @@ int open_file(const char *filename, int insert, int quiet)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
read_file(f, filename, quiet);
|
read_file(f, filename, quiet);
|
||||||
|
#ifndef NANO_SMALL
|
||||||
|
stat(filename, &originalfilestat);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -417,7 +421,7 @@ int do_insertfile(int loading_file)
|
||||||
if (i != -1) {
|
if (i != -1) {
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, _("filename is %s"), answer);
|
fprintf(stderr, _("filename is %s\n"), answer);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DISABLE_TABCOMP
|
#ifndef DISABLE_TABCOMP
|
||||||
|
@ -596,7 +600,7 @@ int add_open_file(int update)
|
||||||
open_files and splice it in after the current one */
|
open_files and splice it in after the current one */
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, _("filename is %s"), open_files->filename);
|
fprintf(stderr, _("filename is %s\n"), open_files->filename);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tmp = make_new_opennode(NULL);
|
tmp = make_new_opennode(NULL);
|
||||||
|
@ -607,6 +611,11 @@ int add_open_file(int update)
|
||||||
/* save current filename */
|
/* save current filename */
|
||||||
open_files->filename = mallocstrcpy(open_files->filename, filename);
|
open_files->filename = mallocstrcpy(open_files->filename, filename);
|
||||||
|
|
||||||
|
#ifndef NANO_SMALL
|
||||||
|
/* save the file's stat */
|
||||||
|
open_files->originalfilestat = originalfilestat;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* save current total number of lines */
|
/* save current total number of lines */
|
||||||
open_files->file_totlines = totlines;
|
open_files->file_totlines = totlines;
|
||||||
|
|
||||||
|
@ -649,7 +658,7 @@ int add_open_file(int update)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, _("filename is %s"), open_files->filename);
|
fprintf(stderr, _("filename is %s\n"), open_files->filename);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -668,6 +677,9 @@ int load_open_file(void)
|
||||||
/* set up the filename, the file buffer, the total number of lines in
|
/* set up the filename, the file buffer, the total number of lines in
|
||||||
the file, and the total file size */
|
the file, and the total file size */
|
||||||
filename = mallocstrcpy(filename, open_files->filename);
|
filename = mallocstrcpy(filename, open_files->filename);
|
||||||
|
#ifndef NANO_SMALL
|
||||||
|
originalfilestat = open_files->originalfilestat;
|
||||||
|
#endif
|
||||||
fileage = open_files->fileage;
|
fileage = open_files->fileage;
|
||||||
current = fileage;
|
current = fileage;
|
||||||
filebot = open_files->filebot;
|
filebot = open_files->filebot;
|
||||||
|
@ -740,7 +752,7 @@ int open_prevfile(int closing_file)
|
||||||
open_files = open_files->prev;
|
open_files = open_files->prev;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, _("filename is %s"), open_files->filename);
|
fprintf(stderr, _("filename is %s\n"), open_files->filename);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -752,7 +764,7 @@ int open_prevfile(int closing_file)
|
||||||
open_files = open_files->next;
|
open_files = open_files->next;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, _("filename is %s"), open_files->filename);
|
fprintf(stderr, _("filename is %s\n"), open_files->filename);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -804,7 +816,7 @@ int open_nextfile(int closing_file)
|
||||||
open_files = open_files->next;
|
open_files = open_files->next;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, _("filename is %s"), open_files->filename);
|
fprintf(stderr, _("filename is %s\n"), open_files->filename);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -815,7 +827,7 @@ int open_nextfile(int closing_file)
|
||||||
open_files = open_files->prev;
|
open_files = open_files->prev;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, _("filename is %s"), open_files->filename);
|
fprintf(stderr, _("filename is %s\n"), open_files->filename);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -873,7 +885,7 @@ int close_open_file(void)
|
||||||
}
|
}
|
||||||
#endif /* MULTIBUFFER */
|
#endif /* MULTIBUFFER */
|
||||||
|
|
||||||
#if !defined (DISABLE_SPELLER) || !defined (DISABLE_OPERATINGDIR)
|
#if !defined(DISABLE_SPELLER) || !defined(DISABLE_OPERATINGDIR)
|
||||||
/*
|
/*
|
||||||
* When passed "[relative path]" or "[relative path][filename]" in
|
* When passed "[relative path]" or "[relative path][filename]" in
|
||||||
* origpath, return "[full path]" or "[full path][filename]" on success,
|
* origpath, return "[full path]" or "[full path][filename]" on success,
|
||||||
|
@ -1283,6 +1295,75 @@ int write_file(char *name, int tmp, int append, int nonamechange)
|
||||||
/* Save the state of file at the end of the symlink (if there is one) */
|
/* Save the state of file at the end of the symlink (if there is one) */
|
||||||
realexists = stat(realname, &st);
|
realexists = stat(realname, &st);
|
||||||
|
|
||||||
|
#ifndef NANO_SMALL
|
||||||
|
/* We backup only if the backup toggle is set, the file isn't
|
||||||
|
temporary, and the file already exists. Furthermore, if we aren't
|
||||||
|
appending, prepending, or writing a selection, also backup only if
|
||||||
|
the file has not been modified by someone else since nano opened
|
||||||
|
it. */
|
||||||
|
if (ISSET(BACKUP_FILE) && !tmp && realexists == 0 &&
|
||||||
|
(append || ISSET(MARK_ISSET) ||
|
||||||
|
originalfilestat.st_mtime == st.st_mtime)) {
|
||||||
|
FILE *backup_file;
|
||||||
|
char *backupname = NULL;
|
||||||
|
char backupbuf[COPYFILEBLOCKSIZE];
|
||||||
|
size_t bytesread;
|
||||||
|
struct utimbuf filetime;
|
||||||
|
|
||||||
|
/* save the original file's access and modification times */
|
||||||
|
filetime.actime = originalfilestat.st_atime;
|
||||||
|
filetime.modtime = originalfilestat.st_mtime;
|
||||||
|
|
||||||
|
/* open the original file to copy to the backup */
|
||||||
|
f = fopen(realname, "rb");
|
||||||
|
if (!f) {
|
||||||
|
statusbar(_("Could not read %s for backup: %s"), realname,
|
||||||
|
strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
backupname = charalloc(strlen(realname) + 2);
|
||||||
|
sprintf(backupname, "%s~", realname);
|
||||||
|
|
||||||
|
/* get a file descriptor for the destination backup file */
|
||||||
|
backup_file = fopen(backupname, "wb");
|
||||||
|
if (!backup_file) {
|
||||||
|
statusbar(_("Couldn't write backup: %s"), strerror(errno));
|
||||||
|
free(backupname);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
fprintf(stderr, _("Backing up %s to %s\n"), realname, backupname);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* copy the file */
|
||||||
|
while ((bytesread = fread(backupbuf, sizeof(char),
|
||||||
|
COPYFILEBLOCKSIZE, f)) > 0)
|
||||||
|
if (fwrite(backupbuf, sizeof(char), bytesread, backup_file) <= 0)
|
||||||
|
break;
|
||||||
|
fclose(backup_file);
|
||||||
|
fclose(f);
|
||||||
|
|
||||||
|
if (chmod(backupname, originalfilestat.st_mode) == -1)
|
||||||
|
statusbar(_("Could not set permissions %o on backup %s: %s"),
|
||||||
|
originalfilestat.st_mode, backupname,
|
||||||
|
strerror(errno));
|
||||||
|
|
||||||
|
if (chown(backupname, originalfilestat.st_uid,
|
||||||
|
originalfilestat.st_gid) == -1)
|
||||||
|
statusbar(_("Could not set owner %d/group %d on backup %s: %s"),
|
||||||
|
originalfilestat.st_uid, originalfilestat.st_gid,
|
||||||
|
backupname, strerror(errno));
|
||||||
|
|
||||||
|
if (utime(backupname, &filetime) == -1)
|
||||||
|
statusbar(_("Could not set access/modification time on backup %s: %s"),
|
||||||
|
backupname, strerror(errno));
|
||||||
|
|
||||||
|
free(backupname);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Stat the link itself for the check... */
|
/* Stat the link itself for the check... */
|
||||||
anyexists = lstat(realname, &lst);
|
anyexists = lstat(realname, &lst);
|
||||||
|
|
||||||
|
@ -1368,7 +1449,6 @@ int write_file(char *name, int tmp, int append, int nonamechange)
|
||||||
else
|
else
|
||||||
fprintf(stderr, _("Wrote >%s\n"), fileptr->data);
|
fprintf(stderr, _("Wrote >%s\n"), fileptr->data);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
if (ISSET(DOS_FILE) || ISSET(MAC_FILE))
|
if (ISSET(DOS_FILE) || ISSET(MAC_FILE))
|
||||||
putc('\r', f);
|
putc('\r', f);
|
||||||
|
@ -1424,7 +1504,6 @@ int write_file(char *name, int tmp, int append, int nonamechange)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (fclose(f)) {
|
if (fclose(f)) {
|
||||||
statusbar(_("Could not close %s: %s"), realname, strerror(errno));
|
statusbar(_("Could not close %s: %s"), realname, strerror(errno));
|
||||||
unlink(buf);
|
unlink(buf);
|
||||||
|
@ -1481,7 +1560,6 @@ int write_file(char *name, int tmp, int append, int nonamechange)
|
||||||
fclose(f_dest);
|
fclose(f_dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (realexists == -1 || tmp ||
|
if (realexists == -1 || tmp ||
|
||||||
(!ISSET(FOLLOW_SYMLINKS) && S_ISLNK(lst.st_mode))) {
|
(!ISSET(FOLLOW_SYMLINKS) && S_ISLNK(lst.st_mode))) {
|
||||||
|
|
||||||
|
@ -1489,7 +1567,7 @@ int write_file(char *name, int tmp, int append, int nonamechange)
|
||||||
mask = umask(0);
|
mask = umask(0);
|
||||||
umask(mask);
|
umask(mask);
|
||||||
|
|
||||||
if (tmp) /* We don't want anyone reading our temporary file! */
|
if (tmp) /* We don't want anyone reading our temporary file! */
|
||||||
mask = 0600;
|
mask = 0600;
|
||||||
else
|
else
|
||||||
mask = 0666 & ~mask;
|
mask = 0666 & ~mask;
|
||||||
|
@ -1529,6 +1607,10 @@ int write_file(char *name, int tmp, int append, int nonamechange)
|
||||||
if (!nonamechange)
|
if (!nonamechange)
|
||||||
filename = mallocstrcpy(filename, realname);
|
filename = mallocstrcpy(filename, realname);
|
||||||
|
|
||||||
|
#ifndef NANO_SMALL
|
||||||
|
/* Update originalfilestat to reference the file as it is now. */
|
||||||
|
stat(filename, &originalfilestat);
|
||||||
|
#endif
|
||||||
statusbar(_("Wrote %d lines"), lineswritten);
|
statusbar(_("Wrote %d lines"), lineswritten);
|
||||||
UNSET(MODIFIED);
|
UNSET(MODIFIED);
|
||||||
titlebar(NULL);
|
titlebar(NULL);
|
||||||
|
@ -1539,8 +1621,9 @@ int write_file(char *name, int tmp, int append, int nonamechange)
|
||||||
int do_writeout(char *path, int exiting, int append)
|
int do_writeout(char *path, int exiting, int append)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
char *formatstr = NULL;
|
#ifndef NANO_SMALL
|
||||||
|
const char *formatstr, *backupstr;
|
||||||
|
#endif
|
||||||
#ifdef NANO_EXTRA
|
#ifdef NANO_EXTRA
|
||||||
static int did_cred = 0;
|
static int did_cred = 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1568,7 +1651,6 @@ int do_writeout(char *path, int exiting, int append)
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
|
|
||||||
if (ISSET(MAC_FILE))
|
if (ISSET(MAC_FILE))
|
||||||
formatstr = _(" [Mac Format]");
|
formatstr = _(" [Mac Format]");
|
||||||
else if (ISSET(DOS_FILE))
|
else if (ISSET(DOS_FILE))
|
||||||
|
@ -1576,31 +1658,44 @@ int do_writeout(char *path, int exiting, int append)
|
||||||
else
|
else
|
||||||
formatstr = "";
|
formatstr = "";
|
||||||
|
|
||||||
|
if (ISSET(BACKUP_FILE))
|
||||||
|
backupstr = _(" [Backup]");
|
||||||
|
else
|
||||||
|
backupstr = "";
|
||||||
|
|
||||||
/* Be nice to the translation folks */
|
/* Be nice to the translation folks */
|
||||||
if (ISSET(MARK_ISSET) && !exiting) {
|
if (ISSET(MARK_ISSET) && !exiting) {
|
||||||
if (append == 2)
|
if (append == 2)
|
||||||
i = statusq(1, writefile_list, "",
|
i = statusq(1, writefile_list, "",
|
||||||
"%s%s", _("Prepend Selection to File"), formatstr);
|
"%s%s%s", _("Prepend Selection to File"), formatstr, backupstr);
|
||||||
else if (append)
|
else if (append)
|
||||||
i = statusq(1, writefile_list, "",
|
i = statusq(1, writefile_list, "",
|
||||||
"%s%s", _("Append Selection to File"), formatstr);
|
"%s%s%s", _("Append Selection to File"), formatstr, backupstr);
|
||||||
else
|
else
|
||||||
i = statusq(1, writefile_list, "",
|
i = statusq(1, writefile_list, "",
|
||||||
"%s%s", _("Write Selection to File"), formatstr);
|
"%s%s%s", _("Write Selection to File"), formatstr, backupstr);
|
||||||
} else
|
} else {
|
||||||
#endif
|
|
||||||
{
|
|
||||||
if (append == 2)
|
if (append == 2)
|
||||||
i = statusq(1, writefile_list, answer,
|
i = statusq(1, writefile_list, answer,
|
||||||
"%s%s", _("File Name to Prepend"), formatstr);
|
"%s%s%s", _("File Name to Prepend to"), formatstr, backupstr);
|
||||||
else if (append)
|
else if (append)
|
||||||
i = statusq(1, writefile_list, answer,
|
i = statusq(1, writefile_list, answer,
|
||||||
"%s%s", _("File Name to Append"), formatstr);
|
"%s%s%s", _("File Name to Append to"), formatstr, backupstr);
|
||||||
else
|
else
|
||||||
i = statusq(1, writefile_list, answer,
|
i = statusq(1, writefile_list, answer,
|
||||||
"%s%s", _("File Name to Write"), formatstr);
|
"%s%s%s", _("File Name to Write"), formatstr, backupstr);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if (append == 2)
|
||||||
|
i = statusq(1, writefile_list, answer,
|
||||||
|
"%s", _("File Name to Prepend to"));
|
||||||
|
else if (append)
|
||||||
|
i = statusq(1, writefile_list, answer,
|
||||||
|
"%s", _("File Name to Append to"));
|
||||||
|
else
|
||||||
|
i = statusq(1, writefile_list, answer,
|
||||||
|
"%s", _("File Name to Write"));
|
||||||
|
#endif /* !NANO_SMALL */
|
||||||
|
|
||||||
if (i != -1) {
|
if (i != -1) {
|
||||||
|
|
||||||
|
@ -1627,13 +1722,18 @@ int do_writeout(char *path, int exiting, int append)
|
||||||
UNSET(DOS_FILE);
|
UNSET(DOS_FILE);
|
||||||
TOGGLE(MAC_FILE);
|
TOGGLE(MAC_FILE);
|
||||||
return(do_writeout(answer, exiting, append));
|
return(do_writeout(answer, exiting, append));
|
||||||
|
#ifndef NANO_SMALL
|
||||||
|
} else if (i == TOGGLE_BACKUP_KEY) {
|
||||||
|
TOGGLE(BACKUP_FILE);
|
||||||
|
return(do_writeout(answer, exiting, append));
|
||||||
|
#endif
|
||||||
} else if (i == NANO_PREPEND_KEY)
|
} else if (i == NANO_PREPEND_KEY)
|
||||||
return(do_writeout(answer, exiting, append == 2 ? 0 : 2));
|
return(do_writeout(answer, exiting, append == 2 ? 0 : 2));
|
||||||
else if (i == NANO_APPEND_KEY)
|
else if (i == NANO_APPEND_KEY)
|
||||||
return(do_writeout(answer, exiting, append == 1 ? 0 : 1));
|
return(do_writeout(answer, exiting, append == 1 ? 0 : 1));
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, _("filename is %s"), answer);
|
fprintf(stderr, _("filename is %s\n"), answer);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NANO_EXTRA
|
#ifdef NANO_EXTRA
|
||||||
|
@ -1653,8 +1753,8 @@ int do_writeout(char *path, int exiting, int append)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifndef NANO_SMALL
|
|
||||||
|
|
||||||
|
#ifndef NANO_SMALL
|
||||||
/* Here's where we allow the selected text to be written to
|
/* Here's where we allow the selected text to be written to
|
||||||
a separate file. */
|
a separate file. */
|
||||||
if (ISSET(MARK_ISSET) && !exiting) {
|
if (ISSET(MARK_ISSET) && !exiting) {
|
||||||
|
@ -1692,7 +1792,8 @@ int do_writeout(char *path, int exiting, int append)
|
||||||
if (oldmod)
|
if (oldmod)
|
||||||
set_modified();
|
set_modified();
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif /* !NANO_SMALL */
|
||||||
|
|
||||||
i = write_file(answer, 0, append, 0);
|
i = write_file(answer, 0, append, 0);
|
||||||
|
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
|
@ -2357,7 +2458,7 @@ char *do_browser(char *inpath)
|
||||||
|
|
||||||
blank_statusbar_refresh();
|
blank_statusbar_refresh();
|
||||||
|
|
||||||
#if !defined DISABLE_HELP || !defined(DISABLE_MOUSE)
|
#if !defined(DISABLE_HELP) || !defined(DISABLE_MOUSE)
|
||||||
currshortcut = browser_list;
|
currshortcut = browser_list;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
97
global.c
97
global.c
|
@ -42,6 +42,11 @@ WINDOW *edit; /* The file portion of the editor */
|
||||||
WINDOW *topwin; /* Top line of screen */
|
WINDOW *topwin; /* Top line of screen */
|
||||||
WINDOW *bottomwin; /* Bottom buffer */
|
WINDOW *bottomwin; /* Bottom buffer */
|
||||||
char *filename = NULL; /* Name of the file */
|
char *filename = NULL; /* Name of the file */
|
||||||
|
|
||||||
|
#ifndef NANO_SMALL
|
||||||
|
struct stat originalfilestat; /* Stat for the file as we loaded it */
|
||||||
|
#endif
|
||||||
|
|
||||||
int editwinrows = 0; /* How many rows long is the edit
|
int editwinrows = 0; /* How many rows long is the edit
|
||||||
window? */
|
window? */
|
||||||
filestruct *current; /* Current buffer pointer */
|
filestruct *current; /* Current buffer pointer */
|
||||||
|
@ -114,7 +119,7 @@ shortcut *browser_list = NULL;
|
||||||
char *syntaxstr = NULL;
|
char *syntaxstr = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(DISABLE_BROWSER) || !defined(DISABLE_MOUSE) || !defined (DISABLE_HELP)
|
#if !defined(DISABLE_BROWSER) || !defined(DISABLE_MOUSE) || !defined(DISABLE_HELP)
|
||||||
shortcut *currshortcut; /* Current shortcut list we're using */
|
shortcut *currshortcut; /* Current shortcut list we're using */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -153,7 +158,7 @@ static void sc_init_one(shortcut **shortcutage, int key,
|
||||||
const char *desc,
|
const char *desc,
|
||||||
#ifndef DISABLE_HELP
|
#ifndef DISABLE_HELP
|
||||||
const char *help,
|
const char *help,
|
||||||
#endif /* !DISABLE_HELP */
|
#endif
|
||||||
int alt, int misc1, int misc2, int view,
|
int alt, int misc1, int misc2, int view,
|
||||||
int (*func) (void))
|
int (*func) (void))
|
||||||
{
|
{
|
||||||
|
@ -173,7 +178,7 @@ static void sc_init_one(shortcut **shortcutage, int key,
|
||||||
s->desc = desc;
|
s->desc = desc;
|
||||||
#ifndef DISABLE_HELP
|
#ifndef DISABLE_HELP
|
||||||
s->help = help;
|
s->help = help;
|
||||||
#endif /* !DISABLE_HELP */
|
#endif
|
||||||
s->altval = alt;
|
s->altval = alt;
|
||||||
s->misc1 = misc1;
|
s->misc1 = misc1;
|
||||||
s->misc2 = misc2;
|
s->misc2 = misc2;
|
||||||
|
@ -205,6 +210,7 @@ static void toggle_init_one(int val, const char *desc, int flag)
|
||||||
u->next = NULL;
|
u->next = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
/* Deallocate all of the toggles */
|
/* Deallocate all of the toggles */
|
||||||
static void free_toggles(void)
|
static void free_toggles(void)
|
||||||
{
|
{
|
||||||
|
@ -217,23 +223,27 @@ static void free_toggles(void)
|
||||||
}
|
}
|
||||||
toggles = NULL;
|
toggles = NULL;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void toggle_init(void)
|
static void toggle_init(void)
|
||||||
{
|
{
|
||||||
char *toggle_const_msg, *toggle_autoindent_msg, *toggle_suspend_msg,
|
char *toggle_const_msg, *toggle_autoindent_msg, *toggle_suspend_msg,
|
||||||
*toggle_nohelp_msg, *toggle_picomode_msg, *toggle_mouse_msg,
|
*toggle_nohelp_msg, *toggle_picomode_msg, *toggle_mouse_msg,
|
||||||
*toggle_cuttoend_msg, *toggle_wrap_msg, *toggle_case_msg,
|
*toggle_cuttoend_msg, *toggle_wrap_msg, *toggle_noconvert_msg,
|
||||||
*toggle_backwards_msg, *toggle_noconvert_msg, *toggle_dos_msg,
|
*toggle_dos_msg, *toggle_mac_msg, *toggle_backup_msg,
|
||||||
*toggle_mac_msg, *toggle_smooth_msg;
|
*toggle_smooth_msg;
|
||||||
|
|
||||||
#ifdef HAVE_REGEX_H
|
|
||||||
char *toggle_regexp_msg;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
char *toggle_load_msg;
|
char *toggle_load_msg;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* There is no need to reinitialize the toggles. They can't
|
||||||
|
change. In fact, reinitializing them causes a segfault in
|
||||||
|
nano.c:do_toggle() when it is called with the Pico-mode
|
||||||
|
toggle. */
|
||||||
|
if (toggles != NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
toggle_const_msg = _("Constant cursor position");
|
toggle_const_msg = _("Constant cursor position");
|
||||||
toggle_autoindent_msg = _("Auto indent");
|
toggle_autoindent_msg = _("Auto indent");
|
||||||
toggle_suspend_msg = _("Suspend");
|
toggle_suspend_msg = _("Suspend");
|
||||||
|
@ -241,25 +251,16 @@ static void toggle_init(void)
|
||||||
toggle_picomode_msg = _("Pico mode");
|
toggle_picomode_msg = _("Pico mode");
|
||||||
toggle_mouse_msg = _("Mouse support");
|
toggle_mouse_msg = _("Mouse support");
|
||||||
toggle_cuttoend_msg = _("Cut to end");
|
toggle_cuttoend_msg = _("Cut to end");
|
||||||
toggle_backwards_msg = _("Backwards search");
|
|
||||||
toggle_case_msg = _("Case sensitive search");
|
|
||||||
|
|
||||||
#ifdef HAVE_REGEX_H
|
|
||||||
toggle_regexp_msg = _("Regular expression search");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
toggle_noconvert_msg = _("No conversion from DOS/Mac format");
|
toggle_noconvert_msg = _("No conversion from DOS/Mac format");
|
||||||
toggle_dos_msg = _("Writing file in DOS format");
|
toggle_dos_msg = _("Writing file in DOS format");
|
||||||
toggle_mac_msg = _("Writing file in Mac format");
|
toggle_mac_msg = _("Writing file in Mac format");
|
||||||
|
toggle_backup_msg = _("Backing up file");
|
||||||
toggle_smooth_msg = _("Smooth scrolling");
|
toggle_smooth_msg = _("Smooth scrolling");
|
||||||
toggle_wrap_msg = _("Auto wrap");
|
toggle_wrap_msg = _("Auto wrap");
|
||||||
|
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
toggle_load_msg = _("Multiple file buffers");
|
toggle_load_msg = _("Multiple file buffers");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
free_toggles();
|
|
||||||
|
|
||||||
toggle_init_one(TOGGLE_CONST_KEY, toggle_const_msg, CONSTUPDATE);
|
toggle_init_one(TOGGLE_CONST_KEY, toggle_const_msg, CONSTUPDATE);
|
||||||
toggle_init_one(TOGGLE_AUTOINDENT_KEY, toggle_autoindent_msg, AUTOINDENT);
|
toggle_init_one(TOGGLE_AUTOINDENT_KEY, toggle_autoindent_msg, AUTOINDENT);
|
||||||
toggle_init_one(TOGGLE_SUSPEND_KEY, toggle_suspend_msg, SUSPEND);
|
toggle_init_one(TOGGLE_SUSPEND_KEY, toggle_suspend_msg, SUSPEND);
|
||||||
|
@ -268,22 +269,17 @@ static void toggle_init(void)
|
||||||
toggle_init_one(TOGGLE_WRAP_KEY, toggle_wrap_msg, NO_WRAP);
|
toggle_init_one(TOGGLE_WRAP_KEY, toggle_wrap_msg, NO_WRAP);
|
||||||
toggle_init_one(TOGGLE_MOUSE_KEY, toggle_mouse_msg, USE_MOUSE);
|
toggle_init_one(TOGGLE_MOUSE_KEY, toggle_mouse_msg, USE_MOUSE);
|
||||||
toggle_init_one(TOGGLE_CUTTOEND_KEY, toggle_cuttoend_msg, CUT_TO_END);
|
toggle_init_one(TOGGLE_CUTTOEND_KEY, toggle_cuttoend_msg, CUT_TO_END);
|
||||||
toggle_init_one(TOGGLE_BACKWARDS_KEY, toggle_backwards_msg, REVERSE_SEARCH);
|
|
||||||
toggle_init_one(TOGGLE_CASE_KEY, toggle_case_msg, CASE_SENSITIVE);
|
|
||||||
#ifdef HAVE_REGEX_H
|
|
||||||
toggle_init_one(TOGGLE_REGEXP_KEY, toggle_regexp_msg, USE_REGEXP);
|
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
toggle_init_one(TOGGLE_LOAD_KEY, toggle_load_msg, MULTIBUFFER);
|
toggle_init_one(TOGGLE_LOAD_KEY, toggle_load_msg, MULTIBUFFER);
|
||||||
#endif
|
#endif
|
||||||
toggle_init_one(TOGGLE_NOCONVERT_KEY, toggle_noconvert_msg, NO_CONVERT);
|
toggle_init_one(TOGGLE_NOCONVERT_KEY, toggle_noconvert_msg, NO_CONVERT);
|
||||||
toggle_init_one(TOGGLE_DOS_KEY, toggle_dos_msg, DOS_FILE);
|
toggle_init_one(TOGGLE_DOS_KEY, toggle_dos_msg, DOS_FILE);
|
||||||
toggle_init_one(TOGGLE_MAC_KEY, toggle_mac_msg, MAC_FILE);
|
toggle_init_one(TOGGLE_MAC_KEY, toggle_mac_msg, MAC_FILE);
|
||||||
|
toggle_init_one(TOGGLE_BACKUP_KEY, toggle_backup_msg, BACKUP_FILE);
|
||||||
toggle_init_one(TOGGLE_SMOOTH_KEY, toggle_smooth_msg, SMOOTHSCROLL);
|
toggle_init_one(TOGGLE_SMOOTH_KEY, toggle_smooth_msg, SMOOTHSCROLL);
|
||||||
}
|
}
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_SMALL */
|
||||||
|
|
||||||
|
|
||||||
/* Deallocate the given shortcut. */
|
/* Deallocate the given shortcut. */
|
||||||
static void free_shortcutage(shortcut **shortcutage)
|
static void free_shortcutage(shortcut **shortcutage)
|
||||||
{
|
{
|
||||||
|
@ -302,42 +298,40 @@ static void free_shortcutage(shortcut **shortcutage)
|
||||||
void shortcut_init(int unjustify)
|
void shortcut_init(int unjustify)
|
||||||
{
|
{
|
||||||
#ifndef DISABLE_HELP
|
#ifndef DISABLE_HELP
|
||||||
char *nano_help_msg = "", *nano_writeout_msg = "", *nano_exit_msg = "",
|
char *nano_help_msg = "", *nano_writeout_msg = "", *nano_exit_msg =
|
||||||
*nano_goto_msg = "", *nano_justify_msg = "", *nano_replace_msg =
|
"", *nano_goto_msg = "", *nano_justify_msg =
|
||||||
"", *nano_insert_msg = "", *nano_whereis_msg =
|
"", *nano_replace_msg = "", *nano_insert_msg =
|
||||||
"", *nano_prevpage_msg = "", *nano_nextpage_msg =
|
"", *nano_whereis_msg = "", *nano_prevpage_msg =
|
||||||
"", *nano_cut_msg = "", *nano_uncut_msg = "", *nano_cursorpos_msg =
|
"", *nano_nextpage_msg = "", *nano_cut_msg =
|
||||||
|
"", *nano_uncut_msg = "", *nano_cursorpos_msg =
|
||||||
"", *nano_spell_msg = "", *nano_up_msg = "", *nano_down_msg =
|
"", *nano_spell_msg = "", *nano_up_msg = "", *nano_down_msg =
|
||||||
"", *nano_forward_msg = "", *nano_back_msg = "", *nano_home_msg =
|
"", *nano_forward_msg = "", *nano_back_msg = "", *nano_home_msg =
|
||||||
"", *nano_end_msg = "", *nano_firstline_msg =
|
"", *nano_end_msg = "", *nano_firstline_msg =
|
||||||
"", *nano_lastline_msg = "", *nano_refresh_msg =
|
"", *nano_lastline_msg = "", *nano_refresh_msg =
|
||||||
"", *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_cancel_msg =
|
"", *nano_enter_msg = "", *nano_cancel_msg =
|
||||||
"", *nano_unjustify_msg = "", *nano_append_msg =
|
"", *nano_unjustify_msg = "", *nano_append_msg =
|
||||||
"", *nano_prepend_msg = "";
|
"", *nano_prepend_msg = "", *nano_tofiles_msg =
|
||||||
|
"", *nano_gotodir_msg = "", *nano_case_msg =
|
||||||
|
"", *nano_reverse_msg = "", *nano_execute_msg =
|
||||||
|
"", *nano_dos_msg = "", *nano_mac_msg =
|
||||||
|
"", *nano_backup_msg = "";
|
||||||
|
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
char *nano_openprev_msg = "", *nano_opennext_msg = "";
|
char *nano_openprev_msg = "", *nano_opennext_msg = "";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char *nano_tofiles_msg = "", *nano_gotodir_msg = "", *nano_case_msg =
|
|
||||||
"", *nano_reverse_msg = "", *nano_execute_msg = "";
|
|
||||||
char *nano_dos_msg = "", *nano_mac_msg = "";
|
|
||||||
|
|
||||||
#ifdef HAVE_REGEX_H
|
#ifdef HAVE_REGEX_H
|
||||||
char *nano_regexp_msg = "", *nano_bracket_msg = "";
|
char *nano_regexp_msg = "", *nano_bracket_msg = "";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
nano_help_msg = _("Invoke the help menu");
|
nano_help_msg = _("Invoke the help menu");
|
||||||
nano_writeout_msg = _("Write the current file to disk");
|
nano_writeout_msg = _("Write the current file to disk");
|
||||||
|
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
nano_exit_msg = _("Close currently loaded file/Exit from nano");
|
nano_exit_msg = _("Close currently loaded file/Exit from nano");
|
||||||
#else
|
#else
|
||||||
nano_exit_msg = _("Exit from nano");
|
nano_exit_msg = _("Exit from nano");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
nano_goto_msg = _("Go to a specific line number");
|
nano_goto_msg = _("Go to a specific line number");
|
||||||
nano_justify_msg = _("Justify the current paragraph");
|
nano_justify_msg = _("Justify the current paragraph");
|
||||||
nano_unjustify_msg = _("Unjustify after a justify");
|
nano_unjustify_msg = _("Unjustify after a justify");
|
||||||
|
@ -349,7 +343,7 @@ void shortcut_init(int unjustify)
|
||||||
nano_cut_msg = _("Cut the current line and store it in the cutbuffer");
|
nano_cut_msg = _("Cut the current line and store it in the cutbuffer");
|
||||||
nano_uncut_msg = _("Uncut from the cutbuffer into the current line");
|
nano_uncut_msg = _("Uncut from the cutbuffer into the current line");
|
||||||
nano_cursorpos_msg = _("Show the position of the cursor");
|
nano_cursorpos_msg = _("Show the position of the cursor");
|
||||||
nano_spell_msg = _("Invoke the spell checker (if available)");
|
nano_spell_msg = _("Invoke the spell checker, if available");
|
||||||
nano_up_msg = _("Move up one line");
|
nano_up_msg = _("Move up one line");
|
||||||
nano_down_msg = _("Move down one line");
|
nano_down_msg = _("Move down one line");
|
||||||
nano_forward_msg = _("Move forward one character");
|
nano_forward_msg = _("Move forward one character");
|
||||||
|
@ -376,8 +370,11 @@ void shortcut_init(int unjustify)
|
||||||
nano_reverse_msg = _("Search backwards");
|
nano_reverse_msg = _("Search backwards");
|
||||||
nano_dos_msg = _("Write file out in DOS format");
|
nano_dos_msg = _("Write file out in DOS format");
|
||||||
nano_mac_msg = _("Write file out in Mac format");
|
nano_mac_msg = _("Write file out in Mac format");
|
||||||
|
#ifndef NANO_SMALL
|
||||||
|
nano_backup_msg = _("Back up original file when saving");
|
||||||
|
#endif
|
||||||
#ifdef HAVE_REGEX_H
|
#ifdef HAVE_REGEX_H
|
||||||
nano_regexp_msg = _("Use Regular expressions");
|
nano_regexp_msg = _("Use regular expressions");
|
||||||
nano_bracket_msg = _("Find other bracket");
|
nano_bracket_msg = _("Find other bracket");
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
|
@ -408,6 +405,7 @@ void shortcut_init(int unjustify)
|
||||||
do_exit);
|
do_exit);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sc_init_one(&main_list, NANO_EXIT_KEY, _("Exit"),
|
sc_init_one(&main_list, NANO_EXIT_KEY, _("Exit"),
|
||||||
IFHELP(nano_exit_msg, 0), NANO_EXIT_FKEY, 0, VIEW,
|
IFHELP(nano_exit_msg, 0), NANO_EXIT_FKEY, 0, VIEW,
|
||||||
do_exit);
|
do_exit);
|
||||||
|
@ -445,7 +443,6 @@ void shortcut_init(int unjustify)
|
||||||
IFHELP(nano_insert_msg, 0),
|
IFHELP(nano_insert_msg, 0),
|
||||||
NANO_INSERTFILE_FKEY, 0, NOVIEW, do_insertfile_void);
|
NANO_INSERTFILE_FKEY, 0, NOVIEW, do_insertfile_void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
else
|
else
|
||||||
sc_init_one(&main_list, NANO_REPLACE_KEY, _("Replace"),
|
sc_init_one(&main_list, NANO_REPLACE_KEY, _("Replace"),
|
||||||
IFHELP(nano_replace_msg, NANO_ALT_REPLACE_KEY),
|
IFHELP(nano_replace_msg, NANO_ALT_REPLACE_KEY),
|
||||||
|
@ -484,7 +481,6 @@ void shortcut_init(int unjustify)
|
||||||
IFHELP(nano_spell_msg, 0),
|
IFHELP(nano_spell_msg, 0),
|
||||||
NANO_SPELL_FKEY, 0, NOVIEW, do_spell);
|
NANO_SPELL_FKEY, 0, NOVIEW, do_spell);
|
||||||
|
|
||||||
|
|
||||||
sc_init_one(&main_list, NANO_UP_KEY, _("Up"),
|
sc_init_one(&main_list, NANO_UP_KEY, _("Up"),
|
||||||
IFHELP(nano_up_msg, 0),
|
IFHELP(nano_up_msg, 0),
|
||||||
KEY_UP, 0, VIEW, do_up);
|
KEY_UP, 0, VIEW, do_up);
|
||||||
|
@ -554,13 +550,11 @@ void shortcut_init(int unjustify)
|
||||||
IFHELP(_("Move backward one word"), NANO_PREVWORD_KEY), 0, 0,
|
IFHELP(_("Move backward one word"), NANO_PREVWORD_KEY), 0, 0,
|
||||||
VIEW, do_prev_word_void);
|
VIEW, do_prev_word_void);
|
||||||
#endif
|
#endif
|
||||||
|
#if !defined(NANO_SMALL) && defined(HAVE_REGEX_H)
|
||||||
#if (!defined NANO_SMALL) && (defined HAVE_REGEX_H)
|
|
||||||
sc_init_one(&main_list, -9, _("Find Other Bracket"),
|
sc_init_one(&main_list, -9, _("Find Other Bracket"),
|
||||||
IFHELP(nano_bracket_msg, NANO_BRACKET_KEY),
|
IFHELP(nano_bracket_msg, NANO_BRACKET_KEY),
|
||||||
0, 0, VIEW, do_find_bracket);
|
0, 0, VIEW, do_find_bracket);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
sc_init_one(&main_list, -9, _("Previous File"),
|
sc_init_one(&main_list, -9, _("Previous File"),
|
||||||
IFHELP(nano_openprev_msg, NANO_OPENPREV_KEY),
|
IFHELP(nano_openprev_msg, NANO_OPENPREV_KEY),
|
||||||
|
@ -703,6 +697,11 @@ void shortcut_init(int unjustify)
|
||||||
sc_init_one(&writefile_list, NANO_PREPEND_KEY, _("Prepend"),
|
sc_init_one(&writefile_list, NANO_PREPEND_KEY, _("Prepend"),
|
||||||
IFHELP(nano_prepend_msg, 0), 0, 0, NOVIEW, 0);
|
IFHELP(nano_prepend_msg, 0), 0, 0, NOVIEW, 0);
|
||||||
|
|
||||||
|
#ifndef NANO_SMALL
|
||||||
|
sc_init_one(&writefile_list, TOGGLE_BACKUP_KEY, _("Backup File"),
|
||||||
|
IFHELP(nano_backup_msg, 0), 0, 0, NOVIEW, 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
sc_init_one(&writefile_list, NANO_CANCEL_KEY, _("Cancel"),
|
sc_init_one(&writefile_list, NANO_CANCEL_KEY, _("Cancel"),
|
||||||
IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
|
IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
|
||||||
|
|
||||||
|
@ -742,7 +741,6 @@ void shortcut_init(int unjustify)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DISABLE_BROWSER
|
#ifndef DISABLE_BROWSER
|
||||||
|
|
||||||
free_shortcutage(&browser_list);
|
free_shortcutage(&browser_list);
|
||||||
|
|
||||||
sc_init_one(&browser_list, NANO_HELP_KEY, _("Get Help"),
|
sc_init_one(&browser_list, NANO_HELP_KEY, _("Get Help"),
|
||||||
|
@ -770,14 +768,11 @@ void shortcut_init(int unjustify)
|
||||||
|
|
||||||
sc_init_one(&gotodir_list, NANO_CANCEL_KEY, _("Cancel"),
|
sc_init_one(&gotodir_list, NANO_CANCEL_KEY, _("Cancel"),
|
||||||
IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
|
IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if !defined(DISABLE_BROWSER) || !defined(DISABLE_MOUSE) || !defined (DISABLE_HELP)
|
#if !defined(DISABLE_BROWSER) || !defined(DISABLE_MOUSE) || !defined (DISABLE_HELP)
|
||||||
currshortcut = main_list;
|
currshortcut = main_list;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
toggle_init();
|
toggle_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
36
nano.1
36
nano.1
|
@ -6,7 +6,7 @@
|
||||||
.\" Public License for copying conditions. There is NO warranty.
|
.\" Public License for copying conditions. There is NO warranty.
|
||||||
.\"
|
.\"
|
||||||
.\" $Id$
|
.\" $Id$
|
||||||
.TH NANO 1 "January 3, 2002"
|
.TH NANO 1 "June 27, 2002"
|
||||||
.\" Please adjust this date whenever revising the manpage.
|
.\" Please adjust this date whenever revising the manpage.
|
||||||
.\"
|
.\"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
|
@ -31,11 +31,15 @@ also implements some missing (or disabled by default) features in Pico,
|
||||||
such as "search and replace" and "goto line number".
|
such as "search and replace" and "goto line number".
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
.TP
|
.TP
|
||||||
|
.B \-B (\-\-backup)
|
||||||
|
When saving a file, back up the previous version of it to the current
|
||||||
|
filename suffixed with a ~.
|
||||||
|
.TP
|
||||||
.B \-D (\-\-dos)
|
.B \-D (\-\-dos)
|
||||||
Write file in DOS format.
|
Write file in DOS format.
|
||||||
.TP
|
.TP
|
||||||
.B \-F (\-\-multibuffer)
|
.B \-F (\-\-multibuffer)
|
||||||
Enable multiple file buffers (if available).
|
Enable multiple file buffers, if available.
|
||||||
.TP
|
.TP
|
||||||
.B \-K (\-\-keypad)
|
.B \-K (\-\-keypad)
|
||||||
Do not use the ncurses keypad() call unless necessary. Try this flag if
|
Do not use the ncurses keypad() call unless necessary. Try this flag if
|
||||||
|
@ -66,7 +70,8 @@ Set the size (width) of a tab.
|
||||||
Show the current version number and author.
|
Show the current version number and author.
|
||||||
.TP
|
.TP
|
||||||
.B \-Y (\-\-syntax=[str])
|
.B \-Y (\-\-syntax=[str])
|
||||||
Specify a specific syntax highlighting from the .nanorc to use (if available).
|
Specify a specific syntax highlighting from the .nanorc to use, if
|
||||||
|
available.
|
||||||
.TP
|
.TP
|
||||||
.B \-c (\-\-const)
|
.B \-c (\-\-const)
|
||||||
Constantly show the cursor position.
|
Constantly show the cursor position.
|
||||||
|
@ -89,18 +94,19 @@ a new file, do not follow it. Good for editing files in /tmp, perhaps?
|
||||||
Enable mouse support (if available for your system).
|
Enable mouse support (if available for your system).
|
||||||
.TP
|
.TP
|
||||||
.B \-o [dir] (\-\-operatingdir=[dir])
|
.B \-o [dir] (\-\-operatingdir=[dir])
|
||||||
Set operating directory. Makes nano set up something similar to a chroot.
|
Set operating directory. Makes nano set up something similar to a
|
||||||
|
chroot.
|
||||||
.TP
|
.TP
|
||||||
.B \-p (\-\-pico)
|
.B \-p (\-\-pico)
|
||||||
Emulate Pico as closely as possible. This affects both the "shortcut list"
|
Emulate Pico as closely as possible. This affects both the "shortcut
|
||||||
at the bottom of the screen, as well as the display and entry of previous
|
list" at the bottom of the screen, as well as the display and entry of
|
||||||
search and replace strings.
|
previous search and replace strings.
|
||||||
.TP
|
.TP
|
||||||
.B \-r [#cols] (\-\-fill=[#cols])
|
.B \-r [#cols] (\-\-fill=[#cols])
|
||||||
Wrap lines at column #cols. By default, this is the width of the screen,
|
Wrap lines at column #cols. By default, this is the width of the
|
||||||
less eight. If this value is negative, wrapping will occur at #cols from
|
screen, less eight. If this value is negative, wrapping will occur at
|
||||||
the right of the screen, allowing it to vary along with the screen width
|
#cols from the right of the screen, allowing it to vary along with the
|
||||||
if the screen is resized.
|
screen width if the screen is resized.
|
||||||
.TP
|
.TP
|
||||||
.B \-s [prog] (\-\-speller=[prog])
|
.B \-s [prog] (\-\-speller=[prog])
|
||||||
Enable alternative spell checker command.
|
Enable alternative spell checker command.
|
||||||
|
@ -128,10 +134,10 @@ Places cursor at LINE on startup.
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
Nano will try to dump the buffer into an emergency file in some cases.
|
Nano will try to dump the buffer into an emergency file in some cases.
|
||||||
Mainly, this will happen if Nano receives a SIGHUP or runs out of
|
Mainly, this will happen if Nano receives a SIGHUP or runs out of
|
||||||
memory, when it will write the buffer into a file named "nano.save" if the
|
memory, when it will write the buffer into a file named "nano.save" if
|
||||||
buffer didn't have a name already, or will add a ".save" suffix to the
|
the buffer didn't have a name already, or will add a ".save" suffix to
|
||||||
current filename. If an emergency file with that name already exists in
|
the current filename. If an emergency file with that name already exists
|
||||||
the current directory, ".save" and a number (e.g. ".save.1") will be
|
in the current directory, ".save" and a number (e.g. ".save.1") will be
|
||||||
suffixed to the current filename in order to make it unique. In
|
suffixed to the current filename in order to make it unique. In
|
||||||
multibuffer mode, nano will write all the open buffers to the respective
|
multibuffer mode, nano will write all the open buffers to the respective
|
||||||
emergency files.
|
emergency files.
|
||||||
|
|
39
nano.1.html
39
nano.1.html
|
@ -3,7 +3,7 @@ Content-type: text/html
|
||||||
<HTML><HEAD><TITLE>Manpage of NANO</TITLE>
|
<HTML><HEAD><TITLE>Manpage of NANO</TITLE>
|
||||||
</HEAD><BODY>
|
</HEAD><BODY>
|
||||||
<H1>NANO</H1>
|
<H1>NANO</H1>
|
||||||
Section: User Commands (1)<BR>Updated: January 3, 2002<BR><A HREF="#index">Index</A>
|
Section: User Commands (1)<BR>Updated: June 27, 2002<BR><A HREF="#index">Index</A>
|
||||||
<A HREF="http://localhost/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
<A HREF="http://localhost/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,6 +44,11 @@ such as "search and replace" and "goto line number".
|
||||||
<H2>OPTIONS</H2>
|
<H2>OPTIONS</H2>
|
||||||
|
|
||||||
<DL COMPACT>
|
<DL COMPACT>
|
||||||
|
<DT><B>-B (--backup)</B>
|
||||||
|
|
||||||
|
<DD>
|
||||||
|
When saving a file, back up the previous version of it to the current
|
||||||
|
filename suffixed with a ~.
|
||||||
<DT><B>-D (--dos)</B>
|
<DT><B>-D (--dos)</B>
|
||||||
|
|
||||||
<DD>
|
<DD>
|
||||||
|
@ -51,7 +56,7 @@ Write file in DOS format.
|
||||||
<DT><B>-F (--multibuffer)</B>
|
<DT><B>-F (--multibuffer)</B>
|
||||||
|
|
||||||
<DD>
|
<DD>
|
||||||
Enable multiple file buffers (if available).
|
Enable multiple file buffers, if available.
|
||||||
<DT><B>-K (--keypad)</B>
|
<DT><B>-K (--keypad)</B>
|
||||||
|
|
||||||
<DD>
|
<DD>
|
||||||
|
@ -91,7 +96,8 @@ Show the current version number and author.
|
||||||
<DT><B>-Y (--syntax=[str])</B>
|
<DT><B>-Y (--syntax=[str])</B>
|
||||||
|
|
||||||
<DD>
|
<DD>
|
||||||
Specify a specific syntax highlighting from the .nanorc to use (if available).
|
Specify a specific syntax highlighting from the .nanorc to use, if
|
||||||
|
available.
|
||||||
<DT><B>-c (--const)</B>
|
<DT><B>-c (--const)</B>
|
||||||
|
|
||||||
<DD>
|
<DD>
|
||||||
|
@ -121,20 +127,21 @@ Enable mouse support (if available for your system).
|
||||||
<DT><B>-o [dir] (--operatingdir=[dir])</B>
|
<DT><B>-o [dir] (--operatingdir=[dir])</B>
|
||||||
|
|
||||||
<DD>
|
<DD>
|
||||||
Set operating directory. Makes nano set up something similar to a chroot.
|
Set operating directory. Makes nano set up something similar to a
|
||||||
|
chroot.
|
||||||
<DT><B>-p (--pico)</B>
|
<DT><B>-p (--pico)</B>
|
||||||
|
|
||||||
<DD>
|
<DD>
|
||||||
Emulate Pico as closely as possible. This affects both the "shortcut list"
|
Emulate Pico as closely as possible. This affects both the "shortcut
|
||||||
at the bottom of the screen, as well as the display and entry of previous
|
list" at the bottom of the screen, as well as the display and entry of
|
||||||
search and replace strings.
|
previous search and replace strings.
|
||||||
<DT><B>-r [#cols] (--fill=[#cols])</B>
|
<DT><B>-r [#cols] (--fill=[#cols])</B>
|
||||||
|
|
||||||
<DD>
|
<DD>
|
||||||
Wrap lines at column #cols. By default, this is the width of the screen,
|
Wrap lines at column #cols. By default, this is the width of the
|
||||||
less eight. If this value is negative, wrapping will occur at #cols from
|
screen, less eight. If this value is negative, wrapping will occur at
|
||||||
the right of the screen, allowing it to vary along with the screen width
|
#cols from the right of the screen, allowing it to vary along with the
|
||||||
if the screen is resized.
|
screen width if the screen is resized.
|
||||||
<DT><B>-s [prog] (--speller=[prog])</B>
|
<DT><B>-s [prog] (--speller=[prog])</B>
|
||||||
|
|
||||||
<DD>
|
<DD>
|
||||||
|
@ -173,10 +180,10 @@ Places cursor at LINE on startup.
|
||||||
|
|
||||||
Nano will try to dump the buffer into an emergency file in some cases.
|
Nano will try to dump the buffer into an emergency file in some cases.
|
||||||
Mainly, this will happen if Nano receives a SIGHUP or runs out of
|
Mainly, this will happen if Nano receives a SIGHUP or runs out of
|
||||||
memory, when it will write the buffer into a file named "nano.save" if the
|
memory, when it will write the buffer into a file named "nano.save" if
|
||||||
buffer didn't have a name already, or will add a ".save" suffix to the
|
the buffer didn't have a name already, or will add a ".save" suffix to
|
||||||
current filename. If an emergency file with that name already exists in
|
the current filename. If an emergency file with that name already exists
|
||||||
the current directory, ".save" and a number (e.g. ".save.1") will be
|
in the current directory, ".save" and a number (e.g. ".save.1") will be
|
||||||
suffixed to the current filename in order to make it unique. In
|
suffixed to the current filename in order to make it unique. In
|
||||||
multibuffer mode, nano will write all the open buffers to the respective
|
multibuffer mode, nano will write all the open buffers to the respective
|
||||||
emergency files.
|
emergency files.
|
||||||
|
@ -227,6 +234,6 @@ used by others).
|
||||||
This document was created by
|
This document was created by
|
||||||
<A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>,
|
<A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>,
|
||||||
using the manual pages.<BR>
|
using the manual pages.<BR>
|
||||||
Time: 19:17:30 GMT, May 08, 2002
|
Time: 21:45:15 GMT, June 27, 2002
|
||||||
</BODY>
|
</BODY>
|
||||||
</HTML>
|
</HTML>
|
||||||
|
|
107
nano.c
107
nano.c
|
@ -464,7 +464,9 @@ void usage(void)
|
||||||
printf(_("Option Meaning\n"));
|
printf(_("Option Meaning\n"));
|
||||||
#endif /* HAVE_GETOPT_LONG */
|
#endif /* HAVE_GETOPT_LONG */
|
||||||
|
|
||||||
|
print1opt("-h, -?", "--help", _("Show this message"));
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
|
print1opt("-B", "--backup", _("Backup existing files on save"));
|
||||||
print1opt("-D", "--dos", _("Write file in DOS format"));
|
print1opt("-D", "--dos", _("Write file in DOS format"));
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
|
@ -478,7 +480,9 @@ void usage(void)
|
||||||
#ifndef DISABLE_JUSTIFY
|
#ifndef DISABLE_JUSTIFY
|
||||||
print1opt(_("-Q [str]"), _("--quotestr [str]"), _("Quoting string, default \"> \""));
|
print1opt(_("-Q [str]"), _("--quotestr [str]"), _("Quoting string, default \"> \""));
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_REGEX_H
|
||||||
|
print1opt("-R", "--regexp", _("Do regular expression searches"));
|
||||||
|
#endif
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
print1opt("-S", "--smooth", _("Smooth scrolling"));
|
print1opt("-S", "--smooth", _("Smooth scrolling"));
|
||||||
#endif
|
#endif
|
||||||
|
@ -488,7 +492,6 @@ void usage(void)
|
||||||
print1opt(_("-Y [str]"), _("--syntax [str]"), _("Syntax definition to use"));
|
print1opt(_("-Y [str]"), _("--syntax [str]"), _("Syntax definition to use"));
|
||||||
#endif
|
#endif
|
||||||
print1opt("-c", "--const", _("Constantly show cursor position"));
|
print1opt("-c", "--const", _("Constantly show cursor position"));
|
||||||
print1opt("-h", "--help", _("Show this message"));
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
print1opt("-i", "--autoindent", _("Automatically indent new lines"));
|
print1opt("-i", "--autoindent", _("Automatically indent new lines"));
|
||||||
print1opt("-k", "--cut", _("Let ^K cut from cursor to end of line"));
|
print1opt("-k", "--cut", _("Let ^K cut from cursor to end of line"));
|
||||||
|
@ -503,7 +506,6 @@ void usage(void)
|
||||||
print1opt(_("-o [dir]"), _("--operatingdir=[dir]"), _("Set operating directory"));
|
print1opt(_("-o [dir]"), _("--operatingdir=[dir]"), _("Set operating directory"));
|
||||||
#endif
|
#endif
|
||||||
print1opt("-p", "--pico", _("Emulate Pico as closely as possible"));
|
print1opt("-p", "--pico", _("Emulate Pico as closely as possible"));
|
||||||
|
|
||||||
#ifndef DISABLE_WRAPJUSTIFY
|
#ifndef DISABLE_WRAPJUSTIFY
|
||||||
print1opt(_("-r [#cols]"), _("--fill=[#cols]"), _("Set fill cols to (wrap lines at) #cols"));
|
print1opt(_("-r [#cols]"), _("--fill=[#cols]"), _("Set fill cols to (wrap lines at) #cols"));
|
||||||
#endif
|
#endif
|
||||||
|
@ -2395,7 +2397,7 @@ int do_justify(void)
|
||||||
strcpy(&tmpline->data[j], quotestr);
|
strcpy(&tmpline->data[j], quotestr);
|
||||||
|
|
||||||
/* Skip the white space in current. */
|
/* Skip the white space in current. */
|
||||||
memcpy(&tmpline->data[qdepth], current->data + i + 1, slen-qdepth);
|
memcpy(&tmpline->data[qdepth], current->data + i + 1, slen - qdepth);
|
||||||
tmpline->data[slen] = '\0';
|
tmpline->data[slen] = '\0';
|
||||||
|
|
||||||
current->data = nrealloc(current->data, i + 1);
|
current->data = nrealloc(current->data, i + 1);
|
||||||
|
@ -2700,13 +2702,6 @@ void do_toggle(toggle *which)
|
||||||
char *enabled = _("enabled");
|
char *enabled = _("enabled");
|
||||||
char *disabled = _("disabled");
|
char *disabled = _("disabled");
|
||||||
|
|
||||||
switch (which->val) {
|
|
||||||
case TOGGLE_BACKWARDS_KEY:
|
|
||||||
case TOGGLE_CASE_KEY:
|
|
||||||
case TOGGLE_REGEXP_KEY:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Even easier! */
|
/* Even easier! */
|
||||||
TOGGLE(which->flag);
|
TOGGLE(which->flag);
|
||||||
|
|
||||||
|
@ -2809,49 +2804,49 @@ int main(int argc, char *argv[])
|
||||||
#ifdef HAVE_GETOPT_LONG
|
#ifdef HAVE_GETOPT_LONG
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
struct option long_options[] = {
|
struct option long_options[] = {
|
||||||
|
{"help", 0, 0, 'h'},
|
||||||
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
|
{"multibuffer", 0, 0, 'F'},
|
||||||
|
#endif
|
||||||
|
{"keypad", 0, 0, 'K'},
|
||||||
|
#ifndef DISABLE_JUSTIFY
|
||||||
|
{"quotestr", 1, 0, 'Q'},
|
||||||
|
#endif
|
||||||
#ifdef HAVE_REGEX_H
|
#ifdef HAVE_REGEX_H
|
||||||
{"regexp", 0, 0, 'R'},
|
{"regexp", 0, 0, 'R'},
|
||||||
#endif
|
#endif
|
||||||
|
{"tabsize", 1, 0, 'T'},
|
||||||
{"version", 0, 0, 'V'},
|
{"version", 0, 0, 'V'},
|
||||||
|
#ifdef ENABLE_COLOR
|
||||||
|
{"syntax", 1, 0, 'Y'},
|
||||||
|
#endif
|
||||||
{"const", 0, 0, 'c'},
|
{"const", 0, 0, 'c'},
|
||||||
{"suspend", 0, 0, 'z'},
|
{"nofollow", 0, 0, 'l'},
|
||||||
{"nowrap", 0, 0, 'w'},
|
|
||||||
{"nohelp", 0, 0, 'x'},
|
|
||||||
{"help", 0, 0, 'h'},
|
|
||||||
{"view", 0, 0, 'v'},
|
|
||||||
#ifndef NANO_SMALL
|
|
||||||
{"cut", 0, 0, 'k'},
|
|
||||||
{"dos", 0, 0, 'D'},
|
|
||||||
{"mac", 0, 0, 'M'},
|
|
||||||
{"noconvert", 0, 0, 'N'},
|
|
||||||
{"autoindent", 0, 0, 'i'},
|
|
||||||
#endif
|
|
||||||
{"tempfile", 0, 0, 't'},
|
|
||||||
#ifndef DISABLE_SPELLER
|
|
||||||
{"speller", 1, 0, 's'},
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef DISABLE_WRAPJUSTIFY
|
|
||||||
{"fill", 1, 0, 'r'},
|
|
||||||
#endif
|
|
||||||
{"mouse", 0, 0, 'm'},
|
{"mouse", 0, 0, 'm'},
|
||||||
#ifndef DISABLE_OPERATINGDIR
|
#ifndef DISABLE_OPERATINGDIR
|
||||||
{"operatingdir", 1, 0, 'o'},
|
{"operatingdir", 1, 0, 'o'},
|
||||||
#endif
|
#endif
|
||||||
{"pico", 0, 0, 'p'},
|
{"pico", 0, 0, 'p'},
|
||||||
{"nofollow", 0, 0, 'l'},
|
#ifndef DISABLE_WRAPJUSTIFY
|
||||||
{"tabsize", 1, 0, 'T'},
|
{"fill", 1, 0, 'r'},
|
||||||
|
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
|
||||||
{"multibuffer", 0, 0, 'F'},
|
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef DISABLE_SPELLER
|
||||||
|
{"speller", 1, 0, 's'},
|
||||||
|
#endif
|
||||||
|
{"tempfile", 0, 0, 't'},
|
||||||
|
{"view", 0, 0, 'v'},
|
||||||
|
{"nowrap", 0, 0, 'w'},
|
||||||
|
{"nohelp", 0, 0, 'x'},
|
||||||
|
{"suspend", 0, 0, 'z'},
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
|
{"backup", 0, 0, 'B'},
|
||||||
|
{"dos", 0, 0, 'D'},
|
||||||
|
{"mac", 0, 0, 'M'},
|
||||||
|
{"noconvert", 0, 0, 'N'},
|
||||||
{"smooth", 0, 0, 'S'},
|
{"smooth", 0, 0, 'S'},
|
||||||
|
{"autoindent", 0, 0, 'i'},
|
||||||
|
{"cut", 0, 0, 'k'},
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_COLOR
|
|
||||||
{"syntax", 1, 0, 'Y'},
|
|
||||||
#endif
|
|
||||||
{"keypad", 0, 0, 'K'},
|
|
||||||
{0, 0, 0, 0}
|
{0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -2872,16 +2867,31 @@ int main(int argc, char *argv[])
|
||||||
#endif /* ENABLE_NANORC */
|
#endif /* ENABLE_NANORC */
|
||||||
|
|
||||||
#ifdef HAVE_GETOPT_LONG
|
#ifdef HAVE_GETOPT_LONG
|
||||||
while ((optchr = getopt_long(argc, argv, "h?DFKMNQ:RST:VY:abcefgijklmo:pr:s:tvwxz",
|
while ((optchr = getopt_long(argc, argv, "h?BDFKMNQ:RST:VY:abcefgijklmo:pr:s:tvwxz",
|
||||||
long_options, &option_index)) != EOF) {
|
long_options, &option_index)) != EOF) {
|
||||||
#else
|
#else
|
||||||
while ((optchr =
|
while ((optchr =
|
||||||
getopt(argc, argv, "h?DFKMNQ:RST:VY:abcefgijklmo:pr:s:tvwxz")) != EOF) {
|
getopt(argc, argv, "h?BDFKMNQ:RST:VY:abcefgijklmo:pr:s:tvwxz")) != EOF) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch (optchr) {
|
switch (optchr) {
|
||||||
|
|
||||||
|
case 'h':
|
||||||
|
case '?':
|
||||||
|
usage();
|
||||||
|
exit(0);
|
||||||
|
case 'a':
|
||||||
|
case 'b':
|
||||||
|
case 'e':
|
||||||
|
case 'f':
|
||||||
|
case 'g':
|
||||||
|
case 'j':
|
||||||
|
/* Pico compatibility flags */
|
||||||
|
break;
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
|
case 'B':
|
||||||
|
SET(BACKUP_FILE);
|
||||||
|
break;
|
||||||
case 'D':
|
case 'D':
|
||||||
SET(DOS_FILE);
|
SET(DOS_FILE);
|
||||||
break;
|
break;
|
||||||
|
@ -2935,21 +2945,9 @@ int main(int argc, char *argv[])
|
||||||
syntaxstr = mallocstrcpy(syntaxstr, optarg);
|
syntaxstr = mallocstrcpy(syntaxstr, optarg);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case 'a':
|
|
||||||
case 'b':
|
|
||||||
case 'e':
|
|
||||||
case 'f':
|
|
||||||
case 'g':
|
|
||||||
case 'j':
|
|
||||||
/* Pico compatibility flags */
|
|
||||||
break;
|
|
||||||
case 'c':
|
case 'c':
|
||||||
SET(CONSTUPDATE);
|
SET(CONSTUPDATE);
|
||||||
break;
|
break;
|
||||||
case 'h':
|
|
||||||
case '?':
|
|
||||||
usage();
|
|
||||||
exit(0);
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
case 'i':
|
case 'i':
|
||||||
SET(AUTOINDENT);
|
SET(AUTOINDENT);
|
||||||
|
@ -3026,7 +3024,6 @@ int main(int argc, char *argv[])
|
||||||
usage();
|
usage();
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clear the filename we'll be using */
|
/* Clear the filename we'll be using */
|
||||||
|
|
21
nano.h
21
nano.h
|
@ -36,6 +36,10 @@
|
||||||
#define ISSET(bit) (flags & bit)
|
#define ISSET(bit) (flags & bit)
|
||||||
#define TOGGLE(bit) flags ^= bit
|
#define TOGGLE(bit) flags ^= bit
|
||||||
|
|
||||||
|
#ifndef NANO_SMALL
|
||||||
|
/* For the backup file copy ... */
|
||||||
|
# define COPYFILEBLOCKSIZE 1024
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef USE_SLANG /* Slang support enabled */
|
#ifdef USE_SLANG /* Slang support enabled */
|
||||||
#include <slcurses.h>
|
#include <slcurses.h>
|
||||||
|
@ -50,6 +54,8 @@
|
||||||
#include <libintl.h>
|
#include <libintl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF)
|
#if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF)
|
||||||
|
@ -79,6 +85,9 @@ typedef struct filestruct {
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
typedef struct openfilestruct {
|
typedef struct openfilestruct {
|
||||||
char *filename;
|
char *filename;
|
||||||
|
#ifndef NANO_SMALL
|
||||||
|
struct stat originalfilestat;
|
||||||
|
#endif
|
||||||
struct openfilestruct *next; /* Next node */
|
struct openfilestruct *next; /* Next node */
|
||||||
struct openfilestruct *prev; /* Previous node */
|
struct openfilestruct *prev; /* Previous node */
|
||||||
struct filestruct *fileage; /* Current file */
|
struct filestruct *fileage; /* Current file */
|
||||||
|
@ -190,6 +199,7 @@ typedef struct syntaxtype {
|
||||||
#define DISABLE_CURPOS (1<<24) /* Damn, we still need it */
|
#define DISABLE_CURPOS (1<<24) /* Damn, we still need it */
|
||||||
#define ALT_KEYPAD (1<<25)
|
#define ALT_KEYPAD (1<<25)
|
||||||
#define NO_CONVERT (1<<26)
|
#define NO_CONVERT (1<<26)
|
||||||
|
#define BACKUP_FILE (1<<27)
|
||||||
|
|
||||||
/* Control key sequences, changing these would be very very bad */
|
/* Control key sequences, changing these would be very very bad */
|
||||||
|
|
||||||
|
@ -259,9 +269,7 @@ typedef struct syntaxtype {
|
||||||
#define NANO_ALT_LCARAT '<'
|
#define NANO_ALT_LCARAT '<'
|
||||||
#define NANO_ALT_RCARAT '>'
|
#define NANO_ALT_RCARAT '>'
|
||||||
#define NANO_ALT_BRACKET ']'
|
#define NANO_ALT_BRACKET ']'
|
||||||
#ifndef NANO_SMALL
|
#define NANO_ALT_SPACE ' '
|
||||||
# define NANO_ALT_SPACE ' '
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Some semi-changeable keybindings; don't play with unless you're sure you
|
/* Some semi-changeable keybindings; don't play with unless you're sure you
|
||||||
know what you're doing */
|
know what you're doing */
|
||||||
|
@ -325,10 +333,8 @@ know what you're doing */
|
||||||
#define NANO_OPENNEXT_ALTKEY NANO_ALT_PERIOD
|
#define NANO_OPENNEXT_ALTKEY NANO_ALT_PERIOD
|
||||||
#define NANO_BRACKET_KEY NANO_ALT_BRACKET
|
#define NANO_BRACKET_KEY NANO_ALT_BRACKET
|
||||||
#define NANO_EXTCMD_KEY NANO_CONTROL_X
|
#define NANO_EXTCMD_KEY NANO_CONTROL_X
|
||||||
#ifndef NANO_SMALL
|
#define NANO_NEXTWORD_KEY NANO_CONTROL_SPACE
|
||||||
# define NANO_NEXTWORD_KEY NANO_CONTROL_SPACE
|
#define NANO_PREVWORD_KEY NANO_ALT_SPACE
|
||||||
# define NANO_PREVWORD_KEY NANO_ALT_SPACE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#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
|
||||||
|
@ -346,6 +352,7 @@ know what you're doing */
|
||||||
#define TOGGLE_MAC_KEY NANO_ALT_O
|
#define TOGGLE_MAC_KEY NANO_ALT_O
|
||||||
#define TOGGLE_SMOOTH_KEY NANO_ALT_S
|
#define TOGGLE_SMOOTH_KEY NANO_ALT_S
|
||||||
#define TOGGLE_NOCONVERT_KEY NANO_ALT_N
|
#define TOGGLE_NOCONVERT_KEY NANO_ALT_N
|
||||||
|
#define TOGGLE_BACKUP_KEY NANO_ALT_B
|
||||||
|
|
||||||
#define MAIN_VISIBLE 12
|
#define MAIN_VISIBLE 12
|
||||||
|
|
||||||
|
|
74
nano.texi
74
nano.texi
|
@ -9,7 +9,7 @@
|
||||||
@smallbook
|
@smallbook
|
||||||
@set EDITION 0.1
|
@set EDITION 0.1
|
||||||
@set VERSION 1.1.9
|
@set VERSION 1.1.9
|
||||||
@set UPDATED 4 Jan 2002
|
@set UPDATED 27 Jun 2002
|
||||||
|
|
||||||
@dircategory Editors
|
@dircategory Editors
|
||||||
@direntry
|
@direntry
|
||||||
|
@ -106,13 +106,18 @@ Email bug reports to @email{nano@@nano-editor.org}.
|
||||||
@section Command Line Options
|
@section Command Line Options
|
||||||
|
|
||||||
@code{nano} takes the following options from the command line:
|
@code{nano} takes the following options from the command line:
|
||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
|
|
||||||
|
@item -B, --backup
|
||||||
|
When saving a file, back up the previous version of it to the current
|
||||||
|
filename suffixed with a ~.
|
||||||
|
|
||||||
@item -D, --dos
|
@item -D, --dos
|
||||||
Write file in DOS format.
|
Write file in DOS format.
|
||||||
|
|
||||||
@item -F, --multibuffer
|
@item -F, --multibuffer
|
||||||
Enable multiple file buffers.
|
Enable multiple file buffers, if available.
|
||||||
|
|
||||||
@item -K, --keypad
|
@item -K, --keypad
|
||||||
Do not use the ncurses keypad() call unless necessary. Try this flag if
|
Do not use the ncurses keypad() call unless necessary. Try this flag if
|
||||||
|
@ -140,6 +145,10 @@ Set the displayed tab length to [num] columns.
|
||||||
@item -V, --version
|
@item -V, --version
|
||||||
Print the version number and copyright and quit.
|
Print the version number and copyright and quit.
|
||||||
|
|
||||||
|
@item -Y, --syntax=[str]
|
||||||
|
Specify a specific syntax highlighting from the .nanorc to use, if
|
||||||
|
available.
|
||||||
|
|
||||||
@item -c, --const
|
@item -c, --const
|
||||||
Constantly display the cursor position and line number on the statusbar.
|
Constantly display the cursor position and line number on the statusbar.
|
||||||
|
|
||||||
|
@ -270,22 +279,22 @@ will display the current directory instead of the filename.
|
||||||
@node The Statusbar, Shortcut Lists, The Titlebar, Editor Basics
|
@node The Statusbar, Shortcut Lists, The Titlebar, Editor Basics
|
||||||
@section The Statusbar
|
@section The Statusbar
|
||||||
|
|
||||||
The statusbar is located three lines from the bottom of the screen (or the
|
The statusbar is located three lines from the bottom of the screen (or
|
||||||
bottom line in Expert Mode. @xref{Expert Mode}, for more info.
|
the bottom line in Expert Mode. @xref{Expert Mode}, for more info.
|
||||||
|
|
||||||
The Statusbar shows important and informational messages. Any error
|
The Statusbar shows important and informational messages. Any error
|
||||||
messages that occur from using the editor will appear on the statusbar.
|
messages that occur from using the editor will appear on the statusbar.
|
||||||
Any questions that are asked of the user will be asked on the statusbar,
|
Any questions that are asked of the user will be asked on the statusbar,
|
||||||
and any user input (search strings, file names, etc) will be input on the
|
and any user input (search strings, file names, etc) will be input on
|
||||||
statusbar.
|
the statusbar.
|
||||||
|
|
||||||
@node Shortcut Lists, , The Statusbar, Editor Basics
|
@node Shortcut Lists, , The Statusbar, Editor Basics
|
||||||
@section Shortcut Lists
|
@section Shortcut Lists
|
||||||
|
|
||||||
The Shortcut Lists are the two lines at the bottom of the screen which show
|
The Shortcut Lists are the two lines at the bottom of the screen which
|
||||||
some of the more commonly used functions in the editor. The exact
|
show some of the more commonly used functions in the editor. The exact
|
||||||
functions which are displayed depend on whether Pico Compatibility Mode mode
|
functions which are displayed depend on whether Pico Compatibility Mode
|
||||||
is enabled. @xref{Pico Compatibility}, for more info.
|
mode is enabled. @xref{Pico Compatibility}, for more info.
|
||||||
|
|
||||||
@node Online Help, Feature Toggles, Editor Basics, Top
|
@node Online Help, Feature Toggles, Editor Basics, Top
|
||||||
@chapter Online Help
|
@chapter Online Help
|
||||||
|
@ -302,25 +311,16 @@ and ^V (Page Down) keys. ^X exits the help system.
|
||||||
Toggles allow you to change certain aspects of the editor that
|
Toggles allow you to change certain aspects of the editor that
|
||||||
would normally be done via command line flags. They are invoked via
|
would normally be done via command line flags. They are invoked via
|
||||||
certain Meta key sequenced. @xref{Special Functions}, for more info.
|
certain Meta key sequenced. @xref{Special Functions}, for more info.
|
||||||
The following toggles are available:
|
The following global toggles are available:
|
||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
|
|
||||||
@item Case Sensitive Search Toggle (Meta-A)
|
@item Backup File Toggle (Meta-B)
|
||||||
toggles case sensistive searching functionality on/off.
|
toggles the -B (--backup) command line flag.
|
||||||
|
|
||||||
@item Backwards Search Toggle (Meta-B)
|
|
||||||
toggles backwards searching fuctionality on/off.
|
|
||||||
|
|
||||||
@item Constant Update Toggle (Meta-C)
|
|
||||||
toggles the -c (--const) command line flag.
|
|
||||||
|
|
||||||
@item DOS Format Toggle (Meta-D)
|
@item DOS Format Toggle (Meta-D)
|
||||||
toggles the -D (--dos) command line flag.
|
toggles the -D (--dos) command line flag.
|
||||||
|
|
||||||
@item Regular Expressions Toggle (Meta-E)
|
|
||||||
toggles the -R (--regexp) command line flag.
|
|
||||||
|
|
||||||
@item Multiple Files Toggle (Meta-F)
|
@item Multiple Files Toggle (Meta-F)
|
||||||
toggles the -F (--multibuffer) command line flag.
|
toggles the -F (--multibuffer) command line flag.
|
||||||
|
|
||||||
|
@ -365,21 +365,21 @@ changes buffer to next loaded file.
|
||||||
@chapter The File Browser
|
@chapter The File Browser
|
||||||
|
|
||||||
When reading or writing files, pressing ^T will invoke the file browser.
|
When reading or writing files, pressing ^T will invoke the file browser.
|
||||||
Here, one can navigate directories in a graphical manner in order to find
|
Here, one can navigate directories in a graphical manner in order to
|
||||||
the desired file.
|
find the desired file.
|
||||||
|
|
||||||
Basic movement in the file browser is accomplished with he arrow keys
|
Basic movement in the file browser is accomplished with he arrow keys
|
||||||
and page up/down. The behavior of the enter (or 's') key varies by what
|
and page up/down. The behavior of the enter (or 's') key varies by what
|
||||||
is currently selected. If the currently selected object is a directory,
|
is currently selected. If the currently selected object is a directory,
|
||||||
the file browser will enter and display the contents of the directory. If
|
the file browser will enter and display the contents of the directory.
|
||||||
the object is a file, this filename and path are copied to the statusbar
|
If the object is a file, this filename and path are copied to the
|
||||||
and the file browser is exited.
|
statusbar and the file browser is exited.
|
||||||
|
|
||||||
@node Pico Compatibility, Building and Configure Options, The File Browser, Top
|
@node Pico Compatibility, Building and Configure Options, The File Browser, Top
|
||||||
@chapter Pico Compatibility
|
@chapter Pico Compatibility
|
||||||
|
|
||||||
Nano does not completely emulate Pico by default. The following differences
|
Nano does not completely emulate Pico by default. The following
|
||||||
apply to the default mode and Pico Compatibility mode:
|
differences apply to the default mode and Pico Compatibility mode:
|
||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
@item Displayed Shortcuts
|
@item Displayed Shortcuts
|
||||||
|
@ -466,24 +466,22 @@ Disables all word wrapping in the editor. This also eliminates the
|
||||||
-w command line flag, as nonwrapping is then the default behavior.
|
-w command line flag, as nonwrapping is then the default behavior.
|
||||||
|
|
||||||
@item --disable-mouse
|
@item --disable-mouse
|
||||||
Disables all mouse functionality. This also disables the -m commands line
|
Disables all mouse functionality. This also disables the -m command line
|
||||||
flag which enables the mouse functions.
|
flag which enables the mouse functions.
|
||||||
|
|
||||||
@item --disable-operatingdir
|
@item --disable-operatingdir
|
||||||
Disables setting of operating directory. This also disables the -o command
|
Disables setting of operating directory. This also disables the -o
|
||||||
line flag.
|
command line flag.
|
||||||
|
|
||||||
@item --disable-nls
|
@item --disable-nls
|
||||||
Disables Native Language support. This will make the available GNU nano
|
Disables Native Language support. This will make the available GNU nano
|
||||||
translations unusable.
|
translations unusable.
|
||||||
|
|
||||||
@item --with-slang
|
@item --with-slang
|
||||||
Compiling GNU nano with Slang is supported, and will make the binary notably
|
Compiling GNU nano with Slang is supported, and will make the binary
|
||||||
smaller than if compiled with ncurses or other curses libraries.
|
notably smaller than if compiled with ncurses or other curses libraries.
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@contents
|
@contents
|
||||||
@bye
|
@bye
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,74 +4,73 @@
|
||||||
#
|
#
|
||||||
# To make sure a value is not enabled, use "unset <option>"
|
# To make sure a value is not enabled, use "unset <option>"
|
||||||
|
|
||||||
# Use regular expressions by default
|
# Use auto-indentation
|
||||||
# set regexp
|
# set autoindent
|
||||||
|
|
||||||
|
# Backup files to filename~
|
||||||
|
# set backup
|
||||||
|
|
||||||
# Constantly update the cursor position
|
# Constantly update the cursor position
|
||||||
# set const
|
# set const
|
||||||
|
|
||||||
# Show column position relative to the current line, not the whole file
|
|
||||||
# set relative
|
|
||||||
|
|
||||||
# Use cut to end of line with ^K by default
|
# Use cut to end of line with ^K by default
|
||||||
# set cut
|
# set cut
|
||||||
|
|
||||||
# Use Auto-indentation
|
# Use this value instead of the default
|
||||||
# set autoindent
|
# set fill -8
|
||||||
|
|
||||||
|
# Use alternate keypad routines
|
||||||
|
# set keypad
|
||||||
|
|
||||||
|
# Allow multiple file buffers (using ^R inserts into separate buffer)
|
||||||
|
# You must have configured with --enable-multibuffer or --enable-extra
|
||||||
|
# for this to work
|
||||||
|
#
|
||||||
|
# set multibuffer
|
||||||
|
|
||||||
|
# Don't convert files from DOS/Mac format
|
||||||
|
# set noconvert
|
||||||
|
|
||||||
# Don't follow symlinks when writing files
|
# Don't follow symlinks when writing files
|
||||||
# set nofollow
|
# set nofollow
|
||||||
|
|
||||||
|
# Don't display the help lists at the bottom of the screen
|
||||||
|
# set nohelp
|
||||||
|
|
||||||
|
# Don't wrap text at all
|
||||||
|
# set nowrap
|
||||||
|
|
||||||
# Set operating directory (chroot of sorts)
|
# Set operating directory (chroot of sorts)
|
||||||
# set operatingdir "~"
|
# set operatingdir "~"
|
||||||
|
|
||||||
# Use Pico Compatibility mode for the shortcut lists and search text
|
# Use Pico Compatibility mode for the shortcut lists and search text
|
||||||
# set pico
|
# set pico
|
||||||
|
|
||||||
# Use this value instead of the default
|
# Use this as the quoting string. You shouldn't need to change this,
|
||||||
# set fill -8
|
# but...... default "> "
|
||||||
|
# set quotestr "// "
|
||||||
|
|
||||||
# Use this tab size instead of the default
|
# Do regular expression searches by default
|
||||||
# set tabsize 4
|
# set regexp
|
||||||
|
|
||||||
|
# Use smooth scrolling as the default
|
||||||
|
# set smooth
|
||||||
|
|
||||||
# Use this spelling checker instead of the default one
|
# Use this spelling checker instead of the default one
|
||||||
# set speller aspell
|
# set speller aspell
|
||||||
|
|
||||||
|
# Allow nano to be suspended with ^Z
|
||||||
|
# set suspend
|
||||||
|
|
||||||
|
# Use this tab size instead of the default
|
||||||
|
# set tabsize 4
|
||||||
|
|
||||||
# Save automatically on exit, don't prompt
|
# Save automatically on exit, don't prompt
|
||||||
# set tempfile
|
# set tempfile
|
||||||
|
|
||||||
# Disallow file modification, why would you want this in an rc file? ;)
|
# Disallow file modification, why would you want this in an rc file? ;)
|
||||||
# set view
|
# set view
|
||||||
|
|
||||||
# Don't wrap text at all
|
|
||||||
# set nowrap
|
|
||||||
|
|
||||||
# Don't display the help lists at the bottom of the screen
|
|
||||||
# set nohelp
|
|
||||||
|
|
||||||
# Allow nano to be suspended with ^Z
|
|
||||||
# set suspend
|
|
||||||
|
|
||||||
# Use smooth scrolling as the default
|
|
||||||
# set smooth
|
|
||||||
|
|
||||||
# Use alternate keypad routines
|
|
||||||
# set keypad
|
|
||||||
|
|
||||||
# Don't convert files from DOS/Mac format
|
|
||||||
# set noconvert
|
|
||||||
|
|
||||||
# Allow multiple file buffers (using ^R inserts into separate buffer)
|
|
||||||
# You must have configured with --enable-multibuffer or --enable-extra for
|
|
||||||
# this to work
|
|
||||||
#
|
|
||||||
# set multibuffer
|
|
||||||
|
|
||||||
# Use this as the quoting string. You shouldn't need to change this,
|
|
||||||
# but...... default "> "
|
|
||||||
# set quotestr "// "
|
|
||||||
|
|
||||||
#
|
|
||||||
# Color setup
|
# Color setup
|
||||||
# Format:
|
# Format:
|
||||||
# syntax "short description" ["filename regex" ...]
|
# syntax "short description" ["filename regex" ...]
|
||||||
|
@ -85,7 +84,7 @@
|
||||||
# If your system supports transparency, not specifying a background
|
# If your system supports transparency, not specifying a background
|
||||||
# color will use a transparent color. If you don't want this, be sure
|
# color will use a transparent color. If you don't want this, be sure
|
||||||
# to set the background color to black or white.
|
# to set the background color to black or white.
|
||||||
#
|
|
||||||
# syntax "c-file" ".*\.c" ".*\.h"
|
# syntax "c-file" ".*\.c" ".*\.h"
|
||||||
# color red "\<[A-Z_]\{2,\}\>"
|
# color red "\<[A-Z_]\{2,\}\>"
|
||||||
# color green "\<float\>" "\<char\>" "\<int\>" "\<void\>"
|
# color green "\<float\>" "\<char\>" "\<int\>" "\<void\>"
|
||||||
|
@ -94,14 +93,15 @@
|
||||||
# color brightcyan "#define" "#include" "#ifn*def" "#endif"
|
# color brightcyan "#define" "#include" "#ifn*def" "#endif"
|
||||||
# color brightcyan "#elif" "#else" "#if"
|
# color brightcyan "#elif" "#else" "#if"
|
||||||
|
|
||||||
# You will in general want your comments and strings to come last, becase
|
# You will in general want your comments and strings to come last,
|
||||||
# syntax highlighting rules will be applied in the order they are read in
|
# because syntax highlighting rules will be applied in the order they are
|
||||||
|
# read in
|
||||||
|
|
||||||
# color brightyellow "<[^= ]*>" "\"[^"]*\""
|
# color brightyellow "<[^= ]*>" "\"[^"]*\""
|
||||||
# color brightblue "//.*"
|
# color brightblue "//.*"
|
||||||
# color brightblue start="/\*.*" end="\*/"
|
# color brightblue start="/\*.*" end="\*/"
|
||||||
|
|
||||||
# For this you will probably want to set your editor to "nano -Y mutt"
|
# For this you will probably want to set your editor to "nano -Y mutt"
|
||||||
#
|
|
||||||
# syntax "mutt"
|
# syntax "mutt"
|
||||||
# color green "^>.*"
|
# color green "^>.*"
|
||||||
|
|
1
proto.h
1
proto.h
|
@ -45,6 +45,7 @@ extern char *quotestr;
|
||||||
|
|
||||||
extern WINDOW *edit, *topwin, *bottomwin;
|
extern WINDOW *edit, *topwin, *bottomwin;
|
||||||
extern char *filename;
|
extern char *filename;
|
||||||
|
extern struct stat originalfilestat;
|
||||||
extern char *answer;
|
extern char *answer;
|
||||||
extern char *hblank, *help_text;
|
extern char *hblank, *help_text;
|
||||||
extern char *last_search;
|
extern char *last_search;
|
||||||
|
|
64
rcfile.c
64
rcfile.c
|
@ -44,27 +44,48 @@
|
||||||
|
|
||||||
/* Static stuff for the nanorc file */
|
/* Static stuff for the nanorc file */
|
||||||
rcoption rcopts[] = {
|
rcoption rcopts[] = {
|
||||||
{"regexp", USE_REGEXP},
|
#ifndef NANO_SMALL
|
||||||
{"const", CONSTUPDATE},
|
|
||||||
{"autoindent", AUTOINDENT},
|
{"autoindent", AUTOINDENT},
|
||||||
|
{"backup", BACKUP_FILE},
|
||||||
|
#endif
|
||||||
|
{"const", CONSTUPDATE},
|
||||||
|
#ifndef NANO_SMALL
|
||||||
{"cut", CUT_TO_END},
|
{"cut", CUT_TO_END},
|
||||||
{"nofollow", FOLLOW_SYMLINKS},
|
#endif
|
||||||
{"mouse", USE_MOUSE},
|
|
||||||
{"operatingdir", 0},
|
|
||||||
{"pico", PICO_MODE},
|
|
||||||
{"tabsize", 0},
|
|
||||||
{"fill", 0},
|
{"fill", 0},
|
||||||
|
{"keypad", ALT_KEYPAD},
|
||||||
|
#ifndef DISABLE_MOUSE
|
||||||
|
{"mouse", USE_MOUSE},
|
||||||
|
#endif
|
||||||
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
|
{"multibuffer", MULTIBUFFER},
|
||||||
|
#endif
|
||||||
|
#ifndef NANO_SMALL
|
||||||
|
{"noconvert", NO_CONVERT},
|
||||||
|
#endif
|
||||||
|
{"nofollow", FOLLOW_SYMLINKS},
|
||||||
|
{"nohelp", NO_HELP},
|
||||||
|
{"nowrap", NO_WRAP},
|
||||||
|
#ifndef DISABLE_OPERATINGDIR
|
||||||
|
{"operatingdir", 0},
|
||||||
|
#endif
|
||||||
|
{"pico", PICO_MODE},
|
||||||
|
#ifndef NANO_SMALL
|
||||||
|
{"quotestr", 0},
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_REGEX_H
|
||||||
|
{"regexp", USE_REGEXP},
|
||||||
|
#endif
|
||||||
|
#ifndef NANO_SMALL
|
||||||
|
{"smooth", SMOOTHSCROLL},
|
||||||
|
#endif
|
||||||
|
#ifndef DISABLE_SPELLER
|
||||||
{"speller", 0},
|
{"speller", 0},
|
||||||
|
#endif
|
||||||
|
{"suspend", SUSPEND},
|
||||||
|
{"tabsize", 0},
|
||||||
{"tempfile", TEMP_OPT},
|
{"tempfile", TEMP_OPT},
|
||||||
{"view", VIEW_MODE},
|
{"view", VIEW_MODE},
|
||||||
{"nowrap", NO_WRAP},
|
|
||||||
{"nohelp", NO_HELP},
|
|
||||||
{"suspend", SUSPEND},
|
|
||||||
{"multibuffer", MULTIBUFFER},
|
|
||||||
{"smooth", SMOOTHSCROLL},
|
|
||||||
{"keypad", ALT_KEYPAD},
|
|
||||||
{"noconvert", NO_CONVERT},
|
|
||||||
{"quotestr", 0},
|
|
||||||
{"", 0}
|
{"", 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -144,6 +165,8 @@ char *parse_next_regex(char *ptr)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_COLOR
|
||||||
|
|
||||||
int colortoint(char *colorname, int *bright)
|
int colortoint(char *colorname, int *bright)
|
||||||
{
|
{
|
||||||
int mcolor = 0;
|
int mcolor = 0;
|
||||||
|
@ -183,8 +206,6 @@ int colortoint(char *colorname, int *bright)
|
||||||
return mcolor;
|
return mcolor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef ENABLE_COLOR
|
|
||||||
void parse_syntax(FILE * rcstream, char *buf, char *ptr)
|
void parse_syntax(FILE * rcstream, char *buf, char *ptr)
|
||||||
{
|
{
|
||||||
syntaxtype *tmpsyntax = NULL;
|
syntaxtype *tmpsyntax = NULL;
|
||||||
|
@ -268,8 +289,7 @@ void parse_syntax(FILE * rcstream, char *buf, char *ptr)
|
||||||
exttmp->next->val = mallocstrcpy(exttmp->next->val, fileregptr);
|
exttmp->next->val = mallocstrcpy(exttmp->next->val, fileregptr);
|
||||||
exttmp->next->next = NULL;
|
exttmp->next->next = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse the color stuff into the colorstrings array */
|
/* Parse the color stuff into the colorstrings array */
|
||||||
|
@ -399,7 +419,8 @@ void parse_colors(FILE * rcstream, char *buf, char *ptr)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* ENABLE_COLOR */
|
|
||||||
|
#endif /* ENABLE_COLOR */
|
||||||
|
|
||||||
/* Parse the RC file, once it has been opened successfully */
|
/* Parse the RC file, once it has been opened successfully */
|
||||||
void parse_rcfile(FILE * rcstream)
|
void parse_rcfile(FILE * rcstream)
|
||||||
|
@ -597,5 +618,4 @@ void do_rcfile(void)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* ENABLE_NANORC */
|
||||||
#endif /* ENABLE_NANORC */
|
|
||||||
|
|
18
search.c
18
search.c
|
@ -75,9 +75,6 @@ int search_init(int replacing)
|
||||||
int i = 0;
|
int i = 0;
|
||||||
char *buf;
|
char *buf;
|
||||||
static char *backupstring = NULL;
|
static char *backupstring = NULL;
|
||||||
#ifndef NANO_SMALL
|
|
||||||
toggle *t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
search_init_globals();
|
search_init_globals();
|
||||||
|
|
||||||
|
@ -180,20 +177,19 @@ int search_init(int replacing)
|
||||||
last_replace[0] = '\0';
|
last_replace[0] = '\0';
|
||||||
break;
|
break;
|
||||||
case TOGGLE_CASE_KEY:
|
case TOGGLE_CASE_KEY:
|
||||||
|
TOGGLE(CASE_SENSITIVE);
|
||||||
|
goto string_reinit;
|
||||||
case TOGGLE_BACKWARDS_KEY:
|
case TOGGLE_BACKWARDS_KEY:
|
||||||
|
TOGGLE(REVERSE_SEARCH);
|
||||||
|
goto string_reinit;
|
||||||
#ifdef HAVE_REGEX_H
|
#ifdef HAVE_REGEX_H
|
||||||
case TOGGLE_REGEXP_KEY:
|
case TOGGLE_REGEXP_KEY:
|
||||||
|
TOGGLE(USE_REGEXP);
|
||||||
#endif
|
#endif
|
||||||
|
string_reinit:
|
||||||
free(backupstring);
|
free(backupstring);
|
||||||
backupstring = NULL;
|
backupstring = NULL;
|
||||||
backupstring = mallocstrcpy(backupstring, answer);
|
backupstring = mallocstrcpy(backupstring, answer);
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
|
||||||
for (t = toggles; t != NULL; t = t->next)
|
|
||||||
if (i == t->val)
|
|
||||||
TOGGLE(t->flag);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
case NANO_OTHERSEARCH_KEY:
|
case NANO_OTHERSEARCH_KEY:
|
||||||
backupstring = mallocstrcpy(backupstring, answer);
|
backupstring = mallocstrcpy(backupstring, answer);
|
||||||
|
@ -859,7 +855,7 @@ int do_gotoline_void(void)
|
||||||
return do_gotoline(0, 0);
|
return do_gotoline(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (defined ENABLE_MULTIBUFFER || !defined DISABLE_SPELLER)
|
#if defined(ENABLE_MULTIBUFFER) || !defined(DISABLE_SPELLER)
|
||||||
void do_gotopos(int line, int pos_x, int pos_y, int pos_placewewant)
|
void do_gotopos(int line, int pos_x, int pos_y, int pos_placewewant)
|
||||||
{
|
{
|
||||||
/* since do_gotoline() resets the x-coordinate but not the
|
/* since do_gotoline() resets the x-coordinate but not the
|
||||||
|
|
4
winio.c
4
winio.c
|
@ -1920,7 +1920,7 @@ void dump_buffer(filestruct * inptr)
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
fileptr = fileptr->next;
|
fileptr = fileptr->next;
|
||||||
}
|
}
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
}
|
}
|
||||||
|
|
||||||
void dump_buffer_reverse(filestruct * inptr)
|
void dump_buffer_reverse(filestruct * inptr)
|
||||||
|
@ -1934,7 +1934,7 @@ void dump_buffer_reverse(filestruct * inptr)
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
fileptr = fileptr->prev;
|
fileptr = fileptr->prev;
|
||||||
}
|
}
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fix editbot, based on the assumption that edittop is correct */
|
/* Fix editbot, based on the assumption that edittop is correct */
|
||||||
|
|
Loading…
Reference in New Issue