Compare commits
57 Commits
v1.1.99pre
...
v1.2.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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
|
||||
|
||||
130
ChangeLog
130
ChangeLog
@@ -1,5 +1,133 @@
|
||||
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_tidle()
|
||||
- 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
|
||||
|
||||
|
||||
21
NEWS
21
NEWS
@@ -1,3 +1,24 @@
|
||||
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
|
||||
|
||||
2
THANKS
2
THANKS
@@ -13,11 +13,13 @@ 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
|
||||
|
||||
1
TODO
1
TODO
@@ -25,6 +25,7 @@ For version 1.4:
|
||||
- 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).
|
||||
- Fix resetstatuspos global which we shouldn't have.
|
||||
|
||||
Old requests:
|
||||
|
||||
|
||||
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.
|
||||
- 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.
|
||||
@@ -19,7 +19,7 @@
|
||||
#
|
||||
# $Id$
|
||||
|
||||
AC_INIT([GNU Nano], [1.1.99pre2], [nano-devel@gnu.org], [nano])
|
||||
AC_INIT([GNU Nano], [1.2.0], [nano-devel@gnu.org], [nano])
|
||||
AC_CONFIG_SRCDIR([nano.c])
|
||||
AM_INIT_AUTOMAKE
|
||||
AM_CONFIG_HEADER([config.h:config.h.in])
|
||||
|
||||
6
faq.html
6
faq.html
@@ -77,9 +77,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.0. 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>
|
||||
@@ -223,7 +223,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>
|
||||
|
||||
96
files.c
96
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
|
||||
|
||||
@@ -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;
|
||||
@@ -503,9 +505,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
|
||||
@@ -1679,7 +1683,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);
|
||||
@@ -1894,15 +1898,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
|
||||
/* 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 {
|
||||
if (i == 1)
|
||||
userdata = getpwuid(geteuid());
|
||||
else {
|
||||
do {
|
||||
userdata = getpwent();
|
||||
} while (userdata != NULL &&
|
||||
@@ -2116,6 +2116,8 @@ char **cwd_tab_completion(char *buf, int *num_matches)
|
||||
break;
|
||||
}
|
||||
}
|
||||
closedir(dir);
|
||||
free(dirname);
|
||||
|
||||
return matches;
|
||||
}
|
||||
@@ -2312,7 +2314,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 +2395,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--;
|
||||
@@ -2461,6 +2465,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 +2721,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 +2843,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,22 +2870,26 @@ 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 = nrealloc(nanohist, strlen(homenv) + 15);
|
||||
sprintf(nanohist, "%s/.nano_history", homenv);
|
||||
} else {
|
||||
userage = getpwuid(geteuid());
|
||||
endpwent();
|
||||
nanohist = nrealloc(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)
|
||||
@@ -2886,7 +2899,7 @@ void load_history(void)
|
||||
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 +2919,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 +2929,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) {
|
||||
if (homenv != NULL) {
|
||||
nanohist = nrealloc(nanohist, strlen(homenv) + 15);
|
||||
sprintf(nanohist, "%s/.nano_history", homenv);
|
||||
} else {
|
||||
userage = getpwuid(geteuid());
|
||||
endpwent();
|
||||
nanohist = nrealloc(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));
|
||||
|
||||
5
global.c
5
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;
|
||||
|
||||
45
nano.1
45
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 "February 9, 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
|
||||
@@ -60,7 +64,7 @@ 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.
|
||||
@@ -73,13 +77,13 @@ 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)
|
||||
.B \-Y \fIstr\fP (\-\-syntax=\fIstr\fP)
|
||||
Specify a specific syntax highlighting from the .nanorc to use, if
|
||||
available.
|
||||
.TP
|
||||
@@ -103,7 +107,7 @@ a new file, do not follow it. Good for editing files in /tmp, perhaps?
|
||||
.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 +115,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,6 +141,13 @@ 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: $SYSCONFDIR/nanorc, then ~/.nanorc. Please see 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
|
||||
@@ -147,6 +158,7 @@ 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
|
||||
@@ -157,8 +169,17 @@ The \fBnano\fP mailing list is available from
|
||||
.B nano-devel@gnu.org.
|
||||
To subscribe, email to 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).
|
||||
|
||||
69
nano.1.html
69
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: February 9, 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>
|
||||
|
||||
@@ -80,7 +82,7 @@ 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
|
||||
@@ -96,7 +98,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,7 +106,7 @@ 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
|
||||
@@ -135,7 +137,7 @@ a new file, do not follow it. Good for editing files in /tmp, perhaps?
|
||||
|
||||
<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 +147,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,8 +182,17 @@ 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: $SYSCONFDIR/nanorc, then ~/.nanorc. Please see <A HREF="http://localhost/cgi-bin/man/man2html?5+nanorc">nanorc</A>(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
|
||||
@@ -193,7 +204,8 @@ name already exists in the current directory, ".save" and a number (e.
|
||||
".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>
|
||||
<P>
|
||||
<A NAME="lbAH"> </A>
|
||||
<H2>BUGS</H2>
|
||||
|
||||
Please send any comments or bug reports to
|
||||
@@ -210,11 +222,24 @@ The <B>nano</B> mailing list is available from
|
||||
|
||||
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>
|
||||
<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
|
||||
@@ -231,15 +256,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: 04:08:28 GMT, February 13, 2003
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
138
nano.c
138
nano.c
@@ -199,7 +199,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 +217,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 +228,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 +343,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 +353,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 +391,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 +453,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 */
|
||||
|
||||
@@ -773,16 +780,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
|
||||
@@ -1523,7 +1520,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--;
|
||||
@@ -1969,7 +1966,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 +1991,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
|
||||
}
|
||||
|
||||
@@ -2052,7 +2047,7 @@ int justify_format(int changes_allowed, filestruct *line, size_t skip)
|
||||
|
||||
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 +2057,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,21 +2080,18 @@ 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');
|
||||
|
||||
/* This assert merely documents a fact about the loop above. */
|
||||
assert(changes_allowed != 0 || back == front);
|
||||
@@ -2220,7 +2212,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 +2250,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 +2389,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;
|
||||
@@ -2481,6 +2475,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,
|
||||
@@ -2809,7 +2810,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,15 +2863,16 @@ 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);
|
||||
@@ -3004,12 +3006,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 +3082,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 +3207,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 +3273,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();
|
||||
|
||||
@@ -3450,6 +3442,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 +3455,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);
|
||||
|
||||
11
nano.h
11
nano.h
@@ -56,10 +56,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>
|
||||
@@ -417,14 +417,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.0
|
||||
@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.0
|
||||
|
||||
@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.0 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.0, 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
|
||||
|
||||
154
nanorc.5
Normal file
154
nanorc.5
Normal file
@@ -0,0 +1,154 @@
|
||||
.\" 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 "February 14, 2003"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.SH NAME
|
||||
nanorc \- GNU nano's rcfile
|
||||
.SH SYNOPSIS
|
||||
.B /etc/nanorc
|
||||
.br
|
||||
.B $HOME/.nanorc
|
||||
.br
|
||||
.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".
|
||||
|
||||
.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 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 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 historylog\fP
|
||||
Enable ~/.nano_history for saving and reading search/replace strings.
|
||||
.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 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 AUTHORS and THANKS for
|
||||
details).
|
||||
This manual page was written by Jordi Mallach <jordi@gnu.org>.
|
||||
160
nanorc.5.html
Normal file
160
nanorc.5.html
Normal file
@@ -0,0 +1,160 @@
|
||||
<HTML><HEAD><TITLE>Manpage of NANORC</TITLE>
|
||||
</HEAD><BODY>
|
||||
<H1>NANORC</H1>
|
||||
Section: File Formats (5)<BR>Updated: February 9, 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>SYNOPSIS</H2>
|
||||
|
||||
<B>/etc/nanorc</B>
|
||||
|
||||
<B>$HOME/.nanorc</B>
|
||||
|
||||
<BR>
|
||||
|
||||
<A NAME="lbAD"> </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>
|
||||
<A NAME="lbAE"> </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>
|
||||
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 filename~.
|
||||
<DT><B>set/unset const</B><DD>
|
||||
Constantly update the cursor position.
|
||||
<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>
|
||||
Set the column where lines will be wrapped at to <I>n</I>.
|
||||
<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>
|
||||
Set operating directory (chroots the user to <I>directory</I> and below).
|
||||
<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. This is a "regular expression" if your
|
||||
system supports them, otherwise a literal string.
|
||||
Default value is set quotestr "^([ ]*[|>:}#])+" if you have regexps,
|
||||
otherwise set quotestr "> ".
|
||||
<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 default (spell).
|
||||
<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 historylog</B><DD>
|
||||
Enable ~/.nano_history for saving and reading search/replace strings.
|
||||
<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="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 AUTHORS and THANKS 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">SYNOPSIS</A><DD>
|
||||
<DT><A HREF="#lbAD">DESCRIPTION</A><DD>
|
||||
<DT><A HREF="#lbAE">OPTIONS</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: 04:08:33 GMT, February 13, 2003
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -172,6 +172,6 @@
|
||||
#color brightwhite "^ *syntax [^ ]*"
|
||||
#color brightblue "^ *set\>" "^ *unset\>" "^ *syntax\>"
|
||||
#color white "^ *color\>.*"
|
||||
#color yellow "^ *color [^ ]*"
|
||||
#color yellow "^ *color (bright)?(white|black|red|blue|green|yellow|magenta|cyan)\>"
|
||||
#color magenta "^ *color\>"
|
||||
#color green "^#.*$"
|
||||
|
||||
62
po/ChangeLog
62
po/ChangeLog
@@ -1,3 +1,65 @@
|
||||
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
|
||||
|
||||
@@ -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
734
po/pt_BR.po
734
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 \)";
|
||||
|
||||
15
proto.h
15
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,15 +87,23 @@ 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;
|
||||
@@ -253,7 +262,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);
|
||||
@@ -430,7 +438,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 +472,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);
|
||||
|
||||
40
rcfile.c
40
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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -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 = nrealloc(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 = nrealloc(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
|
||||
|
||||
13
search.c
13
search.c
@@ -758,11 +758,12 @@ 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;
|
||||
}
|
||||
@@ -776,12 +777,16 @@ void goto_abort(void)
|
||||
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"));
|
||||
if (st != 0) {
|
||||
goto_abort();
|
||||
return 0;
|
||||
}
|
||||
|
||||
97
winio.c
97
winio.c
@@ -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;
|
||||
@@ -218,7 +218,7 @@ 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);
|
||||
@@ -256,10 +256,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;
|
||||
}
|
||||
}
|
||||
@@ -1166,8 +1162,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,26 +1178,25 @@ 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);
|
||||
@@ -1284,13 +1277,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 +1451,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, kp2;
|
||||
int no_help_flag = 0;
|
||||
const shortcut *oldshortcut;
|
||||
|
||||
@@ -1543,7 +1562,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 +1571,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;
|
||||
|
||||
Reference in New Issue
Block a user