Compare commits
92 Commits
v1.1.99pre
...
v1.2.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3364214200 | ||
|
|
c30fc242c3 | ||
|
|
66d60099a2 | ||
|
|
f9390afbd1 | ||
|
|
4f5335d93e | ||
|
|
653d614439 | ||
|
|
13f094e80e | ||
|
|
6d97d18fba | ||
|
|
b764eb6663 | ||
|
|
70047eef7d | ||
|
|
d995e9a762 | ||
|
|
9e74ade187 | ||
|
|
a1475aedd2 | ||
|
|
5b63eafd83 | ||
|
|
67fa8935aa | ||
|
|
b111f57082 | ||
|
|
023e9cda99 | ||
|
|
4654cd19bd | ||
|
|
2e6d0ca131 | ||
|
|
d8ce36e6e1 | ||
|
|
cccc511fef | ||
|
|
ffe575f509 | ||
|
|
aa4593124d | ||
|
|
8151ba5a1a | ||
|
|
4b376a4982 | ||
|
|
e1e0fd634b | ||
|
|
0f4a7dc53a | ||
|
|
e2a9e3c5fa | ||
|
|
db469d8666 | ||
|
|
8f711b8d6b | ||
|
|
d845193a1d | ||
|
|
53c3b47bf9 | ||
|
|
23f575628a | ||
|
|
723399a3a2 | ||
|
|
dbc3ec72e1 | ||
|
|
2b4ead9cb8 | ||
|
|
a7a78decb6 | ||
|
|
593a0678b8 | ||
|
|
9658c4cd82 | ||
|
|
e0516f330f | ||
|
|
33ac7b9181 | ||
|
|
1aa8541c5c | ||
|
|
fc71eb5f72 | ||
|
|
07e2000094 | ||
|
|
3d3325129c | ||
|
|
7ba3279073 | ||
|
|
f717f98d07 | ||
|
|
d3c8f09d17 | ||
|
|
1debce2865 | ||
|
|
5acbc8bb0d | ||
|
|
aebfac8567 | ||
|
|
fee360a06f | ||
|
|
4f989faa6e | ||
|
|
2e39c1c283 | ||
|
|
65f075d3a1 | ||
|
|
bcc8688a3b | ||
|
|
d0845df735 | ||
|
|
fe1d0722d4 | ||
|
|
a0449d92a0 | ||
|
|
7641708cb6 | ||
|
|
e9b5c6fe90 | ||
|
|
d127c71ab3 | ||
|
|
b2cd248d1c | ||
|
|
428f620370 | ||
|
|
fdcb9e92d6 | ||
|
|
a4a9d1759f | ||
|
|
d16f9f66a1 | ||
|
|
65f998e429 | ||
|
|
f16ca28efb | ||
|
|
4640fe3f57 | ||
|
|
a90d0cf214 | ||
|
|
f8f2d586dc | ||
|
|
3a78406d56 | ||
|
|
2ddd75e705 | ||
|
|
e61be2dd6d | ||
|
|
992a25a69c | ||
|
|
a66a8f72a4 | ||
|
|
ab5fec61a8 | ||
|
|
97e10b5d0d | ||
|
|
588df68a8c | ||
|
|
bfc8b2ac4d | ||
|
|
bcaeeb4411 | ||
|
|
3cdf6ff1de | ||
|
|
17ec14b9a5 | ||
|
|
a3daf3a256 | ||
|
|
d6e84363d7 | ||
|
|
3083ff908c | ||
|
|
201f1d976a | ||
|
|
5ec68628ce | ||
|
|
5ea694ebd1 | ||
|
|
a577d5a8b8 | ||
|
|
cddbfd0988 |
2
AUTHORS
2
AUTHORS
@@ -8,7 +8,7 @@ Chris Allegretta <chrisa@asty.org>
|
||||
|
||||
Jordi Mallach <jordi@sindominio.net>
|
||||
* Debian package maintainer, fellow bug squasher.
|
||||
* Internationalization support head, es.po maintainer.
|
||||
* Internationalization support head, ca.po maintainer.
|
||||
|
||||
Adam Rogoyski <rogoyski@cs.utexas.edu>
|
||||
* New write_file() function, read_file() optimization, mouse
|
||||
|
||||
265
ChangeLog
265
ChangeLog
@@ -1,5 +1,268 @@
|
||||
GNU nano 1.2.2 - 2003.08.11
|
||||
- General:
|
||||
- Translation updates (see po/ChangeLog for details).
|
||||
- Change uncast nrealloc()s assigned to char pointers/arrays to
|
||||
charealloc()s, and cast all other nrealloc()s and all
|
||||
nmalloc()s. (David Benbennick and DLR)
|
||||
- Remove gettext marks from all debug messages. Good for developers,
|
||||
better for translators. (Jordi)
|
||||
- Add translator comments on strings that should be short, like in
|
||||
status bar strings, etc. (Jordi)
|
||||
- utils.c:
|
||||
align()
|
||||
- Tweak to avoid a potential problem when strp is non-NULL but
|
||||
*strp is NULL. (David Benbennick)
|
||||
nstricmp(), nstrnicmp()
|
||||
- Add these functions, equivalent to strcasecmp() and
|
||||
strncasecmp(), and convert nano to use them when strcasecmp()
|
||||
and/or strncasecmp() are unavailable. (DLR)
|
||||
- winio.c:
|
||||
do_help()
|
||||
- Get rid of keypad_on() call for bottomwin, which should not be
|
||||
needed (DLR).
|
||||
nanogetstr()
|
||||
- Fix problem with search history where a temporary string
|
||||
added at the bottom of the history (but which was not in the
|
||||
history) would not be preserved after scrolling down to the
|
||||
blank bottom entry and then scrolling back up. (DLR)
|
||||
- Fix problem where pressing down,up,down does not blank the
|
||||
search prompt but keeps the previous search (DLR).
|
||||
- Handle Alt-[-F and H (DLR, fixed home and end not working with
|
||||
-K in statusbar).
|
||||
- configure.ac:
|
||||
- Change the program used to detect a broken regexec() function
|
||||
so that it works properly, using information found at
|
||||
http://sources.redhat.com/ml/libc-hacker/2001-06/msg00015.html.
|
||||
(DLR)
|
||||
- nanorc.sample:
|
||||
- Revised comment explaining the non-escaping of quotes to cover
|
||||
non-escaping of all shell-interpreted characters. (DLR)
|
||||
- Fixes to the descriptions and examples in the comments, and
|
||||
changes to some default values. (David Benbennick and DLR)
|
||||
- Add regexes for Perl syntax. (Richard Smith, tweaked for
|
||||
greater efficiency by David Benbennick)
|
||||
- Add regexes for Java source syntax. (David Benbennick)
|
||||
Regex for C++-style comments (colored the same way as C-style
|
||||
comments) added by DLR.
|
||||
- THANKS:
|
||||
- Added Laurentiu Buzdugan, for Romanian.
|
||||
- Added Geir Helland, for Norwegian Bokmål.
|
||||
- TODO:
|
||||
- Move the items for nano 1.2 to the "Old Requests" section,
|
||||
and mark color syntax highlighting as done. (David Benbennick)
|
||||
- faq.html:
|
||||
- Added question about nano's not showing color when it's
|
||||
compiled with color support. (DLR; suggested by Jordi)
|
||||
- nano.1, nanorc.5:
|
||||
- Formatting improvements by Jean-Philippe Guérard.
|
||||
- Minor fixes by DLR.
|
||||
- nano.1.html, nanorc.5.html:
|
||||
- Regenerated from nano.1 and nanorc.5. (DLR)
|
||||
|
||||
GNU nano 1.2.1 - 2003.04.19
|
||||
- General:
|
||||
- Translation updates (see po/ChangeLog for details).
|
||||
- Work around broken regexec() on some systems that segfaults
|
||||
when passed an empty string. New function regexec_safe().
|
||||
(David Benbennick)
|
||||
- Fix various bugs with search string history logging: don't
|
||||
print a broken error message and freeze if ~/.nano_history is
|
||||
unreadable, actually show an error message in save_history()
|
||||
if ~/.nano_history is unwritable, and prevent ~/.nano_history
|
||||
from being completely overwritten by save_history() if it's
|
||||
unreadable but writable. (David Benbennick)
|
||||
- Only unset KEEP_CUTBUFFER in main() when we do something other
|
||||
than cut text in the main input loop, instead of unsetting it
|
||||
all over the place (which, as written, didn't handle cases
|
||||
like a cut followed by M-Space properly). Also, instead of
|
||||
checking for keyhandled's not being set inside the for loops,
|
||||
do it in if blocks surrounding the for loops to increase
|
||||
efficiency. (David Benbennick) DLR: Also unset KEEP_CUTBUFFER
|
||||
if we hit a shortcut key other than the one for cutting text.
|
||||
- Make it so a marked cut immediately followed by an unmarked
|
||||
cut tacks the latter's text onto the end of the former's text
|
||||
instead of putting it on a new line, as Pico does. (DLR)
|
||||
- Convert instances of "(char *)nrealloc()" to the macro
|
||||
charealloc(), which does the same thing. (DLR)
|
||||
- Change justify_mode from a boolean int to a flag (DLR).
|
||||
- cut.c:
|
||||
do_cut_text()
|
||||
- Tweak where KEEP_CUTBUFFER is set so that a marked cut
|
||||
immediately followed by an unmarked cut preserves the
|
||||
cutbuffer between the two. (David Benbennick) DLR: Also
|
||||
properly set KEEP_CUTBUFFER in tiny mode.
|
||||
do_uncut_text()
|
||||
- If we're about to uncut on the magicline, always make a new
|
||||
magicline in advance, as Pico does. (DLR)
|
||||
- global.c:
|
||||
shortcut_init()
|
||||
- Simplify the #ifdef used to enable file insertion in view mode
|
||||
if multibuffer support has been compiled in. (DLR)
|
||||
- nano.c:
|
||||
justify_format()
|
||||
- If we shave spaces off the end of the line, make sure totsize
|
||||
is properly updated. (DLR; much simplified by David
|
||||
Benbennick)
|
||||
- nano.h:
|
||||
- Simplify #ifdefs relating to HAVE_STRCASECMP and
|
||||
HAVE_STRNCASECMP. (David Benbennick)
|
||||
- search.c:
|
||||
goto_abort()
|
||||
- Removed, with all instances replaced with display_main_list(),
|
||||
since with the removal of all the scattered calls to
|
||||
SET(KEEP_CUTBUFFER), that function was all that was left of
|
||||
it. (DLR)
|
||||
do_find_bracket()
|
||||
- If a matching bracket wasn't found, call update_line() after
|
||||
setting current and current_x back to their original values,
|
||||
in case current_x's original value is greater than the width
|
||||
of the screen. (DLR)
|
||||
- winio.c:
|
||||
nanogetstr()
|
||||
- Remove a few unnecessary breaks occurring immediately after
|
||||
gotos, and properly interpret the up and down arrow keys when
|
||||
ALT_KEYPAD is set. (DLR)
|
||||
- configure.ac:
|
||||
- Enable autodetection of broken regexec(). (DLR) Re-added
|
||||
regex.h check to ensure compile under Debian w/autoconf 1.6.
|
||||
- README:
|
||||
- Update obsolete 1.1.x information.
|
||||
- TODO:
|
||||
- Fix typo. (David Benbennick)
|
||||
- faq.html:
|
||||
- Update RPM links for nano 1.2.x. (DLR)
|
||||
|
||||
GNU nano 1.2.0 - 2003.02.19
|
||||
- General:
|
||||
- Translation updates (see po/ChangeLog for details).
|
||||
- files.c:
|
||||
read_file()
|
||||
- If the file we're loading has already been detected as a DOS
|
||||
or Mac formatted file, don't turn on NOCONVERT if we find
|
||||
binary chars in it. This is because if it's detected as
|
||||
DOS/Mac format, at least one line has already been converted,
|
||||
so setting NOCONVERT (which is supposed to signal that none
|
||||
of the file should be converted) makes no sense. (DLR)
|
||||
- nano.c:
|
||||
justify_format()
|
||||
- Fix ugly behavior when wrapping spaces at the end of long
|
||||
words (David Benbennick).
|
||||
- nanorc.5:
|
||||
- Fix formatting error and update copyright year (Jordi).
|
||||
- Several enhancements (David Benbennick).
|
||||
|
||||
GNU nano 1.1.99pre3 - 2003.02.13
|
||||
- General:
|
||||
- Translation updates (see po/ChangeLog for details).
|
||||
- Fix globals and externs such that nano will compile with
|
||||
DISABLE_SPELLER (David Benbennick).
|
||||
- Fix unreasonable fill values by wrapping at length 0 instead
|
||||
of erroring out, and don't start up if the window size is too
|
||||
small but fill is set reasonably. Changes to
|
||||
nano.c:global_init(), window_init(), and handle_sigwinch().
|
||||
New macro MIN_EDITOR_COLS replaces MIN_FILL_LENGTH
|
||||
(David Benbennick).
|
||||
- Change ngettext macro to P_(), to avoid a clash with the
|
||||
reserved C __ identifier (Jordi).
|
||||
- Memory leak fixes for files.c:do_insertfile(),do_browser(),
|
||||
nano.c:do_spell(), and search.c:do_replace() (David
|
||||
Benbennick).
|
||||
- Remove do_preserve_msg, as using -p still gives Pico-style
|
||||
string behavior, so an annoying message every invocation is
|
||||
probably unneeded (all cheer).
|
||||
- Change resetpos function to be global (now called
|
||||
resetstatuspos. Fixes annoying but small odd problem with
|
||||
cursor placement when inserting a file. This needs to be done
|
||||
better in 1.3 (originally by David Lawrence Ramsey). Added
|
||||
this issue to TODO.
|
||||
- files.c:
|
||||
cwd_tab_completion()
|
||||
- Memory leak fix (David Benbennick).
|
||||
intput_tab()
|
||||
- Fix assumption that matches is null terminated (David
|
||||
Benbennick).
|
||||
load_history()
|
||||
- Fix segfault on loading huge strings from history file
|
||||
(David Benbennick).
|
||||
load_history(), save_history()
|
||||
- Changed to look at $HOME before getpwuid(geteuid()), see
|
||||
details in comment for rcfile.c:do_rcfile().
|
||||
real_dir_from_tilde()
|
||||
- Change check for the running user's home dir to use
|
||||
getpwuid(geteuid()) rather than a getpwent() loop
|
||||
(suggested by Jordi).
|
||||
- nano.c:
|
||||
breakable()
|
||||
- Fix incorrect return value on short lines (David Benbennick).
|
||||
do_help()
|
||||
- Fix line lengths not being computed properly, causes display
|
||||
glitches most noticeable with < 20 rows. New function
|
||||
nano.c:line_len(). (David Benbennick).
|
||||
do_justify()
|
||||
- Add regfree() to quote regex (David Benbennick).
|
||||
- Only copy previous indent if AUTOINDENT is set (David
|
||||
Benbennick).
|
||||
do_suspend()
|
||||
- Fix untranslated message (David Benbennick).
|
||||
do_wrap()
|
||||
- Fix isspace() call to operate on int.
|
||||
help_init()
|
||||
- Fix crashing in do_help when COLS < 23 (David Benbennick).
|
||||
main()
|
||||
- Fix nano not compiling with ENABLE_RCFILE and DISABLE_TABCOMP
|
||||
(David Benbennick).
|
||||
- Silence annoying compiler messages about clobbering and
|
||||
uninitialized variables by moving variable inits to the top
|
||||
of main() and re-initializing them after the sigsetjmp().
|
||||
- rcfile.c:
|
||||
colortoint()
|
||||
- Don't bomb after invalid color and print bad color name
|
||||
(David Benbennick).
|
||||
colortoint, parse_colors()
|
||||
- Don't add strings with invalid fg colors at all.
|
||||
do_rcfile()
|
||||
- Revert (somewhat) previous behavior of looking at
|
||||
$HOME, and only run getpw* if it is NULL. Most *nix programs
|
||||
seem to only care about $HOME, and at the user-level
|
||||
getpw* may not be reliable (and its slower).
|
||||
- search.c:
|
||||
do_gotoline()
|
||||
- Only goto_abort() if we *didnt* abort the command, making
|
||||
the function seem horribly misnamed ;-) (David Benbennick).
|
||||
- winio.c:
|
||||
browser_init(), striponedir(), do_browse_from()
|
||||
- Various memory leak fixes (David Benbennick).
|
||||
do_yesno(), do_help()
|
||||
- Add defined(NCURSES_MOUSE_VERSION) to macro so systems that
|
||||
don't understand MEVENT will compile.
|
||||
nanogetstr()
|
||||
- Remove unnecessary reset of x since it is now handled
|
||||
elsewhere (David Lawrence Ramsey).
|
||||
statusq()
|
||||
- Always blank the statusbar on exit (David Benbennick).
|
||||
- nano.1, nano.1.html:
|
||||
- Add initialization file comments, change some options from
|
||||
bracketed to underlined to emphasize that they are not
|
||||
optional.
|
||||
- Add SEE ALSO section (Jordi).
|
||||
- Moved nano.1 color and syntax sections to nanorc, pointed
|
||||
nano.1 to nanorc.5 for initialization file. Changed
|
||||
nanorc.5 variables to be italics to match nano.1. Added
|
||||
nanorc.5.html to CVS tree.
|
||||
- nanorc.5:
|
||||
- Add nanorc manpage, with descriptions of all available commands
|
||||
(Jordi).
|
||||
- nanorc.sample:
|
||||
- Make nanorc entry less tolerant of invalid colors.
|
||||
- nano.spec.in:
|
||||
- Change default flags to --enable-all.
|
||||
- THANKS:
|
||||
- Add Kalle Kivimaa and Kalle Olavi Niemitalo, for Finnish (Jordi).
|
||||
- UPGRADE:
|
||||
- Add upgrading information document for 1.0 users (Jordi).
|
||||
|
||||
GNU nano 1.1.99pre2 - 2003.02.03
|
||||
- General
|
||||
- General:
|
||||
- Changed some translatable debug messages to use %s
|
||||
instead of the function name, and removed gettext from
|
||||
two strings that had no actual words in them that
|
||||
|
||||
@@ -17,16 +17,16 @@ nano_SOURCES = color.c \
|
||||
utils.c \
|
||||
winio.c
|
||||
|
||||
man_MANS = nano.1
|
||||
man_MANS = nano.1 nanorc.5
|
||||
nano_LDADD = @GLIB_LIBS@ @LIBINTL@
|
||||
|
||||
info_TEXINFOS = nano.texi
|
||||
MAKEINFO = makeinfo --no-split
|
||||
|
||||
EXTRA_DIST = ABOUT-NLS AUTHORS BUGS COPYING ChangeLog INSTALL NEWS \
|
||||
README THANKS TODO config.rpath install-sh missing \
|
||||
mkinstalldirs nano.1 nano.1.html faq.html nanorc.sample \
|
||||
nano.spec
|
||||
README THANKS TODO UPGRADE config.rpath install-sh missing \
|
||||
mkinstalldirs nano.1.html nanorc.5.html faq.html \
|
||||
nanorc.sample nano.spec $(man_MANS)
|
||||
|
||||
SUBDIRS = po m4
|
||||
|
||||
|
||||
39
NEWS
39
NEWS
@@ -1,3 +1,42 @@
|
||||
2003.08.11 - GNU nano 1.2.2 is released, only four months since the
|
||||
last version :-). This release includes fixes for
|
||||
broken regex detection, search history recall, and
|
||||
keypad handling with -K. Debugging strings are no
|
||||
longer translated and comments denote where translations
|
||||
should be as short as possible (i.e. the statusbar).
|
||||
There are new examples for syntax highlighting, and
|
||||
documentation updates and fixes. The 1.3.0 CVS
|
||||
tree will be opening soon for all your nano desires, so
|
||||
stay tuned!
|
||||
|
||||
2003.04.19 - Happy Easter! GNU nano 1.2.1 is released. This release
|
||||
features a new check for broken regexec()
|
||||
implementations and some variable, function and macro
|
||||
cleanups. Fixes are included for search history,
|
||||
cutting marked text, alt keyboard mode, and the usual
|
||||
translation and documentation updates.
|
||||
|
||||
2003.02.19 - GNU nano 1.2.0 is released. Few changes from pre3, just
|
||||
some doc and translation updates, and bugfixes for
|
||||
justify and file conversion. For those of you who
|
||||
haven't kept up with the 1.1 unstable series, v1.2
|
||||
brings nanorc support, color syntax highlighting,
|
||||
multiple file buffers, search/replace history and much
|
||||
much more. Please reade the UPGRADE file for details,
|
||||
and enjoy GNU nano 1.2.0.
|
||||
|
||||
2003.02.13 - GNU nano 1.1.99pre3 "The last testing version, no
|
||||
really!" is released. This release includes fixes for
|
||||
wrapping (again), resizing, color syntax highlighting,
|
||||
rcfile parsing, the mouse code, more memory leaks, and
|
||||
some reversion of the code to get the user's home
|
||||
directory (nano will now again rely on $HOME). There
|
||||
are also translation updates, a new manual page for the
|
||||
nanorc file, and an UPGRADE file detailing the changes
|
||||
since version 1.0. Please submit reports for any bugs
|
||||
you might find to the development team
|
||||
(nano-devel@gnu.org), and enjoy nano almost-1.2.0 ;-)
|
||||
|
||||
2003.02.03 - GNU nano 1.1.99pre2 "bugs in my pockets, bugs in my
|
||||
shoes" is released. There are, not suprisingly,
|
||||
only bugfixes in this release as we move toward the
|
||||
|
||||
29
README
29
README
@@ -56,32 +56,9 @@ Mailing List and Bug Reports
|
||||
|
||||
Current Status
|
||||
|
||||
This is the 1.1 or unstable branch of nano. New features
|
||||
will be added and things will be changed around and basically
|
||||
stability is not guaranteed. If this is not what you're
|
||||
interested in, please use the latest 1.0.x release of nano.
|
||||
|
||||
New features in this branch include:
|
||||
+ .nanorc file support (--enable-nanorc configure option,
|
||||
see sample.nanorc file)
|
||||
+ Negative -r value for "#cols from right", allows dynamic adjustment
|
||||
of wrap margin based on window size.
|
||||
+ Write marked text to separate file (^O after selecting with ^^).
|
||||
+ Append to file (Meta-A at write file menu).
|
||||
+ Multiple file buffers! (--enable-multibuffer configure option,
|
||||
--multibuffer, -F cmdline flag, Meta-F toggle, then ^R to load).
|
||||
+ Better compatibility with Pico. Mouse mode now supports clicking
|
||||
shortcuts and files in browser, search toggles that are Pico
|
||||
extensions moved to Meta keys so as to not interfere with Pico
|
||||
control sequences.
|
||||
+ Smooth scrolling through files, instead of the jerky half-page
|
||||
down, half-page up method. This is available by using the
|
||||
-S or --smooth switch, or the Meta-S toggle.
|
||||
+ Better non-*nix file support. GNU nano now automatically
|
||||
converts files from DOS format or Mac format to standard file
|
||||
format. It can also write files in either format by using the
|
||||
appropriate command line (-D, --dos or -M, --mac) or toggle
|
||||
(Meta-D, Meta-O).
|
||||
GNU nano has reaching its second major milestone, 1.2.x. Development
|
||||
of new features will continue in the 1.3.x branch, while 1.2.x
|
||||
versions will be dedicated to bugfixing and polishing.
|
||||
|
||||
Chris Allegretta (chrisa@asty.org)
|
||||
|
||||
|
||||
6
THANKS
6
THANKS
@@ -2,22 +2,26 @@ The following people have helped GNU nano in some way or another.
|
||||
If we missed you here, let us know!
|
||||
|
||||
Sharuzzaman Ahmat Raslan <sharuzzaman@excite.com>
|
||||
Bahasa Melayu translator
|
||||
Malay translator
|
||||
Laurentiu Buzdugan <buzdugan@voyager.net> Romanian translator
|
||||
Ricardo Cárdenes Medina <ricardo@conisys.com> Spanish translator
|
||||
Marco Colombo <magicdice@inwind.it> Italian translator
|
||||
Karl Eichwalder <keichwa@gmx.net> German translator
|
||||
Doruk Fisek <dfisek@fisek.com.tr> Turkish translator
|
||||
Jean-Philippe Guérard <jean-philippe.guerard@laposte.net>
|
||||
French translator
|
||||
Geir Helland Norwegian bokmål translator
|
||||
Tedi Heriyanto <tedi_h@gmx.net> Indonesian translator
|
||||
Václav Haisman <V.Haisman@sh.cvut.cz> Czech translator
|
||||
Szabolcs Horvath <horvaths@janus.gimsz.sulinet.hu>
|
||||
Hungarian translator
|
||||
Kalle Kivimaa <kalle.kivimaa@iki.fi> Finnish Translator
|
||||
Eivind Kjørstad <ekj@vestdata.no> Norwegian nynorsk translator
|
||||
Florian König <floki@bigfoot.com> German translator
|
||||
Wojciech Kotwica <wkotwica@post.pl> Polish translator
|
||||
Clement Laforet <clem_laf@wanadoo.fr> French translator
|
||||
Gergely Nagy <algernon@debian.org> Hungarian translator
|
||||
Kalle Olavi Niemitalo <kon@iki.fi> Finnish Translator
|
||||
Claudio Neves <cneves@nextis.com> Brazilian Portuguese translator
|
||||
Michael Piefel <piefel@informatik.hu-berlin.de> German translator
|
||||
Sergey A. Ribalchenko <fisher@obu.ck.ua> Russian, Ukrainian translator
|
||||
|
||||
36
TODO
36
TODO
@@ -1,33 +1,37 @@
|
||||
TODO file (? means the feature may be implemented, but not definitely)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
For version 1.2:
|
||||
- Single line scroll up/down? [DONE]
|
||||
- Color syntax highlighting? (certainly seems like there's a demand for it.)
|
||||
- .nanorc [DONE]
|
||||
- Backup making (filename~)? [DONE]
|
||||
- Search (etc.) string history [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 global variable pointing to current shortcut list to determine what
|
||||
keystroke to ungetch(). [DONE].
|
||||
- Implement -o (chroot of sorts) [DONE]
|
||||
- Allow -r to take a negative argument, meaning right margin instead of
|
||||
left (allows resizing that way), formerly -W arg. [DONE]
|
||||
|
||||
For version 1.4:
|
||||
- UTF-8 support.
|
||||
- Support for Pico's paragraph searching ability.
|
||||
- Undo/Redo key?
|
||||
- Remindable keys?
|
||||
- Rebindable keys?
|
||||
- Keystroke to implement "Add next sequence as raw" like vi's ^V.
|
||||
- Spell check selected text only.
|
||||
- Make "To line" (^W^T) and "Read from Command" (^R^X) re-enter their
|
||||
parent menu when their keystroke is entered a second time (^W^T^T and
|
||||
(^R^X^X)(requires figuring out when to keep cursor pos and when not to).
|
||||
(^R^X^X)(requires figuring out when to keep cursor pos and when not
|
||||
to).
|
||||
- Fix resetstatuspos global which we shouldn't have.
|
||||
|
||||
Old requests:
|
||||
|
||||
For version 1.2:
|
||||
- Single line scroll up/down? [DONE]
|
||||
- Color syntax highlighting? (certainly seems like there's a demand for
|
||||
it.) [DONE]
|
||||
- .nanorc [DONE]
|
||||
- Backup making (filename~)? [DONE]
|
||||
- Search (etc.) string history [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 global variable pointing to current shortcut list to determine
|
||||
what keystroke to ungetch(). [DONE].
|
||||
- Implement -o (chroot of sorts) [DONE]
|
||||
- Allow -r to take a negative argument, meaning right margin instead of
|
||||
left (allows resizing that way), formerly -W arg. [DONE]
|
||||
|
||||
For version 1.0:
|
||||
- Implement Spelling [DONE]
|
||||
- Implement Help [DONE]
|
||||
|
||||
28
UPGRADE
Normal file
28
UPGRADE
Normal file
@@ -0,0 +1,28 @@
|
||||
GNU nano upgrading information
|
||||
==============================
|
||||
|
||||
Visible changes since 1.0
|
||||
-------------------------
|
||||
* Editor Features
|
||||
- Complete Pico compatibility (--pico has been removed, and -p means
|
||||
something else, see below).
|
||||
- nanorc support (see nanorc.sample included in sources).
|
||||
- Smooth scrolling (-S).
|
||||
- Searching of matching brace/bracket/etc.
|
||||
- Help for all editor features.
|
||||
- Color syntax highlighting support.
|
||||
- Quote string support, useful for mail agents, etc (-Q).
|
||||
- Insertion of output of external commands.
|
||||
- Optional enabling of XON and XOFF control characters (-p).
|
||||
- Tons of bugfixes/enhancements for already existing features.
|
||||
|
||||
* File Handling
|
||||
- Overwriting and appending or prepending to files.
|
||||
- Writing marked text to separate files.
|
||||
- Multiple file buffers (-F).
|
||||
- Converting from and to DOS/Mac file format (-D/-M, -N to disable).
|
||||
- Better control character handling.
|
||||
- Creation of backup files (-B).
|
||||
- Search/replace history (-H).
|
||||
|
||||
See the GNU nano manual for detailed information on each feature.
|
||||
2
color.c
2
color.c
@@ -91,7 +91,7 @@ void do_colorinit(void)
|
||||
init_pair(tmpcolor->pairnum, tmpcolor->fg, background);
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("Running %s with fg = %d and bg = %d\n"),
|
||||
fprintf(stderr, "Running %s with fg = %d and bg = %d\n",
|
||||
"init_pair()", tmpcolor->fg, tmpcolor->bg);
|
||||
#endif
|
||||
}
|
||||
|
||||
15
configure.ac
15
configure.ac
@@ -19,7 +19,7 @@
|
||||
#
|
||||
# $Id$
|
||||
|
||||
AC_INIT([GNU Nano], [1.1.99pre2], [nano-devel@gnu.org], [nano])
|
||||
AC_INIT([GNU Nano], [1.2.2], [nano-devel@gnu.org], [nano])
|
||||
AC_CONFIG_SRCDIR([nano.c])
|
||||
AM_INIT_AUTOMAKE
|
||||
AM_CONFIG_HEADER([config.h:config.h.in])
|
||||
@@ -38,12 +38,22 @@ AM_GNU_GETTEXT([external], [need-ngettext])
|
||||
dnl Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(fcntl.h getopt.h libintl.h limits.h regex.h termio.h termios.h unistd.h)
|
||||
AC_CHECK_HEADER(regex.h,
|
||||
AC_MSG_CHECKING([for broken regexec])
|
||||
AC_TRY_RUN([
|
||||
#include <sys/types.h>
|
||||
#include <regex.h>
|
||||
int main () { regex_t reg; size_t n = 1; regmatch_t r; regcomp(®, "\\<", 0); regexec(®, "", n, &r, 0); regfree(®); return 0; }],
|
||||
AC_MSG_RESULT(no),
|
||||
AC_MSG_RESULT(yes); AC_DEFINE(BROKEN_REGEXEC, 1, [Define this if your regexec() function segfaults when passed an empty string under certain conditions.])
|
||||
)
|
||||
)
|
||||
|
||||
dnl options
|
||||
AC_ARG_ENABLE(debug,
|
||||
[ --enable-debug Enable debugging (disabled by default)],
|
||||
[if test x$enableval = xyes; then
|
||||
AC_DEFINE(DEBUG, 1, [Define this to enable nano debug messages and assert warnings.])
|
||||
AC_DEFINE(DEBUG, 1, [Define this to enable nano debug messages and assert warnings.])
|
||||
debug_support=yes
|
||||
fi])
|
||||
|
||||
@@ -125,7 +135,6 @@ AC_ARG_ENABLE(wrapping-as-root,
|
||||
AC_DEFINE(DISABLE_ROOTWRAP, 1, [Define this to disable wrapping as root by default.])
|
||||
fi])
|
||||
|
||||
|
||||
AC_ARG_ENABLE(color,
|
||||
[ --enable-color Enable color and syntax highlighting],
|
||||
[if test x$enableval = xyes; then
|
||||
|
||||
57
cut.c
57
cut.c
@@ -29,6 +29,12 @@
|
||||
#include "nano.h"
|
||||
|
||||
static int marked_cut; /* Is the cutbuffer from a mark? */
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
static int concatenate_cut; /* Should we add this cut string to the
|
||||
end of the last one? */
|
||||
#endif
|
||||
|
||||
static filestruct *cutbottom = NULL;
|
||||
/* Pointer to end of cutbuffer */
|
||||
|
||||
@@ -40,13 +46,22 @@ filestruct *get_cutbottom(void)
|
||||
void add_to_cutbuffer(filestruct *inptr)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("add_to_cutbuffer() called with inptr->data = %s\n"),
|
||||
fprintf(stderr, "add_to_cutbuffer() called with inptr->data = %s\n",
|
||||
inptr->data);
|
||||
#endif
|
||||
|
||||
if (cutbuffer == NULL) {
|
||||
cutbuffer = inptr;
|
||||
inptr->prev = NULL;
|
||||
#ifndef NANO_SMALL
|
||||
} else if (concatenate_cut && !ISSET(JUSTIFY_MODE)) {
|
||||
/* Just tack the text in inptr onto the text in cutbottom,
|
||||
unless we're backing up lines while justifying text. */
|
||||
cutbottom->data = charealloc(cutbottom->data,
|
||||
strlen(cutbottom->data) + strlen(inptr->data) + 1);
|
||||
strcat(cutbottom->data, inptr->data);
|
||||
return;
|
||||
#endif
|
||||
} else {
|
||||
cutbottom->next = inptr;
|
||||
inptr->prev = cutbottom;
|
||||
@@ -118,15 +133,13 @@ void cut_marked_segment(filestruct *top, size_t top_x, filestruct *bot,
|
||||
move text from the end forward first. */
|
||||
memmove(top->data + top_x, bot->data + bot_x,
|
||||
newsize - top_x);
|
||||
top->data = (char *)nrealloc(top->data,
|
||||
sizeof(char) * newsize);
|
||||
top->data = charealloc(top->data, newsize);
|
||||
} else {
|
||||
totsize -= bot_x + 1;
|
||||
|
||||
/* Here, the remainder line might get longer, so we
|
||||
realloc() it first. */
|
||||
top->data = (char *)nrealloc(top->data,
|
||||
sizeof(char) * newsize);
|
||||
top->data = charealloc(top->data, newsize);
|
||||
memmove(top->data + top_x, bot->data + bot_x,
|
||||
newsize - top_x);
|
||||
}
|
||||
@@ -172,6 +185,9 @@ void cut_marked_segment(filestruct *top, size_t top_x, filestruct *bot,
|
||||
new_magicline();
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
dump_buffer(cutbuffer);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -190,8 +206,11 @@ int do_cut_text(void)
|
||||
free_filestruct(cutbuffer);
|
||||
cutbuffer = NULL;
|
||||
marked_cut = 0;
|
||||
#ifndef NANO_SMALL
|
||||
concatenate_cut = 0;
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("Blew away cutbuffer =)\n"));
|
||||
fprintf(stderr, "Blew away cutbuffer =)\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -204,6 +223,8 @@ int do_cut_text(void)
|
||||
)
|
||||
return 0;
|
||||
|
||||
SET(KEEP_CUTBUFFER);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(CUT_TO_END) && !ISSET(MARK_ISSET)) {
|
||||
assert(current_x >= 0 && current_x <= strlen(current->data));
|
||||
@@ -223,12 +244,10 @@ int do_cut_text(void)
|
||||
}
|
||||
|
||||
do_delete();
|
||||
SET(KEEP_CUTBUFFER);
|
||||
marked_cut = 2;
|
||||
return 1;
|
||||
} else {
|
||||
SET(MARK_ISSET);
|
||||
SET(KEEP_CUTBUFFER);
|
||||
|
||||
mark_beginx = strlen(current->data);
|
||||
mark_beginbuf = current;
|
||||
@@ -249,6 +268,11 @@ int do_cut_text(void)
|
||||
placewewant = xplustabs();
|
||||
UNSET(MARK_ISSET);
|
||||
|
||||
/* If we just did a marked cut of part of a line, we should add
|
||||
the first line of any cut done immediately afterward to the
|
||||
end of this cut, as Pico does. */
|
||||
if (current == mark_beginbuf && current_x < strlen(current->data))
|
||||
concatenate_cut = 1;
|
||||
marked_cut = 1;
|
||||
if (dontupdate)
|
||||
edit_refresh();
|
||||
@@ -283,8 +307,10 @@ int do_cut_text(void)
|
||||
edit_refresh();
|
||||
set_modified();
|
||||
marked_cut = 0;
|
||||
#ifndef NANO_SMALL
|
||||
concatenate_cut = 0;
|
||||
#endif
|
||||
placewewant = 0;
|
||||
SET(KEEP_CUTBUFFER);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -312,6 +338,11 @@ int do_uncut_text(void)
|
||||
placewewant = 0;
|
||||
}
|
||||
|
||||
/* If we're going to uncut on the magicline, always make a new
|
||||
magicline in advance. */
|
||||
if (current->next == NULL)
|
||||
new_magicline();
|
||||
|
||||
if (marked_cut == 0 || cutbuffer->next != NULL)
|
||||
{
|
||||
newbuf = copy_filestruct(cutbuffer);
|
||||
@@ -330,7 +361,7 @@ int do_uncut_text(void)
|
||||
size_t buf_len = strlen(cutbuffer->data);
|
||||
size_t cur_len = strlen(current->data);
|
||||
|
||||
current->data = nrealloc(current->data, cur_len + buf_len + 1);
|
||||
current->data = charealloc(current->data, cur_len + buf_len + 1);
|
||||
memmove(current->data + current_x + buf_len,
|
||||
current->data + current_x, cur_len - current_x + 1);
|
||||
strncpy(current->data + current_x, cutbuffer->data, buf_len);
|
||||
@@ -338,10 +369,6 @@ int do_uncut_text(void)
|
||||
|
||||
current_x += buf_len;
|
||||
totsize += buf_len;
|
||||
/* If we've uncut a line, make sure there's a magicline after
|
||||
it */
|
||||
if (current->next == NULL)
|
||||
new_magicline();
|
||||
|
||||
placewewant = xplustabs();
|
||||
update_cursor();
|
||||
@@ -426,7 +453,6 @@ int do_uncut_text(void)
|
||||
edit_update(current, CENTER);
|
||||
else
|
||||
edit_refresh();
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -464,6 +490,5 @@ int do_uncut_text(void)
|
||||
#endif
|
||||
|
||||
set_modified();
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
return 1;
|
||||
}
|
||||
|
||||
23
faq.html
23
faq.html
@@ -36,9 +36,10 @@
|
||||
<a href="#4.3">4.3. Nano crashes when I resize my window. How can I fix that?</a><br>
|
||||
<a href="#4.4">4.4. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</a><br>
|
||||
<a href="#4.5a">4.5a. [version 1.1.12 and earlier] When I type in a search string, the string I last searched for is already in front of my cursor! What happened?!</a><br>
|
||||
<a href="#4.5b">4.5b. [version 1.2.0 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</a><br>
|
||||
<a href="#4.5b">4.5b. [version 1.2.2 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</a><br>
|
||||
<a href="#4.6">4.6. I get the message "NumLock glitch detected. Keypad will malfunction with NumLock off." What gives?</a><br>
|
||||
<a href="#4.7">4.7. How do I make nano my default editor (in Pine, mutt, etc.)?</a></p></blockquote>
|
||||
<a href="#4.7">4.7. How do I make nano my default editor (in Pine, mutt, etc.)?</a><br>
|
||||
<a href="#4.8">4.8. I've compiled nano with color support, but I don't see any color when I run it!</a></p></blockquote>
|
||||
<h2><a href="#5">5. Internationalization</a></h2>
|
||||
<blockquote><p><a href="#5.1">5.1. There's no translation for my language!</a><br>
|
||||
<a href="#5.2">5.2. I don't like the translation for <x> in my language. How can I fix it?</a></p></blockquote>
|
||||
@@ -77,9 +78,9 @@
|
||||
<h2><a name="1.5"></a>1.5. Why the name change from TIP?</h2>
|
||||
<blockquote><p>On January 10, 2000, TIP was officially renamed to nano because of a namespace conflict with another program called 'tip'. The original 'tip' program "establishes a full duplex terminal connection to a remote host", and was included with many older Unix systems (and newer ones like Solaris). The conflict was not noticed at first because there is no 'tip' utility included with most GNU/Linux distributions (where nano was developed).</p></blockquote>
|
||||
<h2><a name="1.6"></a>1.6. What is the current version of nano?</h2>
|
||||
<blockquote><p>The current version of nano *should* be 1.1.99pre2. Of course you should always check the nano homepage to see what the latest and greatest version is.</p></blockquote>
|
||||
<blockquote><p>The current version of nano *should* be 1.2.2. Of course you should always check the nano homepage to see what the latest and greatest version is.</p></blockquote>
|
||||
<h2><a name="1.7"></a>1.7. I want to read the man page without having to download the program!</h2>
|
||||
<blockquote><p>Jeez, demanding, aren't we? Okay, look <a href="http://www.nano-editor.org/dist/v1.1/nano.1.html">here</a>.</p></blockquote>
|
||||
<blockquote><p>Jeez, demanding, aren't we? Okay, look <a href="http://www.nano-editor.org/dist/v1.2/nano.1.html">here</a>.</p></blockquote>
|
||||
<hr width="100%">
|
||||
<h1><a name="2"></a>2. Where to get GNU nano.</h1>
|
||||
<h2><a name="2.1"></a>2.1. FTP and WWW sites that carry nano.</h2>
|
||||
@@ -93,8 +94,8 @@
|
||||
<h2><a name="2.2"></a>2.2. RedHat and derivatives (.rpm) packages.</h2>
|
||||
<blockquote>
|
||||
<ul>
|
||||
<li><a href="http://www.nano-editor.org/dist/v1.0/RPMS/">http://www.nano-editor.org/dist/v1.0/RPMS/</a></li>
|
||||
<li><a href="http://www.ewtoo.org/~astyanax/nano/dist/v1.0/RPMS/">http://www.ewtoo.org/~astyanax/nano/dist/v1.0/RPMS/</a></li>
|
||||
<li><a href="http://www.nano-editor.org/dist/v1.2/RPMS/">http://www.nano-editor.org/dist/v1.2/RPMS/</a></li>
|
||||
<li><a href="http://www.ewtoo.org/~astyanax/nano/dist/v1.2/RPMS/">http://www.ewtoo.org/~astyanax/nano/dist/v1.2/RPMS/</a></li>
|
||||
</ul>
|
||||
<p>Additionally, check out the RedHat contribs section at:</p>
|
||||
<ul>
|
||||
@@ -175,7 +176,7 @@
|
||||
<a name="4.5"></a>
|
||||
<h2><a name="4.5a"></a>4.5a. [version 1.1.12 and earlier] When I type in a search string, the string I last searched for is already in front of my cursor! What happened?!</h2>
|
||||
<blockquote><p>In nano version 0.9.20, the default is to have a completely consistent user interface across all user input functions. This means that regardless of whether you're being asked for a filename to insert or write, or a string to search for, the previous value is already inserted before the cursor. If you prefer the old behavior, use the Pico emulation mode (-p or --pico) or just hit Meta-P while in nano (see the ^G help text for more details).</p></blockquote>
|
||||
<h2><a name="4.5b"></a>4.5b. [version 1.2.0 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</h2>
|
||||
<h2><a name="4.5b"></a>4.5b. [version 1.2.2 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</h2>
|
||||
<blockquote><p>It was decided that consistency was nice, but people are used to Pico's inconsistent behavior. Also, in version 1.1.99pre1, search and replace history was introduced. If you wish to edit your previous search/replace entry (or any previous entry), you can do so by hitting the up arrow to cycle through your history. This method allows the best of both worlds: You don't need to erase the previous string if you want to enter a new one, but you can with one keystroke recall previous entries for editing. Therefore there is now no "Pico mode", nano is and has always been a Pico <b>clone</b>, and clones by default should be compatible.</p></blockquote>
|
||||
<h2><a name="4.6"></a>4.6. I get the message "NumLock glitch detected. Keypad will malfunction with NumLock off." What gives?</h2>
|
||||
<blockquote><p>Nano (and actually almost all console editors) has issues when cycling the NumLock key in certain X terminals (rxvt, aterm, wterm, etc...). When you switch NumLock from on to off, you put the terminal into an "application mode" that changes what sequences are sent by the keypad. These sequences vary sufficiently from terminal to terminal that it is nearly impossible to work around them from within nano.</p>
|
||||
@@ -193,6 +194,8 @@
|
||||
<p>Mutt users should see an effect immediately the next time you log in, no further configuration is needed. However, if you want to let people know you use nano to compose your email messages, you can put a line like this in your <b>.muttrc</b>:</p>
|
||||
<p><b>my_hdr X-Composer: nano x.y.z</b></p>
|
||||
<p>Again, replace x.y.z with the version of nano you use.</p></blockquote>
|
||||
<h2><a name="4.8"></a>4.8. I've compiled nano with color support, but I don't see any color when I run it!</h2>
|
||||
<blockquote><p>If you want nano to actually use color, you have to specify the color configurations you want it to use in your .nanorc. Some example configurations are in the <b>nanorc.sample</b> that comes with the nano source or your nano package. See Section <a href="#3.8">3.8</a>.</p></blockquote>
|
||||
<hr width="100%">
|
||||
<h1><a name="5"></a>5. Internationalization</h1>
|
||||
<h2><a name="5.1"></a>5.1. There's no translation for my language!</h2>
|
||||
@@ -223,7 +226,7 @@
|
||||
help-nano - <a href="http://mail.gnu.org/mailman/listinfo/help-nano/">http://mail.gnu.org/mailman/listinfo/help-nano/</a><br>
|
||||
nano-devel - <a href="http://mail.gnu.org/mailman/listinfo/nano-devel/">http://mail.gnu.org/mailman/listinfo/nano-devel/</a></p></blockquote>
|
||||
<h2><a name="7.2"></a>7.2. I want to send the development team a big load of cash (or just a thank you).</h2>
|
||||
<blockquote><p>That's fine. Send it <a href="mailto:nano-devel@gnu.org">our way</a>! Better yet, fix a <a href="http://www.nano-editor.org/dist/v1.1/BUGS">bug</a> in the program or implement a <a href="http://www.nano-editor.org/dist/v1.1/TODO">cool feature</a> and send us that instead (though cash is fine too).</p></blockquote>
|
||||
<blockquote><p>That's fine. Send it <a href="mailto:nano-devel@gnu.org">our way</a>! Better yet, fix a <a href="http://www.nano-editor.org/dist/v1.2/BUGS">bug</a> in the program or implement a <a href="http://www.nano-editor.org/dist/v1.2/TODO">cool feature</a> and send us that instead (though cash is fine too).</p></blockquote>
|
||||
<h2><a name="7.3"></a>7.3. How do I submit a patch?</h2>
|
||||
<blockquote><p>See Section <a href="#7.2">7.2</a>.</p></blockquote>
|
||||
<h2><a name="7.4"></a>7.4. How do I join the development team?</h2>
|
||||
@@ -233,7 +236,9 @@
|
||||
<h2><a name="8"></a>8. ChangeLog</h2>
|
||||
<blockquote>
|
||||
<p>
|
||||
2003/01/16 - Split section 4.5 into 4.5a and 4.5b for search string behavior. Added --enable-all docs.<br>
|
||||
2003/07/02 - Added question about nano's not showing color when it's compiled with color support (DLR; suggested by Jordi).<br>
|
||||
2003/02/23 - Updated RPM links for nano 1.2.x. (DLR).<br>
|
||||
2003/01/16 - Split section 4.5 into 4.5a and 4.5b for search string behavior. Added --enable-all docs.<br>
|
||||
2002/12/28 - More misc. fixes (David Benbennick, DLR).<br>
|
||||
2002/10/25 - Misc. fixes and link updates (DLR).<br>
|
||||
2002/09/10 - Another typo fix (DLR).<br>
|
||||
|
||||
163
files.c
163
files.c
@@ -185,9 +185,11 @@ int read_file(FILE *f, const char *filename, int quiet)
|
||||
input = (char)input_int;
|
||||
#ifndef NANO_SMALL
|
||||
/* If the file has binary chars in it, don't stupidly
|
||||
assume it's a DOS or Mac formatted file! */
|
||||
if (!ISSET(NO_CONVERT) && is_cntrl_char((int)input) != 0
|
||||
&& input != '\t' && input != '\r' && input != '\n')
|
||||
assume it's a DOS or Mac formatted file if it hasn't been
|
||||
detected as one already! */
|
||||
if (fileformat == 0 && !ISSET(NO_CONVERT)
|
||||
&& is_cntrl_char((int)input) != 0 && input != '\t'
|
||||
&& input != '\r' && input != '\n')
|
||||
SET(NO_CONVERT);
|
||||
#endif
|
||||
|
||||
@@ -234,7 +236,7 @@ int read_file(FILE *f, const char *filename, int quiet)
|
||||
decrease it at all. We do free it at the end, though. */
|
||||
if (i >= bufx - 1) {
|
||||
bufx += 128;
|
||||
buf = nrealloc(buf, bufx);
|
||||
buf = charealloc(buf, bufx);
|
||||
}
|
||||
buf[i] = input;
|
||||
buf[i + 1] = '\0';
|
||||
@@ -312,16 +314,16 @@ int read_file(FILE *f, const char *filename, int quiet)
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
if (fileformat == 2)
|
||||
statusbar(__("Read %d line (Converted from Mac format)",
|
||||
statusbar(P_("Read %d line (Converted from Mac format)",
|
||||
"Read %d lines (Converted from Mac format)",
|
||||
num_lines), num_lines);
|
||||
else if (fileformat == 1)
|
||||
statusbar(__("Read %d line (Converted from DOS format)",
|
||||
statusbar(P_("Read %d line (Converted from DOS format)",
|
||||
"Read %d lines (Converted from DOS format)",
|
||||
num_lines), num_lines);
|
||||
else
|
||||
#endif
|
||||
statusbar(__("Read %d line", "Read %d lines", num_lines),
|
||||
statusbar(P_("Read %d line", "Read %d lines", num_lines),
|
||||
num_lines);
|
||||
|
||||
totlines += num_lines;
|
||||
@@ -474,7 +476,7 @@ int do_insertfile(int loading_file)
|
||||
if (i != -1) {
|
||||
inspath = mallocstrcpy(inspath, answer);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("filename is %s\n"), answer);
|
||||
fprintf(stderr, "filename is %s\n", answer);
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
@@ -493,7 +495,6 @@ int do_insertfile(int loading_file)
|
||||
_("Command to execute"));
|
||||
if (ts == -1 || answer == NULL || answer[0] == '\0') {
|
||||
statusbar(_("Cancelled"));
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
display_main_list();
|
||||
return 0;
|
||||
}
|
||||
@@ -503,9 +504,11 @@ int do_insertfile(int loading_file)
|
||||
if (i == NANO_TOFILES_KEY) {
|
||||
char *tmp = do_browse_from(answer);
|
||||
|
||||
if (tmp != NULL)
|
||||
if (tmp != NULL) {
|
||||
free(answer);
|
||||
answer = tmp;
|
||||
else
|
||||
resetstatuspos = 1;
|
||||
} else
|
||||
goto start_again;
|
||||
}
|
||||
#endif
|
||||
@@ -614,7 +617,6 @@ int do_insertfile(int loading_file)
|
||||
free(inspath);
|
||||
inspath = NULL;
|
||||
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
display_main_list();
|
||||
return i;
|
||||
}
|
||||
@@ -643,7 +645,7 @@ int do_insertfile_void(void)
|
||||
/* Create a new openfilestruct node. */
|
||||
openfilestruct *make_new_opennode(openfilestruct *prevnode)
|
||||
{
|
||||
openfilestruct *newnode = nmalloc(sizeof(openfilestruct));
|
||||
openfilestruct *newnode = (openfilestruct *)nmalloc(sizeof(openfilestruct));
|
||||
|
||||
newnode->filename = NULL;
|
||||
newnode->fileage = NULL;
|
||||
@@ -699,12 +701,12 @@ void free_openfilestruct(openfilestruct *src)
|
||||
src = src->next;
|
||||
delete_opennode(src->prev);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("%s: free'd a node, YAY!\n"), "delete_opennode()");
|
||||
fprintf(stderr, "%s: free'd a node, YAY!\n", "delete_opennode()");
|
||||
#endif
|
||||
}
|
||||
delete_opennode(src);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("%s: free'd last node.\n"), "delete_opennode()");
|
||||
fprintf(stderr, "%s: free'd last node.\n", "delete_opennode()");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -731,7 +733,7 @@ int add_open_file(int update)
|
||||
open_files and splice it in after the current one */
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("filename is %s\n"), open_files->filename);
|
||||
fprintf(stderr, "filename is %s\n", open_files->filename);
|
||||
#endif
|
||||
|
||||
tmp = make_new_opennode(NULL);
|
||||
@@ -788,7 +790,7 @@ int add_open_file(int update)
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("filename is %s\n"), open_files->filename);
|
||||
fprintf(stderr, "filename is %s\n", open_files->filename);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
@@ -876,7 +878,7 @@ int open_prevfile(int closing_file)
|
||||
open_files = open_files->prev;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("filename is %s\n"), open_files->filename);
|
||||
fprintf(stderr, "filename is %s\n", open_files->filename);
|
||||
#endif
|
||||
|
||||
}
|
||||
@@ -888,7 +890,7 @@ int open_prevfile(int closing_file)
|
||||
open_files = open_files->next;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("filename is %s\n"), open_files->filename);
|
||||
fprintf(stderr, "filename is %s\n", open_files->filename);
|
||||
#endif
|
||||
|
||||
}
|
||||
@@ -939,7 +941,7 @@ int open_nextfile(int closing_file)
|
||||
open_files = open_files->next;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("filename is %s\n"), open_files->filename);
|
||||
fprintf(stderr, "filename is %s\n", open_files->filename);
|
||||
#endif
|
||||
|
||||
}
|
||||
@@ -950,7 +952,7 @@ int open_nextfile(int closing_file)
|
||||
open_files = open_files->prev;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("filename is %s\n"), open_files->filename);
|
||||
fprintf(stderr, "filename is %s\n", open_files->filename);
|
||||
#endif
|
||||
|
||||
}
|
||||
@@ -1036,7 +1038,7 @@ char *get_full_path(const char *origpath)
|
||||
|
||||
align(&d_here);
|
||||
if (strcmp(d_here, "/")) {
|
||||
d_here = nrealloc(d_here, strlen(d_here) + 2);
|
||||
d_here = charealloc(d_here, strlen(d_here) + 2);
|
||||
strcat(d_here, "/");
|
||||
}
|
||||
|
||||
@@ -1058,9 +1060,9 @@ char *get_full_path(const char *origpath)
|
||||
if (path_only) {
|
||||
tmp = d_there[strlen(d_there) - 1];
|
||||
if (tmp != '/') {
|
||||
d_there = nrealloc(d_there, strlen(d_there) + 2);
|
||||
d_there = charealloc(d_there, strlen(d_there) + 2);
|
||||
strcat(d_there, "/");
|
||||
d_there_file = nrealloc(d_there_file, strlen(d_there_file) + 2);
|
||||
d_there_file = charealloc(d_there_file, strlen(d_there_file) + 2);
|
||||
strcat(d_there_file, "/");
|
||||
}
|
||||
}
|
||||
@@ -1108,7 +1110,7 @@ char *get_full_path(const char *origpath)
|
||||
/* add a slash to d_there, unless it's "/", in which
|
||||
case we don't need it */
|
||||
if (strcmp(d_there, "/")) {
|
||||
d_there = nrealloc(d_there, strlen(d_there) + 2);
|
||||
d_there = charealloc(d_there, strlen(d_there) + 2);
|
||||
strcat(d_there, "/");
|
||||
}
|
||||
}
|
||||
@@ -1221,7 +1223,7 @@ char *safe_tempnam(const char *dirname, const char *filename_prefix)
|
||||
strcpy(full_tempdir, "/tmp/");
|
||||
}
|
||||
|
||||
full_tempdir = nrealloc(full_tempdir, strlen(full_tempdir) + 12);
|
||||
full_tempdir = charealloc(full_tempdir, strlen(full_tempdir) + 12);
|
||||
|
||||
/* like tempnam(), use only the first 5 characters of the prefix */
|
||||
strncat(full_tempdir, filename_prefix, 5);
|
||||
@@ -1396,7 +1398,7 @@ int write_file(const char *name, int tmp, int append, int nonamechange)
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("Backing up %s to %s\n"), realname, backupname);
|
||||
fprintf(stderr, "Backing up %s to %s\n", realname, backupname);
|
||||
#endif
|
||||
|
||||
/* copy the file */
|
||||
@@ -1511,7 +1513,7 @@ int write_file(const char *name, int tmp, int append, int nonamechange)
|
||||
}
|
||||
#ifdef DEBUG
|
||||
else
|
||||
fprintf(stderr, _("Wrote >%s\n"), fileptr->data);
|
||||
fprintf(stderr, "Wrote >%s\n", fileptr->data);
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(DOS_FILE) || ISSET(MAC_FILE))
|
||||
@@ -1679,7 +1681,7 @@ int write_file(const char *name, int tmp, int append, int nonamechange)
|
||||
/* Update originalfilestat to reference the file as it is now. */
|
||||
stat(filename, &originalfilestat);
|
||||
#endif
|
||||
statusbar(__("Wrote %d line", "Wrote %d lines", lineswritten),
|
||||
statusbar(P_("Wrote %d line", "Wrote %d lines", lineswritten),
|
||||
lineswritten);
|
||||
UNSET(MODIFIED);
|
||||
titlebar(NULL);
|
||||
@@ -1810,7 +1812,7 @@ int do_writeout(const char *path, int exiting, int append)
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("filename is %s\n"), answer);
|
||||
fprintf(stderr, "filename is %s\n", answer);
|
||||
#endif
|
||||
|
||||
#ifdef NANO_EXTRA
|
||||
@@ -1894,15 +1896,11 @@ char *real_dir_from_tilde(const char *buf)
|
||||
for (i = 1; buf[i] != '/' && buf[i] != '\0'; i++)
|
||||
;
|
||||
|
||||
if (i == 1) {
|
||||
/* Determine home directory using getpwent(), don't rely on
|
||||
$HOME */
|
||||
uid_t euid = geteuid();
|
||||
|
||||
do {
|
||||
userdata = getpwent();
|
||||
} while (userdata != NULL && userdata->pw_uid != euid);
|
||||
} else {
|
||||
/* Determine home directory using getpwuid() or getpwent(),
|
||||
don't rely on $HOME */
|
||||
if (i == 1)
|
||||
userdata = getpwuid(geteuid());
|
||||
else {
|
||||
do {
|
||||
userdata = getpwent();
|
||||
} while (userdata != NULL &&
|
||||
@@ -1972,7 +1970,7 @@ char **username_tab_completion(char *buf, int *num_matches)
|
||||
struct passwd *userdata;
|
||||
|
||||
*num_matches = 0;
|
||||
matches = nmalloc(BUFSIZ * sizeof(char *));
|
||||
matches = (char **)nmalloc(BUFSIZ * sizeof(char *));
|
||||
|
||||
strcat(buf, "*");
|
||||
|
||||
@@ -2019,7 +2017,7 @@ char **cwd_tab_completion(char *buf, int *num_matches)
|
||||
DIR *dir;
|
||||
struct dirent *next;
|
||||
|
||||
matches = nmalloc(BUFSIZ * sizeof(char *));
|
||||
matches = (char **)nmalloc(BUFSIZ * sizeof(char *));
|
||||
|
||||
/* Stick a wildcard onto the buf, for later use */
|
||||
strcat(buf, "*");
|
||||
@@ -2116,6 +2114,8 @@ char **cwd_tab_completion(char *buf, int *num_matches)
|
||||
break;
|
||||
}
|
||||
}
|
||||
closedir(dir);
|
||||
free(dirname);
|
||||
|
||||
return matches;
|
||||
}
|
||||
@@ -2140,8 +2140,8 @@ char *input_tab(char *buf, int place, int *lastwastab, int *newplace, int *list)
|
||||
|
||||
/* Make a local copy of the string -- up to the position of the
|
||||
cursor */
|
||||
matchbuf = (char *)nmalloc((strlen(buf) + 2) * sizeof(char));
|
||||
memset(matchbuf, '\0', (strlen(buf) + 2));
|
||||
matchbuf = charalloc(strlen(buf) + 2);
|
||||
memset(matchbuf, '\0', strlen(buf) + 2);
|
||||
|
||||
strncpy(matchbuf, buf, place);
|
||||
tmp = matchbuf;
|
||||
@@ -2197,7 +2197,7 @@ char *input_tab(char *buf, int place, int *lastwastab, int *newplace, int *list)
|
||||
break;
|
||||
case 1:
|
||||
|
||||
buf = nrealloc(buf, strlen(buf) + strlen(matches[0]) + 1);
|
||||
buf = charealloc(buf, strlen(buf) + strlen(matches[0]) + 1);
|
||||
|
||||
if (buf[0] != '\0' && strstr(buf, "/") != NULL) {
|
||||
for (tmp = buf + strlen(buf); *tmp != '/' && tmp != buf;
|
||||
@@ -2260,7 +2260,7 @@ char *input_tab(char *buf, int place, int *lastwastab, int *newplace, int *list)
|
||||
(i == num_matches || matches[i] != 0)) {
|
||||
/* All the matches have the same character at pos+1,
|
||||
so paste it into buf... */
|
||||
buf = nrealloc(buf, strlen(buf) + 2);
|
||||
buf = charealloc(buf, strlen(buf) + 2);
|
||||
strncat(buf, matches[0] + pos, 1);
|
||||
*newplace += 1;
|
||||
pos++;
|
||||
@@ -2312,7 +2312,7 @@ char *input_tab(char *buf, int place, int *lastwastab, int *newplace, int *list)
|
||||
|
||||
/* And if the next match isn't going to fit on the
|
||||
line, move to the next one */
|
||||
if (col > (COLS - longestname) && matches[i + 1] != NULL) {
|
||||
if (col > COLS - longestname && i + 1 < num_matches) {
|
||||
editline++;
|
||||
wmove(edit, editline, 0);
|
||||
if (editline == editwinrows - 1) {
|
||||
@@ -2393,13 +2393,15 @@ void striponedir(char *foo)
|
||||
{
|
||||
char *tmp;
|
||||
|
||||
assert(foo != NULL);
|
||||
/* Don't strip the root dir */
|
||||
if (!strcmp(foo, "/"))
|
||||
if (*foo == '\0' || strcmp(foo, "/") == 0)
|
||||
return;
|
||||
|
||||
tmp = foo + strlen(foo);
|
||||
tmp = foo + strlen(foo) - 1;
|
||||
assert(tmp >= foo);
|
||||
if (*tmp == '/')
|
||||
tmp--;
|
||||
*tmp = '\0';
|
||||
|
||||
while (*tmp != '/' && tmp != foo)
|
||||
tmp--;
|
||||
@@ -2447,7 +2449,7 @@ char **browser_init(const char *path, int *longest, int *numents)
|
||||
rewinddir(dir);
|
||||
*longest += 10;
|
||||
|
||||
filelist = nmalloc(*numents * sizeof (char *));
|
||||
filelist = (char **)nmalloc(*numents * sizeof (char *));
|
||||
|
||||
if (!strcmp(path, "/"))
|
||||
path = "";
|
||||
@@ -2461,6 +2463,7 @@ char **browser_init(const char *path, int *longest, int *numents)
|
||||
sprintf(filelist[i], "%s/%s", path, next->d_name);
|
||||
i++;
|
||||
}
|
||||
closedir(dir);
|
||||
|
||||
if (*longest > COLS - 1)
|
||||
*longest = COLS - 1;
|
||||
@@ -2716,6 +2719,8 @@ char *do_browser(const char *inpath)
|
||||
}
|
||||
|
||||
/* Start over again with the new path value */
|
||||
free_charptrarray(filelist, numents);
|
||||
free(foo);
|
||||
free(path);
|
||||
path = new_path;
|
||||
return do_browser(path);
|
||||
@@ -2836,8 +2841,10 @@ char *do_browse_from(const char *inpath)
|
||||
|
||||
if (stat(path, &st) == -1 || !S_ISDIR(st.st_mode)) {
|
||||
striponedir(path);
|
||||
if (stat(path, &st) == -1 || !S_ISDIR(st.st_mode))
|
||||
if (stat(path, &st) == -1 || !S_ISDIR(st.st_mode)) {
|
||||
free(path);
|
||||
path = getcwd(NULL, PATH_MAX + 1);
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
@@ -2861,32 +2868,39 @@ char *do_browse_from(const char *inpath)
|
||||
void load_history(void)
|
||||
{
|
||||
FILE *hist;
|
||||
const struct passwd *userage;
|
||||
uid_t euid = geteuid();
|
||||
const struct passwd *userage = NULL;
|
||||
static char *nanohist;
|
||||
char *buf, *ptr;
|
||||
char *homenv = getenv("HOME");
|
||||
historyheadtype *history = &search_history;
|
||||
|
||||
do {
|
||||
userage = getpwent();
|
||||
} while (userage != NULL && userage->pw_uid != euid);
|
||||
endpwent();
|
||||
|
||||
if (homenv != NULL) {
|
||||
nanohist = charealloc(nanohist, strlen(homenv) + 15);
|
||||
sprintf(nanohist, "%s/.nano_history", homenv);
|
||||
} else {
|
||||
userage = getpwuid(geteuid());
|
||||
endpwent();
|
||||
nanohist = charealloc(nanohist, strlen(userage->pw_dir) + 15);
|
||||
sprintf(nanohist, "%s/.nano_history", userage->pw_dir);
|
||||
}
|
||||
|
||||
/* assume do_rcfile has reported missing home dir */
|
||||
|
||||
if (userage != NULL) {
|
||||
nanohist = nrealloc(nanohist, strlen(userage->pw_dir) + 15);
|
||||
sprintf(nanohist, "%s/.nano_history", userage->pw_dir);
|
||||
if (homenv != NULL || userage != NULL) {
|
||||
hist = fopen(nanohist, "r");
|
||||
if (!hist) {
|
||||
if (errno != ENOENT)
|
||||
if (errno != ENOENT) {
|
||||
/* Don't save history when we quit. */
|
||||
UNSET(HISTORYLOG);
|
||||
rcfile_error(_("Unable to open ~/.nano_history file, %s"), strerror(errno));
|
||||
}
|
||||
free(nanohist);
|
||||
} else {
|
||||
buf = charalloc(1024);
|
||||
while (fgets(buf, 1023, hist) != 0) {
|
||||
ptr = buf;
|
||||
while (*ptr != '\n')
|
||||
while (*ptr != '\n' && *ptr != '\0' && ptr < buf + 1023)
|
||||
ptr++;
|
||||
*ptr = '\0';
|
||||
if (strlen(buf))
|
||||
@@ -2906,9 +2920,9 @@ void load_history(void)
|
||||
void save_history(void)
|
||||
{
|
||||
FILE *hist;
|
||||
const struct passwd *userage;
|
||||
uid_t euid = geteuid();
|
||||
const struct passwd *userage = NULL;
|
||||
char *nanohist = NULL;
|
||||
char *homenv = getenv("HOME");
|
||||
historytype *h;
|
||||
|
||||
/* don't save unchanged or empty histories */
|
||||
@@ -2916,14 +2930,17 @@ void save_history(void)
|
||||
ISSET(HISTORY_CHANGED) && !ISSET(VIEW_MODE)))
|
||||
return;
|
||||
|
||||
do {
|
||||
userage = getpwent();
|
||||
} while (userage != NULL && userage->pw_uid != euid);
|
||||
endpwent();
|
||||
|
||||
if (userage != NULL) {
|
||||
nanohist = nrealloc(nanohist, strlen(userage->pw_dir) + 15);
|
||||
if (homenv != NULL) {
|
||||
nanohist = charealloc(nanohist, strlen(homenv) + 15);
|
||||
sprintf(nanohist, "%s/.nano_history", homenv);
|
||||
} else {
|
||||
userage = getpwuid(geteuid());
|
||||
endpwent();
|
||||
nanohist = charealloc(nanohist, strlen(userage->pw_dir) + 15);
|
||||
sprintf(nanohist, "%s/.nano_history", userage->pw_dir);
|
||||
}
|
||||
|
||||
if (homenv != NULL || userage != NULL) {
|
||||
hist = fopen(nanohist, "wb");
|
||||
if (!hist) {
|
||||
rcfile_msg(_("Unable to write ~/.nano_history file, %s"), strerror(errno));
|
||||
@@ -2932,7 +2949,7 @@ void save_history(void)
|
||||
chmod(nanohist, S_IRUSR | S_IWUSR);
|
||||
/* write oldest first */
|
||||
for (h = search_history.tail ; h->prev ; h = h->prev) {
|
||||
h->data = nrealloc(h->data, strlen(h->data) + 2);
|
||||
h->data = charealloc(h->data, strlen(h->data) + 2);
|
||||
strcat(h->data, "\n");
|
||||
if (fputs(h->data, hist) == EOF) {
|
||||
rcfile_msg(_("Unable to write ~/.nano_history file, %s"), strerror(errno));
|
||||
@@ -2944,7 +2961,7 @@ void save_history(void)
|
||||
goto come_from;
|
||||
}
|
||||
for (h = replace_history.tail ; h->prev ; h = h->prev) {
|
||||
h->data = nrealloc(h->data, strlen(h->data) + 2);
|
||||
h->data = charealloc(h->data, strlen(h->data) + 2);
|
||||
strcat(h->data, "\n");
|
||||
if (fputs(h->data, hist) == EOF) {
|
||||
rcfile_msg(_("Unable to write ~/.nano_history file, %s"), strerror(errno));
|
||||
|
||||
60
global.c
60
global.c
@@ -69,6 +69,8 @@ char *quotestr = NULL; /* Quote string. The default value is
|
||||
set in main(). */
|
||||
#endif
|
||||
|
||||
int resetstatuspos; /* Hack for resetting the status bar
|
||||
cursor position */
|
||||
char *answer = NULL; /* Answer str to many questions */
|
||||
int totlines = 0; /* Total number of lines in the file */
|
||||
long totsize = 0; /* Total number of bytes in the file */
|
||||
@@ -105,7 +107,6 @@ shortcut *whereis_list = NULL;
|
||||
shortcut *replace_list = NULL;
|
||||
shortcut *replace_list_2 = NULL; /* 2nd half of replace dialog */
|
||||
shortcut *goto_list = NULL;
|
||||
shortcut *gotodir_list = NULL;
|
||||
shortcut *writefile_list = NULL;
|
||||
shortcut *insertfile_list = NULL;
|
||||
#ifndef DISABLE_HELP
|
||||
@@ -119,7 +120,9 @@ shortcut *extcmd_list = NULL;
|
||||
#endif
|
||||
#ifndef DISABLE_BROWSER
|
||||
shortcut *browser_list = NULL;
|
||||
shortcut *gotodir_list = NULL;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
const colortype *colorstrings = NULL;
|
||||
syntaxtype *syntaxes = NULL;
|
||||
@@ -171,12 +174,12 @@ void sc_init_one(shortcut **shortcutage, int key, const char *desc,
|
||||
shortcut *s;
|
||||
|
||||
if (*shortcutage == NULL) {
|
||||
*shortcutage = nmalloc(sizeof(shortcut));
|
||||
*shortcutage = (shortcut *)nmalloc(sizeof(shortcut));
|
||||
s = *shortcutage;
|
||||
} else {
|
||||
for (s = *shortcutage; s->next != NULL; s = s->next)
|
||||
;
|
||||
s->next = nmalloc(sizeof(shortcut));
|
||||
s->next = (shortcut *)nmalloc(sizeof(shortcut));
|
||||
s = s->next;
|
||||
}
|
||||
|
||||
@@ -201,12 +204,12 @@ void toggle_init_one(int val, const char *desc, int flag)
|
||||
toggle *u;
|
||||
|
||||
if (toggles == NULL) {
|
||||
toggles = nmalloc(sizeof(toggle));
|
||||
toggles = (toggle *)nmalloc(sizeof(toggle));
|
||||
u = toggles;
|
||||
} else {
|
||||
for (u = toggles; u->next != NULL; u = u->next)
|
||||
;
|
||||
u->next = nmalloc(sizeof(toggle));
|
||||
u->next = (toggle *)nmalloc(sizeof(toggle));
|
||||
u = u->next;
|
||||
}
|
||||
|
||||
@@ -411,71 +414,83 @@ void shortcut_init(int unjustify)
|
||||
#else
|
||||
# define IFHELP(help, nextvar) help, nextvar
|
||||
#endif
|
||||
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&main_list, NANO_HELP_KEY, _("Get Help"),
|
||||
IFHELP(nano_help_msg, 0), NANO_HELP_FKEY, 0, VIEW,
|
||||
do_help);
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (open_files != NULL && (open_files->prev != NULL || open_files->next != NULL))
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&main_list, NANO_EXIT_KEY, _("Close"),
|
||||
IFHELP(nano_exit_msg, 0), NANO_EXIT_FKEY, 0, VIEW,
|
||||
do_exit);
|
||||
else
|
||||
#endif
|
||||
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&main_list, NANO_EXIT_KEY, _("Exit"),
|
||||
IFHELP(nano_exit_msg, 0), NANO_EXIT_FKEY, 0, VIEW,
|
||||
do_exit);
|
||||
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&main_list, NANO_WRITEOUT_KEY, _("WriteOut"),
|
||||
IFHELP(nano_writeout_msg, 0),
|
||||
NANO_WRITEOUT_FKEY, 0, NOVIEW, do_writeout_void);
|
||||
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&main_list, NANO_JUSTIFY_KEY, _("Justify"),
|
||||
IFHELP(nano_justify_msg, 0), NANO_JUSTIFY_FKEY, 0,
|
||||
NOVIEW, do_justify);
|
||||
|
||||
/* this is so we can view multiple files */
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&main_list, NANO_INSERTFILE_KEY, _("Read File"),
|
||||
IFHELP(nano_insert_msg, 0), NANO_INSERTFILE_FKEY, 0,
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
/* this is so we can view multiple files */
|
||||
sc_init_one(&main_list, NANO_INSERTFILE_KEY, _("Read File"),
|
||||
IFHELP(nano_insert_msg, 0),
|
||||
NANO_INSERTFILE_FKEY, 0, VIEW, do_insertfile_void);
|
||||
VIEW
|
||||
#else
|
||||
sc_init_one(&main_list, NANO_INSERTFILE_KEY, _("Read File"),
|
||||
IFHELP(nano_insert_msg, 0),
|
||||
NANO_INSERTFILE_FKEY, 0, NOVIEW, do_insertfile_void);
|
||||
NOVIEW
|
||||
#endif
|
||||
, do_insertfile_void);
|
||||
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&main_list, NANO_WHEREIS_KEY, _("Where Is"),
|
||||
IFHELP(nano_whereis_msg, 0),
|
||||
NANO_WHEREIS_FKEY, 0, VIEW, do_search);
|
||||
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&main_list, NANO_PREVPAGE_KEY, _("Prev Page"),
|
||||
IFHELP(nano_prevpage_msg, 0),
|
||||
NANO_PREVPAGE_FKEY, KEY_PPAGE, VIEW, do_page_up);
|
||||
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&main_list, NANO_NEXTPAGE_KEY, _("Next Page"),
|
||||
IFHELP(nano_nextpage_msg, 0),
|
||||
NANO_NEXTPAGE_FKEY, KEY_NPAGE, VIEW, do_page_down);
|
||||
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&main_list, NANO_CUT_KEY, _("Cut Text"),
|
||||
IFHELP(nano_cut_msg, 0),
|
||||
NANO_CUT_FKEY, 0, NOVIEW, do_cut_text);
|
||||
|
||||
if (unjustify)
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&main_list, NANO_UNJUSTIFY_KEY, _("UnJustify"),
|
||||
IFHELP(nano_unjustify_msg, 0),
|
||||
0, 0, NOVIEW, do_uncut_text);
|
||||
else
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&main_list, NANO_UNCUT_KEY, _("UnCut Txt"),
|
||||
IFHELP(nano_uncut_msg, 0),
|
||||
NANO_UNCUT_FKEY, 0, NOVIEW, do_uncut_text);
|
||||
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&main_list, NANO_CURSORPOS_KEY, _("Cur Pos"),
|
||||
IFHELP(nano_cursorpos_msg, 0),
|
||||
NANO_CURSORPOS_FKEY, 0, VIEW, do_cursorpos_void);
|
||||
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&main_list, NANO_SPELL_KEY, _("To Spell"),
|
||||
IFHELP(nano_spell_msg, 0),
|
||||
NANO_SPELL_FKEY, 0, NOVIEW, do_spell);
|
||||
@@ -563,35 +578,44 @@ void shortcut_init(int unjustify)
|
||||
sc_init_one(&whereis_list, NANO_HELP_KEY, _("Get Help"),
|
||||
IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);
|
||||
|
||||
/* Translators: try to keep this string under 12 characters long */
|
||||
sc_init_one(&whereis_list, NANO_CANCEL_KEY, _("Cancel"),
|
||||
IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
|
||||
|
||||
/* Translators: try to keep this string under 12 characters long */
|
||||
sc_init_one(&whereis_list, NANO_FIRSTLINE_KEY, _("First Line"),
|
||||
IFHELP(nano_firstline_msg, 0),
|
||||
0, 0, VIEW, do_first_line);
|
||||
|
||||
/* Translators: try to keep this string under 12 characters long */
|
||||
sc_init_one(&whereis_list, NANO_LASTLINE_KEY, _("Last Line"),
|
||||
IFHELP(nano_lastline_msg, 0), 0, 0, VIEW, do_last_line);
|
||||
|
||||
/* Translators: try to keep this string under 12 characters long */
|
||||
sc_init_one(&whereis_list, NANO_OTHERSEARCH_KEY, _("Replace"),
|
||||
IFHELP(nano_replace_msg, 0), 0, 0, VIEW, do_replace);
|
||||
|
||||
/* Translators: try to keep this string under 12 characters long */
|
||||
sc_init_one(&whereis_list, NANO_FROMSEARCHTOGOTO_KEY, _("Go To Line"),
|
||||
IFHELP(nano_goto_msg, 0), 0, 0, VIEW, do_gotoline_void);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* Translators: try to keep this string under 12 characters long */
|
||||
sc_init_one(&whereis_list, TOGGLE_CASE_KEY, _("Case Sens"),
|
||||
IFHELP(nano_case_msg, 0), 0, 0, VIEW, 0);
|
||||
|
||||
/* Translators: try to keep this string under 12 characters long */
|
||||
sc_init_one(&whereis_list, TOGGLE_BACKWARDS_KEY, _("Direction"),
|
||||
IFHELP(nano_reverse_msg, 0), 0, 0, VIEW, 0);
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
/* Translators: try to keep this string under 12 characters long */
|
||||
sc_init_one(&whereis_list, TOGGLE_REGEXP_KEY, _("Regexp"),
|
||||
IFHELP(nano_regexp_msg, 0), 0, 0, VIEW, 0);
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* Translators: try to keep this string under 12 characters long */
|
||||
sc_init_one(&whereis_list, KEY_UP, _("History"),
|
||||
IFHELP(nano_editstr_msg, 0), NANO_UP_KEY, 0, VIEW, 0);
|
||||
#endif
|
||||
@@ -612,6 +636,7 @@ void shortcut_init(int unjustify)
|
||||
sc_init_one(&replace_list, NANO_LASTLINE_KEY, _("Last Line"),
|
||||
IFHELP(nano_lastline_msg, 0), 0, 0, VIEW, do_last_line);
|
||||
|
||||
/* Translators: try to keep this string under 12 characters long */
|
||||
sc_init_one(&replace_list, NANO_OTHERSEARCH_KEY, _("No Replace"),
|
||||
IFHELP(nano_whereis_msg, 0), 0, 0, VIEW, do_search);
|
||||
|
||||
@@ -689,25 +714,31 @@ void shortcut_init(int unjustify)
|
||||
IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
/* Translators: try to keep this string under 16 characters long */
|
||||
sc_init_one(&writefile_list, NANO_TOFILES_KEY, _("To Files"),
|
||||
IFHELP(nano_tofiles_msg, 0), 0, 0, NOVIEW, 0);
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* Translators: try to keep this string under 16 characters long */
|
||||
sc_init_one(&writefile_list, TOGGLE_DOS_KEY, _("DOS Format"),
|
||||
IFHELP(nano_dos_msg, 0), 0, 0, NOVIEW, 0);
|
||||
|
||||
/* Translators: try to keep this string under 16 characters long */
|
||||
sc_init_one(&writefile_list, TOGGLE_MAC_KEY, _("Mac Format"),
|
||||
IFHELP(nano_mac_msg, 0), 0, 0, NOVIEW, 0);
|
||||
#endif
|
||||
|
||||
/* Translators: try to keep this string under 16 characters long */
|
||||
sc_init_one(&writefile_list, NANO_APPEND_KEY, _("Append"),
|
||||
IFHELP(nano_append_msg, 0), 0, 0, NOVIEW, 0);
|
||||
|
||||
/* Translators: try to keep this string under 16 characters long */
|
||||
sc_init_one(&writefile_list, NANO_PREPEND_KEY, _("Prepend"),
|
||||
IFHELP(nano_prepend_msg, 0), 0, 0, NOVIEW, 0);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* Translators: try to keep this string under 16 characters long */
|
||||
sc_init_one(&writefile_list, TOGGLE_BACKUP_KEY, _("Backup File"),
|
||||
IFHELP(nano_backup_msg, 0), 0, 0, NOVIEW, 0);
|
||||
#endif
|
||||
@@ -728,9 +759,11 @@ void shortcut_init(int unjustify)
|
||||
IFHELP(nano_tofiles_msg, 0), 0, 0, NOVIEW, 0);
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
/* Translators: try to keep this string under 22 characters long */
|
||||
sc_init_one(&insertfile_list, NANO_EXTCMD_KEY, _("Execute Command"),
|
||||
IFHELP(nano_execute_msg, 0), 0, 0, NOVIEW, 0);
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
/* Translators: try to keep this string under 22 characters long */
|
||||
sc_init_one(&insertfile_list, TOGGLE_LOAD_KEY, _("New Buffer"),
|
||||
IFHELP(nano_multibuffer_msg, 0), 0, 0, NOVIEW, 0);
|
||||
#endif
|
||||
@@ -773,6 +806,7 @@ void shortcut_init(int unjustify)
|
||||
IFHELP(nano_nextpage_msg, 0), NANO_NEXTPAGE_FKEY,
|
||||
KEY_NPAGE, VIEW, 0);
|
||||
|
||||
/* Translators: try to keep this string under 22 characters long */
|
||||
sc_init_one(&browser_list, NANO_GOTO_KEY, _("Go To Dir"),
|
||||
IFHELP(nano_gotodir_msg, NANO_ALT_GOTO_KEY),
|
||||
NANO_GOTO_FKEY, 0, VIEW, 0);
|
||||
|
||||
8
move.c
8
move.c
@@ -30,7 +30,6 @@
|
||||
|
||||
int do_home(void)
|
||||
{
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
current_x = 0;
|
||||
placewewant = 0;
|
||||
update_line(current, current_x);
|
||||
@@ -39,7 +38,6 @@ int do_home(void)
|
||||
|
||||
int do_end(void)
|
||||
{
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
current_x = strlen(current->data);
|
||||
placewewant = xplustabs();
|
||||
update_line(current, current_x);
|
||||
@@ -89,7 +87,6 @@ int do_page_up(void)
|
||||
edit_update(current, TOP);
|
||||
update_cursor();
|
||||
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
check_statblank();
|
||||
return 1;
|
||||
}
|
||||
@@ -132,7 +129,6 @@ int do_page_down(void)
|
||||
}
|
||||
|
||||
update_cursor();
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
check_statblank();
|
||||
return 1;
|
||||
}
|
||||
@@ -151,7 +147,6 @@ int do_up(void)
|
||||
update_line(current, current_x);
|
||||
} else
|
||||
page_up();
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
check_statblank();
|
||||
}
|
||||
return 1;
|
||||
@@ -162,7 +157,6 @@ int do_up(void)
|
||||
int do_down(void)
|
||||
{
|
||||
wrap_reset();
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
check_statblank();
|
||||
|
||||
if (current->next == NULL)
|
||||
@@ -207,7 +201,6 @@ int do_left(void)
|
||||
}
|
||||
placewewant = xplustabs();
|
||||
update_line(current, current_x);
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
check_statblank();
|
||||
return 1;
|
||||
}
|
||||
@@ -224,7 +217,6 @@ int do_right(void)
|
||||
}
|
||||
placewewant = xplustabs();
|
||||
update_line(current, current_x);
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
check_statblank();
|
||||
return 1;
|
||||
}
|
||||
|
||||
112
nano.1
112
nano.1
@@ -1,20 +1,23 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.\" nano.1 is copyright 1999-2002 by
|
||||
.\" nano.1 is copyright (C) 1999, 2000, 2001, 2002, 2003 by
|
||||
.\" Chris Allegretta <chrisa@asty.org>
|
||||
.\"
|
||||
.\" This is free documentation, see the latest version of the GNU General
|
||||
.\" Public License for copying conditions. There is NO warranty.
|
||||
.\"
|
||||
.\" $Id$
|
||||
.TH NANO 1 "November 1, 2002"
|
||||
.TH NANO 1 "June 19, 2003"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
|
||||
.SH NAME
|
||||
nano \- Nano's ANOther editor, an enhanced free Pico clone
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B nano
|
||||
.I [\+LINE]\ [options]\ [file]
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
This manual page documents briefly the \fBnano\fP command.
|
||||
.PP
|
||||
@@ -26,6 +29,7 @@ Pico, the default editor included in the non-free Pine package. Rather
|
||||
than just copying Pico's look and feel, \fBnano\fP also implements some
|
||||
missing (or disabled by default) features in Pico, such as "search and
|
||||
replace" and "go to line number".
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \+\fILINE\fP
|
||||
@@ -42,12 +46,17 @@ Write file in DOS format.
|
||||
Enable multiple file buffers, if available.
|
||||
.TP
|
||||
.B \-H (\-\-historylog)
|
||||
Log search and replace strings to ~/.nano_history so they may be
|
||||
stored for later editing, if nanorc support is configured.
|
||||
Log search and replace strings to
|
||||
.I ~/.nano_history
|
||||
so they may be stored for later editing, if nanorc support is
|
||||
configured.
|
||||
.TP
|
||||
.B \-I (\-\-ignorercfiles)
|
||||
Don't look at $SYSCONFDIR/nanorc or ~/.nanorc, if nanorc support is
|
||||
available.
|
||||
Don't look at
|
||||
.I $SYSCONFDIR/nanorc
|
||||
or
|
||||
.IR ~/.nanorc ,
|
||||
if nanorc support is available.
|
||||
.TP
|
||||
.B \-K (\-\-keypad)
|
||||
Do not use the ncurses keypad() call unless necessary. Try this flag if
|
||||
@@ -60,10 +69,10 @@ Write file in Mac format.
|
||||
.B \-N (\-\-noconvert)
|
||||
Disable automatic conversion of files from DOS/Mac format.
|
||||
.TP
|
||||
.B \-Q \fI[str]\fP (\-\-quotestr=\fI[str]\fP)
|
||||
.B \-Q \fIstr\fP (\-\-quotestr=\fIstr\fP)
|
||||
Set the quoting string for justifying. The default is
|
||||
"^([ \\t]*[|>:}#])+" if regular expression support is available, or
|
||||
"> " otherwise.
|
||||
"^([\ \\t]*[|>:}#])+" if regular expression support is available, or
|
||||
">\ " otherwise.
|
||||
.TP
|
||||
.B \-R (\-\-regexp)
|
||||
Enable regular expression matching for search strings, as well as
|
||||
@@ -73,15 +82,16 @@ Enable regular expression matching for search strings, as well as
|
||||
Enable smooth scrolling. Text will scroll line-by-line, instead of the
|
||||
usual chunk-by-chunk behavior.
|
||||
.TP
|
||||
.B \-T \fI[num]\fP (\-\-tabsize=\fI[num]\fP)
|
||||
.B \-T \fInum\fP (\-\-tabsize=\fInum\fP)
|
||||
Set the size (width) of a tab.
|
||||
.TP
|
||||
.B \-V (\-\-version)
|
||||
Show the current version number and author.
|
||||
.TP
|
||||
.B \-Y \fI[str]\fP (\-\-syntax=\fI[str]\fP)
|
||||
Specify a specific syntax highlighting from the .nanorc to use, if
|
||||
available.
|
||||
.B \-Y \fIstr\fP (\-\-syntax=\fIstr\fP)
|
||||
Specify a specific syntax highlighting from the
|
||||
.I .nanorc
|
||||
to use, if available.
|
||||
.TP
|
||||
.B \-c (\-\-const)
|
||||
Constantly show the cursor position.
|
||||
@@ -98,12 +108,14 @@ Enable cut from cursor to end of line with ^K.
|
||||
.TP
|
||||
.B \-l (\-\-nofollow)
|
||||
If the file being edited is a symbolic link, replace the link with
|
||||
a new file, do not follow it. Good for editing files in /tmp, perhaps?
|
||||
a new file, do not follow it. Good for editing files in
|
||||
.IR /tmp ,
|
||||
perhaps?
|
||||
.TP
|
||||
.B \-m (\-\-mouse)
|
||||
Enable mouse support (if available for your system).
|
||||
.TP
|
||||
.B \-o \fI[dir]\fP (\-\-operatingdir=\fI[dir]\fP)
|
||||
.B \-o \fIdir\fP (\-\-operatingdir=\fIdir\fP)
|
||||
Set operating directory. Makes nano set up something similar to a
|
||||
chroot.
|
||||
.TP
|
||||
@@ -111,13 +123,13 @@ chroot.
|
||||
Preserve the XON and XOFF sequences (^Q and ^S) so they will be
|
||||
caught by the terminal.
|
||||
.TP
|
||||
.B \-r \fI[#cols]\fP (\-\-fill=\fI[#cols]\fP)
|
||||
Wrap lines at column #cols. By default, this is the width of the
|
||||
.B \-r \fIcols\fP (\-\-fill=\fIcols\fP)
|
||||
Wrap lines at column \fIcols\fP. By default, this is the width of the
|
||||
screen, less eight. If this value is negative, wrapping will occur at
|
||||
#cols from the right of the screen, allowing it to vary along with the
|
||||
screen width if the screen is resized.
|
||||
\fIcols\fP columns from the right of the screen, allowing the wrap point
|
||||
to vary along with the screen width if resized.
|
||||
.TP
|
||||
.B \-s \fI[prog]\fP (\-\-speller=\fI[prog]\fP)
|
||||
.B \-s \fIprog\fP (\-\-speller=\fIprog\fP)
|
||||
Enable alternative spell checker command.
|
||||
.TP
|
||||
.B \-t (\-\-tempfile)
|
||||
@@ -137,31 +149,57 @@ Enable suspend ability.
|
||||
.TP
|
||||
.B \-a, \-b, \-e, \-f, \-g, \-j
|
||||
Ignored, for compatibility with Pico.
|
||||
|
||||
.SH INITIALIZATION FILE
|
||||
\fBnano\fP will read initialization files in the following
|
||||
order:
|
||||
.IR $SYSCONFDIR/nanorc ,
|
||||
then
|
||||
.IR ~/.nanorc .
|
||||
Please see
|
||||
.BR nanorc (5)
|
||||
and the example file \fBnanorc.sample\fP which should be provided with
|
||||
\fBnano\fP.
|
||||
|
||||
.SH NOTES
|
||||
\fBnano\fP will try to dump the buffer into an emergency file in some
|
||||
cases. Mainly, this will happen if \fBnano\fP receives a SIGHUP or
|
||||
SIGTERM or runs out of memory, when it will write the buffer into a file
|
||||
named "nano.save" if the buffer didn't have a name already, or will add
|
||||
a ".save" suffix to the current filename. If an emergency file with that
|
||||
name already exists 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 multibuffer mode, \fBnano\fP will write all the open buffers
|
||||
to the respective emergency files.
|
||||
named
|
||||
.I nano.save
|
||||
if the buffer didn't have a name already, or will add a ".save" suffix
|
||||
to the current filename. If an emergency file with that name already
|
||||
exists 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
|
||||
multibuffer mode, \fBnano\fP will write all the open buffers to the
|
||||
respective emergency files.
|
||||
|
||||
.SH BUGS
|
||||
Please send any comments or bug reports to
|
||||
.br
|
||||
.B nano@nano-editor.org.
|
||||
.br
|
||||
.BR nano@nano-editor.org .
|
||||
|
||||
The \fBnano\fP mailing list is available from
|
||||
.br
|
||||
.B nano-devel@gnu.org.
|
||||
To subscribe, email to nano-devel-request@gnu.org with a
|
||||
subject of "subscribe".
|
||||
.BR nano-devel@gnu.org .
|
||||
|
||||
To subscribe, email to
|
||||
.B nano-devel-request@gnu.org
|
||||
with a subject of "subscribe".
|
||||
|
||||
.SH HOMEPAGE
|
||||
http://www.nano-editor.org
|
||||
http://www.nano-editor.org/
|
||||
|
||||
.SH SEE ALSO
|
||||
.PD 0
|
||||
.TP
|
||||
\fBnanorc\fP(5)
|
||||
.PP
|
||||
\fI/usr/share/doc/nano/\fP (or equivalent on your system)
|
||||
|
||||
.SH AUTHOR
|
||||
Chris Allegretta <chrisa@asty.org>, et al (see AUTHORS and THANKS for
|
||||
details).
|
||||
This manual page was originally written by Jordi Mallach
|
||||
Chris Allegretta <chrisa@asty.org>, et al (see
|
||||
.I AUTHORS
|
||||
and
|
||||
.I THANKS
|
||||
for details). This manual page was originally written by Jordi Mallach
|
||||
<jordi@sindominio.net>, for the Debian GNU system (but may be
|
||||
used by others).
|
||||
|
||||
149
nano.1.html
149
nano.1.html
@@ -1,17 +1,17 @@
|
||||
Content-type: text/html
|
||||
|
||||
<HTML><HEAD><TITLE>Manpage of NANO</TITLE>
|
||||
</HEAD><BODY>
|
||||
<H1>NANO</H1>
|
||||
Section: User Commands (1)<BR>Updated: November 1, 2002<BR><A HREF="#index">Index</A>
|
||||
Section: User Commands (1)<BR>Updated: June 19, 2003<BR><A HREF="#index">Index</A>
|
||||
<A HREF="http://localhost/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
||||
|
||||
|
||||
|
||||
<P>
|
||||
<A NAME="lbAB"> </A>
|
||||
<H2>NAME</H2>
|
||||
|
||||
nano - Nano's ANOther editor, an enhanced free Pico clone
|
||||
<P>
|
||||
<A NAME="lbAC"> </A>
|
||||
<H2>SYNOPSIS</H2>
|
||||
|
||||
@@ -21,6 +21,7 @@ nano - Nano's ANOther editor, an enhanced free Pico clone
|
||||
|
||||
<BR>
|
||||
|
||||
<P>
|
||||
<A NAME="lbAD"> </A>
|
||||
<H2>DESCRIPTION</H2>
|
||||
|
||||
@@ -35,6 +36,7 @@ Pico, the default editor included in the non-free Pine package. Rather
|
||||
than just copying Pico's look and feel, <B>nano</B> also implements some
|
||||
missing (or disabled by default) features in Pico, such as "search and
|
||||
replace" and "go to line number".
|
||||
<P>
|
||||
<A NAME="lbAE"> </A>
|
||||
<H2>OPTIONS</H2>
|
||||
|
||||
@@ -59,13 +61,21 @@ Enable multiple file buffers, if available.
|
||||
<DT><B>-H (--historylog)</B>
|
||||
|
||||
<DD>
|
||||
Log search and replace strings to ~/.nano_history so they may be
|
||||
stored for later editing, if nanorc support is configured.
|
||||
Log search and replace strings to
|
||||
<I>~/.nano_history</I>
|
||||
|
||||
so they may be stored for later editing, if nanorc support is
|
||||
configured.
|
||||
<DT><B>-I (--ignorercfiles)</B>
|
||||
|
||||
<DD>
|
||||
Don't look at $SYSCONFDIR/nanorc or ~/.nanorc, if nanorc support is
|
||||
available.
|
||||
Don't look at
|
||||
<I>$SYSCONFDIR/nanorc</I>
|
||||
|
||||
or
|
||||
<I>~/.nanorc</I>,
|
||||
|
||||
if nanorc support is available.
|
||||
<DT><B>-K (--keypad)</B>
|
||||
|
||||
<DD>
|
||||
@@ -80,12 +90,12 @@ Write file in Mac format.
|
||||
|
||||
<DD>
|
||||
Disable automatic conversion of files from DOS/Mac format.
|
||||
<DT><B>-Q </B><I>[str]</I> (--quotestr=<I>[str]</I>)
|
||||
<DT><B>-Q </B><I>str</I> (--quotestr=<I>str</I>)
|
||||
|
||||
<DD>
|
||||
Set the quoting string for justifying. The default is
|
||||
"^([ \t]*[|>:}#])+" if regular expression support is available, or
|
||||
"> " otherwise.
|
||||
"^([ \t]*[|>:}#])+" if regular expression support is available, or
|
||||
"> " otherwise.
|
||||
<DT><B>-R (--regexp)</B>
|
||||
|
||||
<DD>
|
||||
@@ -96,7 +106,7 @@ Enable regular expression matching for search strings, as well as
|
||||
<DD>
|
||||
Enable smooth scrolling. Text will scroll line-by-line, instead of the
|
||||
usual chunk-by-chunk behavior.
|
||||
<DT><B>-T </B><I>[num]</I> (--tabsize=<I>[num]</I>)
|
||||
<DT><B>-T </B><I>num</I> (--tabsize=<I>num</I>)
|
||||
|
||||
<DD>
|
||||
Set the size (width) of a tab.
|
||||
@@ -104,11 +114,13 @@ Set the size (width) of a tab.
|
||||
|
||||
<DD>
|
||||
Show the current version number and author.
|
||||
<DT><B>-Y </B><I>[str]</I> (--syntax=<I>[str]</I>)
|
||||
<DT><B>-Y </B><I>str</I> (--syntax=<I>str</I>)
|
||||
|
||||
<DD>
|
||||
Specify a specific syntax highlighting from the .nanorc to use, if
|
||||
available.
|
||||
Specify a specific syntax highlighting from the
|
||||
<I>.nanorc</I>
|
||||
|
||||
to use, if available.
|
||||
<DT><B>-c (--const)</B>
|
||||
|
||||
<DD>
|
||||
@@ -130,12 +142,15 @@ Enable cut from cursor to end of line with ^K.
|
||||
|
||||
<DD>
|
||||
If the file being edited is a symbolic link, replace the link with
|
||||
a new file, do not follow it. Good for editing files in /tmp, perhaps?
|
||||
a new file, do not follow it. Good for editing files in
|
||||
<I>/tmp</I>,
|
||||
|
||||
perhaps?
|
||||
<DT><B>-m (--mouse)</B>
|
||||
|
||||
<DD>
|
||||
Enable mouse support (if available for your system).
|
||||
<DT><B>-o </B><I>[dir]</I> (--operatingdir=<I>[dir]</I>)
|
||||
<DT><B>-o </B><I>dir</I> (--operatingdir=<I>dir</I>)
|
||||
|
||||
<DD>
|
||||
Set operating directory. Makes nano set up something similar to a
|
||||
@@ -145,14 +160,14 @@ chroot.
|
||||
<DD>
|
||||
Preserve the XON and XOFF sequences (^Q and ^S) so they will be
|
||||
caught by the terminal.
|
||||
<DT><B>-r </B><I>[#cols]</I> (--fill=<I>[#cols]</I>)
|
||||
<DT><B>-r </B><I>cols</I> (--fill=<I>cols</I>)
|
||||
|
||||
<DD>
|
||||
Wrap lines at column #cols. By default, this is the width of the
|
||||
Wrap lines at column <I>cols</I>. By default, this is the width of the
|
||||
screen, less eight. If this value is negative, wrapping will occur at
|
||||
#cols from the right of the screen, allowing it to vary along with the
|
||||
screen width if the screen is resized.
|
||||
<DT><B>-s </B><I>[prog]</I> (--speller=<I>[prog]</I>)
|
||||
<I>cols</I> columns from the right of the screen, allowing the wrap point
|
||||
to vary along with the screen width if resized.
|
||||
<DT><B>-s </B><I>prog</I> (--speller=<I>prog</I>)
|
||||
|
||||
<DD>
|
||||
Enable alternative spell checker command.
|
||||
@@ -180,46 +195,82 @@ Enable suspend ability.
|
||||
|
||||
<DD>
|
||||
Ignored, for compatibility with Pico.
|
||||
<P>
|
||||
</DL>
|
||||
<A NAME="lbAF"> </A>
|
||||
<H2>INITIALIZATION FILE</H2>
|
||||
|
||||
<B>nano</B> will read initialization files in the following
|
||||
order:
|
||||
<I>$SYSCONFDIR/nanorc</I>,
|
||||
|
||||
then
|
||||
<I>~/.nanorc</I>.
|
||||
|
||||
Please see
|
||||
<B><A HREF="http://localhost/cgi-bin/man/man2html?5+nanorc">nanorc</A></B>(5)
|
||||
|
||||
and the example file <B>nanorc.sample</B> which should be provided with
|
||||
<B>nano</B>.
|
||||
<P>
|
||||
<A NAME="lbAG"> </A>
|
||||
<H2>NOTES</H2>
|
||||
|
||||
<B>nano</B> will try to dump the buffer into an emergency file in some
|
||||
cases. Mainly, this will happen if <B>nano</B> receives a SIGHUP or
|
||||
SIGTERM or runs out of memory, when it will write the buffer into a file
|
||||
named "nano.save" if the buffer didn't have a name already, or will add
|
||||
a ".save" suffix to the current filename. If an emergency file with that
|
||||
name already exists 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 multibuffer mode, <B>nano</B> will write all the open buffers
|
||||
to the respective emergency files.
|
||||
<A NAME="lbAG"> </A>
|
||||
named
|
||||
<I>nano.save</I>
|
||||
|
||||
if the buffer didn't have a name already, or will add a ".save" suffix
|
||||
to the current filename. If an emergency file with that name already
|
||||
exists 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
|
||||
multibuffer mode, <B>nano</B> will write all the open buffers to the
|
||||
respective emergency files.
|
||||
<P>
|
||||
<A NAME="lbAH"> </A>
|
||||
<H2>BUGS</H2>
|
||||
|
||||
Please send any comments or bug reports to
|
||||
<BR>
|
||||
|
||||
<B><A HREF="mailto:nano@nano-editor.org">nano@nano-editor.org</A>.</B>
|
||||
|
||||
<BR>
|
||||
<B><A HREF="mailto:nano@nano-editor.org">nano@nano-editor.org</A></B>.
|
||||
|
||||
<P>
|
||||
The <B>nano</B> mailing list is available from
|
||||
<BR>
|
||||
<B><A HREF="mailto:nano-devel@gnu.org">nano-devel@gnu.org</A></B>.
|
||||
|
||||
<B><A HREF="mailto:nano-devel@gnu.org">nano-devel@gnu.org</A>.</B>
|
||||
<P>
|
||||
To subscribe, email to
|
||||
<B><A HREF="mailto:nano-devel-request@gnu.org">nano-devel-request@gnu.org</A></B>
|
||||
|
||||
To subscribe, email to <A HREF="mailto:nano-devel-request@gnu.org">nano-devel-request@gnu.org</A> with a
|
||||
subject of "subscribe".
|
||||
<A NAME="lbAH"> </A>
|
||||
with a subject of "subscribe".
|
||||
<P>
|
||||
<A NAME="lbAI"> </A>
|
||||
<H2>HOMEPAGE</H2>
|
||||
|
||||
<A HREF="http://www.nano-editor.org">http://www.nano-editor.org</A>
|
||||
<A NAME="lbAI"> </A>
|
||||
<A HREF="http://www.nano-editor.org/">http://www.nano-editor.org/</A>
|
||||
<P>
|
||||
<A NAME="lbAJ"> </A>
|
||||
<H2>SEE ALSO</H2>
|
||||
|
||||
|
||||
<DL COMPACT>
|
||||
<DT><B><A HREF="http://localhost/cgi-bin/man/man2html?5+nanorc">nanorc</A></B>(5)<DD>
|
||||
</DL>
|
||||
<P>
|
||||
|
||||
<I>/usr/share/doc/nano/</I> (or equivalent on your system)
|
||||
<P>
|
||||
<A NAME="lbAK"> </A>
|
||||
<H2>AUTHOR</H2>
|
||||
|
||||
Chris Allegretta <<A HREF="mailto:chrisa@asty.org">chrisa@asty.org</A>>, et al (see AUTHORS and THANKS for
|
||||
details).
|
||||
This manual page was originally written by Jordi Mallach
|
||||
Chris Allegretta <<A HREF="mailto:chrisa@asty.org">chrisa@asty.org</A>>, et al (see
|
||||
<I>AUTHORS</I>
|
||||
|
||||
and
|
||||
<I>THANKS</I>
|
||||
|
||||
for details). This manual page was originally written by Jordi Mallach
|
||||
<<A HREF="mailto:jordi@sindominio.net">jordi@sindominio.net</A>>, for the Debian GNU system (but may be
|
||||
used by others).
|
||||
<P>
|
||||
@@ -231,15 +282,17 @@ used by others).
|
||||
<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
|
||||
<DT><A HREF="#lbAD">DESCRIPTION</A><DD>
|
||||
<DT><A HREF="#lbAE">OPTIONS</A><DD>
|
||||
<DT><A HREF="#lbAF">NOTES</A><DD>
|
||||
<DT><A HREF="#lbAG">BUGS</A><DD>
|
||||
<DT><A HREF="#lbAH">HOMEPAGE</A><DD>
|
||||
<DT><A HREF="#lbAI">AUTHOR</A><DD>
|
||||
<DT><A HREF="#lbAF">INITIALIZATION FILE</A><DD>
|
||||
<DT><A HREF="#lbAG">NOTES</A><DD>
|
||||
<DT><A HREF="#lbAH">BUGS</A><DD>
|
||||
<DT><A HREF="#lbAI">HOMEPAGE</A><DD>
|
||||
<DT><A HREF="#lbAJ">SEE ALSO</A><DD>
|
||||
<DT><A HREF="#lbAK">AUTHOR</A><DD>
|
||||
</DL>
|
||||
<HR>
|
||||
This document was created by
|
||||
<A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>,
|
||||
using the manual pages.<BR>
|
||||
Time: 03:06:20 GMT, January 17, 2003
|
||||
Time: 22:27:55 GMT, June 19, 2003
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
298
nano.c
298
nano.c
@@ -66,18 +66,6 @@ static sigjmp_buf jmpbuf; /* Used to return to mainloop after SIGWINCH */
|
||||
/* What we do when we're all set to exit */
|
||||
RETSIGTYPE finish(int sigage)
|
||||
{
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifdef ENABLE_NANORC
|
||||
/* do here so errors about ./nano_history
|
||||
don't confuse user */
|
||||
if (!ISSET(NO_RCFILE) && ISSET(HISTORYLOG))
|
||||
save_history();
|
||||
#endif
|
||||
free_history(&search_history);
|
||||
free_history(&replace_history);
|
||||
#endif
|
||||
|
||||
keypad(edit, TRUE);
|
||||
keypad(bottomwin, TRUE);
|
||||
|
||||
@@ -93,6 +81,11 @@ RETSIGTYPE finish(int sigage)
|
||||
/* Restore the old term settings */
|
||||
tcsetattr(0, TCSANOW, &oldterm);
|
||||
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
if (!ISSET(NO_RCFILE) && ISSET(HISTORYLOG))
|
||||
save_history();
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
thanks_for_all_the_fish();
|
||||
#endif
|
||||
@@ -199,7 +192,8 @@ void global_init(int save_cutbuffer)
|
||||
current_x = 0;
|
||||
current_y = 0;
|
||||
|
||||
if ((editwinrows = LINES - 5 + no_help()) < MIN_EDITOR_ROWS)
|
||||
editwinrows = LINES - 5 + no_help();
|
||||
if (editwinrows < MIN_EDITOR_ROWS || COLS < MIN_EDITOR_COLS)
|
||||
die_too_small();
|
||||
|
||||
fileage = NULL;
|
||||
@@ -216,8 +210,8 @@ void global_init(int save_cutbuffer)
|
||||
fill = wrap_at;
|
||||
if (fill <= 0)
|
||||
fill += COLS;
|
||||
if (fill < MIN_FILL_LENGTH)
|
||||
die_too_small();
|
||||
if (fill < 0)
|
||||
fill = 0;
|
||||
#endif
|
||||
|
||||
hblank = charalloc(COLS + 1);
|
||||
@@ -227,7 +221,8 @@ void global_init(int save_cutbuffer)
|
||||
|
||||
void window_init(void)
|
||||
{
|
||||
if ((editwinrows = LINES - 5 + no_help()) < MIN_EDITOR_ROWS)
|
||||
editwinrows = LINES - 5 + no_help();
|
||||
if (editwinrows < MIN_EDITOR_ROWS)
|
||||
die_too_small();
|
||||
|
||||
if (edit != NULL)
|
||||
@@ -341,6 +336,7 @@ void help_init(void)
|
||||
"complete the directory name.\n\n The following function "
|
||||
"keys are available in Browser Go To Directory mode:\n\n");
|
||||
#endif
|
||||
#ifndef DISABLE_SPELLER
|
||||
else if (currshortcut == spell_list)
|
||||
ptr = _("Spell Check Help Text\n\n "
|
||||
"The spell checker checks the spelling of all text "
|
||||
@@ -350,6 +346,7 @@ void help_init(void)
|
||||
"instance of the given misspelled word in the "
|
||||
"current file.\n\n The following other functions are "
|
||||
"available in Spell Check mode:\n\n");
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
else if (currshortcut == extcmd_list)
|
||||
ptr = _("External Command Help Text\n\n "
|
||||
@@ -387,9 +384,12 @@ void help_init(void)
|
||||
/* If we're on the main list, we also count the toggle help text.
|
||||
* Each line has "M-%c\t\t\t", which fills 24 columns, plus at most
|
||||
* COLS - 24 characters, plus '\n'.*/
|
||||
if (currshortcut == main_list)
|
||||
if (currshortcut == main_list) {
|
||||
size_t endislen = strlen(_("enable/disable"));
|
||||
|
||||
for (t = toggles; t != NULL; t = t->next)
|
||||
allocsize += COLS - 17;
|
||||
allocsize += 8 + strlen(t->desc) + endislen;
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
/* help_text has been freed and set to NULL unless the user resized
|
||||
@@ -446,16 +446,16 @@ void help_init(void)
|
||||
*(ptr++) = '\t';
|
||||
|
||||
assert(s->help != NULL);
|
||||
ptr += sprintf(ptr, "%.*s\n", COLS - 24, s->help);
|
||||
ptr += sprintf(ptr, "%.*s\n", COLS > 24 ? COLS - 24 : 0, s->help);
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* And the toggles... */
|
||||
if (currshortcut == main_list)
|
||||
for (t = toggles; t != NULL; t = t->next) {
|
||||
ptr += sprintf(ptr, "M-%c\t\t\t", t->val - 32);
|
||||
assert(t->desc != NULL);
|
||||
ptr += sprintf(ptr, _("%.*s enable/disable\n"), COLS - 24, t->desc);
|
||||
ptr += sprintf(ptr, "M-%c\t\t\t%s %s\n", t->val - 32, t->desc,
|
||||
_("enable/disable"));
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
@@ -562,12 +562,12 @@ void free_filestruct(filestruct *src)
|
||||
src = src->next;
|
||||
delete_node(src->prev);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("%s: free'd a node, YAY!\n"), "delete_node()");
|
||||
fprintf(stderr, "%s: free'd a node, YAY!\n", "delete_node()");
|
||||
#endif
|
||||
}
|
||||
delete_node(src);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("%s: free'd last node.\n"), "delete_node()");
|
||||
fprintf(stderr, "%s: free'd last node.\n", "delete_node()");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -773,16 +773,6 @@ void nano_disabled_msg(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
void do_preserve_msg(void)
|
||||
{
|
||||
fprintf(stderr, _("\nThe -p flag now invokes the Pico \"preserve\" flag.\n"
|
||||
"The Pico compatibility flag has been removed as nano\n"
|
||||
"now fully Pico compatible. Please see the nano FAQ\n"
|
||||
"for more info on this change...\n\n"
|
||||
"Press return to continue\n"));
|
||||
while (getchar() != '\n');
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
static int pid; /* This is the PID of the newly forked process
|
||||
* below. It must be global since the signal
|
||||
@@ -998,7 +988,7 @@ void do_char(char ch)
|
||||
}
|
||||
|
||||
/* more dangerousness fun =) */
|
||||
current->data = nrealloc(current->data, current_len + 2);
|
||||
current->data = charealloc(current->data, current_len + 2);
|
||||
assert(current_x <= current_len);
|
||||
memmove(¤t->data[current_x + 1],
|
||||
¤t->data[current_x],
|
||||
@@ -1028,8 +1018,6 @@ void do_char(char ch)
|
||||
if (refresh)
|
||||
edit_refresh();
|
||||
#endif
|
||||
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
}
|
||||
|
||||
int do_backspace(void)
|
||||
@@ -1041,7 +1029,7 @@ int do_backspace(void)
|
||||
memmove(¤t->data[current_x - 1], ¤t->data[current_x],
|
||||
strlen(current->data) - current_x + 1);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("current->data now = \"%s\"\n"), current->data);
|
||||
fprintf(stderr, "current->data now = \"%s\"\n", current->data);
|
||||
#endif
|
||||
align(¤t->data);
|
||||
#ifndef NANO_SMALL
|
||||
@@ -1068,7 +1056,7 @@ int do_backspace(void)
|
||||
mark_beginbuf = previous;
|
||||
}
|
||||
#endif
|
||||
previous->data = nrealloc(previous->data,
|
||||
previous->data = charealloc(previous->data,
|
||||
current_x + strlen(current->data) + 1);
|
||||
strcpy(previous->data + current_x, current->data);
|
||||
|
||||
@@ -1101,9 +1089,8 @@ int do_backspace(void)
|
||||
current_y--;
|
||||
totlines--;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("After, data = \"%s\"\n"), current->data);
|
||||
fprintf(stderr, "After, data = \"%s\"\n", current->data);
|
||||
#endif
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
refresh = 1;
|
||||
}
|
||||
|
||||
@@ -1141,7 +1128,7 @@ int do_delete(void)
|
||||
|
||||
filestruct *foo;
|
||||
|
||||
current->data = nrealloc(current->data,
|
||||
current->data = charealloc(current->data,
|
||||
strlen(current->data) +
|
||||
strlen(current->next->data) + 1);
|
||||
strcat(current->data, current->next->data);
|
||||
@@ -1162,7 +1149,6 @@ int do_delete(void)
|
||||
|
||||
totsize--;
|
||||
set_modified();
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
update_line(current, current_x);
|
||||
if (refresh)
|
||||
edit_refresh();
|
||||
@@ -1523,7 +1509,7 @@ int do_wrap(filestruct *inptr)
|
||||
* between after_break and wrap_line. If the line already ends
|
||||
* in a tab or a space, we don't add a space and decrement
|
||||
* totsize to account for that. */
|
||||
if (!isspace(newline[strlen(newline) - 1]))
|
||||
if (!isspace((int) newline[strlen(newline) - 1]))
|
||||
strcat(newline, " ");
|
||||
else
|
||||
totsize--;
|
||||
@@ -1806,7 +1792,7 @@ char *do_int_speller(char *tempfile_name)
|
||||
while ((bytesread = read(uniq_fd[0], read_buff_ptr, pipe_buff_size)) > 0) {
|
||||
read_buff_read += bytesread;
|
||||
read_buff_size += pipe_buff_size;
|
||||
read_buff = read_buff_ptr = nrealloc(read_buff, read_buff_size);
|
||||
read_buff = read_buff_ptr = charealloc(read_buff, read_buff_size);
|
||||
read_buff_ptr += read_buff_read;
|
||||
|
||||
}
|
||||
@@ -1899,12 +1885,12 @@ char *do_alt_speller(char *tempfile_name)
|
||||
|
||||
/* Set up an argument list to pass the execvp function */
|
||||
if (spellargs == NULL) {
|
||||
spellargs = nmalloc(arglen * sizeof(char *));
|
||||
spellargs = (char **)nmalloc(arglen * sizeof(char *));
|
||||
|
||||
spellargs[0] = strtok(alt_speller, " ");
|
||||
while ((ptr = strtok(NULL, " ")) != NULL) {
|
||||
arglen++;
|
||||
spellargs = nrealloc(spellargs, arglen * sizeof(char *));
|
||||
spellargs = (char **)nrealloc(spellargs, arglen * sizeof(char *));
|
||||
spellargs[arglen - 3] = ptr;
|
||||
}
|
||||
spellargs[arglen - 1] = NULL;
|
||||
@@ -1969,7 +1955,7 @@ int do_spell(void)
|
||||
nano_disabled_msg();
|
||||
return TRUE;
|
||||
#else
|
||||
char *temp, *spell_msg = _("Generic error");
|
||||
char *temp, *spell_msg;
|
||||
|
||||
if ((temp = safe_tempnam(0, "nano.")) == NULL) {
|
||||
statusbar(_("Could not create a temporary filename: %s"),
|
||||
@@ -1994,17 +1980,15 @@ int do_spell(void)
|
||||
else
|
||||
spell_msg = do_int_speller(temp);
|
||||
remove(temp);
|
||||
free(temp);
|
||||
|
||||
if (spell_msg == NULL) {
|
||||
statusbar(_("Finished checking spelling"));
|
||||
return 1;
|
||||
} else {
|
||||
if (spell_msg != NULL) {
|
||||
statusbar(_("Spell checking failed: %s"), spell_msg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
free(temp);
|
||||
|
||||
statusbar(_("Finished checking spelling"));
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -2047,12 +2031,12 @@ int justify_format(int changes_allowed, filestruct *line, size_t skip)
|
||||
/* These four asserts are assumptions about the input data. */
|
||||
assert(line != NULL);
|
||||
assert(line->data != NULL);
|
||||
assert(skip <= strlen(line->data));
|
||||
assert(skip < strlen(line->data));
|
||||
assert(line->data[skip] != ' ' && line->data[skip] != '\t');
|
||||
|
||||
back = line->data + skip;
|
||||
front = back;
|
||||
for (; *front; front++) {
|
||||
for (front = back; ; front++) {
|
||||
int remove_space = 0;
|
||||
/* Do we want to remove this space? */
|
||||
|
||||
@@ -2062,11 +2046,11 @@ int justify_format(int changes_allowed, filestruct *line, size_t skip)
|
||||
*front = ' ';
|
||||
}
|
||||
/* these tests are safe since line->data + skip is not a space */
|
||||
if (*front == ' ' && *(front - 1) == ' ') {
|
||||
if ((*front == '\0' || *front == ' ') && *(front - 1) == ' ') {
|
||||
const char *bob = front - 2;
|
||||
|
||||
remove_space = 1;
|
||||
for (bob = front - 2; bob >= line->data + skip; bob--) {
|
||||
for (bob = back - 2; bob >= line->data + skip; bob--) {
|
||||
if (strchr(punct, *bob) != NULL) {
|
||||
remove_space = 0;
|
||||
break;
|
||||
@@ -2085,28 +2069,25 @@ int justify_format(int changes_allowed, filestruct *line, size_t skip)
|
||||
if (mark_beginbuf == line && back - line->data < mark_beginx)
|
||||
mark_beginx--;
|
||||
#endif
|
||||
if (*front == '\0')
|
||||
*(back - 1) = '\0';
|
||||
} else {
|
||||
*back = *front;
|
||||
back++;
|
||||
}
|
||||
if (*front == '\0')
|
||||
break;
|
||||
}
|
||||
|
||||
/* Remove spaces from the end of the line, except maintain 1 after a
|
||||
* sentence punctuation. */
|
||||
while (line->data < back && *(back - 1) == ' ')
|
||||
back--;
|
||||
if (line->data < back && *back == ' ' &&
|
||||
strchr(punct, *(back - 1)) != NULL)
|
||||
back++;
|
||||
if (!changes_allowed && back != front)
|
||||
return 1;
|
||||
back--;
|
||||
assert(*back == '\0' && *front == '\0');
|
||||
|
||||
/* This assert merely documents a fact about the loop above. */
|
||||
assert(changes_allowed != 0 || back == front);
|
||||
|
||||
/* Now back is the new end of line->data. */
|
||||
if (back != front) {
|
||||
totsize += back - line->data - strlen(line->data);
|
||||
totsize -= front - back;
|
||||
null_at(&line->data, back - line->data);
|
||||
#ifndef NANO_SMALL
|
||||
if (mark_beginbuf == line && back - line->data < mark_beginx)
|
||||
@@ -2220,7 +2201,9 @@ int breakable(const char *line, int goal)
|
||||
else
|
||||
goal -= 1;
|
||||
}
|
||||
return FALSE;
|
||||
/* If goal is not negative, the whole line (one word) was short
|
||||
* enough. */
|
||||
return goal >= 0;
|
||||
}
|
||||
|
||||
/* We are trying to break a chunk off line. We find the last space such
|
||||
@@ -2256,7 +2239,7 @@ int break_line(const char *line, int goal, int force)
|
||||
/* No space found short enough. */
|
||||
if (force)
|
||||
for(; *line != '\0'; line++, cur_loc++)
|
||||
if (*line == ' ' && *(line + 1) != ' ')
|
||||
if (*line == ' ' && *(line + 1) != ' ' && *(line + 1) != '\0')
|
||||
return cur_loc;
|
||||
return -1;
|
||||
}
|
||||
@@ -2395,10 +2378,10 @@ int do_justify(void)
|
||||
/* There is no next paragraph, so nothing to justify. */
|
||||
if (current->next == NULL) {
|
||||
placewewant = 0;
|
||||
if (current_y > editwinrows - 1)
|
||||
edit_update(current, CENTER);
|
||||
else
|
||||
edit_refresh();
|
||||
edit_refresh();
|
||||
#ifdef HAVE_REGEX_H
|
||||
regfree(&qreg);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
current = current->next;
|
||||
@@ -2441,6 +2424,7 @@ int do_justify(void)
|
||||
|
||||
/* Next step, we loop through the lines of this paragraph, justifying
|
||||
* each one individually. */
|
||||
SET(JUSTIFY_MODE);
|
||||
for(; par_len > 0; current_y++, par_len--) {
|
||||
size_t line_len;
|
||||
size_t display_len;
|
||||
@@ -2481,6 +2465,13 @@ int do_justify(void)
|
||||
* line and copy text after break_pos into it. */
|
||||
splice_node(current, make_new_node(current),
|
||||
current->next);
|
||||
/* In a non-quoted paragraph, we copy the indent only if
|
||||
AUTOINDENT is turned on. */
|
||||
if (quote_len == 0)
|
||||
#ifndef NANO_SMALL
|
||||
if (!ISSET(AUTOINDENT))
|
||||
#endif
|
||||
indent_len = 0;
|
||||
current->next->data = charalloc(indent_len + line_len -
|
||||
break_pos);
|
||||
strncpy(current->next->data, current->data,
|
||||
@@ -2497,9 +2488,8 @@ int do_justify(void)
|
||||
|
||||
indent_len = quote_len +
|
||||
indent_length(current->next->data + quote_len);
|
||||
current->next->data = (char *)nrealloc(current->next->data,
|
||||
sizeof(char) * (next_line_len + line_len -
|
||||
break_pos + 1));
|
||||
current->next->data = charealloc(current->next->data,
|
||||
next_line_len + line_len - break_pos + 1);
|
||||
|
||||
memmove(current->next->data + indent_len + line_len - break_pos,
|
||||
current->next->data + indent_len,
|
||||
@@ -2543,7 +2533,7 @@ int do_justify(void)
|
||||
fill - display_len - 1, FALSE);
|
||||
assert(break_pos != -1);
|
||||
|
||||
current->data = (char *)nrealloc(current->data,
|
||||
current->data = charealloc(current->data,
|
||||
line_len + break_pos + 2);
|
||||
current->data[line_len] = ' ';
|
||||
strncpy(current->data + line_len + 1,
|
||||
@@ -2586,6 +2576,8 @@ int do_justify(void)
|
||||
continue_loc:
|
||||
current = current->next;
|
||||
}
|
||||
UNSET(JUSTIFY_MODE);
|
||||
|
||||
/* We are now done justifying the paragraph. There are cleanup things to
|
||||
* do, and we check for unjustify. */
|
||||
|
||||
@@ -2670,10 +2662,9 @@ int do_justify(void)
|
||||
}
|
||||
edit_refresh();
|
||||
}
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
cutbuffer = cutbuffer_save;
|
||||
blank_statusbar_refresh();
|
||||
/* display shortcut list without UnCut */
|
||||
/* display shortcut list with UnCut */
|
||||
shortcut_init(0);
|
||||
display_main_list();
|
||||
|
||||
@@ -2809,7 +2800,7 @@ RETSIGTYPE handle_hupterm(int signal)
|
||||
RETSIGTYPE do_suspend(int signal)
|
||||
{
|
||||
endwin();
|
||||
printf("\n\n\n\n\nUse \"fg\" to return to nano\n");
|
||||
printf("\n\n\n\n\n%s\n", _("Use \"fg\" to return to nano"));
|
||||
fflush(stdout);
|
||||
|
||||
/* Restore the terminal settings for the disabled keys */
|
||||
@@ -2862,18 +2853,19 @@ void handle_sigwinch(int s)
|
||||
* But not in all cases, argh. */
|
||||
COLS = win.ws_col;
|
||||
LINES = win.ws_row;
|
||||
if ((editwinrows = LINES - 5 + no_help()) < MIN_EDITOR_ROWS)
|
||||
editwinrows = LINES - 5 + no_help();
|
||||
if (editwinrows < MIN_EDITOR_ROWS || COLS < MIN_EDITOR_COLS)
|
||||
die_too_small();
|
||||
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
fill = wrap_at;
|
||||
if (fill <= 0)
|
||||
fill += COLS;
|
||||
if (fill < MIN_FILL_LENGTH)
|
||||
die_too_small();
|
||||
if (fill < 0)
|
||||
fill = 0;
|
||||
#endif
|
||||
|
||||
hblank = nrealloc(hblank, COLS + 1);
|
||||
hblank = charealloc(hblank, COLS + 1);
|
||||
memset(hblank, ' ', COLS);
|
||||
hblank[COLS] = '\0';
|
||||
|
||||
@@ -3004,12 +2996,12 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
int optchr;
|
||||
int startline = 0; /* Line to try and start at */
|
||||
int modify_control_seq;
|
||||
int modify_control_seq = 0;
|
||||
int fill_flag_used = 0; /* Was the fill option used? */
|
||||
const shortcut *s;
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
int preserveopt = 0; /* Did the cmdline include --preserve? */
|
||||
#endif
|
||||
int keyhandled = 0; /* Have we handled the keystroke yet? */
|
||||
int kbinput = -1; /* Input from keyboard */
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
const toggle *t;
|
||||
#endif
|
||||
@@ -3080,20 +3072,6 @@ int main(int argc, char *argv[])
|
||||
textdomain(PACKAGE);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
{
|
||||
/* Check for the --preserve flag, and report error if people are
|
||||
still using --pico. */
|
||||
int i;
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (!strcmp(argv[i], "--preserve"))
|
||||
preserveopt = 1;
|
||||
else if (!strcmp(argv[i], "--pico"))
|
||||
do_preserve_msg();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(ENABLE_NANORC) && defined(DISABLE_ROOTWRAP) && !defined(DISABLE_WRAPPING)
|
||||
/* if we don't have rcfile support, we're root, and
|
||||
--disable-wrapping-as-root is used, turn wrapping off */
|
||||
@@ -3219,8 +3197,6 @@ int main(int argc, char *argv[])
|
||||
case 'p':
|
||||
SET(PRESERVE);
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
if (!preserveopt)
|
||||
do_preserve_msg();
|
||||
#endif
|
||||
break;
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
@@ -3287,9 +3263,15 @@ int main(int argc, char *argv[])
|
||||
int tabsize_cpy = tabsize;
|
||||
long flags_cpy = flags;
|
||||
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
operating_dir = NULL;
|
||||
#endif
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
quotestr = NULL;
|
||||
#endif
|
||||
#ifndef DISABLE_SPELLER
|
||||
alt_speller = NULL;
|
||||
#endif
|
||||
|
||||
do_rcfile();
|
||||
|
||||
@@ -3325,6 +3307,14 @@ int main(int argc, char *argv[])
|
||||
#endif
|
||||
#endif /* ENABLE_NANORC */
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
history_init();
|
||||
#ifdef ENABLE_NANORC
|
||||
if (!ISSET(NO_RCFILE) && ISSET(HISTORYLOG))
|
||||
load_history();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
/* Set up the operating directory. This entails chdir()ing there,
|
||||
so that file reads and writes will be based there. */
|
||||
@@ -3391,7 +3381,7 @@ int main(int argc, char *argv[])
|
||||
signal_init();
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("Main: set up windows\n"));
|
||||
fprintf(stderr, "Main: set up windows\n");
|
||||
#endif
|
||||
|
||||
window_init();
|
||||
@@ -3404,25 +3394,14 @@ int main(int argc, char *argv[])
|
||||
keypad(bottomwin, TRUE);
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
history_init();
|
||||
#ifdef ENABLE_NANORC
|
||||
if (!ISSET(NO_RCFILE) && ISSET(HISTORYLOG))
|
||||
load_history();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("Main: bottom win\n"));
|
||||
fprintf(stderr, "Main: bottom win\n");
|
||||
#endif
|
||||
/* Set up bottom of window */
|
||||
display_main_list();
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("Main: open file\n"));
|
||||
fprintf(stderr, "Main: open file\n");
|
||||
#endif
|
||||
|
||||
open_file(filename, 0, 1);
|
||||
@@ -3450,6 +3429,11 @@ int main(int argc, char *argv[])
|
||||
/* Return here after a sigwinch */
|
||||
sigsetjmp(jmpbuf, 1);
|
||||
|
||||
/* SHUT UP GCC! */
|
||||
startline = 0;
|
||||
fill_flag_used = 0;
|
||||
keyhandled = 0;
|
||||
|
||||
/* This variable should be initialized after the sigsetjmp(), so we
|
||||
can't do Esc-Esc then quickly resize and muck things up. */
|
||||
modify_control_seq = 0;
|
||||
@@ -3458,8 +3442,7 @@ int main(int argc, char *argv[])
|
||||
reset_cursor();
|
||||
|
||||
while (1) {
|
||||
int keyhandled = 0; /* Have we handled the keystroke yet? */
|
||||
int kbinput; /* Input from keyboard */
|
||||
keyhandled = 0;
|
||||
|
||||
if (ISSET(CONSTUPDATE))
|
||||
do_cursorpos(1);
|
||||
@@ -3475,7 +3458,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
kbinput = wgetch(edit);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("AHA! %c (%d)\n"), kbinput, kbinput);
|
||||
fprintf(stderr, "AHA! %c (%d)\n", kbinput, kbinput);
|
||||
#endif
|
||||
if (kbinput == 27) { /* Grab Alt-key stuff first */
|
||||
kbinput = wgetch(edit);
|
||||
@@ -3495,7 +3478,7 @@ int main(int argc, char *argv[])
|
||||
kbinput = KEY_F(kbinput - 79);
|
||||
#ifdef DEBUG
|
||||
else {
|
||||
fprintf(stderr, _("I got Alt-O-%c! (%d)\n"),
|
||||
fprintf(stderr, "I got Alt-O-%c! (%d)\n",
|
||||
kbinput, kbinput);
|
||||
break;
|
||||
}
|
||||
@@ -3522,7 +3505,7 @@ int main(int argc, char *argv[])
|
||||
kbinput = KEY_HOME;
|
||||
#ifdef DEBUG
|
||||
else {
|
||||
fprintf(stderr, _("I got Alt-[-1-%c! (%d)\n"),
|
||||
fprintf(stderr, "I got Alt-[-1-%c! (%d)\n",
|
||||
kbinput, kbinput);
|
||||
break;
|
||||
}
|
||||
@@ -3552,7 +3535,7 @@ int main(int argc, char *argv[])
|
||||
break;
|
||||
#ifdef DEBUG
|
||||
default:
|
||||
fprintf(stderr, _("I got Alt-[-2-%c! (%d)\n"),
|
||||
fprintf(stderr, "I got Alt-[-2-%c! (%d)\n",
|
||||
kbinput, kbinput);
|
||||
break;
|
||||
#endif
|
||||
@@ -3621,7 +3604,7 @@ int main(int argc, char *argv[])
|
||||
break;
|
||||
default:
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("I got Alt-[-%c! (%d)\n"),
|
||||
fprintf(stderr, "I got Alt-[-%c! (%d)\n",
|
||||
kbinput, kbinput);
|
||||
#endif
|
||||
break;
|
||||
@@ -3646,23 +3629,28 @@ int main(int argc, char *argv[])
|
||||
kbinput <= 'Z' && kbinput == s->altval - 32)) {
|
||||
if (ISSET(VIEW_MODE) && !s->viewok)
|
||||
print_view_warning();
|
||||
else
|
||||
else {
|
||||
if (s->func != do_cut_text)
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
s->func();
|
||||
}
|
||||
keyhandled = 1;
|
||||
break;
|
||||
}
|
||||
#ifndef NANO_SMALL
|
||||
/* And for toggle switches */
|
||||
for (t = toggles; t != NULL && !keyhandled; t = t->next)
|
||||
if (kbinput == t->val || (t->val >= 'a' &&
|
||||
t->val <= 'z' && kbinput == t->val - 32)) {
|
||||
do_toggle(t);
|
||||
keyhandled = 1;
|
||||
break;
|
||||
}
|
||||
if (!keyhandled)
|
||||
/* And for toggle switches */
|
||||
for (t = toggles; t != NULL; t = t->next)
|
||||
if (kbinput == t->val || (t->val >= 'a' &&
|
||||
t->val <= 'z' && kbinput == t->val - 32)) {
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
do_toggle(t);
|
||||
keyhandled = 1;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("I got Alt-%c! (%d)\n"), kbinput,
|
||||
fprintf(stderr, "I got Alt-%c! (%d)\n", kbinput,
|
||||
kbinput);
|
||||
#endif
|
||||
break;
|
||||
@@ -3689,25 +3677,33 @@ int main(int argc, char *argv[])
|
||||
/* Look through the main shortcut list to see if we've hit a
|
||||
shortcut key */
|
||||
|
||||
if (!keyhandled)
|
||||
#if !defined(DISABLE_BROWSER) || !defined (DISABLE_HELP) || (!defined(DISABLE_MOUSE) && defined(NCURSES_MOUSE_VERSION))
|
||||
for (s = currshortcut; s != NULL && !keyhandled; s = s->next) {
|
||||
for (s = currshortcut; s != NULL && !keyhandled; s = s->next) {
|
||||
#else
|
||||
for (s = main_list; s != NULL && !keyhandled; s = s->next) {
|
||||
for (s = main_list; s != NULL && !keyhandled; s = s->next) {
|
||||
#endif
|
||||
if (kbinput == s->val ||
|
||||
(s->misc1 && kbinput == s->misc1) ||
|
||||
(s->misc2 && kbinput == s->misc2)) {
|
||||
if (ISSET(VIEW_MODE) && !s->viewok)
|
||||
print_view_warning();
|
||||
else
|
||||
s->func();
|
||||
keyhandled = 1;
|
||||
/* Rarely, the value of s can change after s->func(),
|
||||
leading to problems; get around this by breaking out
|
||||
explicitly once we successfully handle a shortcut */
|
||||
break;
|
||||
if (kbinput == s->val ||
|
||||
(s->misc1 && kbinput == s->misc1) ||
|
||||
(s->misc2 && kbinput == s->misc2)) {
|
||||
if (ISSET(VIEW_MODE) && !s->viewok)
|
||||
print_view_warning();
|
||||
else {
|
||||
if (s->func != do_cut_text)
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
s->func();
|
||||
}
|
||||
keyhandled = 1;
|
||||
/* Rarely, the value of s can change after
|
||||
s->func(), leading to problems; get around this
|
||||
by breaking out explicitly once we successfully
|
||||
handle a shortcut */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!keyhandled)
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
|
||||
#ifdef _POSIX_VDISABLE
|
||||
/* Don't even think about changing this string */
|
||||
@@ -3753,7 +3749,7 @@ int main(int argc, char *argv[])
|
||||
break;
|
||||
default:
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("I got %c (%d)!\n"), kbinput, kbinput);
|
||||
fprintf(stderr, "I got %c (%d)!\n", kbinput, kbinput);
|
||||
#endif
|
||||
/* We no longer stop unhandled sequences so that people with
|
||||
odd character sets can type... */
|
||||
|
||||
28
nano.h
28
nano.h
@@ -35,6 +35,9 @@
|
||||
/* Define charalloc as a macro rather than duplicating code */
|
||||
#define charalloc(howmuch) (char *)nmalloc((howmuch) * sizeof(char))
|
||||
#define charealloc(ptr, howmuch) (char *)nrealloc(ptr, (howmuch) * sizeof(char))
|
||||
#ifdef BROKEN_REGEXEC
|
||||
#define regexec(preg, string, nmatch, pmatch, eflags) regexec_safe(preg, string, nmatch, pmatch, eflags)
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* For the backup file copy ... */
|
||||
@@ -56,10 +59,10 @@
|
||||
# include <libintl.h>
|
||||
# endif
|
||||
# define _(string) gettext(string)
|
||||
# define __(singular, plural, number) ngettext(singular, plural, number)
|
||||
# define P_(singular, plural, number) ngettext(singular, plural, number)
|
||||
#else
|
||||
# define _(string) (string)
|
||||
# define __(singular, plural, number) (number == 1 ? singular : plural)
|
||||
# define P_(singular, plural, number) (number == 1 ? singular : plural)
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
@@ -76,13 +79,12 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_STRCASECMP) || !defined(HAVE_STRNCASECMP)
|
||||
# ifndef HAVE_STRCASECMP
|
||||
# define strcasecmp strcmp
|
||||
# endif
|
||||
# ifndef HAVE_STRNCASECMP
|
||||
# define strncasecmp strncmp
|
||||
# endif
|
||||
#ifndef HAVE_STRCASECMP
|
||||
#define strcasecmp nstricmp
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRNCASECMP
|
||||
#define strncasecmp nstrnicmp
|
||||
#endif
|
||||
|
||||
/* HP-UX 10 & 11 do not seem to support KEY_HOME and KEY_END */
|
||||
@@ -250,6 +252,7 @@ typedef struct historyheadtype {
|
||||
#define PRESERVE (1<<28)
|
||||
#define HISTORY_CHANGED (1<<29)
|
||||
#define HISTORYLOG (1<<30)
|
||||
#define JUSTIFY_MODE (1<<31)
|
||||
|
||||
/* Control key sequences, changing these would be very very bad */
|
||||
|
||||
@@ -417,14 +420,13 @@ typedef enum {
|
||||
/* Minimum editor window rows required for nano to work correctly */
|
||||
#define MIN_EDITOR_ROWS 3
|
||||
|
||||
/* Minimum editor window cols required for nano to work correctly */
|
||||
#define MIN_EDITOR_COLS 10
|
||||
|
||||
/* Default number of characters from end-of-line where text wrapping
|
||||
occurs */
|
||||
#define CHARS_FROM_EOL 8
|
||||
|
||||
/* Minimum fill length (space available for text before wrapping
|
||||
occurs) */
|
||||
#define MIN_FILL_LENGTH 10
|
||||
|
||||
/* Maximum number of search history strings saved, same value used for
|
||||
replace history */
|
||||
#define MAX_SEARCH_HISTORY 100
|
||||
|
||||
@@ -9,7 +9,7 @@ Release : %{rel}
|
||||
Copyright : GPL
|
||||
Group : Console/Editors
|
||||
URL : http://www.nano-editor.org
|
||||
Source : http://www.nano-editor.org/dist/v1.1/%{name}-%{ver}.tar.gz
|
||||
Source : http://www.nano-editor.org/dist/v1.2/%{name}-%{ver}.tar.gz
|
||||
BuildRoot : /var/tmp/%{name}-buildroot
|
||||
Requires : ncurses
|
||||
|
||||
@@ -21,7 +21,7 @@ text editor while also offering a few enhancements.
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
%configure --enable-extra
|
||||
%configure --enable-all
|
||||
make RPM_OPT_FLAGS="$RPM_OPT_FLAGS"
|
||||
|
||||
%install
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
@c Run `makeinfo' rather than `texinfo-format-buffer'.
|
||||
@smallbook
|
||||
@set EDITION 0.1
|
||||
@set VERSION 1.1.99pre2
|
||||
@set VERSION 1.2.2
|
||||
@set UPDATED 17 Jan 2003
|
||||
|
||||
@dircategory Editors
|
||||
@@ -23,7 +23,7 @@
|
||||
@titlepage
|
||||
@title GNU @code{nano}
|
||||
@subtitle a small and friendly text editor.
|
||||
@subtitle version 1.1.99pre2
|
||||
@subtitle version 1.2.2
|
||||
|
||||
@author Chris Allegretta
|
||||
@page
|
||||
@@ -387,7 +387,7 @@ are certain differences between the editors:
|
||||
|
||||
@table @code
|
||||
@item Search and Replace History
|
||||
As of version 1.1.99pre2 of @code{nano}, text entered as search or replace
|
||||
As of version 1.2.2 of @code{nano}, text entered as search or replace
|
||||
strings will be stored and can be accessed with the up/down
|
||||
arrow keys. Previously, @code{nano} offered a more consistent, but incompatible
|
||||
with Pico, method for entering search and replace strings. In the old
|
||||
@@ -425,7 +425,7 @@ replace it. The @code{nano} implementation will stop at each search
|
||||
string found and query whether to replace this instance or not. The
|
||||
internal spell checker operates similarly. Note that these is no way
|
||||
to force these functions to behave in the Pico fashion. As of
|
||||
version 1.1.99pre2, misspelled words are sorted and trimmed for
|
||||
version 1.2.2, misspelled words are sorted and trimmed for
|
||||
uniqueness in the internal spell checker such that the words 'apple'
|
||||
and 'Apple' will be prompted for correction separately.
|
||||
@end table
|
||||
|
||||
169
nanorc.5
Normal file
169
nanorc.5
Normal file
@@ -0,0 +1,169 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.\" nanorc.5 is Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
.\"
|
||||
.\" This is free documentation, see the latest version of the GNU General
|
||||
.\" Public License for copying conditions. There is NO warranty.
|
||||
.\"
|
||||
.\" $Id$
|
||||
.TH NANORC 5 "June 19, 2003"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.SH NAME
|
||||
nanorc \- GNU nano's rcfile
|
||||
.SH DESCRIPTION
|
||||
This manual page documents GNU \fBnano\fP's rcfile.
|
||||
.PP
|
||||
\fBnano\fP is a small, free and friendly editor which aims to replace
|
||||
Pico, the default editor included in the non-free Pine package. Rather
|
||||
than just copying Pico's look and feel, \fBnano\fP also implements some
|
||||
missing (or disabled by default) features in Pico, such as "search and
|
||||
replace" and "go to line number".
|
||||
.PP
|
||||
The \fInanorc\fP file contains the default settings for \fBnano\fP.
|
||||
During startup, \fBnano\fP will first read its system-wide settings from
|
||||
.IR $SYSCONFDIR/nanorc ,
|
||||
and then user-specific settings from
|
||||
.IR ~/.nanorc .
|
||||
|
||||
.SH OPTIONS
|
||||
The configuration file accepts a series of "set" and "unset" commands,
|
||||
which can be used to configure nano on startup without using the
|
||||
command-line options. Additionally, the "syntax" and "color" keywords
|
||||
are used to define syntax highlighting rules for different text patterns.
|
||||
GNU nano will read one command per line.
|
||||
|
||||
Options in rcfiles take precedence over nano's defaults, and command line
|
||||
options override rcfile settings.
|
||||
|
||||
Options are unset by default, except for options that take an argument.
|
||||
|
||||
The supported commands and arguments are:
|
||||
|
||||
.TP 3
|
||||
\fBset/unset autoindent\fP
|
||||
Use auto-indentation.
|
||||
.TP
|
||||
\fBset/unset backup\fP
|
||||
Create backup files in
|
||||
.IR filename~ .
|
||||
.TP
|
||||
\fBset/unset const\fP
|
||||
Constantly display the cursor position in the status bar.
|
||||
.TP
|
||||
\fBset/unset cut\fP
|
||||
Use cut to end of line with ^K by default.
|
||||
.TP
|
||||
\fBset fill \fIn\fP\fP
|
||||
Wrap lines at column number \fIn\fP. If \fIn\fP is 0 or less, the line
|
||||
length will be the screen width less \fIn\fP. The default value is -8.
|
||||
.TP
|
||||
\fBset/unset historylog\fP
|
||||
Enable
|
||||
.I ~/.nano_history
|
||||
for saving and reading search/replace strings.
|
||||
.TP
|
||||
\fBset/unset keypad\fP
|
||||
Use alternate keypad routines.
|
||||
.TP
|
||||
\fBset/unset multibuffer\fP
|
||||
Allow inserting files into their own buffers.
|
||||
.TP
|
||||
\fBset/unset noconvert\fP
|
||||
Don't convert files from DOS/Mac format.
|
||||
.TP
|
||||
\fBset/unset nofollow\fP
|
||||
Don't follow symlinks when writing files.
|
||||
.TP
|
||||
\fBset/unset nohelp\fP
|
||||
Don't display the help lists at the bottom of the screen.
|
||||
.TP
|
||||
\fBset/unset nowrap\fP
|
||||
Don't wrap text at all.
|
||||
.TP
|
||||
\fBset operatingdir "\fIdirectory\fP"\fP
|
||||
\fBnano\fP will only read and write files inside \fIdirectory\fP and its
|
||||
subdirectories. Also, the current directory is changed to here, so files
|
||||
are inserted from this dir. By default the operating directory feature is
|
||||
turned off.
|
||||
.TP
|
||||
\fBset/unset preserve\fP
|
||||
Preserve the XON and XOFF keys (^Q and ^S).
|
||||
.TP
|
||||
\fBset quotestr "\fIstring\fP"\fP
|
||||
The email-quote string, used to justify email-quoted paragraphs. This is
|
||||
an "extended regular expression" if your system supports them, otherwise a
|
||||
literal string. The default value is
|
||||
|
||||
set quotestr "^([\ \\t]*[|>:}#])+"
|
||||
|
||||
if you have regexps, otherwise set quotestr ">\ ". Note that '\\t'
|
||||
above stands for a literal Tab character.
|
||||
.TP
|
||||
\fBset/unset regexp\fP
|
||||
Do regular expression searches by default.
|
||||
.TP
|
||||
\fBset/unset smooth\fP
|
||||
Use smooth scrolling by default.
|
||||
.TP
|
||||
\fBset speller \fIspellprog\fP\fP
|
||||
Use spelling checker \fIspellprog\fP instead of the built-in one, which
|
||||
calls \fIspell\fP.
|
||||
.TP
|
||||
\fBset/unset suspend\fP
|
||||
Allow nano to be suspended with ^Z.
|
||||
.TP
|
||||
\fBset tabsize \fIn\fP\fP
|
||||
Use a tab size of \fIn\fP instead of the default (8); must be greater
|
||||
than 0.
|
||||
.TP
|
||||
\fBset/unset tempfile\fP
|
||||
Save automatically on exit, don't prompt.
|
||||
.TP
|
||||
\fBset/unset view\fP
|
||||
Disallow file modification.
|
||||
.TP
|
||||
.B syntax "\fIstr\fP" ["\fIfileregex\fP" ... ]
|
||||
Defines a syntax named \fIstr\fP which can be activated via the
|
||||
\fB-Y\fP flag, or will be automatically activated if the current
|
||||
filename matches \fIfileregex\fP. All following \fBcolor\fP statements
|
||||
will apply to \fIsyntax\fP until a new syntax is defined.
|
||||
.TP
|
||||
.B color \fIfgcolor\fP[,\fIbgcolor\fP] "\fIregex\fP" ...
|
||||
For the currently defined syntax, display all expressions matching
|
||||
\fIregex\fP with foreground color \fIfgcolor\fP and optional background
|
||||
color \fIbgcolor\fP. Legal colors for foreground and background color are:
|
||||
white, black, red, blue, green, yellow, magenta, and cyan. You may use
|
||||
the prefix "bright" to force a stronger color highlight. If your
|
||||
terminal supports transparency, not specifying a \fIbgcolor\fP tells
|
||||
\fBnano\fP to attempt to use a transparent background.
|
||||
.TP
|
||||
.B color \fIfgcolor\fP[,\fIbgcolor\fP] start="\fIsr\fP" end="\fIer\fP"
|
||||
Display expressions which start with \fIsr\fP and end with \fIer\fP
|
||||
with foreground color \fIfgcolor\fP and optional
|
||||
background color \fIbgcolor\fP. This allows syntax highlighting to span
|
||||
multiple lines. Note that all subsequent instances of \fIsr\fP after
|
||||
an initial \fIsr\fP is found will be highlighted until the first
|
||||
instance of \fIer\fP.
|
||||
\fI
|
||||
|
||||
.SH FILES
|
||||
.TP
|
||||
.I $SYSCONFDIR/nanorc
|
||||
System-wide configuration file
|
||||
.TP
|
||||
.I ~/.nanorc
|
||||
Per-user configuration file
|
||||
.SH SEE ALSO
|
||||
.PD 0
|
||||
.TP
|
||||
\fBnano\fP(1)
|
||||
.PP
|
||||
\fI/usr/share/doc/nano/examples/nanorc.sample\fP (or equivalent on your
|
||||
system)
|
||||
.SH AUTHOR
|
||||
Chris Allegretta <chrisa@asty.org>, et al (see
|
||||
.I AUTHORS
|
||||
and
|
||||
.I THANKS
|
||||
for details).
|
||||
This manual page was written by Jordi Mallach <jordi@gnu.org>.
|
||||
195
nanorc.5.html
Normal file
195
nanorc.5.html
Normal file
@@ -0,0 +1,195 @@
|
||||
<HTML><HEAD><TITLE>Manpage of NANORC</TITLE>
|
||||
</HEAD><BODY>
|
||||
<H1>NANORC</H1>
|
||||
Section: File Formats (5)<BR>Updated: June 19, 2003<BR><A HREF="#index">Index</A>
|
||||
<A HREF="http://localhost/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
||||
|
||||
|
||||
|
||||
<A NAME="lbAB"> </A>
|
||||
<H2>NAME</H2>
|
||||
|
||||
nanorc - GNU nano's rcfile
|
||||
<A NAME="lbAC"> </A>
|
||||
<H2>DESCRIPTION</H2>
|
||||
|
||||
This manual page documents GNU <B>nano</B>'s rcfile.
|
||||
<P>
|
||||
|
||||
<B>nano</B> is a small, free and friendly editor which aims to replace
|
||||
Pico, the default editor included in the non-free Pine package. Rather
|
||||
than just copying Pico's look and feel, <B>nano</B> also implements some
|
||||
missing (or disabled by default) features in Pico, such as "search and
|
||||
replace" and "go to line number".
|
||||
<P>
|
||||
|
||||
The <I>nanorc</I> file contains the default settings for <B>nano</B>.
|
||||
During startup, <B>nano</B> will first read its system-wide settings from
|
||||
<I>$SYSCONFDIR/nanorc</I>,
|
||||
|
||||
and then user-specific settings from
|
||||
<I>~/.nanorc</I>.
|
||||
|
||||
<P>
|
||||
<A NAME="lbAD"> </A>
|
||||
<H2>OPTIONS</H2>
|
||||
|
||||
The configuration file accepts a series of "set" and "unset" commands,
|
||||
which can be used to configure nano on startup without using the
|
||||
command-line options. Additionally, the "syntax" and "color" keywords
|
||||
are used to define syntax highlighting rules for different text patterns.
|
||||
GNU nano will read one command per line.
|
||||
<P>
|
||||
Options in rcfiles take precedence over nano's defaults, and command line
|
||||
options override rcfile settings.
|
||||
<P>
|
||||
Options are unset by default, except for options that take an argument.
|
||||
<P>
|
||||
The supported commands and arguments are:
|
||||
<P>
|
||||
<DL COMPACT>
|
||||
<DT><B>set/unset autoindent</B><DD>
|
||||
Use auto-indentation.
|
||||
<DT><B>set/unset backup</B><DD>
|
||||
Create backup files in
|
||||
<I>filename~</I>.
|
||||
|
||||
<DT><B>set/unset const</B><DD>
|
||||
Constantly display the cursor position in the status bar.
|
||||
<DT><B>set/unset cut</B><DD>
|
||||
Use cut to end of line with ^K by default.
|
||||
<DT><B>set fill </B><I>n</I><DD>
|
||||
Wrap lines at column number <I>n</I>. If <I>n</I> is 0 or less, the line
|
||||
length will be the screen width less <I>n</I>. The default value is -8.
|
||||
<DT><B>set/unset historylog</B><DD>
|
||||
Enable
|
||||
<I>~/.nano_history</I>
|
||||
|
||||
for saving and reading search/replace strings.
|
||||
<DT><B>set/unset keypad</B><DD>
|
||||
Use alternate keypad routines.
|
||||
<DT><B>set/unset multibuffer</B><DD>
|
||||
Allow inserting files into their own buffers.
|
||||
<DT><B>set/unset noconvert</B><DD>
|
||||
Don't convert files from DOS/Mac format.
|
||||
<DT><B>set/unset nofollow</B><DD>
|
||||
Don't follow symlinks when writing files.
|
||||
<DT><B>set/unset nohelp</B><DD>
|
||||
Don't display the help lists at the bottom of the screen.
|
||||
<DT><B>set/unset nowrap</B><DD>
|
||||
Don't wrap text at all.
|
||||
<DT><B>set operatingdir "</B><I>directory</I>"<DD>
|
||||
<B>nano</B> will only read and write files inside <I>directory</I> and its
|
||||
subdirectories. Also, the current directory is changed to here, so files
|
||||
are inserted from this dir. By default the operating directory feature is
|
||||
turned off.
|
||||
<DT><B>set/unset preserve</B><DD>
|
||||
Preserve the XON and XOFF keys (^Q and ^S).
|
||||
<DT><B>set quotestr "</B><I>string</I>"<DD>
|
||||
The email-quote string, used to justify email-quoted paragraphs. This is
|
||||
an "extended regular expression" if your system supports them, otherwise a
|
||||
literal string. The default value is
|
||||
<P>
|
||||
<TT> </TT>set quotestr "^([ \t]*[|>:}#])+"<BR>
|
||||
<P>
|
||||
if you have regexps, otherwise set quotestr "> ". Note that '\t'
|
||||
above stands for a literal Tab character.
|
||||
<DT><B>set/unset regexp</B><DD>
|
||||
Do regular expression searches by default.
|
||||
<DT><B>set/unset smooth</B><DD>
|
||||
Use smooth scrolling by default.
|
||||
<DT><B>set speller </B><I>spellprog</I><DD>
|
||||
Use spelling checker <I>spellprog</I> instead of the built-in one, which
|
||||
calls <I>spell</I>.
|
||||
<DT><B>set/unset suspend</B><DD>
|
||||
Allow nano to be suspended with ^Z.
|
||||
<DT><B>set tabsize </B><I>n</I><DD>
|
||||
Use a tab size of <I>n</I> instead of the default (8); must be greater
|
||||
than 0.
|
||||
<DT><B>set/unset tempfile</B><DD>
|
||||
Save automatically on exit, don't prompt.
|
||||
<DT><B>set/unset view</B><DD>
|
||||
Disallow file modification.
|
||||
<DT><B>syntax </B><I>str</I> [<I>fileregex</I> ... ]
|
||||
|
||||
<DD>
|
||||
Defines a syntax named <I>str</I> which can be activated via the
|
||||
<B>-Y</B> flag, or will be automatically activated if the current
|
||||
filename matches <I>fileregex</I>. All following <B>color</B> statements
|
||||
will apply to <I>syntax</I> until a new syntax is defined.
|
||||
<DT><B>color </B><I>fgcolor</I>[,<I>bgcolor</I>] <I>regex</I> ...
|
||||
|
||||
<DD>
|
||||
For the currently defined syntax, display all expressions matching
|
||||
<I>regex</I> with foreground color <I>fgcolor</I> and optional background
|
||||
color <I>bgcolor</I>. Legal colors for foreground and background color are:
|
||||
white, black, red, blue, green, yellow, magenta, and cyan. You may use
|
||||
the prefix "bright" to force a stronger color highlight. If your
|
||||
terminal supports transparency, not specifying a <I>bgcolor</I> tells
|
||||
<B>nano</B> to attempt to use a transparent background.
|
||||
<DT><B>color </B><I>fgcolor</I>[,<I>bgcolor</I>] start=<I>sr</I> end=<I>er</I>
|
||||
|
||||
<DD>
|
||||
Display expressions which start with <I>sr</I> and end with <I>er</I>
|
||||
with foreground color <I>fgcolor</I> and optional
|
||||
background color <I>bgcolor</I>. This allows syntax highlighting to span
|
||||
multiple lines. Note that all subsequent instances of <I>sr</I> after
|
||||
an initial <I>sr</I> is found will be highlighted until the first
|
||||
instance of <I>er</I>.
|
||||
<I>
|
||||
<P>
|
||||
</DL>
|
||||
</I><A NAME="lbAE"> </A>
|
||||
<H2>FILES</H2>
|
||||
|
||||
<DL COMPACT>
|
||||
<DT><I>$SYSCONFDIR/nanorc</I>
|
||||
|
||||
<DD>
|
||||
System-wide configuration file
|
||||
<DT><I>~/.nanorc</I>
|
||||
|
||||
<DD>
|
||||
Per-user configuration file
|
||||
</DL>
|
||||
<A NAME="lbAF"> </A>
|
||||
<H2>SEE ALSO</H2>
|
||||
|
||||
|
||||
<DL COMPACT>
|
||||
<DT><B><A HREF="http://localhost/cgi-bin/man/man2html?1+nano">nano</A></B>(1)<DD>
|
||||
</DL>
|
||||
<P>
|
||||
|
||||
<I>/usr/share/doc/nano/examples/nanorc.sample</I> (or equivalent on your
|
||||
system)
|
||||
<A NAME="lbAG"> </A>
|
||||
<H2>AUTHOR</H2>
|
||||
|
||||
Chris Allegretta <<A HREF="mailto:chrisa@asty.org">chrisa@asty.org</A>>, et al (see
|
||||
<I>AUTHORS</I>
|
||||
|
||||
and
|
||||
<I>THANKS</I>
|
||||
|
||||
for details).
|
||||
This manual page was written by Jordi Mallach <<A HREF="mailto:jordi@gnu.org">jordi@gnu.org</A>>.
|
||||
<P>
|
||||
|
||||
<HR>
|
||||
<A NAME="index"> </A><H2>Index</H2>
|
||||
<DL>
|
||||
<DT><A HREF="#lbAB">NAME</A><DD>
|
||||
<DT><A HREF="#lbAC">DESCRIPTION</A><DD>
|
||||
<DT><A HREF="#lbAD">OPTIONS</A><DD>
|
||||
<DT><A HREF="#lbAE">FILES</A><DD>
|
||||
<DT><A HREF="#lbAF">SEE ALSO</A><DD>
|
||||
<DT><A HREF="#lbAG">AUTHOR</A><DD>
|
||||
</DL>
|
||||
<HR>
|
||||
This document was created by
|
||||
<A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>,
|
||||
using the manual pages.<BR>
|
||||
Time: 22:28:00 GMT, June 19, 2003
|
||||
</BODY>
|
||||
</HTML>
|
||||
190
nanorc.sample
190
nanorc.sample
@@ -1,8 +1,12 @@
|
||||
## Sample initialization file for GNU nano
|
||||
## Please note that you must have configured nano with
|
||||
## --enable-nanorc for this file to be read!
|
||||
## Please note that you must have configured nano with --enable-nanorc
|
||||
## for this file to be read! Also note that characters specially
|
||||
## interpreted by the shell should not be escaped here.
|
||||
##
|
||||
## To make sure a value is not enabled, use "unset <option>"
|
||||
##
|
||||
## For the options that take parameters, the default value is given.
|
||||
## Other options are unset by default.
|
||||
|
||||
## Use auto-indentation
|
||||
# set autoindent
|
||||
@@ -10,23 +14,27 @@
|
||||
## Backup files to filename~
|
||||
# set backup
|
||||
|
||||
## Constantly update the cursor position
|
||||
## Constantly display the cursor position in the status bar.
|
||||
# set const
|
||||
|
||||
## Use cut to end of line with ^K by default
|
||||
# set cut
|
||||
|
||||
## Use this value instead of the default
|
||||
## An out-of-range negative value can make nano die complaining that the
|
||||
## screen is too small
|
||||
## set fill -8
|
||||
## Set the line length for wrapping text and justifying paragraphs.
|
||||
## If fill is negative, the line length will be the screen width less
|
||||
## this number.
|
||||
##
|
||||
# set fill -8
|
||||
|
||||
## Enable ~/.nano_history for saving and reading search/replace strings.
|
||||
# set historylog
|
||||
|
||||
## Use alternate keypad routines
|
||||
# set keypad
|
||||
|
||||
## Allow multiple file buffers (using ^R inserts into separate buffer)
|
||||
## Allow multiple file buffers (using ^R inserts into separate buffer).
|
||||
## You must have configured with --enable-multibuffer or --enable-extra
|
||||
## for this to work
|
||||
## for this to work.
|
||||
##
|
||||
## set multibuffer
|
||||
|
||||
@@ -42,33 +50,41 @@
|
||||
## Don't wrap text at all
|
||||
# set nowrap
|
||||
|
||||
## Set operating directory (chroot of sorts)
|
||||
# set operatingdir "~"
|
||||
## Set operating directory. nano will not read or write files outside
|
||||
## this directory and its subdirectories. Also, the current directory
|
||||
## is changed to here, so files are inserted from this dir. A blank
|
||||
## string means the operating directory feature is turned off.
|
||||
##
|
||||
# set operatingdir ""
|
||||
|
||||
## Preserve the XON and XOFF keys (^Q and ^S)
|
||||
# set preserve
|
||||
|
||||
## The email-quote string. This is a "regular expression" if your
|
||||
## system supports them, otherwise a literal string. Default
|
||||
# set quotestr "^([ \t]*[|>:}#])+" if you have regexps, otherwise
|
||||
# set quotestr "> ".
|
||||
## The email-quote string, used to justify email-quoted paragraphs.
|
||||
## This is an extended regular expression if your system supports them,
|
||||
## otherwise a literal string. Default:
|
||||
# set quotestr "^([ ]*[\|>:}#])+"
|
||||
## if you have regexps, otherwise:
|
||||
# set quotestr "> "
|
||||
## You can get old nano quoted-justify behavior via:
|
||||
# set quotestr "(> )+"
|
||||
|
||||
## Do regular expression searches by default
|
||||
## Do extended regular expression searches by default
|
||||
# set regexp
|
||||
|
||||
## Use smooth scrolling as the default
|
||||
# set smooth
|
||||
|
||||
## Use this spelling checker instead of the default one
|
||||
# set speller aspell
|
||||
## Use this spelling checker instead of the internal one. This option
|
||||
## does not properly have a default value.
|
||||
##
|
||||
# set speller "aspell -c"
|
||||
|
||||
## Allow nano to be suspended with ^Z
|
||||
# set suspend
|
||||
|
||||
## Use this tab size instead of the default; it must be greater than 0
|
||||
# set tabsize 4
|
||||
# set tabsize 8
|
||||
|
||||
## Save automatically on exit, don't prompt
|
||||
# set tempfile
|
||||
@@ -80,98 +96,116 @@
|
||||
# set view
|
||||
|
||||
## Color setup
|
||||
## Format:
|
||||
## Format:
|
||||
## syntax "short description" ["filename regex" ...]
|
||||
## color foreground,background "regex" ["regex"...]
|
||||
##
|
||||
## Legal colors are: white, black, red, blue, green, yellow, magenta,
|
||||
## cyan. You may use the prefix "bright" to mean a stronger color
|
||||
## highlight.
|
||||
## Legal colors: white, black, red, blue, green, yellow, magenta, cyan.
|
||||
## You may use the prefix "bright" to mean a stronger color highlight.
|
||||
##
|
||||
## To use multi-line regexes use the start="regex" end="regex" format.
|
||||
##
|
||||
## If your system supports transparency, not specifying a background
|
||||
## color will use a transparent color. If you don't want this, be sure
|
||||
## 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 green "\<float\>" "\<char\>" "\<int\>" "\<void\>"
|
||||
# color green "\<static\>" "\<const\>" "\<struct\>"
|
||||
# color brightyellow "\<if\>" "\<while\>" "\<do\>" "\<else\>" "\<case\>" "\<switch\>"
|
||||
# color brightcyan "#define" "#include" "#ifn*def" "#endif"
|
||||
# color brightcyan "#elif" "#else" "#if"
|
||||
|
||||
# color green "\<(float|char|int|void|static|const|struct)\>"
|
||||
# color brightyellow "\<(if|while|do|else|case|switch)\>"
|
||||
# color brightcyan "^#( )*(define|include|ifn?def|endif|elif|else|if)"
|
||||
##
|
||||
## You will in general want your comments and strings to come last,
|
||||
## because syntax highlighting rules will be applied in the order they
|
||||
## are read in. Note that quotes in regexes should not be escaped (use "
|
||||
## instead of \").
|
||||
|
||||
# color brightyellow "<[^= ]*>" ""(\\.|[^\"])*""
|
||||
|
||||
## are read in.
|
||||
##
|
||||
# color brightyellow "<[^= ]*>" ""(\\.|[^\"])*""
|
||||
##
|
||||
## This string is VERY resource intensive!!!
|
||||
# color brightyellow start=""(\\.|[^\"])*\\( | )*$" end="^(\\.|[^\"])*""
|
||||
|
||||
##
|
||||
## And we want to have some nice comment highlighting too
|
||||
# color brightblue "//.*"
|
||||
# color brightblue start="/\*" end="\*/"
|
||||
|
||||
|
||||
## Here are some short examples for TeX files and HTML
|
||||
## Here is a short example for HTML
|
||||
# syntax "HTML" "\.html$"
|
||||
#
|
||||
# color blue start="<" end=">"
|
||||
# color red "&([^; ])*;"
|
||||
#
|
||||
# color red "&[^; ]*;"
|
||||
|
||||
## Here is a short example for TeX files
|
||||
# syntax "TeX" "\.tex$"
|
||||
#
|
||||
# color green "\\(.|([A-Za-z]*))"
|
||||
# color magenta "\{" "\}"
|
||||
# color green "\\.|\\[A-Za-z]*"
|
||||
# color magenta "[{}]"
|
||||
# color blue "%.*"
|
||||
|
||||
|
||||
## For this you will probably want to set your editor to "nano -Y mutt"
|
||||
## Here is an example for quoted emails (under e.g. mutt)
|
||||
# syntax "mutt"
|
||||
# color green "^>.*"
|
||||
|
||||
|
||||
## Here is are examples for groff and for your .nanorc
|
||||
|
||||
#syntax "groff" "\.ms$" "\.mm$" "\.me$" "\.tmac$" "^tmac." ".rof"
|
||||
## Here is an example for groff
|
||||
##
|
||||
# syntax "groff" "\.ms$" "\.mm$" "\.me$" "\.tmac$" "^tmac." ".rof"
|
||||
## The argument of .nr or .ds
|
||||
#color cyan "^\.ds [^ ]*"
|
||||
#color cyan "^\.nr [^ ]*"
|
||||
# color cyan "^\.ds [^ ]*"
|
||||
# color cyan "^\.nr [^ ]*"
|
||||
## Single character escapes
|
||||
#color brightmagenta "\\."
|
||||
## Highlight the argument of \f or \s in the same colour
|
||||
#color brightmagenta "\\f."
|
||||
#color brightmagenta "\\f\(.."
|
||||
#color brightmagenta "\\s(\+|\-)?[0-9]"
|
||||
# color brightmagenta "\\."
|
||||
## Highlight the argument of \f or \s in the same color
|
||||
# color brightmagenta "\\f."
|
||||
# color brightmagenta "\\f\(.."
|
||||
# color brightmagenta "\\s(\+|\-)?[0-9]"
|
||||
## \n
|
||||
#color cyan "(\\|\\\\)n."
|
||||
#color cyan "(\\|\\\\)n\(.."
|
||||
#color cyan start="(\\|\\\\)n\[" end="]"
|
||||
# color cyan "(\\|\\\\)n."
|
||||
# color cyan "(\\|\\\\)n\(.."
|
||||
# color cyan start="(\\|\\\\)n\[" end="]"
|
||||
## Requests
|
||||
#color brightgreen "^\. *[^ ]*"
|
||||
# color brightgreen "^\. *[^ ]*"
|
||||
## Comments
|
||||
#color yellow "^\.\\\".*$"
|
||||
# color yellow "^\.\\\".*$"
|
||||
## Strings
|
||||
#color green "(\\|\\\\)\*."
|
||||
#color green "(\\|\\\\)\*\(.."
|
||||
#color green start="(\\|\\\\)\*\[" end="]"
|
||||
# color green "(\\|\\\\)\*."
|
||||
# color green "(\\|\\\\)\*\(.."
|
||||
# color green start="(\\|\\\\)\*\[" end="]"
|
||||
## Characters
|
||||
#color brightred "\\\(.."
|
||||
#color brightred start="\\\[" end="]"
|
||||
# color brightred "\\\(.."
|
||||
# color brightred start="\\\[" end="]"
|
||||
## Macro arguments
|
||||
#color brightcyan "\\\\\$[1-9]"
|
||||
# color brightcyan "\\\\\$[1-9]"
|
||||
|
||||
## Here is an example for perl
|
||||
##
|
||||
# syntax "perl" "\.p[lm]$"
|
||||
# color red "\<(accept|alarm|atan2|bin(d|mode)|c(aller|h(dir|mod|op|own|root)|lose(dir)?|onnect|os|rypt)|d(bm(close|open)|efined|elete|ie|o|ump)|e(ach|of|val|x(ec|ists|it|p))|f(cntl|ileno|lock|ork)|get(c|login|peername|pgrp|ppid|priority|pwnam|(host|net|proto|serv)byname|pwuid|grgid|(host|net)byaddr|protobynumber|servbyport)|([gs]et|end)(pw|gr|host|net|proto|serv)ent|getsock(name|opt)|gmtime|goto|grep|hex|index|int|ioctl|join|keys|kill|last|length|link|listen|local(time)?|log|lstat|m|mkdir|msg(ctl|get|snd|rcv)|next|oct|open(dir)?|ord|pack|pipe|pop|printf?|push|q|qq|qx|rand|re(ad(dir|link)?|cv|do|name|quire|set|turn|verse|winddir)|rindex|rmdir|s|scalar|seek|seekdir|se(lect|mctl|mget|mop|nd|tpgrp|tpriority|tsockopt)|shift|shm(ctl|get|read|write)|shutdown|sin|sleep|socket(pair)?|sort|spli(ce|t)|sprintf|sqrt|srand|stat|study|substr|symlink|sys(call|read|tem|write)|tell(dir)?|time|tr|y|truncate|umask|un(def|link|pack|shift)|utime|values|vec|wait(pid)?|wantarray|warn|write)\>"
|
||||
# color magenta "\<(continue|else|elsif|do|for|foreach|if|unless|until|while|eq|ne|lt|gt|le|ge|cmp|x|my|sub|use|package|can|isa)\>"
|
||||
# color cyan start="[$@%]" end="( |\\W|-)"
|
||||
# color yellow "".*"|qq\|.*\|"
|
||||
# color white "[sm]/.*/"
|
||||
# color white start="(^use| = new)" end=";"
|
||||
# color green "#.*"
|
||||
# color yellow start="<< 'STOP'" end="STOP"
|
||||
|
||||
#syntax "nanorc" "[\.]*nanorc$"
|
||||
#color white "^ *(set|unset).*$"
|
||||
#color cyan "^ *(set|unset) (autoindent|backup|const|cut|fill|keypad|multibuffer|noconvert|nofollow|nohelp|nowrap|operatingdir|preserve|quotestr|regexp|smooth|speller|suspend|tabsize|tempfile|historylog|view)"
|
||||
#color brightwhite "^ *syntax [^ ]*"
|
||||
#color brightblue "^ *set\>" "^ *unset\>" "^ *syntax\>"
|
||||
#color white "^ *color\>.*"
|
||||
#color yellow "^ *color [^ ]*"
|
||||
#color magenta "^ *color\>"
|
||||
#color green "^#.*$"
|
||||
## Here is an example for Java source
|
||||
##
|
||||
# syntax "Java source" "\.java$"
|
||||
# color green "\<(boolean|byte|char|double|float|int|long|new|short|this|transient|void)\>"
|
||||
# color red "\<(break|case|catch|continue|default|do|else|finally|for|if|return|switch|throw|try|while)\>"
|
||||
# color cyan "\<(abstract|class|extends|final|implements|import|instanceof|interface|native|package|private|protected|public|static|strictfp|super|synchronized|throws|volatile)\>"
|
||||
# color red ""[^\"]*""
|
||||
# color yellow "\<(true|false|null)\>"
|
||||
# color blue "//.*"
|
||||
# color blue start="/\*" end="\*/"
|
||||
# color brightblue start="/\*\*" end="\*/"
|
||||
# color brightgreen,brightgreen "[ ]+$"
|
||||
|
||||
## Here is an example for your .nanorc
|
||||
##
|
||||
# syntax "nanorc" "[\.]*nanorc$"
|
||||
# color white "^ *(set|unset).*$"
|
||||
# color cyan "^ *(set|unset) (autoindent|backup|const|cut|fill|keypad|multibuffer|noconvert|nofollow|nohelp|nowrap|operatingdir|preserve|quotestr|regexp|smooth|speller|suspend|tabsize|tempfile|historylog|view)"
|
||||
# color brightwhite "^ *syntax [^ ]*"
|
||||
# color brightblue "^ *set\>" "^ *unset\>" "^ *syntax\>"
|
||||
# color white "^ *color\>.*"
|
||||
# color yellow "^ *color (bright)?(white|black|red|blue|green|yellow|magenta|cyan)\>"
|
||||
# color magenta "^ *color\>"
|
||||
# color green "^#.*$"
|
||||
|
||||
113
po/ChangeLog
113
po/ChangeLog
@@ -1,3 +1,116 @@
|
||||
2003-08-05 Jordi Mallach <jordi@sindominio.net>
|
||||
|
||||
* ca.po: Updated Catalan translation.
|
||||
|
||||
2003-06-11 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* nb.po: Updated Norwegian bokmål translation by Geir Helland.
|
||||
|
||||
2003-06-10 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* fr.po: Updated French translation by Jean-Philippe Guérard.
|
||||
|
||||
2003-06-02 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* de.po: Updated German translation by Michael Piefel.
|
||||
|
||||
2003-05-06 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ms.po: Malay translation by Sharuzzaman Ahmat Raslan.
|
||||
|
||||
2003-04-24 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ro.po: New Romanian translation by Laurentiu Buzdugan.
|
||||
* id.po: Updated Indonesian translation by Tedi Heriyanto.
|
||||
* LINGUAS: Added "ro" (Romanian).
|
||||
|
||||
2003-04-12 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ms.po: Updated Malay translation by Sharuzzaman Ahmat Raslan.
|
||||
|
||||
2003-04-04 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* fr.po: Updated French translation by Jean-Philippe Guérard.
|
||||
|
||||
2003-03-17 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ms.po: Updated Malay translation by Sharuzzaman Ahmat Raslan.
|
||||
|
||||
2003-03-10 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* da.po: Updated Danish translation by Keld Simonsen.
|
||||
|
||||
2003-03-06 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ms.po: Updated Malay translation by Sharuzzaman Ahmat Raslan.
|
||||
* id.po: Updated Indonesian translation by Tedi Heriyanto.
|
||||
|
||||
2003-02-23 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* nl.po: Updated Dutch translation by Guus Sliepen.
|
||||
|
||||
2003-02-19 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* fi.po: Updated Finnish translation by Kalle Olavi Niemitalo.
|
||||
* es.po: Updated Spanish translation by Ricardo Javier Cárdenes
|
||||
Medina.
|
||||
|
||||
2003-02-17 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* de.po: Updated German translation by Michael Piefel.
|
||||
* ru.po: Updated Russian translation by Sergey A. Ribalchenko.
|
||||
* uk.po: Updated Ukrainian translation by Sergey A. Ribalchenko.
|
||||
|
||||
2003-02-16 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* gl.po: Updated Galician translation by Jacobo Tarrío.
|
||||
* fr.po: Updated French translation by Jean-Philippe Guérard.
|
||||
|
||||
2003-02-15 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* fr.po: Updated French translation by Jean-Philippe Guérard.
|
||||
* nl.po: Updated Dutch translation by Guus Sliepen.
|
||||
* sv.po: Updated Swedish translation by Christian Rose.
|
||||
* ca.po: Updated Catalan translation.
|
||||
|
||||
2003-02-13 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ru.po: Updated Russian translation from Sergey A. Ribalchenko.
|
||||
|
||||
2003-02-10 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* Makevars (XGETTEXT_OPTIONS): Added --keyword=P_:1,2.
|
||||
* update.pl: likewise.
|
||||
* fi.po: Added Plural-Forms: header.
|
||||
|
||||
2003-02-10 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* fi.po: Updated Finnish translation by Kalle Kivimaa and
|
||||
Kalle Olavi Niemitalo.
|
||||
|
||||
2003-02-08 Chris Allegretta <chrisa@asty.org>
|
||||
|
||||
* it.po: Fix broken format string in translation.
|
||||
|
||||
2003-02-08 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* it.po: Updated Italian translation by Marco Colombo.
|
||||
* gl.po: Updated Galician translation by Jacobo Tarrío.
|
||||
* es.po: Updated Spanish translation by Ricardo Javier Cárdenes
|
||||
Medina.
|
||||
|
||||
2003-02-06 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* pl.po: Updated Polish translation by Wojciech Kotwica.
|
||||
* sv.po: Updated Swedish translation by Christian Rose.
|
||||
|
||||
2003-02-04 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ca.po: Updated Catalan translation.
|
||||
* fr.po: Updated French translation by Jean-Philippe Guérard.
|
||||
* uk.po: Updated Ukrainian translation by Sergey A. Ribalchenko.
|
||||
* de.po: Updated German translation by Michael Piefel.
|
||||
|
||||
2003-01-27 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* es.po: Updated translation by Ricardo Javier Cárdenes Medina.
|
||||
|
||||
23
po/LINGUAS
23
po/LINGUAS
@@ -1,23 +1,2 @@
|
||||
# List of available languages.
|
||||
es
|
||||
de
|
||||
fr
|
||||
it
|
||||
id
|
||||
fi
|
||||
hu
|
||||
ca
|
||||
cs
|
||||
gl
|
||||
uk
|
||||
ru
|
||||
sv
|
||||
nn
|
||||
nl
|
||||
da
|
||||
pl
|
||||
nb
|
||||
ms
|
||||
pt_BR
|
||||
tr
|
||||
eu
|
||||
es de fr it id fi hu ca cs gl uk ru sv nn nl da pl nb ms pt_BR tr eu ro
|
||||
|
||||
@@ -8,7 +8,7 @@ subdir = po
|
||||
top_builddir = ..
|
||||
|
||||
# These options get passed to xgettext.
|
||||
XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
|
||||
XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ --keyword=P_:1,2
|
||||
|
||||
# This is the copyright holder that gets inserted into the header of the
|
||||
# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
|
||||
|
||||
718
po/nano.pot
718
po/nano.pot
File diff suppressed because it is too large
Load Diff
811
po/pt_BR.po
811
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
@@ -293,7 +293,7 @@ sub GeneratePot{
|
||||
close INFILE;
|
||||
|
||||
$GETTEXT ="xgettext --default-domain\=$PACKAGE --directory\=\.\."
|
||||
." --add-comments --keyword\=\_ --keyword\=N\_"
|
||||
." --add-comments --keyword\=\_ --keyword\=N\_ --keyword\=P_\:1,2"
|
||||
." --files-from\=\.\/POTFILES\.in ";
|
||||
$GTEST ="test \! -f $PACKAGE\.po \|\| \( rm -f \.\/$PACKAGE\.pot "
|
||||
."&& mv $PACKAGE\.po \.\/$PACKAGE\.pot \)";
|
||||
|
||||
27
proto.h
27
proto.h
@@ -65,6 +65,7 @@ extern char *full_operating_dir;
|
||||
extern char *alt_speller;
|
||||
#endif
|
||||
|
||||
extern int resetstatuspos;
|
||||
extern struct stat fileinfo;
|
||||
extern filestruct *current, *fileage, *edittop, *editbot, *filebot;
|
||||
extern filestruct *cutbuffer;
|
||||
@@ -86,18 +87,25 @@ extern shortcut *shortcut_list;
|
||||
extern shortcut *main_list, *whereis_list;
|
||||
extern shortcut *replace_list, *goto_list;
|
||||
extern shortcut *writefile_list, *insertfile_list;
|
||||
extern shortcut *spell_list, *replace_list_2;
|
||||
extern shortcut *replace_list_2;
|
||||
#ifndef NANO_SMALL
|
||||
extern shortcut *extcmd_list;
|
||||
#endif
|
||||
#ifndef DISABLE_HELP
|
||||
extern shortcut *help_list;
|
||||
#endif
|
||||
#ifndef DISABLE_SPELLER
|
||||
extern shortcut *spell_list;
|
||||
#endif
|
||||
#ifndef DISABLE_BROWSER
|
||||
extern shortcut *browser_list, *gotodir_list;
|
||||
#endif
|
||||
|
||||
#if !defined(DISABLE_BROWSER) || !defined(DISABLE_HELP) || (!defined(DISABLE_MOUSE) && defined(NCURSES_MOUSE_VERSION))
|
||||
extern const shortcut *currshortcut;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
extern int use_regexp, regexp_compiled;
|
||||
extern regex_t search_regexp;
|
||||
extern regmatch_t regmatches[10];
|
||||
#ifdef ENABLE_COLOR
|
||||
@@ -253,7 +261,6 @@ int no_help(void);
|
||||
#if defined(DISABLE_JUSTIFY) || defined(DISABLE_SPELLER) || defined(DISABLE_HELP) || defined(NANO_SMALL)
|
||||
void nano_disabled_msg(void);
|
||||
#endif
|
||||
void do_preserve_msg(void);
|
||||
#ifndef NANO_SMALL
|
||||
RETSIGTYPE cancel_fork(int signal);
|
||||
int open_pipe(const char *command);
|
||||
@@ -359,7 +366,6 @@ char *replace_line(void);
|
||||
int do_replace_loop(const char *prevanswer, const filestruct *begin,
|
||||
int *beginx, int wholewords, int *i);
|
||||
int do_replace(void);
|
||||
void goto_abort(void);
|
||||
int do_gotoline(int line, int save_pos);
|
||||
int do_gotoline_void(void);
|
||||
#if defined (ENABLE_MULTIBUFFER) || !defined (DISABLE_SPELLER)
|
||||
@@ -383,12 +389,22 @@ void save_history(void);
|
||||
#endif
|
||||
|
||||
/* Public functions in utils.c */
|
||||
#ifdef BROKEN_REGEXEC
|
||||
int regexec_safe(const regex_t *preg, const char *string, size_t nmatch,
|
||||
regmatch_t pmatch[], int eflags);
|
||||
#endif
|
||||
int is_cntrl_char(int c);
|
||||
int num_of_digits(int n);
|
||||
void align(char **strp);
|
||||
void null_at(char **data, size_t index);
|
||||
void unsunder(char *str, size_t true_len);
|
||||
void sunder(char *str);
|
||||
#ifndef HAVE_STRCASECMP
|
||||
int nstricmp(const char *s1, const char *s2);
|
||||
#endif
|
||||
#ifndef HAVE_STRNCASECMP
|
||||
int nstrnicmp(const char *s1, const char *s2, size_t n);
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
const char *revstrstr(const char *haystack, const char *needle,
|
||||
const char *rev_start);
|
||||
@@ -430,7 +446,7 @@ int nanogetstr(int allowtabs, const char *buf, const char *def,
|
||||
#ifndef DISABLE_TABCOMP
|
||||
, int *list
|
||||
#endif
|
||||
, int resetpos);
|
||||
);
|
||||
void set_modified(void);
|
||||
void titlebar(const char *path);
|
||||
void bottombars(const shortcut *s);
|
||||
@@ -464,6 +480,7 @@ void display_main_list(void);
|
||||
void statusbar(const char *msg, ...);
|
||||
int do_cursorpos(int constant);
|
||||
int do_cursorpos_void(void);
|
||||
int line_len(const char *ptr);
|
||||
int do_help(void);
|
||||
int keypad_on(WINDOW *win, int newval);
|
||||
void do_replace_highlight(int highlight_flag, const char *word);
|
||||
|
||||
57
rcfile.c
57
rcfile.c
@@ -215,10 +215,10 @@ int colortoint(const char *colorname, int *bright)
|
||||
rcfile_error(_("color %s not understood.\n"
|
||||
"Valid colors are \"green\", \"red\", \"blue\", \n"
|
||||
"\"white\", \"yellow\", \"cyan\", \"magenta\" and \n"
|
||||
"\"black\", with the optional prefix \"bright\".\n"));
|
||||
exit(1);
|
||||
"\"black\", with the optional prefix \"bright\".\n"),
|
||||
colorname);
|
||||
mcolor = -1;
|
||||
}
|
||||
|
||||
return mcolor;
|
||||
}
|
||||
|
||||
@@ -295,7 +295,7 @@ void parse_syntax(char *ptr)
|
||||
tmpsyntax->next = (syntaxtype *)nmalloc(sizeof(syntaxtype));
|
||||
tmpsyntax = tmpsyntax->next;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("Adding new syntax after 1st\n"));
|
||||
fprintf(stderr, "Adding new syntax after 1st\n");
|
||||
#endif
|
||||
}
|
||||
tmpsyntax->desc = mallocstrcpy(NULL, nameptr);
|
||||
@@ -303,7 +303,7 @@ void parse_syntax(char *ptr)
|
||||
tmpsyntax->extensions = NULL;
|
||||
tmpsyntax->next = NULL;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("Starting a new syntax type\n"));
|
||||
fprintf(stderr, "Starting a new syntax type\n");
|
||||
fprintf(stderr, "string val=%s\n", nameptr);
|
||||
#endif
|
||||
|
||||
@@ -361,6 +361,10 @@ void parse_colors(char *ptr)
|
||||
|
||||
fg = colortoint(fgstr, &bright);
|
||||
|
||||
/* Don't try and parse screwed up fg colors */
|
||||
if (fg == -1)
|
||||
return;
|
||||
|
||||
if (syntaxes == NULL) {
|
||||
rcfile_error(_("Cannot add a color directive without a syntax line"));
|
||||
return;
|
||||
@@ -413,7 +417,7 @@ void parse_colors(char *ptr)
|
||||
if (tmpsyntax->color == NULL) {
|
||||
tmpsyntax->color = newcolor;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("Starting a new colorstring for fg %d bg %d\n"),
|
||||
fprintf(stderr, "Starting a new colorstring for fg %d bg %d\n",
|
||||
fg, bg);
|
||||
#endif
|
||||
} else {
|
||||
@@ -421,7 +425,7 @@ void parse_colors(char *ptr)
|
||||
tmpcolor = tmpcolor->next)
|
||||
;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("Adding new entry for fg %d bg %d\n"), fg, bg);
|
||||
fprintf(stderr, "Adding new entry for fg %d bg %d\n", fg, bg);
|
||||
#endif
|
||||
tmpcolor->next = newcolor;
|
||||
}
|
||||
@@ -479,7 +483,7 @@ void parse_rcfile(FILE *rcstream)
|
||||
|
||||
if (*ptr == '#') {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("%s: Read a comment\n"), "parse_rcfile()");
|
||||
fprintf(stderr, "%s: Read a comment\n", "parse_rcfile()");
|
||||
#endif
|
||||
continue; /* Skip past commented lines */
|
||||
}
|
||||
@@ -514,7 +518,7 @@ void parse_rcfile(FILE *rcstream)
|
||||
for (i = 0; rcopts[i].name != NULL; i++) {
|
||||
if (!strcasecmp(option, rcopts[i].name)) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("%s: Parsing option %s\n"),
|
||||
fprintf(stderr, "%s: Parsing option %s\n",
|
||||
"parse_rcfile()", rcopts[i].name);
|
||||
#endif
|
||||
if (set == 1) {
|
||||
@@ -591,13 +595,13 @@ void parse_rcfile(FILE *rcstream)
|
||||
} else
|
||||
SET(rcopts[i].flag);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("set flag %d!\n"),
|
||||
fprintf(stderr, "set flag %d!\n",
|
||||
rcopts[i].flag);
|
||||
#endif
|
||||
} else {
|
||||
UNSET(rcopts[i].flag);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("unset flag %d!\n"),
|
||||
fprintf(stderr, "unset flag %d!\n",
|
||||
rcopts[i].flag);
|
||||
#endif
|
||||
}
|
||||
@@ -618,6 +622,7 @@ void do_rcfile(void)
|
||||
FILE *rcstream;
|
||||
const struct passwd *userage;
|
||||
uid_t euid = geteuid();
|
||||
char *homenv = getenv("HOME");
|
||||
|
||||
#ifdef SYSCONFDIR
|
||||
assert(sizeof(SYSCONFDIR) == strlen(SYSCONFDIR) + 1);
|
||||
@@ -631,20 +636,27 @@ void do_rcfile(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Determine home directory using getpwent(), don't rely on $HOME */
|
||||
do {
|
||||
userage = getpwent();
|
||||
} while (userage != NULL && userage->pw_uid != euid);
|
||||
endpwent();
|
||||
|
||||
lineno = 0;
|
||||
|
||||
if (userage == NULL) {
|
||||
rcfile_error(_("I can't find my home directory! Wah!"));
|
||||
SET(NO_RCFILE);
|
||||
/* Rely on $HOME, fall back on getpwuid() */
|
||||
if (homenv != NULL) {
|
||||
nanorc = charealloc(nanorc, strlen(homenv) + 10);
|
||||
sprintf(nanorc, "%s/.nanorc", homenv);
|
||||
} else {
|
||||
nanorc = nrealloc(nanorc, strlen(userage->pw_dir) + 9);
|
||||
sprintf(nanorc, "%s/.nanorc", userage->pw_dir);
|
||||
userage = getpwuid(euid);
|
||||
endpwent();
|
||||
|
||||
if (userage == NULL) {
|
||||
rcfile_error(_("I can't find my home directory! Wah!"));
|
||||
SET(NO_RCFILE);
|
||||
} else {
|
||||
nanorc = charealloc(nanorc, strlen(userage->pw_dir) + 9);
|
||||
sprintf(nanorc, "%s/.nanorc", userage->pw_dir);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!ISSET(NO_RCFILE)) {
|
||||
|
||||
#if defined(DISABLE_ROOTWRAP) && !defined(DISABLE_WRAPPING)
|
||||
/* If we've already read $SYSCONFDIR/nanorc (if it's there), we're
|
||||
@@ -664,6 +676,7 @@ void do_rcfile(void)
|
||||
fclose(rcstream);
|
||||
}
|
||||
}
|
||||
lineno = 0;
|
||||
|
||||
free(nanorc);
|
||||
#ifdef ENABLE_COLOR
|
||||
|
||||
29
search.c
29
search.c
@@ -67,7 +67,6 @@ void not_found_msg(const char *str)
|
||||
|
||||
void search_abort(void)
|
||||
{
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
display_main_list();
|
||||
wrefresh(bottomwin);
|
||||
if (ISSET(MARK_ISSET))
|
||||
@@ -758,31 +757,30 @@ int do_replace(void)
|
||||
edit_update(current, CENTER);
|
||||
|
||||
if (numreplaced >= 0)
|
||||
statusbar(__("Replaced %d occurrence", "Replaced %d occurrences",
|
||||
statusbar(P_("Replaced %d occurrence", "Replaced %d occurrences",
|
||||
numreplaced), numreplaced);
|
||||
else
|
||||
not_found_msg(prevanswer);
|
||||
|
||||
free(prevanswer);
|
||||
replace_abort();
|
||||
return 1;
|
||||
}
|
||||
|
||||
void goto_abort(void)
|
||||
{
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
display_main_list();
|
||||
}
|
||||
|
||||
int do_gotoline(int line, int save_pos)
|
||||
{
|
||||
if (line <= 0) { /* Ask for it */
|
||||
if (statusq(0, goto_list, (line ? answer : ""),
|
||||
int st = statusq(FALSE, goto_list, line != 0 ? answer : "",
|
||||
#ifndef NANO_SMALL
|
||||
0,
|
||||
NULL,
|
||||
#endif
|
||||
_("Enter line number"))) {
|
||||
_("Enter line number"));
|
||||
|
||||
/* Cancel, or Enter with blank string. */
|
||||
if (st == -1 || st == -2)
|
||||
statusbar(_("Aborted"));
|
||||
goto_abort();
|
||||
if (st != 0) {
|
||||
display_main_list();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -791,7 +789,7 @@ int do_gotoline(int line, int save_pos)
|
||||
/* Bounds check */
|
||||
if (line <= 0) {
|
||||
statusbar(_("Come on, be reasonable"));
|
||||
goto_abort();
|
||||
display_main_list();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -808,7 +806,7 @@ int do_gotoline(int line, int save_pos)
|
||||
else
|
||||
edit_update(current, CENTER);
|
||||
placewewant = 0;
|
||||
goto_abort();
|
||||
display_main_list();
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -904,6 +902,7 @@ int do_find_bracket(void)
|
||||
statusbar(_("No matching bracket"));
|
||||
current_x = current_x_save;
|
||||
current = current_save;
|
||||
update_line(current, current_x);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -961,7 +960,7 @@ void insert_node(historytype *h, const char *s)
|
||||
{
|
||||
historytype *a;
|
||||
|
||||
a = nmalloc(sizeof(historytype));
|
||||
a = (historytype *)nmalloc(sizeof(historytype));
|
||||
a->next = h->next;
|
||||
a->prev = h->next->prev;
|
||||
h->next->prev = a;
|
||||
|
||||
52
utils.c
52
utils.c
@@ -30,6 +30,18 @@
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
#ifdef BROKEN_REGEXEC
|
||||
#undef regexec
|
||||
int regexec_safe(const regex_t *preg, const char *string, size_t nmatch,
|
||||
regmatch_t pmatch[], int eflags)
|
||||
{
|
||||
if (string != NULL && *string != '\0')
|
||||
return regexec(preg, string, nmatch, pmatch, eflags);
|
||||
return REG_NOMATCH;
|
||||
}
|
||||
#define regexec(preg, string, nmatch, pmatch, eflags) regexec_safe(preg, string, nmatch, pmatch, eflags)
|
||||
#endif
|
||||
|
||||
int is_cntrl_char(int c)
|
||||
{
|
||||
return (-128 <= c && c < -96) || (0 <= c && c < 32) ||
|
||||
@@ -54,15 +66,16 @@ int num_of_digits(int n)
|
||||
/* Fix the memory allocation for a string. */
|
||||
void align(char **strp)
|
||||
{
|
||||
if (strp != NULL)
|
||||
*strp = nrealloc(*strp, strlen(*strp) + 1);
|
||||
assert(strp != NULL);
|
||||
if (*strp != NULL)
|
||||
*strp = charealloc(*strp, strlen(*strp) + 1);
|
||||
}
|
||||
|
||||
/* Null a string at a certain index and align it. */
|
||||
void null_at(char **data, size_t index)
|
||||
{
|
||||
assert(data != NULL);
|
||||
*data = (char *)nrealloc(*data, sizeof(char) * (index + 1));
|
||||
*data = charealloc(*data, index + 1);
|
||||
(*data)[index] = '\0';
|
||||
}
|
||||
|
||||
@@ -86,6 +99,37 @@ void sunder(char *str)
|
||||
*str = '\0';
|
||||
}
|
||||
|
||||
#ifndef HAVE_STRCASECMP
|
||||
/* This function is equivalent to strcasecmp(). */
|
||||
int nstricmp(const char *s1, const char *s2)
|
||||
{
|
||||
assert(s1 != NULL && s2 != NULL);
|
||||
for (; *s1 != '\0' && *s2 != '\0'; s1++, s2++) {
|
||||
if (tolower(*s1) != tolower(*s2))
|
||||
break;
|
||||
}
|
||||
return (tolower(*s1) - tolower(*s2));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRNCASECMP
|
||||
/* This function is equivalent to strncasecmp(). */
|
||||
int nstrnicmp(const char *s1, const char *s2, size_t n)
|
||||
{
|
||||
assert(s1 != NULL && s2 != NULL);
|
||||
for (; n > 0 && *s1 != '\0' && *s2 != '\0'; n--, s1++, s2++) {
|
||||
if (tolower(*s1) != tolower(*s2))
|
||||
break;
|
||||
}
|
||||
if (n > 0)
|
||||
return (tolower(*s1) - tolower(*s2));
|
||||
else if (n == 0)
|
||||
return 0;
|
||||
else if (n < 0)
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* None of this is needed if we're using NANO_SMALL! */
|
||||
#ifndef NANO_SMALL
|
||||
const char *revstrstr(const char *haystack, const char *needle,
|
||||
@@ -247,7 +291,7 @@ char *mallocstrcpy(char *dest, const char *src)
|
||||
/* Append a new magic-line to filebot. */
|
||||
void new_magicline(void)
|
||||
{
|
||||
filebot->next = nmalloc(sizeof(filestruct));
|
||||
filebot->next = (filestruct *)nmalloc(sizeof(filestruct));
|
||||
filebot->next->data = charalloc(1);
|
||||
filebot->next->data[0] = '\0';
|
||||
filebot->next->prev = filebot;
|
||||
|
||||
221
winio.c
221
winio.c
@@ -87,7 +87,7 @@ size_t actual_x(const filestruct *fileptr, size_t xplus)
|
||||
i--;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("actual_x for xplus=%d returns %d\n"), xplus, i);
|
||||
fprintf(stderr, "actual_x for xplus=%d returns %d\n", xplus, i);
|
||||
#endif
|
||||
|
||||
return i;
|
||||
@@ -194,7 +194,7 @@ int nanogetstr(int allowtabs, const char *buf, const char *def,
|
||||
#ifndef DISABLE_TABCOMP
|
||||
, int *list
|
||||
#endif
|
||||
, int resetpos)
|
||||
)
|
||||
{
|
||||
int kbinput;
|
||||
static int x = -1;
|
||||
@@ -210,7 +210,15 @@ int nanogetstr(int allowtabs, const char *buf, const char *def,
|
||||
char *history = NULL;
|
||||
char *currentbuf = NULL;
|
||||
char *complete = NULL;
|
||||
int last_kbinput = 0, ret2cb = 0;
|
||||
int last_kbinput = 0;
|
||||
|
||||
/* This variable is used in the search history code. use_cb == 0
|
||||
means that we're using the existing history and ignoring
|
||||
currentbuf. use_cb == 1 means that the entry in answer should be
|
||||
moved to currentbuf or restored from currentbuf to answer.
|
||||
use_cb == 2 means that the entry in currentbuf should be moved to
|
||||
answer or restored from answer to currentbuf. */
|
||||
int use_cb = 0;
|
||||
#endif
|
||||
xend = strlen(def);
|
||||
|
||||
@@ -218,10 +226,10 @@ int nanogetstr(int allowtabs, const char *buf, const char *def,
|
||||
it would be past the end of the string as it is. Otherwise,
|
||||
leave it alone. This is so the cursor position stays at the same
|
||||
place if a prompt-changing toggle is pressed. */
|
||||
if (x == -1 || x > xend || resetpos)
|
||||
if (x == -1 || x > xend || resetstatuspos)
|
||||
x = xend;
|
||||
|
||||
answer = (char *)nrealloc(answer, xend + 1);
|
||||
answer = charealloc(answer, xend + 1);
|
||||
if (xend > 0)
|
||||
strcpy(answer, def);
|
||||
else
|
||||
@@ -242,7 +250,7 @@ int nanogetstr(int allowtabs, const char *buf, const char *def,
|
||||
while ((kbinput = wgetch(bottomwin)) != 13) {
|
||||
for (t = s; t != NULL; t = t->next) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("Aha! \'%c\' (%d)\n"), kbinput, kbinput);
|
||||
fprintf(stderr, "Aha! \'%c\' (%d)\n", kbinput, kbinput);
|
||||
#endif
|
||||
|
||||
if (kbinput == t->val && kbinput < 32) {
|
||||
@@ -256,10 +264,6 @@ int nanogetstr(int allowtabs, const char *buf, const char *def,
|
||||
}
|
||||
#endif
|
||||
|
||||
/* We canceled putting in an answer; reset x */
|
||||
if (kbinput == NANO_CANCEL_KEY)
|
||||
x = -1;
|
||||
|
||||
return t->val;
|
||||
}
|
||||
}
|
||||
@@ -362,18 +366,37 @@ int nanogetstr(int allowtabs, const char *buf, const char *def,
|
||||
case KEY_UP:
|
||||
case NANO_UP_KEY:
|
||||
#ifndef NANO_SMALL
|
||||
do_upkey:
|
||||
if (history_list != NULL) {
|
||||
|
||||
/* If there's no previous temp holder, or if we already
|
||||
arrowed back down to it and (possibly edited it),
|
||||
update the holder */
|
||||
if (currentbuf == NULL || (ret2cb == 1 && strcmp(currentbuf, answer))) {
|
||||
/* if currentbuf is NULL, or if use_cb is 1, currentbuf
|
||||
isn't NULL, and currentbuf is different from answer,
|
||||
it means that we're scrolling up at the top of the
|
||||
search history, and we need to save the current
|
||||
answer in currentbuf; do this and reset use_cb to
|
||||
0 */
|
||||
if (currentbuf == NULL || (use_cb == 1 && strcmp(currentbuf, answer))) {
|
||||
currentbuf = mallocstrcpy(currentbuf, answer);
|
||||
ret2cb = 0;
|
||||
use_cb = 0;
|
||||
}
|
||||
|
||||
/* get older search from the history list */
|
||||
if ((history = get_history_older(history_list)) != NULL) {
|
||||
/* if currentbuf isn't NULL, use_cb is 2, and currentbuf
|
||||
is different from answer, it means that we're
|
||||
scrolling up at the bottom of the search history, and
|
||||
we need to make the string in currentbuf the current
|
||||
answer; do this, blow away currentbuf since we don't
|
||||
need it anymore, and reset use_cb to 0 */
|
||||
if (currentbuf != NULL && use_cb == 2 && strcmp(currentbuf, answer)) {
|
||||
answer = mallocstrcpy(answer, currentbuf);
|
||||
free(currentbuf);
|
||||
currentbuf = NULL;
|
||||
xend = strlen(answer);
|
||||
use_cb = 0;
|
||||
|
||||
/* else get older search from the history list and save
|
||||
it in answer; if there is no older search, blank out
|
||||
answer */
|
||||
} else if ((history = get_history_older(history_list)) != NULL) {
|
||||
answer = mallocstrcpy(answer, history);
|
||||
xend = strlen(history);
|
||||
} else {
|
||||
@@ -387,23 +410,43 @@ int nanogetstr(int allowtabs, const char *buf, const char *def,
|
||||
case KEY_DOWN:
|
||||
case NANO_DOWN_KEY:
|
||||
#ifndef NANO_SMALL
|
||||
do_downkey:
|
||||
if (history_list != NULL) {
|
||||
/* get newer search from the history list */
|
||||
|
||||
/* get newer search from the history list and save it
|
||||
in answer */
|
||||
if ((history = get_history_newer(history_list)) != NULL) {
|
||||
answer = mallocstrcpy(answer, history);
|
||||
xend = strlen(history);
|
||||
|
||||
/* else if we ran out of history, regurgitate the temporary
|
||||
buffer and blow away currentbuf */
|
||||
} else if (currentbuf != NULL) {
|
||||
/* if there is no newer search, we're here */
|
||||
|
||||
/* if currentbuf isn't NULL and use_cb isn't 2, it means
|
||||
that we're scrolling down at the bottom of the search
|
||||
history and we need to make the string in currentbuf
|
||||
the current answer; do this, blow away currentbuf
|
||||
since we don't need it anymore, and set use_cb to
|
||||
1 */
|
||||
} else if (currentbuf != NULL && use_cb != 2) {
|
||||
answer = mallocstrcpy(answer, currentbuf);
|
||||
free(currentbuf);
|
||||
currentbuf = NULL;
|
||||
xend = strlen(answer);
|
||||
ret2cb = 1;
|
||||
} else {
|
||||
answer = mallocstrcpy(answer, "");
|
||||
use_cb = 1;
|
||||
|
||||
/* otherwise, if currentbuf is NULL and use_cb isn't 2,
|
||||
it means that we're scrolling down at the bottom of
|
||||
the search history and the current answer (if it's
|
||||
not blank) needs to be saved in currentbuf; do this,
|
||||
blank out answer (if necessary), and set use_cb to
|
||||
2 */
|
||||
} else if (use_cb != 2) {
|
||||
if (answer[0] != '\0') {
|
||||
currentbuf = mallocstrcpy(currentbuf, answer);
|
||||
answer = mallocstrcpy(answer, "");
|
||||
}
|
||||
xend = 0;
|
||||
use_cb = 2;
|
||||
}
|
||||
x = xend;
|
||||
}
|
||||
@@ -425,6 +468,18 @@ int nanogetstr(int allowtabs, const char *buf, const char *def,
|
||||
break;
|
||||
case '[':
|
||||
switch (kbinput = wgetch(edit)) {
|
||||
case 'A':
|
||||
#ifndef NANO_SMALL
|
||||
goto do_upkey;
|
||||
#else
|
||||
break;
|
||||
#endif
|
||||
case 'B':
|
||||
#ifndef NANO_SMALL
|
||||
goto do_downkey;
|
||||
#else
|
||||
break;
|
||||
#endif
|
||||
case 'C':
|
||||
if (x < xend)
|
||||
x++;
|
||||
@@ -433,6 +488,12 @@ int nanogetstr(int allowtabs, const char *buf, const char *def,
|
||||
if (x > 0)
|
||||
x--;
|
||||
break;
|
||||
case 'F':
|
||||
x = xend;
|
||||
break;
|
||||
case 'H':
|
||||
x = 0;
|
||||
break;
|
||||
case '1':
|
||||
case '7':
|
||||
x = 0;
|
||||
@@ -460,7 +521,7 @@ int nanogetstr(int allowtabs, const char *buf, const char *def,
|
||||
|
||||
for (t = s; t != NULL; t = t->next) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("Aha! \'%c\' (%d)\n"), kbinput,
|
||||
fprintf(stderr, "Aha! \'%c\' (%d)\n", kbinput,
|
||||
kbinput);
|
||||
#endif
|
||||
if (kbinput == t->val || kbinput == t->val - 32)
|
||||
@@ -476,14 +537,14 @@ int nanogetstr(int allowtabs, const char *buf, const char *def,
|
||||
default:
|
||||
if (kbinput < 32)
|
||||
break;
|
||||
answer = nrealloc(answer, xend + 2);
|
||||
answer = charealloc(answer, xend + 2);
|
||||
memmove(answer + x + 1, answer + x, xend - x + 1);
|
||||
xend++;
|
||||
answer[x] = kbinput;
|
||||
x++;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("input \'%c\' (%d)\n"), kbinput, kbinput);
|
||||
fprintf(stderr, "input \'%c\' (%d)\n", kbinput, kbinput);
|
||||
#endif
|
||||
} /* switch (kbinput) */
|
||||
#ifndef NANO_SMALL
|
||||
@@ -840,7 +901,6 @@ void edit_add(const filestruct *fileptr, int yval, int start
|
||||
if (paintlen == COLS)
|
||||
goto skip_step_two;
|
||||
|
||||
|
||||
step_two: /* Second step, we look for starts on this line. */
|
||||
start_col = 0;
|
||||
while (start_col < start + COLS) {
|
||||
@@ -1052,7 +1112,7 @@ void update_cursor(void)
|
||||
int i = 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("Moved to (%d, %d) in edit buffer\n"), current_y,
|
||||
fprintf(stderr, "Moved to (%d, %d) in edit buffer\n", current_y,
|
||||
current_x);
|
||||
#endif
|
||||
|
||||
@@ -1166,8 +1226,6 @@ int statusq(int tabs, const shortcut *s, const char *def,
|
||||
#ifndef DISABLE_TABCOMP
|
||||
int list = 0;
|
||||
#endif
|
||||
static int resetpos = 0; /* Do we need to scrap the cursor position
|
||||
on the statusbar? */
|
||||
|
||||
bottombars(s);
|
||||
|
||||
@@ -1184,29 +1242,28 @@ int statusq(int tabs, const shortcut *s, const char *def,
|
||||
#ifndef DISABLE_TABCOMP
|
||||
, &list
|
||||
#endif
|
||||
, resetpos);
|
||||
);
|
||||
free(foo);
|
||||
resetpos = 0;
|
||||
resetstatuspos = 0;
|
||||
|
||||
switch (ret) {
|
||||
case NANO_FIRSTLINE_KEY:
|
||||
do_first_line();
|
||||
resetpos = 1;
|
||||
resetstatuspos = 1;
|
||||
break;
|
||||
case NANO_LASTLINE_KEY:
|
||||
do_last_line();
|
||||
resetpos = 1;
|
||||
resetstatuspos = 1;
|
||||
break;
|
||||
case NANO_CANCEL_KEY:
|
||||
ret = -1;
|
||||
resetpos = 1;
|
||||
resetstatuspos = 1;
|
||||
break;
|
||||
default:
|
||||
blank_statusbar();
|
||||
}
|
||||
blank_statusbar();
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("I got \"%s\"\n"), answer);
|
||||
fprintf(stderr, "I got \"%s\"\n", answer);
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_TABCOMP
|
||||
@@ -1284,13 +1341,13 @@ int do_yesno(int all, int leavecursor, const char *msg, ...)
|
||||
|
||||
do {
|
||||
int kbinput = wgetch(edit);
|
||||
#ifndef DISABLE_MOUSE
|
||||
#if !defined(DISABLE_MOUSE) && defined(NCURSES_MOUSE_VERSION)
|
||||
MEVENT mevent;
|
||||
#endif
|
||||
|
||||
if (kbinput == NANO_CONTROL_C)
|
||||
ok = -1;
|
||||
#ifndef DISABLE_MOUSE
|
||||
#if !defined(DISABLE_MOUSE) && defined(NCURSES_MOUSE_VERSION)
|
||||
/* Look ma! We get to duplicate lots of code from do_mouse!! */
|
||||
else if (kbinput == KEY_MOUSE && getmouse(&mevent) != ERR &&
|
||||
wenclose(bottomwin, mevent.y, mevent.x) &&
|
||||
@@ -1458,12 +1515,38 @@ int do_cursorpos_void(void)
|
||||
return do_cursorpos(0);
|
||||
}
|
||||
|
||||
/* Calculate the next line of help_text, starting at ptr. */
|
||||
int line_len(const char *ptr)
|
||||
{
|
||||
int j = 0;
|
||||
|
||||
while (*ptr != '\n' && *ptr != '\0' && j < COLS - 5) {
|
||||
ptr++;
|
||||
j++;
|
||||
}
|
||||
if (j == COLS - 5) {
|
||||
/* Don't wrap at the first of two spaces following a period. */
|
||||
if (*ptr == ' ' && *(ptr + 1) == ' ')
|
||||
j++;
|
||||
/* Don't print half a word if we've run out of space */
|
||||
while (*ptr != ' ' && j > 0) {
|
||||
ptr--;
|
||||
j--;
|
||||
}
|
||||
/* Word longer than COLS - 5 chars just gets broken */
|
||||
if (j == 0)
|
||||
j = COLS - 5;
|
||||
}
|
||||
assert(j >= 0 && j <= COLS - 4 && (j > 0 || *ptr == '\n'));
|
||||
return j;
|
||||
}
|
||||
|
||||
/* Our shortcut-list-compliant help function, which is
|
||||
* better than nothing, and dynamic! */
|
||||
int do_help(void)
|
||||
{
|
||||
#ifndef DISABLE_HELP
|
||||
int i, j, row = 0, page = 1, kbinput = 0, no_more = 0, kp, kp2;
|
||||
int i, page = 0, kbinput = 0, no_more = 0, kp;
|
||||
int no_help_flag = 0;
|
||||
const shortcut *oldshortcut;
|
||||
|
||||
@@ -1481,7 +1564,6 @@ int do_help(void)
|
||||
currshortcut = help_list;
|
||||
|
||||
kp = keypad_on(edit, 1);
|
||||
kp2 = keypad_on(bottomwin, 1);
|
||||
|
||||
if (ISSET(NO_HELP)) {
|
||||
|
||||
@@ -1513,19 +1595,15 @@ int do_help(void)
|
||||
case '5': /* Alt-[-5 = Page Up */
|
||||
wgetch(edit);
|
||||
goto do_pageupkey;
|
||||
break;
|
||||
case 'V': /* Alt-[-V = Page Up in Hurd Console */
|
||||
case 'I': /* Alt-[-I = Page Up - FreeBSD Console */
|
||||
goto do_pageupkey;
|
||||
break;
|
||||
case '6': /* Alt-[-6 = Page Down */
|
||||
wgetch(edit);
|
||||
goto do_pagedownkey;
|
||||
break;
|
||||
case 'U': /* Alt-[-U = Page Down in Hurd Console */
|
||||
case 'G': /* Alt-[-G = Page Down - FreeBSD Console */
|
||||
goto do_pagedownkey;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1543,7 +1621,7 @@ int do_help(void)
|
||||
case NANO_PREVPAGE_FKEY:
|
||||
case KEY_PPAGE:
|
||||
do_pageupkey:
|
||||
if (page > 1) {
|
||||
if (page > 0) {
|
||||
no_more = 0;
|
||||
blank_edit();
|
||||
page--;
|
||||
@@ -1552,43 +1630,21 @@ int do_help(void)
|
||||
}
|
||||
|
||||
/* Calculate where in the text we should be, based on the page */
|
||||
for (i = 1; i < page; i++) {
|
||||
row = 0;
|
||||
j = 0;
|
||||
|
||||
while (row < editwinrows - 2 && *ptr != '\0') {
|
||||
if (*ptr == '\n' || j == COLS - 5) {
|
||||
j = 0;
|
||||
row++;
|
||||
}
|
||||
for (i = 1; i < page * (editwinrows - 1); i++) {
|
||||
ptr += line_len(ptr);
|
||||
if (*ptr == '\n')
|
||||
ptr++;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
i = 0;
|
||||
j = 0;
|
||||
while (i < editwinrows && *ptr != '\0') {
|
||||
const char *end = ptr;
|
||||
while (*end != '\n' && *end != '\0' && j != COLS - 5) {
|
||||
end++;
|
||||
j++;
|
||||
}
|
||||
if (j == COLS - 5) {
|
||||
for (i = 0; i < editwinrows && *ptr != '\0'; i++) {
|
||||
int j = line_len(ptr);
|
||||
|
||||
/* Don't print half a word if we've run out of space */
|
||||
while (*end != ' ' && *end != '\0') {
|
||||
end--;
|
||||
j--;
|
||||
}
|
||||
}
|
||||
mvwaddnstr(edit, i, 0, ptr, j);
|
||||
j = 0;
|
||||
i++;
|
||||
if (*end == '\n')
|
||||
end++;
|
||||
ptr = end;
|
||||
ptr += j;
|
||||
if (*ptr == '\n')
|
||||
ptr++;
|
||||
}
|
||||
|
||||
if (*ptr == '\0') {
|
||||
no_more = 1;
|
||||
continue;
|
||||
@@ -1609,7 +1665,6 @@ int do_help(void)
|
||||
curs_set(1);
|
||||
edit_refresh();
|
||||
kp = keypad_on(edit, kp);
|
||||
kp2 = keypad_on(bottomwin, kp2);
|
||||
|
||||
/* The help_init() at the beginning allocated help_text, which has
|
||||
now been written to screen. */
|
||||
@@ -1695,11 +1750,11 @@ void fix_editbot(void)
|
||||
/* Dump the current file structure to stderr */
|
||||
void dump_buffer(const filestruct *inptr) {
|
||||
if (inptr == fileage)
|
||||
fprintf(stderr, _("Dumping file buffer to stderr...\n"));
|
||||
fprintf(stderr, "Dumping file buffer to stderr...\n");
|
||||
else if (inptr == cutbuffer)
|
||||
fprintf(stderr, _("Dumping cutbuffer to stderr...\n"));
|
||||
fprintf(stderr, "Dumping cutbuffer to stderr...\n");
|
||||
else
|
||||
fprintf(stderr, _("Dumping a buffer to stderr...\n"));
|
||||
fprintf(stderr, "Dumping a buffer to stderr...\n");
|
||||
|
||||
while (inptr != NULL) {
|
||||
fprintf(stderr, "(%d) %s\n", inptr->lineno, inptr->data);
|
||||
|
||||
Reference in New Issue
Block a user