Compare commits
57 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
59edef55dc | ||
|
|
f119a90fe5 | ||
|
|
4920030384 | ||
|
|
a898fa5dcc | ||
|
|
c0aa5ad258 | ||
|
|
58c3dd6cd0 | ||
|
|
5ca765f107 | ||
|
|
cf75da9888 | ||
|
|
14c62dbf11 | ||
|
|
f6fbc1572d | ||
|
|
38d7362f20 | ||
|
|
26683a9e5f | ||
|
|
d35ecd02b8 | ||
|
|
61bc248555 | ||
|
|
c38f571d4b | ||
|
|
a89437219d | ||
|
|
aa28441071 | ||
|
|
5dbd288254 | ||
|
|
8f21d256fb | ||
|
|
08cfdbcbdb | ||
|
|
6103c47f1c | ||
|
|
88cf22f804 | ||
|
|
8177e62c18 | ||
|
|
124a859516 | ||
|
|
322120c980 | ||
|
|
54e6fe2b4a | ||
|
|
fa56310454 | ||
|
|
f35c3dbd57 | ||
|
|
acb394aec0 | ||
|
|
4223b83f75 | ||
|
|
4a1302ef55 | ||
|
|
cbf7e57ed0 | ||
|
|
e36e829ad0 | ||
|
|
121c53f3b8 | ||
|
|
5b9683cd64 | ||
|
|
7c1dfea59e | ||
|
|
4a073a0f3e | ||
|
|
f8841f0927 | ||
|
|
8d692a87dc | ||
|
|
13176792f0 | ||
|
|
d7fbc70a72 | ||
|
|
1dd01eb4e1 | ||
|
|
fd0589d8bc | ||
|
|
a381021ffc | ||
|
|
0b0ddb1e5f | ||
|
|
991e49a36a | ||
|
|
b1c20629f5 | ||
|
|
7373e4cd46 | ||
|
|
5f30775d62 | ||
|
|
69bd4d1f06 | ||
|
|
d3429a7a57 | ||
|
|
e1538e6dc3 | ||
|
|
1c46551ce8 | ||
|
|
f1b87f960c | ||
|
|
b0ef2e2803 | ||
|
|
6981294c9d | ||
|
|
fc89ac11d2 |
2
AUTHORS
2
AUTHORS
@@ -39,7 +39,7 @@ Mike Frysinger <vapier@gentoo.org>
|
||||
* Gentoo package maintainer. Whitespace display mode,
|
||||
--enable-utf8/--disable-utf8 configure options for ncurses,
|
||||
many new color regexes and improvements to existing color
|
||||
regexes for nanorc.sample, and miscellaneous bug fixes.
|
||||
regexes in syntax/*.nanorc, and miscellaneous bug fixes.
|
||||
|
||||
Mark Majeres <mark@engine12.com>
|
||||
* A functional undo/redo system, and coloring nano's interface.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
4010
ChangeLog.2007-2015
Normal file
4010
ChangeLog.2007-2015
Normal file
File diff suppressed because it is too large
Load Diff
@@ -2,6 +2,11 @@ AUTOMAKE_OPTIONS = gnu no-dependencies
|
||||
|
||||
SUBDIRS = doc m4 po src
|
||||
|
||||
EXTRA_DIST = ChangeLog.pre-2.1 IMPROVEMENTS README.GIT nano.spec
|
||||
if USE_COLOR
|
||||
SUBDIRS += syntax
|
||||
endif
|
||||
|
||||
EXTRA_DIST = ChangeLog.1999-2006 ChangeLog.2007-2015 \
|
||||
IMPROVEMENTS README.GIT nano.spec
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
8
NEWS
8
NEWS
@@ -1,3 +1,11 @@
|
||||
2017.01.10 - GNU nano 2.7.4 "Red dress" undoes deletions in an orderly
|
||||
manner again (bug was introduced in previous version),
|
||||
sets the preferred x position for vertical movements
|
||||
more consistently, avoids some scrolling problems in
|
||||
softwrap mode, installs the Info manual also when your
|
||||
system lacks 'makeinfo', and corrects the behavior of
|
||||
the beginning-of-word anchor (\<) in regex searches.
|
||||
|
||||
2016.12.28 - GNU nano 2.7.3 "Ontbijtkoek" wipes away a handful of bugs:
|
||||
your editor is now able to handle filenames that contain
|
||||
newlines, avoids a brief flash of color when switching
|
||||
|
||||
2
README
2
README
@@ -34,7 +34,7 @@ How to compile and install nano
|
||||
default installation directory of /usr/local.
|
||||
|
||||
If you haven't configured with the --disable-nanorc option, after
|
||||
installation you may want to copy the doc/nanorc.sample file to
|
||||
installation you may want to copy the doc/sample.nanorc file to
|
||||
your home directory, rename it to ".nanorc", and then edit it
|
||||
according to your taste.
|
||||
|
||||
|
||||
24
configure.ac
24
configure.ac
@@ -16,7 +16,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
AC_INIT([GNU nano], [2.7.3], [nano-devel@gnu.org], [nano])
|
||||
AC_INIT([GNU nano], [2.7.4], [nano-devel@gnu.org], [nano])
|
||||
AC_CONFIG_SRCDIR([src/nano.c])
|
||||
AC_CANONICAL_HOST
|
||||
AM_INIT_AUTOMAKE
|
||||
@@ -628,12 +628,10 @@ AC_CACHE_CHECK([for enhanced regular expression flag], nano_cv_flag_reg_extended
|
||||
AC_DEFINE_UNQUOTED(NANO_REG_EXTENDED, $nano_cv_flag_reg_extended,
|
||||
[Flag(s) to use to get the full range of extended regular expressions])
|
||||
|
||||
if test x$color_support = xyes; then
|
||||
# Now check for the end-of-word boundary support (/< and />).
|
||||
AC_MSG_CHECKING([for GNU-style word boundary regex support])
|
||||
|
||||
AC_ARG_WITH(wordbounds,
|
||||
AS_HELP_STRING([--with-wordbounds], [Use GNU-style word boundary delimiters]),
|
||||
# Check for word-boundary support (/< and />).
|
||||
AC_MSG_CHECKING([for GNU-style word boundary regex support])
|
||||
AC_ARG_WITH(wordbounds,
|
||||
AS_HELP_STRING([--with-wordbounds], [Use GNU-style word boundary delimiters]),
|
||||
[ case "$with_wordbounds" in
|
||||
no)
|
||||
AC_MSG_RESULT(no)
|
||||
@@ -670,6 +668,7 @@ int main(void)
|
||||
)
|
||||
])
|
||||
|
||||
if test x$color_support = xyes; then
|
||||
# if test x$CURSES_LIB_NAME = xcurses; then
|
||||
AC_MSG_CHECKING([whether _XOPEN_SOURCE_EXTENDED is needed])
|
||||
AC_TRY_RUN([
|
||||
@@ -733,10 +732,6 @@ else
|
||||
fi
|
||||
AM_CONDITIONAL(GROFF_HTML, test x$groff_html_support = xyes)
|
||||
|
||||
# Check for the availability of makeinfo.
|
||||
AC_CHECK_PROG(haveit, makeinfo, yes, no)
|
||||
AM_CONDITIONAL(HAVE_MAKEINFO, test x$haveit = xyes)
|
||||
|
||||
# Check whether this is a git repository.
|
||||
AC_MSG_CHECKING([whether building from git])
|
||||
if test -d .git ; then
|
||||
@@ -751,14 +746,11 @@ AM_CONDITIONAL(BUILDING_FROM_GIT, test x$from_git = xyes)
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
doc/Makefile
|
||||
doc/nanorc.sample
|
||||
doc/man/Makefile
|
||||
doc/man/fr/Makefile
|
||||
doc/syntax/Makefile
|
||||
doc/texinfo/Makefile
|
||||
doc/sample.nanorc
|
||||
m4/Makefile
|
||||
po/Makefile.in
|
||||
src/Makefile
|
||||
syntax/Makefile
|
||||
nano.spec
|
||||
])
|
||||
|
||||
|
||||
8
doc/.gitignore
vendored
8
doc/.gitignore
vendored
@@ -1 +1,7 @@
|
||||
/nanorc.sample
|
||||
nano.1.html
|
||||
rnano.1.html
|
||||
nanorc.5.html
|
||||
texinfo.tex
|
||||
nano.info
|
||||
nano.html
|
||||
sample.nanorc
|
||||
|
||||
@@ -1,11 +1,33 @@
|
||||
SUBDIRS = man
|
||||
|
||||
if HAVE_MAKEINFO
|
||||
SUBDIRS += texinfo
|
||||
endif
|
||||
|
||||
if USE_COLOR
|
||||
SUBDIRS += syntax
|
||||
endif
|
||||
SUBDIRS =
|
||||
BUILT_SOURCES =
|
||||
|
||||
dist_html_DATA = faq.html
|
||||
|
||||
dist_man_MANS = nano.1 rnano.1
|
||||
html_pages = nano.1.html rnano.1.html
|
||||
|
||||
if USE_NANORC
|
||||
dist_man_MANS += nanorc.5
|
||||
html_pages += nanorc.5.html
|
||||
endif
|
||||
|
||||
nano.1.html: nano.1
|
||||
groff -t -mandoc -Thtml < $? > $@
|
||||
nanorc.5.html: nanorc.5
|
||||
groff -t -mandoc -Thtml < $? > $@
|
||||
rnano.1.html: rnano.1
|
||||
groff -t -mandoc -Thtml < $? > $@
|
||||
|
||||
if GROFF_HTML
|
||||
BUILT_SOURCES += $(html_pages)
|
||||
dist_html_DATA += $(html_pages)
|
||||
endif
|
||||
|
||||
info_TEXINFOS = nano.texi
|
||||
|
||||
BUILT_SOURCES += nano.html
|
||||
dist_html_DATA += nano.html
|
||||
|
||||
AM_MAKEINFOHTMLFLAGS = --no-split
|
||||
|
||||
EXTRA_DIST = $(BUILT_SOURCES) $(info_TEXINFOS)
|
||||
|
||||
210
doc/faq.html
210
doc/faq.html
@@ -5,6 +5,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
</head>
|
||||
<body text="#330000" bgcolor="#ffffff" link="#0000ef" vlink="#51188e" alink="#ff0000">
|
||||
|
||||
<h1>The GNU nano editor FAQ</h1>
|
||||
<h2>Table of Contents</h2>
|
||||
<h2><a href="#1">1. General</a></h2>
|
||||
@@ -38,15 +39,11 @@
|
||||
<a href="#4.5">4.5. How do I type the F13-F16 keys shown in the help browser? My keyboard only has F1-F12!</a><br>
|
||||
<a href="#4.6">4.6. nano crashes when I type <insert keystroke here>!</a><br>
|
||||
<a href="#4.7">4.7. nano crashes when I resize my window. How can I fix that?</a><br>
|
||||
<a href="#4.8">4.8. [version 1.3.12 and later] I'm using glibc 2.2.3, and nano crashes when I use color support or do regular expression searches. How can I fix that?</a><br>
|
||||
<a href="#4.9">4.9. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</a><br>
|
||||
<a href="#4.10a">4.10a. [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.10b">4.10b. [version 1.1.99pre1 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</a><br>
|
||||
<a href="#4.11">4.11. How do I make nano my default editor (in Pine, mutt, etc.)?</a><br>
|
||||
<a href="#4.12">4.12. I've compiled nano with color support, but I don't see any color when I run it!</a><br>
|
||||
<a href="#4.13">4.13. How do I select text for or paste text from the clipboard in an X terminal when I'm running nano in one and nano's mouse support is turned on?</a><br>
|
||||
<a href="#4.14">4.14. When I paste text into a document, each line gets indented further than the last. Why does nano do this, and how can I avoid it?</a><br>
|
||||
<a href="#4.15">4.15. On startup I get a message that says "Detected a legacy nano history file". Now older nano versions can't find my search history!</a></p></blockquote>
|
||||
<a href="#4.8">4.8. When I paste text into a document, each line gets indented further than the last. Why does nano do this, and how can I avoid it?</a><br>
|
||||
<a href="#4.9">4.9. I've compiled nano with color support, but I don't see any color when I run it!</a><br>
|
||||
<a href="#4.10">4.10. How do I make nano my default editor (in Pine, mutt, etc.)?</a><br>
|
||||
<a href="#4.11">4.11. How do I select text for or paste text from the clipboard in an X terminal when I'm running nano in one and nano's mouse support is turned on?</a><br>
|
||||
<a href="#4.12">4.12. On startup I get a message that says "Detected a legacy nano history file". Now older nano versions can't find my search history!</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><br>
|
||||
@@ -64,13 +61,14 @@
|
||||
<a href="#7.5">7.5. Can I have write access to the GIT tree?</a></p></blockquote>
|
||||
<h2><a href="#8">8. ChangeLog</a></h2>
|
||||
<hr width="100%">
|
||||
|
||||
<h1><a name="1"></a>1. General</h1>
|
||||
<h2><a name="1.1"></a>1.1 About this FAQ</h2>
|
||||
<blockquote><p>This FAQ was originally written and maintained by Chris Allegretta <<a href="mailto:chrisa@asty.org">chrisa@asty.org</a>>, who also happens to be the creator of nano. It was then maintained by David Lawrence Ramsey <<a href="mailto:pooka109@gmail.com">pooka109@gmail.com</a>>. Maybe someone else will volunteer to maintain this FAQ someday, who knows...</p></blockquote>
|
||||
<h2><a name="1.2"></a>1.2. How do I contribute to it?</h2>
|
||||
<blockquote><p>Your best bet is to send it to the nano email address, <a href="mailto:nano@nano-editor.org">nano@nano-editor.org</a> and if it is useful enough it will be included in future versions.</p></blockquote>
|
||||
<h2><a name="1.3"></a>1.3. What is GNU nano?</h2>
|
||||
<blockquote><p>GNU nano is designed to be a free replacement for the Pico text editor, part of the Pine email suite from <a href="http://www.washington.edu/pine/">The University of Washington</a>. It aims to "emulate Pico as closely as possible and perhaps include extra functionality".</p></blockquote>
|
||||
<blockquote><p>GNU nano is designed to be a free replacement for the Pico text editor, part of the Pine email suite from <a href="http://www.washington.edu/pine/">The University of Washington</a>. It aims to "emulate Pico as closely as possible and then include extra functionality".</p></blockquote>
|
||||
<h2><a name="1.4"></a>1.4. What is the history behind nano?</h2>
|
||||
<blockquote><p>Funny you should ask!</p>
|
||||
<p><b>In the beginning...</b></p>
|
||||
@@ -79,15 +77,16 @@
|
||||
<p>The <a href="http://www.debian.org/">Debian GNU/Linux</a> distribution, known for its strict standards in distributing truly "free" software (i.e. software with no restrictions on redistribution), would not include a binary package for Pine or Pico. Many people had a serious dilemma: they loved these programs, but the versions available at the time were not truly free software in the <a href="http://www.gnu.org/philosophy/free-sw.html">GNU</a> sense of the word.</p>
|
||||
<p><b>The event...</b></p>
|
||||
<p>It was in late 1999 when Chris Allegretta (our hero) was yet again complaining to himself about the less-than-perfect license Pico was distributed under, the 1000 makefiles that came with it and how just a few small improvements could make it the Best Editor in the World (TM). Having been a convert from Slackware to Debian, he missed having a simple binary package that included Pine and Pico, and had grown tired of downloading them himself.</p>
|
||||
<p>Finally something snapped inside and Chris coded and hacked like a madman for many hours straight one weekend to make a (barely usable) Pico clone, at the time called TIP (Tip Isn't Pico). The program could not be invoked without a filename, could not save files, had no help text display, spell checker, and so forth. But over time it improved, and with the help of a few great coders it matured to the (hopefully) stable state it is today.</p>
|
||||
<p>Finally something snapped inside and Chris coded and hacked like a madman for many hours straight one weekend to make a (barely usable) Pico clone, at the time called TIP (Tip Isn't Pico). The program could not be invoked without a filename, could not save files, had no help text display, spell checker, and so forth. But over time it improved, and with the help of a few great coders it matured to the (hopefully) stable state it is in today.</p>
|
||||
<p>In February 2001, nano was declared an official GNU program by Richard Stallman. nano also reached its first production release on March 22, 2001.</p></blockquote>
|
||||
<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 2.7.0. Of course, you should always check the <a href="https://nano-editor.org/">nano homepage</a> to see what the latest and greatest version is.</p></blockquote>
|
||||
<blockquote><p>The current version of nano <i>should</i> be <b>2.7.4</b>. Of course, you should always check the <a href="https://nano-editor.org/">nano homepage</a> 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="https://nano-editor.org/dist/latest/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. Web sites that carry nano.</h2>
|
||||
<blockquote><p>The nano source tarballs can be downloaded from the following web sites:</p>
|
||||
@@ -115,6 +114,7 @@
|
||||
<h2><a name="2.4"></a>2.4. By GIT (for the brave).</h2>
|
||||
<blockquote><p>For the 'bleeding edge' current version of nano, you can use GIT to download the current source code. <b>Note:</b> believe it or not, by downloading code that has not yet stabilized into an official release, there could quite possibly be bugs, in fact the code may not even compile! Anyway, see <a href="http://git.savannah.gnu.org/cgit/nano.git/tree/README.GIT">the nano GIT document</a> for info on anonymous GIT access to the nano source.</p></blockquote>
|
||||
<hr width="100%">
|
||||
|
||||
<h1><a name="3"></a>3. Installation and Configuration</h1>
|
||||
<h2><a name="3.1"></a>3.1. How do I install the RPM or DEB package?</h2>
|
||||
<blockquote><p>It's simple really! As root, type <b>rpm -Uvh nano-x.y.z-1.i386.rpm</b> if you have a RedHat-ish system or <b>dpkg -i nano_x.y.z-1.deb</b> if you have a Debian-ish system, where <b>x.y.z</b> is the release of nano. There are other programs to install packages, and if you wish to use those, knock yourself out.</p></blockquote>
|
||||
@@ -149,23 +149,25 @@
|
||||
<b>--disable-operatingdir</b> Disable the setting of an operating directory
|
||||
<b>--disable-speller</b> Disable spell checker functions
|
||||
<b>--disable-tabcomp</b> Disable tab completion functions
|
||||
<b>--disable-wordcomp</b> Disable the word completion function
|
||||
<b>--disable-wrapping</b> Disable all hard-wrapping of text</pre>
|
||||
<p>There's also the <b>--enable-tiny</b> option which disables everything above, as well as some larger chunks of the program (like the marker code that you use with Control-^ to select text). Also, if you know you aren't going to be using other languages you can use <b>--disable-nls</b> to disable internationalization and save a few K to a few dozen K depending on if you have locale support on your system. And finally there's always good old <b>strip</b> to strip all debugging code and code that exists in libraries on your system.</p>
|
||||
<p>There's also the <b>--enable-tiny</b> option which disables everything above, as well as some larger chunks of the program (like the marker code that you use with Control-^ to select text). Also, if you know you aren't going to be using other languages, you can use <b>--disable-nls</b> to disable internationalization and save a few K to a few dozen K depending on whether you have locale support on your system. And finally, there's always good old <b>strip</b> to strip all debugging code and code that exists in libraries on your system.</p>
|
||||
<p>With <b>--disable-wrapping-as-root</b> you can disable any hard-wrapping by default when the user is root, useful to prevent accidentally changing long lines in system configuration files.</p>
|
||||
</blockquote>
|
||||
<h2><a name="3.7"></a>3.7. Tell me more about this multibuffer stuff!</h2>
|
||||
<blockquote><p>To use multiple file buffers, you must be using nano 1.1.0 or newer, and you must not have configured it with <b>--disable-multibuffer</b> nor with <b>--enable-tiny</b> (use <b>nano -V</b> to check the compilation options). Then when you want to insert a file into its own buffer instead of into the current file, just hit <b>Meta-F</b>, then insert the file as normal with <b>^R</b>. If you always want files to be loaded into their own buffers, use the <b>--multibuffer</b> or <b>-F</b> flag when you invoke nano.</p>
|
||||
<p>You can move between the buffers you have open with the <b>Meta-<</b> and <b>Meta-></b> keys, or more easily with <b>Meta-,</b> and <b>Meta-.</b> (clear as mud, right? =-). When you have more than one file buffer open, the ^X shortcut will say "Close", instead of the normal "Exit" when only one buffer is open.</p></blockquote>
|
||||
<blockquote><p>To use multiple file buffers, you must not have configured nano with <b>--disable-multibuffer</b> nor with <b>--enable-tiny</b> (use <b>nano -V</b> to check the compilation options). Then when you want to insert a file into its own buffer instead of into the current file, just hit <b>Meta-F</b>, then insert the file as normal with <b>^R</b>. If you always want files to be loaded into their own buffers, use the <b>--multibuffer</b> or <b>-F</b> flag when you invoke nano.</p>
|
||||
<p>You can move between the buffers you have open with the <b>Meta-<</b> and <b>Meta-></b> keys, or more easily without holding Shift: <b>Meta-,</b> and <b>Meta-.</b> (clear as mud, right? =-). When you have more than one file buffer open, the ^X shortcut will say "Close", instead of the normal "Exit" when only one buffer is open.</p></blockquote>
|
||||
<h2><a name="3.8"></a>3.8. Tell me more about this verbatim input stuff!</h2>
|
||||
<blockquote><p>To use verbatim input, you must be using nano 1.3.1 or newer. When you want to insert a literal character into the file you're editing, such as a control character that nano usually treats as a command, first press <b>Meta-V</b> (if you're not at a prompt, you'll get the message "Verbatim Input"), then press the key(s) that generate the character you want.</p>
|
||||
<p>Alternatively, if you've enabled Unicode support (see section <a href="#5.3">5.3</a>), you can press <b>Meta-V</b> and then type a six-digit hexadecimal code (from 000000 to 10FFFF, case-insensitive), and the character with the corresponding value will be inserted instead. The prompt will change to "Unicode Input" when you do this.</p></blockquote>
|
||||
<h2><a name="3.9a"></a>3.9a. How do I make a .nanorc file that nano will read when I start it?</h2>
|
||||
<blockquote><p>It's not hard at all! But, your version of nano must <b>not</b> have been compiled with <b>--disable-nanorc</b>, and must be version 1.1.12 or newer (use nano -V to check your version and compiled features). Then simply copy the <b>nanorc.sample</b> that came with the nano source or your nano package (most likely in /usr/doc/nano) to .nanorc in your home directory. If you didn't get one, the syntax is simple. Flags are turned on and off by using the words <b>set</b> and <b>unset</b> plus the long option name for the feature. For example, "set nowrap" or "set smarthome".</p></blockquote>
|
||||
<blockquote><p>When you want to insert a literal character into the file you're editing, such as a control character that nano usually treats as a command, first press <b>Meta-V</b> (if you're not at a prompt, you'll get the message "Verbatim Input" on the statusbar), then press the key(s) that generate the character you want.</p>
|
||||
<p>Alternatively, if you've enabled Unicode support (see section <a href="#5.3">5.3</a>), you can press <b>Meta-V</b> and then type a six-digit hexadecimal code (from 000000 to 10FFFF, case-insensitive), and the character with the corresponding value will be inserted. The statubar will change to "Unicode Input: ......" when you do this.</p></blockquote>
|
||||
<h2><a name="3.9a"></a>3.9a. How do I make a .nanorc file that will be read when I start nano?</h2>
|
||||
<blockquote><p>It's not hard at all! But, your nano must <b>not</b> have been compiled with <b>--disable-nanorc</b>. Then simply copy the <b>sample.nanorc</b> that came with the nano source or your nano package (most likely in /usr/doc/nano) to .nanorc in your home directory. If you didn't get one, the syntax of the file is simple. Flags are turned on and off by using the words <b>set</b> and <b>unset</b> plus the long option name for the feature. For example, "set nowrap" or "set smarthome".</p></blockquote>
|
||||
<h2><a name="3.9b"></a>3.9b. How about in Win32?</h2>
|
||||
<blockquote><p>If you're using the official nano .zip file and have extracted all the files, you should take the file nano.rc and place it somewhere on your Win32 system (for example, if you have write permission to do so, at the top of C:\). Then you must create an Environment variable called HOME which points to the directory where you put nano.rc. In Windows XP, you can get to Environment variables by right-clicking "My Computer" either on the desktop or in the Start Menu, and selecting Properties. This should bring up the System Properties panel. Then click the Advanced Tab, and there should be a button called Environment Variables. Click that to bring up the Environment Variables section. Now, under User Variables you should be able to click the New button, and make a new Variables Name called HOME, with the Variable Value of whatever path you copied nano.rc into (just the directory name; don't add nano.rc onto the end).</p>
|
||||
<p>We're still working on documentation for enabling syntax highlighting on Win32; please bear with us.</p>
|
||||
<p>Note that the nano.rc file must remain Unix-formatted in order for nano to understand it. In other words, you should probably use only nano to edit its config file. Other programs like Wordpad and Notepad will convert the file to DOS format when saving, and the latter does not even properly read Unix-formatted files to begin with.</p></blockquote>
|
||||
<hr width="100%">
|
||||
|
||||
<h1><a name="4"></a>4. Running</h1>
|
||||
<h2><a name="4.1"></a>4.1. How do I open a file with a name beginning with '+' from the command line?</h2>
|
||||
<blockquote><p>If a command-line option that begins with '+' is followed by another option, the former is always treated as a starting line and column number, and the latter is always treated as a filename. If a command-line option that begins with '+' isn't followed by another option, it's always treated as a filename. Examples:</p>
|
||||
@@ -188,15 +190,11 @@
|
||||
<blockquote><p>If you aren't trying some bizarre keystroke combination with some bizarre $TERM entry, chances are you have found a bug. You are welcome to submit it to the <a href="mailto:nano-devel@gnu.org">nano-devel</a> list or in the <a href="https://savannah.gnu.org/bugs/?group=nano">bug tracker</a> on Savannah.</p></blockquote>
|
||||
<h2><a name="4.7"></a>4.7. nano crashes when I resize my window. How can I fix that?</h2>
|
||||
<blockquote><p>Older versions of nano had this problem. Please upgrade to version 2.7.0 or newer.</p></blockquote>
|
||||
<h2><a name="4.8"></a>4.8. [version 1.3.12 and later] I'm using glibc 2.2.3, and nano crashes when I use color support or do regular expression searches. How can I fix that?</h2>
|
||||
<blockquote><p>It's a bug in glibc 2.2.3. You should upgrade to at least glibc 2.2.4.</p></blockquote>
|
||||
<h2><a name="4.9"></a>4.9. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</h2>
|
||||
<blockquote><p>The help (^G) and justify (^J) functions were among the last to be written. To show the improvements that nano had over Pico (go to line number, and replace), ^_ and ^\ were put on the shortcut list. Later, ^G came back in place of ^_ as it proved to be very valuable for new Unix users.</p></blockquote>
|
||||
<h2><a name="4.10a"></a>4.10a. [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>Since nano version 0.9.20, the default was 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.</p></blockquote>
|
||||
<h2><a name="4.10b"></a>4.10b. [version 1.1.99pre1 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.11"></a>4.11. How do I make nano my default editor (in Pine, mutt, etc.)?</h2>
|
||||
<h2><a name="4.8"></a>4.8. When I paste text into a document, each line gets indented further than the last. Why does nano do this, and how can I avoid it?</h2>
|
||||
<blockquote><p>You have the autoindent feature turned on. Hit Meta-I to turn it off, paste your text, and then hit Meta-I again to turn it back on.</p></blockquote>
|
||||
<h2><a name="4.9"></a>4.9. 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. Several example configurations are in the <b>doc/syntax</b> subdirectory of the nano source, which are normally installed to <b>/usr/local/share/nano</b>. To enable all of them, uncomment the line <b># include "/usr/local/share/nano/*.nanorc"</b> in your nanorc. See also section <a href="#3.9a">3.9a</a>.</p></blockquote>
|
||||
<h2><a name="4.10"></a>4.10. How do I make nano my default editor (in Pine, mutt, etc.)?</h2>
|
||||
<blockquote><p>You need to make nano your $EDITOR. If you want this to be saved, you should put a line like this in your <b>.bashrc</b> if you use bash (or <b>.zshrc</b> if you believe in zsh):</p>
|
||||
<p><b>export EDITOR=/usr/local/bin/nano</b></p>
|
||||
<p>or, if you use tcsh, put this in your <b>.cshrc</b> file:</p>
|
||||
@@ -209,17 +207,14 @@
|
||||
<p>If you're a mutt user, you 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.12"></a>4.12. 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. Several example configurations are in the <b>doc/syntax</b> subdirectory of the nano source, which are normally installed to <b>/usr/local/share/nano</b>. To enable all of them, uncomment the line <b># include "/usr/local/share/nano/*.nanorc"</b> in your nanorc. See also section <a href="#3.9a">3.9a</a>.</p></blockquote>
|
||||
<h2><a name="4.13"></a>4.13. How do I select text for or paste text from the clipboard in an X terminal when I'm running nano in one and nano's mouse support is turned on?</h2>
|
||||
<h2><a name="4.11"></a>4.11. How do I select text for or paste text from the clipboard in an X terminal when I'm running nano in one and nano's mouse support is turned on?</h2>
|
||||
<blockquote><p>Try holding down the Shift key and selecting or pasting the text as you normally would.</p></blockquote>
|
||||
<h2><a name="4.14"></a>4.14. When I paste text into a document, each line gets indented further than the last. Why does nano do this, and how can I avoid it?</h2>
|
||||
<blockquote><p>You have the autoindent feature turned on. Hit Meta-I to turn it off, paste your text, and then hit Meta-I again to turn it back on.</p></blockquote>
|
||||
<h2><a name="4.15"></a>4.15. On startup I get a message that says "Detected a legacy nano history file". Now older nano versions can't find my search history!</h2>
|
||||
<h2><a name="4.12"></a>4.12. On startup I get a message that says "Detected a legacy nano history file". Now older nano versions can't find my search history!</h2>
|
||||
<blockquote><p>In nano 2.3.0, cursor-position history was introduced, and both history files now reside in a .nano subdirectory in your home directory. A newer nano will move an existing search-history file to this new location so it can continue to be used. This means that if you then try and use an earlier version of nano, it will be unable to see your current search history. To fix this, run the following command:<br>
|
||||
<p><b>ln -sf ~/.nano/search_history ~/.nano_history</b></p>
|
||||
</p><p>The "migration service" (moving the search-history file to its new location) will be deleted from nano in early 2018.</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>
|
||||
<blockquote><p>In June 2001, GNU nano entered the <a href="http://translationproject.org/html/welcome.html">Translation Project</a> and since then, translations should be managed from there.</p>
|
||||
@@ -228,8 +223,9 @@
|
||||
<h2><a name="5.2"></a>5.2. I don't like the translation for <x> in my language. How can I fix it?</h2>
|
||||
<blockquote><p>The best way would probably be to send an e-mail to the team's mailing listed mentione in the <code>Language-Team:</code> field in the <b><your_language>.po</b> file with your suggested corrections, and then they can make the changes reach the nano-devel list.</p></blockquote>
|
||||
<h2><a name="5.3"></a>5.3. What is the status of Unicode support?</h2>
|
||||
<blockquote><p>In version 1.3.12 or later, Unicode should be usable. With your terminal, locale (LC_ALL and similar environment variables), and encoding configured to properly support UTF-8, you should be able to enter and save Unicode text.</p></blockquote>
|
||||
<blockquote><p>Since versions 1.3.12, Unicode should be usable. With your terminal, locale (LC_ALL and similar environment variables), and encoding configured to properly support UTF-8, you should be able to enter and save Unicode text.</p></blockquote>
|
||||
<hr width="100%">
|
||||
|
||||
<h1><a name="6"></a>6. Advocacy and Licensing</h1>
|
||||
<h2><a name="6.1"></a>6.1. Why should I use nano instead of Pico?</h2>
|
||||
<blockquote><p>There are many reasons to use nano instead of Pico. A more complete list can be found at the <a href="https://nano-editor.org/">nano homepage</a>.</p></blockquote>
|
||||
@@ -241,6 +237,7 @@
|
||||
<blockquote><p>If you are looking to use a Free Software program similar to Pine, and Emacs is not your thing, you should definitely take a look at <a href="http://www.mutt.org/">mutt</a>. It is a full-screen, console based mail program that actually has a lot more flexibility than Pine, but has a keymap included in the distribution that allows you to use the same keystrokes as Pine would to send and receive mail. It's also under the GNU General Public License, version 2.0.<P>
|
||||
Of course, due to the license change you can now use the <A HREF="http://www.washington.edu/alpine/">Alpine distribution</A> of PINE as it is now considered Free Software, but you would be sacrificing many of nano's features to do so.</p></blockquote>
|
||||
<hr width="100%">
|
||||
|
||||
<h1><a name="7"></a>7. Miscellaneous</h1>
|
||||
<h2><a name="7.1"></a>7.1. nano-related mailing lists.</h2>
|
||||
<blockquote><p>There are three mailing lists for nano hosted at <a href="http://savannah.gnu.org/">Savannah</a>: info-nano, help-nano and nano-devel. info-nano is a very low traffic list where new versions of nano are announced (surprise!). help-nano is for getting help with the editor without needing to hear all of the development issues surrounding it. nano-devel is a normally low, sometimes high traffic list for discussing the present and future development of nano. Here are links to where you can sign up for a given list:</p>
|
||||
@@ -256,76 +253,79 @@ Of course, due to the license change you can now use the <A HREF="http://www.was
|
||||
<h2><a name="7.4"></a>7.4. How do I join the development team?</h2>
|
||||
<blockquote><p>The easiest way is to consistently send in good patches that add some needed functionality, fix a bug or two, and/or make the program more optimized/efficient. Then ask nicely and you will probably be added to the Savannah development list and be given write access after a while. There is a lot of responsibility that goes along with being a team member, so don't think it's just something to add to your resume.</p></blockquote>
|
||||
<h2><a name="7.5"></a>7.5. Can I have write access to the git tree?</h2>
|
||||
<blockquote><p>Re-read Section <a href="#7.4">7.4</a> and you should know the answer.</p></blockquote>
|
||||
<h2><a name="8"></a>8. ChangeLog</h2>
|
||||
<blockquote><p>Re-read section <a href="#7.4">7.4</a> and you should know the answer.</p></blockquote>
|
||||
<hr width="100%">
|
||||
|
||||
<h1><a name="8"></a>8. ChangeLog</h1>
|
||||
<blockquote><p>
|
||||
2016/04/17 - Update docs to refer to GIT instead of subversion. (Mike)<br>
|
||||
2015/07/18 - More small fixes and updates. (Benno)<br>
|
||||
2014/04/24 - A bunch of small fixes and updates. (Benno)<br>
|
||||
2009/11/30 - Update various bits for nano 2.2.x. (DLR)<br>
|
||||
2009/11/18 - Typo fix. (j.mader@gmail.com)<br>
|
||||
2008/03/16 - Update docs to refer to subversion instead of CVS, add more words about Alpine, and refer to Savannah for bugs and patches. (chrisa)<br>
|
||||
2007/12/21 - Update maintainer information. (DLR)<br>
|
||||
2007/12/09 - Add minor punctuation and wording fixes, and update various sections to account for Alpine. (DLR)<br>
|
||||
2007/08/26 - Update links to the Free Translation Project. (DLR)<br>
|
||||
2007/07/29 - Update RPM links for nano 2.0.x. (DLR)<br>
|
||||
2007/04/18 - Add a new section 4.14 to explain how autoindent affects pasted text. (John M. Gabriele, minor tweaks by DLR)<br>
|
||||
2007/04/04 - Update email address. (DLR)<br>
|
||||
2007/01/01 - Update section 4.1 to describe how to open files with names beginning with '+' at specified columns as well as lines. (DLR)<br>
|
||||
2006/11/25 - Add miscellaneous wording and capitalization fixes. (DLR)<br>
|
||||
2006/10/28 - Update various links for the 2.0 branch of nano. (DLR)<br>
|
||||
2006/10/06 - Update the question in section 4.13 to match the version of it in the answer section. (DLR)<br>
|
||||
2006/07/25 - Update section 5.3 again to not state "the latest development version" before 1.3.12, as it's no longer accurate. Also add some minor spacing fixes. (DLR)<br>
|
||||
2006/06/12 - Update section 5.3, due to the display fix for two-column Unicode characters. (DLR)<br>
|
||||
2006/06/05 - Add a new section 4.8, and move all section 4 entries after it down one number, to explain how to deal with glibc 2.2.3's crashes involving extended regular expressions. (DLR)<br>
|
||||
2006/06/04 - Add minor punctuation, wording, and typo fixes. (DLR)<br>
|
||||
2006/05/27 - Update section 3.8 to mention the new "Unicode Input" prompt, and how Unicode input only works when Unicode support is enabled. (DLR)<br>
|
||||
2006/05/12 - Remove section 4.4, and move all section 4 entries after it up one number, since it no longer applies. Meta-] and Meta-[ are no longer used to indent and unindent marked text, since they require that the bracket matching key change to Ctrl-], which is used as the telnet escape key (found by Chris). Also, make the link to the nano CVS page a bit more readable. (DLR)<br>
|
||||
2006/05/08 - Add a new section 4.5, and move all section 4 entries after it down one number, to explain a problem that can occur when holding down keys to generate Meta sequences. Also add a few more capitalization and wording fixes. (Benno Schulenberg, minor tweaks by DLR)<br>
|
||||
2006/05/01 - Add a new section 4.4, and move all section 4 entries after it down one number, to explain how to deal with problems typing Meta-[. Also add a few capitalization and wording fixes. (DLR)<br>
|
||||
2006/04/14 - Clarify section 1.4: help menu -> help text display. (DLR, suggested by Benno Schulenberg)<br>
|
||||
2006/03/16 - Update the Free Translation Project's address, change the character set to UTF-8, and remove broken links to contributed RedHat nano packages. (DLR)<br>
|
||||
2005/11/21 - Clarify section 5.3 to better explain how to enable Unicode support, and remove the mention of quirks, since they turned out to not be a nano problem. (Mike Frysinger and DLR)<br>
|
||||
2005/11/19 - Add a new section 5.3 to explain the status of nano's Unicode support. (Mike Frysinger, minor tweaks by DLR)<br>
|
||||
2005/08/27 - Update email address. (DLR)<br>
|
||||
2005/08/10 - Add a new section 4.3, and move all section 4 entries after it down one number, to explain how to deal with numeric keypad problems. (DLR)<br>
|
||||
2005/08/08 - Update section 3.8 to mention that verbatim input mode now takes a six-digit hexadecimal number. (DLR)<br>
|
||||
2005/07/04 - Update section 4.10 to mention that pasting from the X clipboard via the middle mouse button also works when the Shift key is used. (DLR)<br>
|
||||
2005/06/15 - Update description of --enable-extra, and add missing line breaks. (DLR)<br>
|
||||
2005/06/13 - Minor capitalization and wording fixes. (DLR)<br>
|
||||
2005/06/08 - Updated section 1.1 to mention the current maintainer. (DLR)<br>
|
||||
2005/03/09 - Added question about opening files with names beginning with '+'s, and added a few more miscellaneous cosmetic fixes. (DLR)<br>
|
||||
2005/01/03 - Removed now-inaccurate note about verbatim input's not working at prompts, and update its description to mention that it handles hexadecimal values now. (DLR)<br>
|
||||
2004/11/21 - Listed sh as an example of a Bourne shell. (DLR)<br>
|
||||
2004/11/05 - Fixed inaccuracy: Pico compatibility mode was made the default in nano 1.1.99pre1, not 1.2.2. Also added question about how to type F13-F16 on terminals lacking keys past F12 (suggested by Chris), question about how to select text for the clipboard in X terminals with nano's mouse support turned on (answer found by Joseph Birthisel), and misc. fixes and link updates. (DLR)<br>
|
||||
2004/04/07 - Removed NumLock glitch question, as it's no longer needed. (DLR)<br>
|
||||
2004/01/30 - Fixed inaccuracy: multibuffer mode was first in nano 1.1.0, not 1.1.12. (DLR)<br>
|
||||
2003/12/31 - Added question about the new verbatim input function, and a few minor fixes. Removed reference to "set pico" (DLR).<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>
|
||||
2002/05/15 - Typo fix (DLR).<br>
|
||||
2001/12/26 - Misc. fixes (Aaron S. Hawley, DLR).<br>
|
||||
2001/10/02 - Update for Free Translation Project.<br>
|
||||
2001/10/02 - Assorted fixes, Debian additions.<br>
|
||||
2001/06/30 - Silly typo fix.<br>
|
||||
2001/05/05 - Spelling fixes by David Lawrence Ramsey.<br>
|
||||
2001/05/02 - Misc fixes.<br>
|
||||
2001/03/26 - Typo fix in an URL.<br>
|
||||
2001/02/17 - Advocacy updates.<br>
|
||||
2001/02/15 - Added GNU notes for 0.9.99pre3.<br>
|
||||
2001/02/06 - Typo fixes.<br>
|
||||
2001/01/14 - Added note about NumLock glitch.<br>
|
||||
2001/01/10 - Linux -> GNU/Linux.<br>
|
||||
2001/01/09 - Added "making exe smaller" section.<br>
|
||||
2000/12/19 - Typo and assorted error fixes.<br>
|
||||
2000/11/28 - Added blurb about make install-strip.<br>
|
||||
2000/11/19 - Changed Debian frozen to stable.<br>
|
||||
2000/11/18 - Previous string display (4.5).<br>
|
||||
2000/09/27 - Moved addresses to nano-editor.org.<br>
|
||||
2000/06/31 - Initial framework.</p></blockquote>
|
||||
2017.01.09 - Delete some obsolete items and update a few others. (Benno)<br>
|
||||
2016.04.17 - Update docs to refer to GIT instead of subversion. (Mike)<br>
|
||||
2015.07.18 - More small fixes and updates. (Benno)<br>
|
||||
2014.04.24 - A bunch of small fixes and updates. (Benno)<br>
|
||||
2009.11.30 - Update various bits for nano 2.2.x. (DLR)<br>
|
||||
2009.11.18 - Typo fix. (j.mader@gmail.com)<br>
|
||||
2008.03.16 - Update docs to refer to subversion instead of CVS, add more words about Alpine, and refer to Savannah for bugs and patches. (Chris)<br>
|
||||
2007.12.21 - Update maintainer information. (DLR)<br>
|
||||
2007.12.09 - Add minor punctuation and wording fixes, and update various sections to account for Alpine. (DLR)<br>
|
||||
2007.08.26 - Update links to the Free Translation Project. (DLR)<br>
|
||||
2007.07.29 - Update RPM links for nano 2.0.x. (DLR)<br>
|
||||
2007.04.18 - Add a new section 4.14 to explain how autoindent affects pasted text. (John M. Gabriele, minor tweaks by DLR)<br>
|
||||
2007.04.04 - Update email address. (DLR)<br>
|
||||
2007.01.01 - Update section 4.1 to describe how to open files with names beginning with '+' at specified columns as well as lines. (DLR)<br>
|
||||
2006.11.25 - Add miscellaneous wording and capitalization fixes. (DLR)<br>
|
||||
2006.10.28 - Update various links for the 2.0 branch of nano. (DLR)<br>
|
||||
2006.10.06 - Update the question in section 4.13 to match the version of it in the answer section. (DLR)<br>
|
||||
2006.07.25 - Update section 5.3 again to not state "the latest development version" before 1.3.12, as it's no longer accurate. Also add some minor spacing fixes. (DLR)<br>
|
||||
2006.06.12 - Update section 5.3, due to the display fix for two-column Unicode characters. (DLR)<br>
|
||||
2006.06.05 - Add a new section 4.8, and move all section 4 entries after it down one number, to explain how to deal with glibc 2.2.3's crashes involving extended regular expressions. (DLR)<br>
|
||||
2006.06.04 - Add minor punctuation, wording, and typo fixes. (DLR)<br>
|
||||
2006.05.27 - Update section 3.8 to mention the new "Unicode Input" prompt, and how Unicode input only works when Unicode support is enabled. (DLR)<br>
|
||||
2006.05.12 - Remove section 4.4, and move all section 4 entries after it up one number, since it no longer applies. Meta-] and Meta-[ are no longer used to indent and unindent marked text, since they require that the bracket matching key change to Ctrl-], which is used as the telnet escape key (found by Chris). Also, make the link to the nano CVS page a bit more readable. (DLR)<br>
|
||||
2006.05.08 - Add a new section 4.5, and move all section 4 entries after it down one number, to explain a problem that can occur when holding down keys to generate Meta sequences. Also add a few more capitalization and wording fixes. (Benno Schulenberg, minor tweaks by DLR)<br>
|
||||
2006.05.01 - Add a new section 4.4, and move all section 4 entries after it down one number, to explain how to deal with problems typing Meta-[. Also add a few capitalization and wording fixes. (DLR)<br>
|
||||
2006.04.14 - Clarify section 1.4: help menu -> help text display. (DLR, suggested by Benno Schulenberg)<br>
|
||||
2006.03.16 - Update the Free Translation Project's address, change the character set to UTF-8, and remove broken links to contributed RedHat nano packages. (DLR)<br>
|
||||
2005.11.21 - Clarify section 5.3 to better explain how to enable Unicode support, and remove the mention of quirks, since they turned out to not be a nano problem. (Mike Frysinger and DLR)<br>
|
||||
2005.11.19 - Add a new section 5.3 to explain the status of nano's Unicode support. (Mike Frysinger, minor tweaks by DLR)<br>
|
||||
2005.08.27 - Update email address. (DLR)<br>
|
||||
2005.08.10 - Add a new section 4.3, and move all section 4 entries after it down one number, to explain how to deal with numeric keypad problems. (DLR)<br>
|
||||
2005.08.08 - Update section 3.8 to mention that verbatim input mode now takes a six-digit hexadecimal number. (DLR)<br>
|
||||
2005.07.04 - Update section 4.10 to mention that pasting from the X clipboard via the middle mouse button also works when the Shift key is used. (DLR)<br>
|
||||
2005.06.15 - Update description of --enable-extra, and add missing line breaks. (DLR)<br>
|
||||
2005.06.13 - Minor capitalization and wording fixes. (DLR)<br>
|
||||
2005.06.08 - Updated section 1.1 to mention the current maintainer. (DLR)<br>
|
||||
2005.03.09 - Added question about opening files with names beginning with '+'s, and added a few more miscellaneous cosmetic fixes. (DLR)<br>
|
||||
2005.01.03 - Removed now-inaccurate note about verbatim input's not working at prompts, and update its description to mention that it handles hexadecimal values now. (DLR)<br>
|
||||
2004.11.21 - Listed sh as an example of a Bourne shell. (DLR)<br>
|
||||
2004.11.05 - Fixed inaccuracy: Pico compatibility mode was made the default in nano 1.1.99pre1, not 1.2.2. Also added question about how to type F13-F16 on terminals lacking keys past F12 (suggested by Chris), question about how to select text for the clipboard in X terminals with nano's mouse support turned on (answer found by Joseph Birthisel), and misc. fixes and link updates. (DLR)<br>
|
||||
2004.04.07 - Removed NumLock glitch question, as it's no longer needed. (DLR)<br>
|
||||
2004.01.30 - Fixed inaccuracy: multibuffer mode was first in nano 1.1.0, not 1.1.12. (DLR)<br>
|
||||
2003.12.31 - Added question about the new verbatim input function, and a few minor fixes. Removed reference to "set pico" (DLR).<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>
|
||||
2002.05.15 - Typo fix (DLR).<br>
|
||||
2001.12.26 - Misc. fixes (Aaron S. Hawley, DLR).<br>
|
||||
2001.10.02 - Update for Free Translation Project.<br>
|
||||
2001.10.02 - Assorted fixes, Debian additions.<br>
|
||||
2001.06.30 - Silly typo fix.<br>
|
||||
2001.05.05 - Spelling fixes by David Lawrence Ramsey.<br>
|
||||
2001.05.02 - Misc fixes.<br>
|
||||
2001.03.26 - Typo fix in an URL.<br>
|
||||
2001.02.17 - Advocacy updates.<br>
|
||||
2001.02.15 - Added GNU notes for 0.9.99pre3.<br>
|
||||
2001.02.06 - Typo fixes.<br>
|
||||
2001.01.14 - Added note about NumLock glitch.<br>
|
||||
2001.01.10 - Linux -> GNU/Linux.<br>
|
||||
2001.01.09 - Added "making exe smaller" section.<br>
|
||||
2000.12.19 - Typo and assorted error fixes.<br>
|
||||
2000.11.28 - Added blurb about make install-strip.<br>
|
||||
2000.11.19 - Changed Debian frozen to stable.<br>
|
||||
2000.11.18 - Previous string display (4.5).<br>
|
||||
2000.09.27 - Moved addresses to nano-editor.org.<br>
|
||||
2000.06.31 - Initial framework.</p></blockquote>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
3
doc/man/.gitignore
vendored
3
doc/man/.gitignore
vendored
@@ -1,3 +0,0 @@
|
||||
nano.1.html
|
||||
nanorc.5.html
|
||||
rnano.1.html
|
||||
@@ -1,28 +0,0 @@
|
||||
SUBDIRS =
|
||||
BUILT_SOURCES =
|
||||
|
||||
if USE_NLS
|
||||
SUBDIRS += fr
|
||||
endif
|
||||
|
||||
dist_man_MANS = nano.1 rnano.1
|
||||
html_pages = nano.1.html rnano.1.html
|
||||
|
||||
if USE_NANORC
|
||||
dist_man_MANS += nanorc.5
|
||||
html_pages += nanorc.5.html
|
||||
endif
|
||||
|
||||
nano.1.html: nano.1
|
||||
groff -t -mandoc -Thtml < $? > $@
|
||||
nanorc.5.html: nanorc.5
|
||||
groff -t -mandoc -Thtml < $? > $@
|
||||
rnano.1.html: rnano.1
|
||||
groff -t -mandoc -Thtml < $? > $@
|
||||
|
||||
if GROFF_HTML
|
||||
BUILT_SOURCES += $(html_pages)
|
||||
dist_html_DATA = $(html_pages)
|
||||
endif
|
||||
|
||||
EXTRA_DIST = $(BUILT_SOURCES)
|
||||
@@ -1,26 +0,0 @@
|
||||
mandir = @mandir@/fr
|
||||
htmldir = @htmldir@/fr
|
||||
|
||||
BUILT_SOURCES =
|
||||
|
||||
dist_man_MANS = nano.1 rnano.1
|
||||
html_pages = nano.1.html rnano.1.html
|
||||
|
||||
if USE_NANORC
|
||||
dist_man_MANS += nanorc.5
|
||||
html_pages += nanorc.5.html
|
||||
endif
|
||||
|
||||
nano.1.html: nano.1
|
||||
groff -t -mandoc -Thtml < $? > $@
|
||||
nanorc.5.html: nanorc.5
|
||||
groff -t -mandoc -Thtml < $? > $@
|
||||
rnano.1.html: rnano.1
|
||||
groff -t -mandoc -Thtml < $? > $@
|
||||
|
||||
if GROFF_HTML
|
||||
BUILT_SOURCES += $(html_pages)
|
||||
dist_html_DATA = $(html_pages)
|
||||
endif
|
||||
|
||||
EXTRA_DIST = $(BUILT_SOURCES)
|
||||
@@ -1,324 +0,0 @@
|
||||
.\" Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
|
||||
.\" Free Software Foundation, Inc.
|
||||
.\"
|
||||
.\" Le travail d'adaptation française de cette page de manuel a été
|
||||
.\" réalisé par Jean-Philippe Guérard, en 2003, 2004, 2005, 2006 et 2007.
|
||||
.\" Ce travail d'adaptation est dans le domaine public. Attention, la
|
||||
.\" page traduite reste soumise au droit d'auteur de ses auteurs
|
||||
.\" originaux.
|
||||
.\"
|
||||
.\" The French translation of this document is a public domain work of
|
||||
.\" Jean-Philippe Guérard. This translation work was made in 2003, 2004,
|
||||
.\" 2005, 2006 and 2007. The translated man page in itself is still
|
||||
.\" subject to the copyright of its original authors.
|
||||
.\"
|
||||
.\" This document is dual-licensed. You may distribute and/or modify it
|
||||
.\" under the terms of either of the following licenses:
|
||||
.\"
|
||||
.\" * The GNU General Public License, as published by the Free Software
|
||||
.\" Foundation, version 3 or (at your option) any later version. You
|
||||
.\" should have received a copy of the GNU General Public License
|
||||
.\" along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.\" * The GNU Free Documentation License, as published by the Free
|
||||
.\" Software Foundation, version 1.2 or (at your option) any later
|
||||
.\" version, with no Invariant Sections, no Front-Cover Texts, and no
|
||||
.\" Back-Cover Texts. You should have received a copy of the GNU Free
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.\" Ce document est publié sous une double licence. Vous pouvez
|
||||
.\" le distribuer et le modifier selon les termes de l'une des deux
|
||||
.\" licences ci-dessous :
|
||||
.\"
|
||||
.\" * La Licence publique générale GNU (GNU GPL) version 3 ou, à
|
||||
.\" votre choix, supérieure, telle que publiée par la Free
|
||||
.\" Software Foundation. Vous devriez avoir reçu une copie de la
|
||||
.\" Licence publique générale GNU avec ce programme. Si ce n'est pas
|
||||
.\" le cas, consultez <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.\" * La Licence de documentation libre GNU (GNU FDL), version 1.2 ou,
|
||||
.\" à votre choix, supérieure, telle que publiée par la Free
|
||||
.\" Software Foundation, sans section invariante, ni texte de
|
||||
.\" première ou de quatrième de couverture. Vous devriez avoir reçu
|
||||
.\" une copie de la Licence de documentation libre GNU avec ce
|
||||
.\" programme. Si ce n'est pas le cas, consultez
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH NANO 1 "version 2.0.0" "29\ novembre\ 2007"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
|
||||
.\"
|
||||
|
||||
.SH NOM
|
||||
nano \- NAno un NOuvel éditeur, un clone libre et amélioré de Pico
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B nano
|
||||
.I [OPTIONS]\ [[+LIGNE,COLONNE]\ FICHIER]...
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
Cette page de manuel décrit brièvement la commande \fBnano\fR.
|
||||
.PP
|
||||
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
|
||||
.\" \fI<whatever>\fP escape sequences to invoke bold face and italics,
|
||||
.\" respectively.
|
||||
\fBnano\fR est un éditeur petit, sympathique et libre, qui vise à remplacer
|
||||
Pico, l'éditeur par défaut du logiciel non libre Pine. \fBnano\fR ne se
|
||||
contentant pas de copier l'interface et l'ergonomie de Pico, il offre
|
||||
également certaines fonctions manquantes (ou désactivées par défaut)
|
||||
dans Pico. Ces fonctionnalités sont, par exemple, les fonctions de
|
||||
recherche et de remplacement, et la possibilité de sauter directement à
|
||||
une ligne et à une colonne précise.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B +\fILIGNE\fP,\fICOLONNE\fP
|
||||
Démarre avec le curseur positionné à la colonne \fICOLONNE\fP de
|
||||
la ligne \fILIGNE\fR (l'un des deux, au moins, devant être spécifié) au
|
||||
lieu de démarrer à la colonne\ 1, ligne\ 1.
|
||||
.TP
|
||||
.B \-?
|
||||
Identique à \fB\-h (\-\-help)\fP.
|
||||
.TP
|
||||
.B \-A (\-\-smarthome)
|
||||
Rend plus malin le fonctionnement de la touche «\ Début\ ». Lorsque l'on
|
||||
appuie sur cette touche à n'importe quel endroit excepté au tout début
|
||||
du texte d'une ligne (i.\ e. au premier caractère non blanc), le curseur
|
||||
se positionnera au début du texte de la ligne (qu'il soit en avant ou en
|
||||
arrière). Si le curseur est déjà là, il se placera au vrai début de la
|
||||
ligne.
|
||||
.TP
|
||||
.B \-B (\-\-backup)
|
||||
Lors de l'écriture d'un fichier, crée une copie de sécurité de la
|
||||
version précédente, en ajoutant un tilde (~) au nom du fichier.
|
||||
.TP
|
||||
.B \-D (\-\-boldtext)
|
||||
Utilise des caractères gras à la place de la vidéo inverse.
|
||||
.TP
|
||||
.B \-C \fIrépertoire\fP (\-\-backupdir=\fIrépertoire\fP)
|
||||
Définit le répertoire utilisé par \fBnano\fP pour enregistrer les copies
|
||||
de sécurité uniques si celles-ci sont activées.
|
||||
.TP
|
||||
.B \-E (\-\-tabstospaces)
|
||||
Convertit les tabulations clavier en espaces.
|
||||
.TP
|
||||
.B \-F (\-\-multibuffer)
|
||||
Active le mode multi-espace, autorisant l'édition simultanée de
|
||||
plusieurs fichiers, si ce mode est disponible.
|
||||
.TP
|
||||
.B \-H (\-\-historylog)
|
||||
Enregistre les chaînes ayant fait l'objet d'une recherche ou d'un
|
||||
remplacement dans le fichier \fI~/.nano_history\fR afin de permettre leur
|
||||
réutilisation. Ceci n'est possible que si \fBnano\fR est configuré pour
|
||||
utiliser les fichiers nanorc.
|
||||
.TP
|
||||
.B \-I (\-\-ignorercfiles)
|
||||
Ne pas utiliser pas les fichiers \fISYSCONFDIR/nanorc\fR et
|
||||
\fI~/.nanorc\fR (si \fBnano\fR est capable de les utiliser).
|
||||
.TP
|
||||
.B \-K (\-\-rebindkeypad)
|
||||
Interprète les touches du pavé numérique afin qu'elles fonctionnent
|
||||
toutes correctement. Vous ne devriez utiliser cette option que si ce
|
||||
n'est pas le cas, car nano ne sera plus capable d'utiliser la souris
|
||||
correctement lorsque cette option sera activée.
|
||||
.TP
|
||||
.B \-L (\-\-nonewlines)
|
||||
Ne pas ajouter de passage à la ligne à la fin des fichiers.
|
||||
.TP
|
||||
.B \-N (\-\-noconvert)
|
||||
Désactive la conversion automatique des fichiers depuis les formats Mac et
|
||||
DOS.
|
||||
.TP
|
||||
.B \-O (\-\-morespace)
|
||||
Utiliser la ligne blanche située sous la ligne de titre comme
|
||||
espace supplémentaire d'édition.
|
||||
.TP
|
||||
.B \-Q \fIchaîne\fP (\-\-quotestr=\fIchaîne\fP)
|
||||
Définit le préfixe par défaut des citations. Nano utilise ce préfixe
|
||||
pour réaliser une justification correcte des citations. Si nano est
|
||||
capable d'utiliser des expressions rationnelles, le préfixe par défaut
|
||||
sera "\fI^([\ \\t]*[#:>\\|}])+\fP", sinon, ce sera "\fI>\ \fP". Dans
|
||||
l'expression rationnelle précédente, «\ \fI\\t\fP\ » représente une
|
||||
tabulation.
|
||||
.TP
|
||||
.B \-R (\-\-restricted)
|
||||
Mode restreint\ : aucune lecture ou écriture de fichiers non indiqués
|
||||
sur la ligne de commande, pas de lecture des fichiers nanorc,
|
||||
interdiction de suspendre, interdiction d'ajouter au début, à la fin,
|
||||
de sauvegarder un fichier ayant déjà un nom sous un nom différent,
|
||||
d'utiliser une copie de sécurité ou le correcteur orthographique. Cette
|
||||
option peut aussi être activée en appelant \fBnano\fP sous un nom
|
||||
commençant par «\ r\ » (par exemple «\ rnano\ »).
|
||||
.TP
|
||||
.B \-S (\-\-smooth)
|
||||
Active le défilement progressif. Le texte défilera ligne-par-ligne au lieu
|
||||
de défiler morceau-par-morceau.
|
||||
.TP
|
||||
.B \-T \fInombre\fP (\-\-tabsize=\fInombre\fP)
|
||||
Définit la taille (largeur) des tabulations en nombre de colonnes. Le
|
||||
nombre indiqué doit être strictement supérieur à 0. La valeur par défaut
|
||||
est de 8.
|
||||
.TP
|
||||
.B \-U (\-\-quickblank)
|
||||
Effacement rapide de la ligne d'état. Les messages affichés par la ligne
|
||||
d'état disparaîtront après une frappe clavier au lieu de 25. Notez que
|
||||
l'option \fB-c\fP prend le pas sur cette option.
|
||||
.TP
|
||||
.B \-V (\-\-version)
|
||||
Affiche la version, puis s'arrête.
|
||||
.TP
|
||||
.B \-W (\-\-wordbounds)
|
||||
Détection plus précise des limites de mots, obtenue en considérant les
|
||||
caractères de ponctuation comme faisant partie des mots.
|
||||
.TP
|
||||
.B \-Y \fIchaîne\fP (\-\-syntax=\fIchaîne\fP)
|
||||
Indique quel mode de colorisation syntaxique adopter, parmi les modes
|
||||
définis dans le fichier \fI.nanorc\fR, si cette fonctionnalité est
|
||||
disponible.
|
||||
.TP
|
||||
.B \-c (\-\-const)
|
||||
Affiche en permanence la position du curseur. Notez que cette option
|
||||
prend le pas sur l'option \fB-U\fP.
|
||||
.TP
|
||||
.B \-d (\-\-rebinddelete)
|
||||
Interprète différemment la touche «\ Supprimer\ », afin que les touches
|
||||
«\ Effacement arrière\ » et «\ Supprimer\ » fonctionnent correctement.
|
||||
Vous ne devriez avoir besoin de cette option que si, sur votre système,
|
||||
la touche «\ Effacement arrière\ » produit l'effet de la touche
|
||||
«\ Supprimer\ ».
|
||||
.TP
|
||||
.B \-h (\-\-help)
|
||||
Affiche un résumé des options de lancement de nano, puis s'arrête.
|
||||
.TP
|
||||
.B \-i (\-\-autoindent)
|
||||
Indentation automatique. Commence chaque nouvelle ligne au même niveau que
|
||||
la ligne précédente. Utile pour l'édition de code source.
|
||||
.TP
|
||||
.B \-k (\-\-cut)
|
||||
Coupe le texte du curseur à la fin de la ligne, au lieu de couper la
|
||||
ligne entière.
|
||||
.TP
|
||||
.B \-l (\-\-nofollow)
|
||||
Si le fichier édité est un lien symbolique, au lieu de le suivre,
|
||||
remplace le lien par le nouveau fichier. Sans doute utile pour éditer
|
||||
les fichiers de \fI/tmp\fR, non\ ?
|
||||
.TP
|
||||
.B \-m (\-\-mouse)
|
||||
Active l'utilisation de la souris, si elle est disponible pour votre
|
||||
système. Lorsque celle-ci est activée, il est possible d'utiliser la
|
||||
souris pour positionner le curseur, pour marquer le texte (avec un
|
||||
double-clic) et pour lancer les fonctions correspondant aux raccourcis.
|
||||
Il est possible d'utiliser la souris sous X\ Window ou en mode console
|
||||
avec gpm.
|
||||
.TP
|
||||
.B \-o \fIrépertoire\fP (\-\-operatingdir=\fIrépertoire\fP)
|
||||
Définit le répertoire de travail. Demande à \fBnano\fP de mettre en place
|
||||
quelque chose de similaire à un environnement d'exécution restreint
|
||||
(\fIchroot\fR).
|
||||
.TP
|
||||
.B \-p (\-\-preserve)
|
||||
Préserve les séquences XON et XOFF (^Q et ^S), afin qu'elle soient reçues
|
||||
par le terminal.
|
||||
.TP
|
||||
.B \-r \fIcolonne\fP (\-\-fill=\fIcolonne\fP)
|
||||
Passe automatiquement à la ligne une fois arrivé à la colonne
|
||||
\fIcolonne\fR. Si la valeur indiquée est de 0 ou moins, le point de
|
||||
passage à la ligne aura lieu à la taille de l'écran moins \fIcolonne\fR.
|
||||
Cela permet de faire varier le point de passage à la ligne lorsque l'on
|
||||
change la taille de l'écran. La valeur par défaut est de \-8.
|
||||
.TP
|
||||
.B \-s \fIprogramme\fP (\-\-speller=\fIprogramme\fP)
|
||||
Choix d'un correcteur orthographique de remplacement.
|
||||
.TP
|
||||
.B \-t (\-\-tempfile)
|
||||
S'il a été modifié, le fichier sera sauvegardé automatiquement sans
|
||||
demande de confirmation. Identique à l'option \fB-t\fP de Pico.
|
||||
.TP
|
||||
.B \-v (\-\-view)
|
||||
Mode visualisation (lecture seule).
|
||||
.TP
|
||||
.B \-w (\-\-nowrap)
|
||||
Désactive le passage automatique à la ligne.
|
||||
.TP
|
||||
.B \-x (\-\-nohelp)
|
||||
Désactive la barre d'aide affichée en bas de l'écran.
|
||||
.TP
|
||||
.B \-z (\-\-suspend)
|
||||
Autorise à suspendre l'éditeur.
|
||||
.TP
|
||||
.B \-a, \-b, \-e, \-f, \-g, \-j
|
||||
Ignoré, pour être compatible avec Pico.
|
||||
|
||||
.SH "FICHIERS D'INITIALISATION"
|
||||
\fBnano\fR lit les fichiers d'initialisation dans l'ordre suivant\ :
|
||||
\fISYSCONFDIR/nanorc\fR, puis \fI~/.nanorc\fR. Référez-vous à la page de
|
||||
manuel de \fBnanorc(5)\fR et au fichier d'exemple \fInanorc.sample\fR,
|
||||
qui devraient tous les deux être livrés avec \fBnano\fR.
|
||||
|
||||
.SH NOTES
|
||||
Si aucun correcteur orthographique de remplacement n'est indiqué dans la
|
||||
ligne de commande ou dans l'un des fichiers nanorc, \fBnano\fR prendra
|
||||
la commande indiquée par la variable d'environnement \fBSPELL\fR si
|
||||
elle est définie.
|
||||
|
||||
Dans certains cas, \fBnano\fR essaiera de sauvegarder le fichier en cours
|
||||
d'édition dans un fichier de secours. Cela arrivera principalement si
|
||||
\fBnano\fR reçoit un signal SIGHUP ou SIGTERM, ou bien se trouve à court de
|
||||
mémoire. Le nom de ce fichier de secours sera \fInano.save\fR si le fichier en
|
||||
cours n'avait pas encore de nom, ou sera composé du nom du fichier en cours
|
||||
suivi du suffixe «\ .save\ ». Si un fichier de ce nom existe déjà dans
|
||||
le répertoire, un «\ .save\ » et un nombre seront ajoutés à la fin du
|
||||
nom du fichier en cours afin de le rendre unique (par exemple,
|
||||
«\ .save.1\ »). En mode multi-espace, \fBnano\fR réalisera une
|
||||
sauvegarde de tous les fichiers en cours dans leurs fichiers de secours
|
||||
respectifs.
|
||||
|
||||
.SH BOGUES
|
||||
Merci de nous faire parvenir vos commentaires et de nous signaler les
|
||||
bogues, en écrivant, en anglais, à \fBnano@nano-editor.org\fR.
|
||||
|
||||
La liste de discussion anglophone \fBnano\fR est disponible à l'adresse
|
||||
\fBnano-devel@gnu.org\fR.
|
||||
|
||||
Pour vous abonner, envoyez un courrier électronique à
|
||||
\fBnano-devel-request@gnu.org\fR, ayant pour objet «\ subscribe\ ».
|
||||
|
||||
N'hésitez pas également à envoyez vos commentaires, suggestions et
|
||||
corrections relatives à l'adaptation française de cette page de manuel
|
||||
ou du logiciel à \fBjean-philippe.guerard@tigreraye.org\fR.
|
||||
|
||||
.SH "SITE INTERNET"
|
||||
http://www.nano-editor.org/
|
||||
|
||||
.SH "VOIR AUSSI"
|
||||
.PD 0
|
||||
.TP
|
||||
\fBnanorc\fR(5)
|
||||
.PP
|
||||
\fI/usr/share/doc/nano/\fR (ou son équivalent sur votre système)
|
||||
|
||||
.SH AUTEUR
|
||||
Chris Allegretta <chrisa@asty.org> et d'autres (voir les fichiers
|
||||
\fIAUTHORS\fR et \fITHANKS\fR pour plus d'information). Cette page de
|
||||
manuel a été initialement rédigée par Jordi Mallach <jordi@gnu.org> pour
|
||||
le système Debian (mais elle peut être utilisée par d'autres).
|
||||
|
||||
.SH TRADUCTION
|
||||
Cette adaptation française a été réalisée par Jean-Philippe\ Guérard
|
||||
<jean-philippe.guerard@tigreraye.org> le 29\ novembre\ 2007 à partir
|
||||
de la version 1.54 du 11\ octobre\ 2007 de la page de manuel de nano
|
||||
2.0.0. Cette page a été relue par Gérard Delafond.
|
||||
|
||||
Un maximum de soin a été apporté lors de l'élaboration de cette
|
||||
traduction\ ; néanmoins, quelques imperfections peuvent subsister. Si
|
||||
vous en rencontrez, que ce soit dans la version française ou dans la
|
||||
version originale, n'hésitez pas à les signaler à l'auteur ou au
|
||||
traducteur.
|
||||
|
||||
La version originale la plus à jour de ce document est toujours
|
||||
consultable via la commande\ :
|
||||
|
||||
LANGUAGE=en man nano
|
||||
@@ -1,374 +0,0 @@
|
||||
.\" Copyright (C) 2003, 2004, 2005, 2006, 2007
|
||||
.\" Free Software Foundation, Inc.
|
||||
.\"
|
||||
.\" Le travail d'adaptation française de cette page de manuel a été
|
||||
.\" réalisé par Jean-Philippe Guérard, en 2003, 2004, 2005, 2006 et 2007.
|
||||
.\" Ce travail d'adaptation est dans le domaine public. Attention, la
|
||||
.\" page traduite reste soumise au droit d'auteur de ses auteurs
|
||||
.\" originaux.
|
||||
.\"
|
||||
.\" The French translation of this document is a public domain work of
|
||||
.\" Jean-Philippe Guérard. This translation work was made in 2003, 2004,
|
||||
.\" 2005, 2006 and 2007. The translated man page in itself is still
|
||||
.\" subject to the copyright of its original authors.
|
||||
.\"
|
||||
.\" This document is dual-licensed. You may distribute and/or modify it
|
||||
.\" under the terms of either of the following licenses:
|
||||
.\"
|
||||
.\" * The GNU General Public License, as published by the Free Software
|
||||
.\" Foundation, version 3 or (at your option) any later version. You
|
||||
.\" should have received a copy of the GNU General Public License
|
||||
.\" along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.\" * The GNU Free Documentation License, as published by the Free
|
||||
.\" Software Foundation, version 1.2 or (at your option) any later
|
||||
.\" version, with no Invariant Sections, no Front-Cover Texts, and no
|
||||
.\" Back-Cover Texts. You should have received a copy of the GNU Free
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.\" Ce document est publié sous une double licence. Vous pouvez
|
||||
.\" le distribuer et le modifier selon les termes de l'une des deux
|
||||
.\" licences ci-dessous :
|
||||
.\"
|
||||
.\" * La Licence publique générale GNU (GNU GPL) version 3 ou, à
|
||||
.\" votre choix, supérieure, telle que publiée par la Free
|
||||
.\" Software Foundation. Vous devriez avoir reçu une copie de la
|
||||
.\" Licence publique générale GNU avec ce programme. Si ce n'est
|
||||
.\" pas le cas, consultez <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.\" * La Licence de documentation libre GNU (GNU FDL), version 1.2
|
||||
.\" ou, à votre choix, supérieure, telle que publiée par la Free
|
||||
.\" Software Foundation, sans section invariante, ni texte de
|
||||
.\" première ou de quatrième de couverture. Vous devriez avoir reçu
|
||||
.\" une copie de la Licence de documentation libre GNU avec ce
|
||||
.\" programme. Si ce n'est pas le cas, consultez
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH NANORC 5 "version 2.0.0" "29\ novembre\ 2007"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
|
||||
|
||||
.SH NOM
|
||||
nanorc \- fichier de configuration de l'éditeur nano du projet GNU
|
||||
|
||||
.SH DESCRIPTION
|
||||
Cette page de manuel décrit brièvement le fichier de configuration de
|
||||
l'éditeur \fBnano\fP GNU.
|
||||
.PP
|
||||
\fBnano\fP est un petit éditeur sympathique et libre, qui vise à
|
||||
remplacer Pico, l'éditeur par défaut du logiciel non libre Pine.
|
||||
\fBnano\fP ne se contentant pas de copier l'interface et l'ergonomie de
|
||||
Pico, il offre également certaines fonctionnalités manquantes (ou
|
||||
désactivées par défaut) de Pico. Ces fonctionnalités sont, par exemple,
|
||||
les fonctions de recherche et de remplacement et la possibilité de
|
||||
sauter directement à une ligne et à une colonne précise.
|
||||
.PP
|
||||
Le fichier \fInanorc\fP contient les paramètres par défaut de
|
||||
\fBnano\fP. Il ne doit pas être au format DOS ou Mac. Lors de son
|
||||
démarrage, nano commencera par lire le fichier de configuration général
|
||||
\fISYSCONFDIR/nanorc\fP, puis lira le fichier de configuration personnel
|
||||
de l'utilisateur \fI~/.nanorc\fP.
|
||||
|
||||
.SH OPTIONS
|
||||
Le fichier de configuration accepte une série de commandes \fBset\fP
|
||||
(activer) et \fBunset\fP (désactiver), qui permettent de définir le
|
||||
paramétrage de nano au démarrage sans avoir à utiliser d'options de
|
||||
ligne de commande. De plus, les mots clefs \fBsyntax\fP (syntaxe),
|
||||
\fBcolor\fP (couleur) et \fBicolor\fP (couleur insensible à la casse)
|
||||
sont utilisés pour définir les règles de colorisation pour différents
|
||||
motifs de texte. \fBnano\fP lit une commande par ligne.
|
||||
|
||||
Les options du fichier de configuration ont priorité sur les valeurs par
|
||||
défaut utilisées par nano. Les options de la ligne de commande sont
|
||||
prioritaires par rapport aux options du fichier de configuration. Les
|
||||
options sont désactivées (unset) par défaut, sauf les options prenant un
|
||||
argument.
|
||||
|
||||
Les apostrophes («\ \fI'\fP\ ») et les guillemets droits («\ \fI"\fP\ »)
|
||||
présents dans des chaînes de caractères utilisées comme paramètres n'ont
|
||||
pas besoin d'être précédées d'une barre oblique inversée
|
||||
(«\ \fI\\\fP\ »). La chaîne sera terminée par le dernier guillemet
|
||||
droit. Par exemple, pour l'option \fBbrackets\fP, "\fI"')>]}\fP"
|
||||
correspondra à \fI"\fP, \fI'\fP, \fI)\fP, \fI>\fP, \fI]\fP et \fI}\fP.
|
||||
|
||||
Les commandes et arguments reconnus sont\ :
|
||||
|
||||
.TP 3
|
||||
.B set/unset autoindent
|
||||
Active l'indentation automatique.
|
||||
.TP
|
||||
.B set/unset backup
|
||||
Crée des copies de sécurité nommées
|
||||
.IR nom_du_fichier~ .
|
||||
.TP
|
||||
.B set backupdir "\fIrépertoire\fP"
|
||||
Définit le répertoire utilisé par \fBnano\fP pour enregistrer les copies
|
||||
de sécurité uniques, si l'enregistrement de copies de sécurité est
|
||||
activé.
|
||||
.TP
|
||||
.B set/unset backwards
|
||||
Par défaut, les recherches se font vers l'arrière.
|
||||
.TP
|
||||
.B set/unset boldtext
|
||||
Utilise des caractères gras à la place de la vidéo inverse.
|
||||
.TP
|
||||
.B set brackets "\fIchaîne\fP"
|
||||
Définit les caractères considérés comme des crochets fermants lors de la
|
||||
justification des paragraphes. Ces caractères ne doivent pas contenir
|
||||
d'espaces. Seules les ponctuations terminales, éventuellement suivies
|
||||
de crochets fermants, peuvent terminer une phrase.
|
||||
|
||||
La valeur par défaut de cette option est\ : "\fI"')>]}\fP".
|
||||
|
||||
N.D.T.\ : reportez-vous au paragraphe sur l'option \fBpunct\fR pour
|
||||
plus d'informations.
|
||||
|
||||
.TP
|
||||
.B set/unset casesensitive
|
||||
Par défaut, les recherches ne tiennent pas compte de la casse.
|
||||
.TP
|
||||
.B set/unset const
|
||||
Affiche en permanence la position du curseur dans la ligne d'état.
|
||||
.TP
|
||||
.B set/unset cut
|
||||
Par défaut, coupe le texte du curseur à la fin de la ligne, au lieu de
|
||||
couper la ligne entière.
|
||||
.TP
|
||||
.B set fill \fIn\fP
|
||||
Passe automatiquement à la ligne une fois arrivé à la colonne
|
||||
\fIn\fR. Si la valeur indiquée est de 0 ou moins, le point de passage à
|
||||
la ligne aura lieu à la taille de l'écran moins \fIn\fR. Cela permet de
|
||||
faire varier le point de passage à la ligne lorsque l'on change la
|
||||
taille de l'écran. La valeur par défaut est de \-8.
|
||||
.TP
|
||||
.B set/unset historylog
|
||||
Active l'utilisation de
|
||||
.I ~/.nano_history
|
||||
pour enregistrer et relire les chaînes ayant fait l'objet d'une
|
||||
recherche ou d'un remplacement.
|
||||
.TP
|
||||
.B set matchbrackets "\fIchaîne\fP"
|
||||
Définit les crochets ouvrants et fermant pour la recherche de crochets
|
||||
correspondants. Cette liste ne doit pas contenir de blancs. L'ensemble
|
||||
des crochets ouvrants doit être indiqué en premier, suivi de l'ensemble
|
||||
des crochets fermant, qui doit être dans le même ordre. La valeur par
|
||||
défaut de cette option est "\fI(<[{)>]}\fP".
|
||||
.TP
|
||||
.B set/unset morespace
|
||||
Utiliser la ligne blanche située sous la ligne de titre comme espace
|
||||
supplémentaire d'édition.
|
||||
.TP
|
||||
.B set/unset mouse
|
||||
Active l'utilisation de la souris, si elle est disponible pour votre
|
||||
système. Lorsque celle-ci est activée, il est possible d'utiliser la
|
||||
souris pour positionner le curseur, pour marquer le texte (avec un
|
||||
double-clic) et pour lancer les fonctions correspondant aux raccourcis.
|
||||
Il est possible d'utiliser la souris sous X\ Window ou en mode console
|
||||
avec gpm.
|
||||
.TP
|
||||
.B set/unset multibuffer
|
||||
Mode multi-espace\ : permet de charger les fichiers dans leur propre
|
||||
espace.
|
||||
.TP
|
||||
.B set/unset noconvert
|
||||
Pas de conversion depuis les formats DOS et Mac.
|
||||
.TP
|
||||
.B set/unset nofollow
|
||||
Ne suit pas les liens symboliques lors de l'écriture des fichiers.
|
||||
.TP
|
||||
.B set/unset nohelp
|
||||
Désactive les lignes d'aide affichée en bas de l'écran.
|
||||
.TP
|
||||
.B set/unset nonewlines
|
||||
Ne pas ajouter de passage à la ligne à la fin des fichiers.
|
||||
.TP
|
||||
.B set/unset nowrap
|
||||
Désactive le passage automatique à la ligne.
|
||||
.TP
|
||||
.B set operatingdir "\fIrépertoire\fP"
|
||||
\fBnano\fP ne lira et n'écrira des fichiers qu'à l'intérieur du
|
||||
\fIrépertoire\fP et de ses sous-répertoires. De plus, celui-ci devient
|
||||
le répertoire courant, afin que les fichiers soient lus depuis ce
|
||||
répertoire. Par défaut, cette fonction est désactivée.
|
||||
.TP
|
||||
.B set/unset preserve
|
||||
Préserve les séquences XON et XOFF (^Q et ^S).
|
||||
.TP
|
||||
.B set punct "\fIchaîne\fP"
|
||||
Définit les caractères interprétés comme des ponctuations terminales
|
||||
lors de la justification des paragraphes. Ces caractères ne peuvent
|
||||
inclure de blancs. Seules les ponctuations terminales, éventuellement
|
||||
suivies de crochets fermants, peuvent terminer une phrase. La valeur par
|
||||
défaut de cette option est "\fI!.?\fP".
|
||||
|
||||
N.D.T.\ : ce réglage permet, lors de la justification, de conserver
|
||||
2\ espaces au lieu d'une derrière les ponctuations terminales, ce qui
|
||||
correspond aux normes typographiques anglo-saxonnes, mais n'a pas lieu
|
||||
d'être en français. Pour le français, le plus simple est d'indiquer,
|
||||
dans le fichier nanorc, une chaîne vide pour ce paramètre.
|
||||
.TP
|
||||
.B set/unset quickblank
|
||||
Effacement rapide de la ligne d'état. Les messages affichés par la ligne
|
||||
d'état disparaîtront après une frappe clavier au lieu de 25.
|
||||
.TP
|
||||
.B set quotestr "\fIchaîne\fP"
|
||||
Définit le préfixe par défaut utilisé pour les citations dans les
|
||||
courriers électroniques. Ce préfixe est utilisé pour réaliser une
|
||||
justification correcte de ces citations. Il s'agira, si votre système le
|
||||
permet, d'une expression rationnelle étendue. Dans le cas
|
||||
contraire, il s'agira d'une chaîne de texte brut. Si vous disposez des
|
||||
expressions rationnelles, la valeur par défaut de cette option sera
|
||||
"\fI^([\ \\t]*[#:>\\|}])+\fP", sinon, ce sera ">\ ". Notez que le
|
||||
«\ \\t\ » ci-dessus correspond à un caractère de tabulation.
|
||||
.TP
|
||||
.B set/unset rebinddelete
|
||||
Interprète différemment la touche «\ Supprimer\ », afin que les touches
|
||||
«\ Effacement arrière\ » et «\ Supprimer\ » fonctionnent correctement.
|
||||
Vous ne devriez avoir besoin de cette option que si, sur votre système,
|
||||
la touche «\ Effacement arrière\ » produit l'effet de la touche «\
|
||||
Supprimer\ ».
|
||||
.TP
|
||||
.B set/unset rebindkeypad
|
||||
Interprète les touches du pavé numérique afin qu'elles fonctionnent
|
||||
toutes correctement. Vous ne devriez utiliser cette option que si ce
|
||||
n'est pas le cas, car nano ne sera plus capable d'utiliser la souris
|
||||
correctement lorsque cette option sera activée.
|
||||
.TP
|
||||
.B set/unset regexp
|
||||
Utilise par défaut des expressions rationnelles étendues pour les
|
||||
recherches.
|
||||
.TP
|
||||
.B set/unset smarthome
|
||||
Rend plus malin le fonctionnement de la touche «\ Début\ ». Lorsque
|
||||
cette touche est pressée à n'importe quel endroit excepté au tout début
|
||||
du texte d'une ligne (i.\ e. au premier caractère non blanc), le curseur
|
||||
se positionnera au début du texte de la ligne (qu'il soit en avant ou en
|
||||
arrière). Si le curseur est déjà là, il se placera au vrai début de la
|
||||
ligne.
|
||||
.TP
|
||||
.B set/unset smooth
|
||||
Active le défilement ligne-par-ligne du texte.
|
||||
.TP
|
||||
.B set speller "\fIprogramme\fP"
|
||||
Utilise le correcteur orthographique \fIprogramme\fP au lieu du
|
||||
correcteur intégré, qui s'appuie sur \fIspell\fP.
|
||||
.TP
|
||||
.B set/unset suspend
|
||||
Autorise à suspendre \fBnano\fP.
|
||||
.TP
|
||||
.B set tabsize \fIn\fP
|
||||
Utilise une taille de tabulation de \fIn\fP colonnes. Cette valeur doit
|
||||
être strictement supérieure à 0. La valeur par défaut est de\ 8.
|
||||
.TP
|
||||
.B set/unset tabstospaces
|
||||
Convertit les tabulations clavier en espaces.
|
||||
.TP
|
||||
.B set/unset tempfile
|
||||
S'il a été modifié, le fichier sera sauvegardé automatiquement en
|
||||
quittant, sans demande de confirmation.
|
||||
.TP
|
||||
.B set/unset view
|
||||
Interdit de modifier les fichiers.
|
||||
.TP
|
||||
.B set whitespace "\fIchaîne\fP"
|
||||
Définit les deux caractères utilisés pour afficher les premiers
|
||||
caractères des tabulations et des espaces. Ces deux caractères doivent
|
||||
être mono-colonne.
|
||||
.TP
|
||||
.B set/unset wordbounds
|
||||
Détection plus précise des limites de mots, obtenue en considérant les
|
||||
caractères de ponctuation comme faisant partie des mots.
|
||||
.TP
|
||||
.B syntax "\fIchaîne\fP" ["\fImotif_de_fichier\fP" ... ]
|
||||
Définit une syntaxe nommée \fIchaîne\fP qui pourra être activé via
|
||||
l'option \fB-Y\fP (ou \fB--syntax\fP) ou qui sera automatiquement
|
||||
activée si le nom du fichier en cours correspond à l'expression
|
||||
rationnelle étendue \fImotif_de_fichier\fP. Toutes les instructions
|
||||
suivantes de colorisation \fBcolor\fP ou \fBicolor\fP s'appliqueront à
|
||||
cette syntaxe, jusqu'à la définition d'une nouvelle syntaxe.
|
||||
|
||||
La syntaxe nommée \fInone\fP (aucune) est réservée\ ; si elle est
|
||||
indiquée dans la ligne de commande, cela revient à ne définir aucune
|
||||
syntaxe. La syntaxe nommée \fIdefault\fP (par défaut) est spéciale, elle
|
||||
ne nécessite aucun motif de \fImotif_de_fichier\fP, et s'applique aux
|
||||
fichiers ne correspondant à aucun des \fImotif_de_fichier\fP des autres
|
||||
syntaxes.
|
||||
.TP
|
||||
.B color \fIcouleur_texte\fP[,\fIcouleur_fond\fP] "\fImotif\fP" ...
|
||||
Pour la syntaxe en cours, affiche toutes les expressions correspondant à
|
||||
l'expression rationnelle étendue \fImotif\fP en utilisant la couleur de
|
||||
texte \fIcouleur_texte\fP et la couleur de fond \fIcouleur_fond\fP,
|
||||
l'une de ces deux couleurs au moins devant être définie. Les couleurs
|
||||
acceptées par \fBnano\fP pour le texte et le fond sont\ : \fIwhite\fP
|
||||
(blanc), \fIblack\fP (noir), \fIred\fP (rouge), \fIblue\fP (bleu),
|
||||
\fIgreen\fP (vert), \fIyellow\fP (jaune), \fImagenta\fP, et \fIcyan\fP.
|
||||
Pour la couleur du texte, vous pouvez ajouter à ces couleurs le préfixe
|
||||
\fIbright\fP (lumineux) pour obtenir une couleur plus lumineuse. Si
|
||||
votre terminal est capable de gérer la transparence, ne pas spécifier de
|
||||
\fIcouleur_fond\fP indique à \fBnano\fP d'essayer d'utiliser un fond
|
||||
transparent.
|
||||
.TP
|
||||
.B icolor \fIcouleur_texte\fP[,\fIcouleur_fond\fP] "\fImotif\fP" ...
|
||||
Comme ci-dessus, mais la recherche des motifs est effectuée sans tenir
|
||||
compte de la casse.
|
||||
.TP
|
||||
.B color \fIcouleur_texte\fP[,\fIcouleur_fond\fP] start="\fImotif_début\fP" end="\fImotif_fin\fP"
|
||||
Affiche les expressions commençant par l'expression rationnelle étendue
|
||||
\fImotif_début\fP et se terminant par l'expression rationnelle étendue
|
||||
\fImotif_fin\fP en utilisant la couleur de texte \fIcouleur_texte\fP
|
||||
et la couleur de fond \fIcouleur_fond\fP, l'une de ces deux couleurs au
|
||||
moins devant être définie. Cela permet à la colorisation syntaxique de
|
||||
s'étendre sur plusieurs lignes. Notez que toutes les occurrences
|
||||
successives de \fImotif_début\fP après le \fImotif_début\fP initial
|
||||
seront surlignées jusqu'à la prochaine instance de \fImotif_fin\fP.
|
||||
.TP
|
||||
.B icolor \fIcouleur_texte\fP[,\fIcouleur_fond\fP] start="\fImotif_début\fP" end="\fImotif_fin\fP"
|
||||
Comme ci-dessus, mais la recherche des motifs est effectuée sans tenir
|
||||
compte de la casse.
|
||||
.TP
|
||||
.B include "\fIfichier_de_syntaxes\fP"
|
||||
Lit le fichier \fIfichier_de_syntaxes\fP contenant une liste
|
||||
autosuffisante de définitions de syntaxes. Ce fichier ne doit contenir
|
||||
que des commandes \fBsyntax\fP, \fBcolor\fP et \fBicolor\fP.
|
||||
|
||||
.SH FICHIERS
|
||||
.TP
|
||||
.I $SYSCONFDIR/nanorc
|
||||
Fichier de configuration général
|
||||
.TP
|
||||
.I ~/.nanorc
|
||||
Fichier de configuration personnel
|
||||
|
||||
.SH VOIR AUSSI
|
||||
.PD 0
|
||||
.TP
|
||||
\fBnano\fP(1)
|
||||
.PP
|
||||
\fI/usr/share/doc/nano/examples/nanorc.sample\fP (ou son équivalent sur
|
||||
votre système)
|
||||
|
||||
.SH AUTEUR
|
||||
Chris Allegretta <chrisa@asty.org> et d'autres (voir les fichiers
|
||||
\fIAUTHORS\fP et \fITHANKS\fP pour plus d'information). Cette page de
|
||||
manuel a été initialement rédigée par Jordi Mallach <jordi@gnu.org> pour
|
||||
le système Debian (mais elle peut être utilisée par d'autres).
|
||||
|
||||
.SH TRADUCTION
|
||||
Cette adaptation française a été réalisée par Jean-Philippe\ Guérard
|
||||
<jean-philippe.guerard@tigreraye.org> le 29\ novembre\ 2007 à partir de
|
||||
la version 1.56 du 11\ octobre\ 2007 de la page de manuel de nanorc
|
||||
(pour la version 2.0.0 de nano). Cette page a été relue par Gérard
|
||||
Delafond.
|
||||
|
||||
Un maximum de soin a été apporté lors de l'élaboration de cette
|
||||
traduction\ ; néanmoins, quelques imperfections peuvent subsister. Si
|
||||
vous en rencontrez, que ce soit dans la version française ou dans la
|
||||
version originale, n'hésitez pas à les signaler à l'auteur ou au
|
||||
traducteur.
|
||||
|
||||
La version originale la plus à jour de ce document est toujours
|
||||
consultable via la commande\ :
|
||||
|
||||
LANGUAGE=en man nano
|
||||
@@ -1,152 +0,0 @@
|
||||
.\" Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
.\" Skeleton based on nano-tiny.1:
|
||||
.\" Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
.\"
|
||||
.\" Le travail d'adaptation française de cette page de manuel a été
|
||||
.\" réalisé par Jean-Philippe Guérard, en 2006 et 2007. Ce travail
|
||||
.\" d'adaptation est dans le domaine public. Attention, la page traduite
|
||||
.\" reste soumise au droit d'auteur de ses auteurs originaux.
|
||||
.\"
|
||||
.\" The French translation of this document is a public domain work of
|
||||
.\" Jean-Philippe Guérard. This translation work was made in 2006 and
|
||||
.\" 2007. The translated man page in itself is still subject to the
|
||||
.\" copyright of its original authors.
|
||||
.\"
|
||||
.\" This document is dual-licensed. You may distribute and/or modify it
|
||||
.\" under the terms of either of the following licenses:
|
||||
.\"
|
||||
.\" * The GNU General Public License, as published by the Free Software
|
||||
.\" Foundation, version 3 or (at your option) any later version. You
|
||||
.\" should have received a copy of the GNU General Public License
|
||||
.\" along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.\" * The GNU Free Documentation License, as published by the Free
|
||||
.\" Software Foundation, version 1.2 or (at your option) any later
|
||||
.\" version, with no Invariant Sections, no Front-Cover Texts, and no
|
||||
.\" Back-Cover Texts. You should have received a copy of the GNU Free
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.\" Ce document est publié sous une double licence. Vous pouvez
|
||||
.\" le distribuer et le modifier selon les termes de l'une des deux
|
||||
.\" licences ci-dessous :
|
||||
.\"
|
||||
.\" * La Licence publique générale GNU (GNU GPL) version 3 ou, à
|
||||
.\" votre choix, supérieure, telle que publiée par la Free
|
||||
.\" Software Foundation. Vous devriez avoir reçu une copie de la
|
||||
.\" Licence publique générale GNU avec ce programme. Si ce n'est pas
|
||||
.\" le cas, consultez <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.\" * La Licence de documentation libre GNU (GNU FDL), version 1.2 ou,
|
||||
.\" à votre choix, supérieure, telle que publiée par la Free
|
||||
.\" Software Foundation, sans section invariante, ni texte de
|
||||
.\" première ou de quatrième de couverture. Vous devriez avoir reçu
|
||||
.\" une copie de la Licence de documentation libre GNU avec ce
|
||||
.\" programme. Si ce n'est pas le cas, consultez
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH RNANO 1 "version 2.0.0" "29\ novembre\ 20O7"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
|
||||
.\"
|
||||
.SH NOM
|
||||
rnano \- Le mode restreint de NAno un NOuvel éditeur, un clone libre et
|
||||
amélioré de Pico
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B rnano
|
||||
.I [OPTIONS]\ [[+LIGNE,COLONNE]\ FICHIER]...
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
Cette page de manuel décrit brièvement la commande \fBrnano\fR.
|
||||
.PP
|
||||
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
|
||||
.\" \fI<whatever>\fP escape sequences to invoke bold face and italics,
|
||||
.\" respectively.
|
||||
\fBnano\fR est un éditeur petit, sympathique et libre, qui vise à
|
||||
remplacer Pico, l'éditeur par défaut du logiciel non libre Pine.
|
||||
\fBnano\fR ne se contentant pas de copier l'interface et l'ergonomie de
|
||||
Pico, il offre également certaines fonctions manquantes (ou désactivées
|
||||
par défaut) dans Pico. Ces fonctionnalités sont, par exemple, les
|
||||
fonctions de recherche et de remplacement, et la possibilité de sauter
|
||||
directement à une ligne et à une colonne précise..
|
||||
.PP
|
||||
\fBrnano\fP est une version de \fBnano\fP fonctionnant en mode
|
||||
restreint, qui ne permet d'éditer que les fichiers indiqués et qui
|
||||
n'autorise pas l'utilisateur à accéder au système de fichier ou à un
|
||||
interpréteur de commandes.
|
||||
.PP
|
||||
En mode restreint, \fBnano\fP refusera\ :
|
||||
.IP \[bu] 2
|
||||
de lire ou d'écrire dans un fichier n'ayant pas été indiqué dans la
|
||||
ligne de commande\ ;
|
||||
.IP \[bu]
|
||||
de lire un fichier nanorc\ ;
|
||||
.IP \[bu]
|
||||
de permettre de suspendre l'édition\ ;
|
||||
.IP \[bu]
|
||||
de permettre d'ajouter en début ou en fin d'un fichier, ou de
|
||||
l'enregistrer sous un nom différent\ ;
|
||||
.IP \[bu]
|
||||
l'utilisation de copies de sécurité ou de la correction orthographique.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B +\fILIGNE\fP,\fICOLONNE\fP
|
||||
Démarre avec le curseur positionné à la colonne \fICOLONNE\fP de
|
||||
la ligne \fILIGNE\fR (l'un des deux, au moins, devant être spécifié) au
|
||||
lieu de démarrer à la colonne\ 1, ligne\ 1.
|
||||
.TP
|
||||
.B \-?
|
||||
Identique à \fB\-h (\-\-help)\fP.
|
||||
.TP
|
||||
.B \-h (\-\-help)
|
||||
Affiche un résumé des options de lancement de nano, puis s'arrête.
|
||||
.TP
|
||||
.B \-V (\-\-version)
|
||||
Affiche la version, puis s'arrête.
|
||||
.PP
|
||||
Reportez-vous à la page de manuel \fBnano\fP(1) si vous souhaitez
|
||||
consulter la documentation complète de \fBnano\fP.
|
||||
|
||||
.SH BOGUES
|
||||
Merci de nous faire parvenir vos commentaires et de nous signaler les
|
||||
bogues, en écrivant, en anglais, à \fBnano@nano-editor.org\fR.
|
||||
|
||||
La liste de discussion anglophone \fBnano\fR est disponible à l'adresse
|
||||
\fBnano-devel@gnu.org\fR.
|
||||
|
||||
Pour vous abonner, envoyez un courrier électronique à
|
||||
\fBnano-devel-request@gnu.org\fR, ayant pour objet «\ subscribe\ ».
|
||||
|
||||
N'hésitez pas également à envoyez vos commentaires, suggestions et
|
||||
corrections relatives à l'adaptation française de cette page de manuel
|
||||
ou du logiciel à \fBjean-philippe.guerard@tigreraye.org\fR.
|
||||
|
||||
.SH "SITE INTERNET"
|
||||
http://www.nano-editor.org/
|
||||
|
||||
.SH AUTEUR
|
||||
Chris Allegretta <chrisa@asty.org> et d'autres (voir le fichier
|
||||
\fIAUTHORS\fR). Cette page de manuel a été initialement rédigée par
|
||||
Thijs Kinkhorst <thijs@kinkhorst.com>, pour le système GNU Debian (mais
|
||||
elle peut être utilisée par d'autres).
|
||||
|
||||
.SH TRADUCTION
|
||||
Cette adaptation française a été réalisée par Jean-Philippe\ Guérard
|
||||
<jean-philippe.guerard@tigreraye.org> le 29\ novembre\ 2007 à partir
|
||||
de la version 1.19 du 6\ novembre\ 2007 de la page de manuel de rnano
|
||||
(pour la version 2.0.0 de nano).
|
||||
|
||||
Un maximum de soin a été apporté lors de l'élaboration de cette
|
||||
traduction\ ; néanmoins, quelques imperfections peuvent subsister. Si
|
||||
vous en rencontrez, que ce soit dans la version française ou dans la
|
||||
version originale, n'hésitez pas à les signaler à l'auteur ou au
|
||||
traducteur.
|
||||
|
||||
La version originale la plus à jour de ce document est toujours
|
||||
consultable via la commande\ :
|
||||
|
||||
LANGUAGE=en man nano
|
||||
@@ -17,7 +17,7 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH NANO 1 "version 2.7.3" "December 2016"
|
||||
.TH NANO 1 "version 2.7.4" "January 2017"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
|
||||
.SH NAME
|
||||
@@ -6,8 +6,8 @@
|
||||
|
||||
@smallbook
|
||||
@set EDITION 0.4
|
||||
@set VERSION 2.7.3
|
||||
@set UPDATED December 2016
|
||||
@set VERSION 2.7.4
|
||||
@set UPDATED January 2017
|
||||
|
||||
@dircategory Editors
|
||||
@direntry
|
||||
@@ -21,7 +21,7 @@
|
||||
@titlepage
|
||||
@title GNU @code{nano}
|
||||
@subtitle a small and friendly text editor.
|
||||
@subtitle version 2.7.3
|
||||
@subtitle version 2.7.4
|
||||
|
||||
@author Chris Allegretta
|
||||
@page
|
||||
@@ -17,7 +17,7 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH NANORC 5 "version 2.7.3" "December 2016"
|
||||
.TH NANORC 5 "version 2.7.4" "January 2017"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
|
||||
.SH NAME
|
||||
@@ -16,7 +16,7 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH RNANO 1 "version 2.7.3" "December 2016"
|
||||
.TH RNANO 1 "version 2.7.4" "January 2017"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
|
||||
.SH NAME
|
||||
@@ -1,11 +0,0 @@
|
||||
## Here is a short example for HTML.
|
||||
|
||||
syntax "html" "\.html?$"
|
||||
magic "HTML document text"
|
||||
comment "<!--|-->"
|
||||
|
||||
color cyan start="<" end=">"
|
||||
color red "&[^;[:space:]]*;"
|
||||
color green ""(\\.|[^"])*""
|
||||
|
||||
color yellow start="<!--" end="-->"
|
||||
3
doc/texinfo/.gitignore
vendored
3
doc/texinfo/.gitignore
vendored
@@ -1,3 +0,0 @@
|
||||
texinfo.tex
|
||||
nano.html
|
||||
nano.info
|
||||
@@ -1,10 +0,0 @@
|
||||
info_TEXINFOS = nano.texi
|
||||
|
||||
MAKEINFO = makeinfo --no-split
|
||||
|
||||
BUILT_SOURCES = nano.html
|
||||
|
||||
nano.html: nano.texi
|
||||
makeinfo --no-split --html < $< > $@
|
||||
|
||||
EXTRA_DIST = $(info_TEXINFOS) $(BUILT_SOURCES)
|
||||
@@ -43,7 +43,7 @@ fi
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%doc AUTHORS COPYING ChangeLog INSTALL NEWS README THANKS TODO doc/faq.html doc/nanorc.sample
|
||||
%doc AUTHORS COPYING ChangeLog INSTALL NEWS README THANKS TODO doc/faq.html doc/sample.nanorc
|
||||
%{_bindir}/*
|
||||
%{_docdir}/nano/*
|
||||
%{_mandir}/man*/*
|
||||
|
||||
458
po/nano.pot
458
po/nano.pot
File diff suppressed because it is too large
Load Diff
458
po/pt_BR.po
458
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
458
po/zh_CN.po
458
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
458
po/zh_TW.po
458
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
@@ -219,11 +219,7 @@ char *do_browser(char *path)
|
||||
selected = filelist_len - 1;
|
||||
} else if (func == goto_dir_void) {
|
||||
/* Ask for the directory to go to. */
|
||||
int i = do_prompt(TRUE,
|
||||
#ifndef DISABLE_TABCOMP
|
||||
FALSE,
|
||||
#endif
|
||||
MGOTODIR, NULL,
|
||||
int i = do_prompt(TRUE, FALSE, MGOTODIR, NULL,
|
||||
#ifndef DISABLE_HISTORIES
|
||||
NULL,
|
||||
#endif
|
||||
@@ -348,8 +344,6 @@ char *do_browse_from(const char *inpath)
|
||||
char *path;
|
||||
/* This holds the tilde-expanded version of inpath. */
|
||||
|
||||
assert(inpath != NULL);
|
||||
|
||||
path = real_dir_from_tilde(inpath);
|
||||
|
||||
/* Perhaps path is a directory. If so, we'll pass it to
|
||||
@@ -670,11 +664,7 @@ int filesearch_init(void)
|
||||
buf = mallocstrcpy(NULL, "");
|
||||
|
||||
/* This is now one simple call. It just does a lot. */
|
||||
input = do_prompt(FALSE,
|
||||
#ifndef DISABLE_TABCOMP
|
||||
TRUE,
|
||||
#endif
|
||||
MWHEREISFILE, NULL,
|
||||
input = do_prompt(FALSE, FALSE, MWHEREISFILE, NULL,
|
||||
#ifndef DISABLE_HISTORIES
|
||||
&search_history,
|
||||
#endif
|
||||
@@ -798,8 +788,6 @@ char *striponedir(const char *path)
|
||||
{
|
||||
char *retval, *tmp;
|
||||
|
||||
assert(path != NULL);
|
||||
|
||||
retval = mallocstrcpy(NULL, path);
|
||||
|
||||
tmp = strrchr(retval, '/');
|
||||
|
||||
@@ -108,8 +108,6 @@ void color_init(void)
|
||||
bool using_defaults = FALSE;
|
||||
short foreground, background;
|
||||
|
||||
assert(openfile != NULL);
|
||||
|
||||
/* If the terminal is not capable of colors, forget it. */
|
||||
if (!has_colors())
|
||||
return;
|
||||
@@ -164,8 +162,6 @@ void color_update(void)
|
||||
syntaxtype *sint = NULL;
|
||||
colortype *ink;
|
||||
|
||||
assert(openfile != NULL);
|
||||
|
||||
/* If the rcfiles were not read, or contained no syntaxes, get out. */
|
||||
if (syntaxes == NULL)
|
||||
return;
|
||||
|
||||
64
src/cut.c
64
src/cut.c
@@ -60,13 +60,13 @@ void cut_line(void)
|
||||
#ifndef NANO_TINY
|
||||
/* Move all currently marked text into the cutbuffer, and set the
|
||||
* current place we want to where the text used to start. */
|
||||
void cut_marked(void)
|
||||
void cut_marked(bool *right_side_up)
|
||||
{
|
||||
filestruct *top, *bot;
|
||||
size_t top_x, bot_x;
|
||||
|
||||
mark_order((const filestruct **)&top, &top_x,
|
||||
(const filestruct **)&bot, &bot_x, NULL);
|
||||
(const filestruct **)&bot, &bot_x, right_side_up);
|
||||
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, top, top_x, bot, bot_x);
|
||||
openfile->placewewant = xplustabs();
|
||||
@@ -82,8 +82,6 @@ void cut_to_eol(void)
|
||||
{
|
||||
size_t data_len = strlen(openfile->current->data);
|
||||
|
||||
assert(openfile->current_x <= data_len);
|
||||
|
||||
if (openfile->current_x < data_len)
|
||||
/* If we're not at the end of the line, move all the text from
|
||||
* the current position up to it, not counting the newline at
|
||||
@@ -124,45 +122,39 @@ void do_cut_text(bool copy_text, bool cut_till_eof)
|
||||
/* The length of the string at the current end of the cutbuffer,
|
||||
* before we add text to it. */
|
||||
bool old_no_newlines = ISSET(NO_NEWLINES);
|
||||
bool right_side_up = TRUE;
|
||||
/* There *is* no region, *or* it is marked forward. */
|
||||
#endif
|
||||
size_t was_totsize = openfile->totsize;
|
||||
|
||||
assert(openfile->current != NULL && openfile->current->data != NULL);
|
||||
|
||||
/* Empty the cutbuffer when a chain of cuts is broken. */
|
||||
/* If a chain of cuts was broken, empty the cutbuffer. */
|
||||
if (!keep_cutbuffer) {
|
||||
free_filestruct(cutbuffer);
|
||||
cutbuffer = NULL;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Blew away cutbuffer =)\n");
|
||||
#endif
|
||||
/* Indicate that future cuts should add to the cutbuffer. */
|
||||
keep_cutbuffer = TRUE;
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (copy_text) {
|
||||
/* If the cutbuffer isn't empty, remember where it currently ends. */
|
||||
if (cutbuffer != NULL) {
|
||||
/* If the cutbuffer isn't empty, save where it currently
|
||||
* ends. This is where we'll add the new text. */
|
||||
cb_save = cutbottom;
|
||||
cb_save_len = strlen(cutbottom->data);
|
||||
}
|
||||
|
||||
/* Set NO_NEWLINES to TRUE, so that we don't disturb the last
|
||||
* line of the file when moving text to the cutbuffer. */
|
||||
/* Don't add a magicline when moving text to the cutbuffer. */
|
||||
SET(NO_NEWLINES);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Ensure that the text we're going to move into the cutbuffer will
|
||||
* be added to the text already there, instead of replacing it. */
|
||||
keep_cutbuffer = TRUE;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (cut_till_eof) {
|
||||
/* Move all text up to the end of the file into the cutbuffer. */
|
||||
cut_to_eof();
|
||||
} else if (openfile->mark_set) {
|
||||
/* Move the marked text to the cutbuffer, and turn the mark off. */
|
||||
cut_marked();
|
||||
cut_marked(&right_side_up);
|
||||
openfile->mark_set = FALSE;
|
||||
} else if (ISSET(CUT_TO_END))
|
||||
/* Move all text up to the end of the line into the cutbuffer. */
|
||||
@@ -174,10 +166,9 @@ void do_cut_text(bool copy_text, bool cut_till_eof)
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (copy_text) {
|
||||
/* Copy the text in the cutbuffer, starting at its saved end if
|
||||
* there is one, back into the filestruct. This effectively
|
||||
* uncuts the text we just cut without marking the file as
|
||||
* modified. */
|
||||
/* Copy the text that is in the cutbuffer (starting at its saved end,
|
||||
* if there is one) back into the current buffer. This effectively
|
||||
* uncuts the text we just cut. */
|
||||
if (cutbuffer != NULL) {
|
||||
if (cb_save != NULL) {
|
||||
cb_save->data += cb_save_len;
|
||||
@@ -186,17 +177,18 @@ void do_cut_text(bool copy_text, bool cut_till_eof)
|
||||
} else
|
||||
copy_from_filestruct(cutbuffer);
|
||||
|
||||
/* Set the current place we want to where the text from the
|
||||
* cutbuffer ends. */
|
||||
openfile->placewewant = xplustabs();
|
||||
/* If the copied region was marked forward, put the new desired
|
||||
* x position at its end; otherwise, leave it at its beginning. */
|
||||
if (right_side_up)
|
||||
openfile->placewewant = xplustabs();
|
||||
}
|
||||
|
||||
/* Set NO_NEWLINES back to what it was before, since we're done
|
||||
* disturbing the text. */
|
||||
/* Restore the magicline behavior now that we're done fiddling. */
|
||||
if (!old_no_newlines)
|
||||
UNSET(NO_NEWLINES);
|
||||
} else
|
||||
#endif /* !NANO_TINY */
|
||||
/* Only set the modification flag if actually something was cut. */
|
||||
if (openfile->totsize != was_totsize)
|
||||
set_modified();
|
||||
|
||||
refresh_needed = TRUE;
|
||||
@@ -264,11 +256,9 @@ void do_cut_till_eof(void)
|
||||
/* Copy text from the cutbuffer into the current filestruct. */
|
||||
void do_uncut_text(void)
|
||||
{
|
||||
int was_lineno = openfile->current->lineno;
|
||||
ssize_t was_lineno = openfile->current->lineno;
|
||||
|
||||
assert(openfile->current != NULL && openfile->current->data != NULL);
|
||||
|
||||
/* If the cutbuffer is empty, get out. */
|
||||
/* If the cutbuffer is empty, there is nothing to do. */
|
||||
if (cutbuffer == NULL)
|
||||
return;
|
||||
|
||||
@@ -287,13 +277,17 @@ void do_uncut_text(void)
|
||||
if (openfile->current->lineno - was_lineno < editwinrows)
|
||||
focusing = FALSE;
|
||||
|
||||
/* Set the current place we want to where the text from the
|
||||
* cutbuffer ends. */
|
||||
/* Set the desired x position to where the pasted text ends. */
|
||||
openfile->placewewant = xplustabs();
|
||||
|
||||
/* Mark the file as modified. */
|
||||
set_modified();
|
||||
|
||||
/* Update the cursor position to account for the inserted lines. */
|
||||
reset_cursor();
|
||||
|
||||
ensure_line_is_visible();
|
||||
|
||||
refresh_needed = TRUE;
|
||||
|
||||
#ifndef DISABLE_COLOR
|
||||
|
||||
42
src/files.c
42
src/files.c
@@ -906,8 +906,7 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkw
|
||||
openfile->current_x = 0;
|
||||
}
|
||||
|
||||
/* Set the current place we want to the end of the last line of the
|
||||
* file we inserted. */
|
||||
/* Set the desired x position at the end of what was inserted. */
|
||||
openfile->placewewant = xplustabs();
|
||||
|
||||
if (!writable)
|
||||
@@ -1087,10 +1086,7 @@ void do_insertfile(void)
|
||||
|
||||
present_path = mallocstrcpy(present_path, "./");
|
||||
|
||||
i = do_prompt(TRUE,
|
||||
#ifndef DISABLE_TABCOMP
|
||||
TRUE,
|
||||
#endif
|
||||
i = do_prompt(TRUE, TRUE,
|
||||
#ifndef NANO_TINY
|
||||
execute ? MEXTCMD :
|
||||
#endif
|
||||
@@ -1114,9 +1110,7 @@ void do_insertfile(void)
|
||||
filestruct *edittop_save = openfile->edittop;
|
||||
ssize_t was_current_lineno = openfile->current->lineno;
|
||||
size_t was_current_x = openfile->current_x;
|
||||
ssize_t was_current_y = openfile->current_y;
|
||||
bool current_was_at_top = FALSE;
|
||||
size_t pww_save = openfile->placewewant;
|
||||
#if !defined(NANO_TINY) || !defined(DISABLE_BROWSER)
|
||||
functionptrtype func = func_from_key(&i);
|
||||
#endif
|
||||
@@ -1261,9 +1255,6 @@ void do_insertfile(void)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/* Update the current y-coordinate to account for the
|
||||
* number of lines inserted. */
|
||||
openfile->current_y += was_current_y;
|
||||
|
||||
/* Unpartition the filestruct so that it contains all
|
||||
* the text again. Note that we've replaced the
|
||||
@@ -1278,14 +1269,19 @@ void do_insertfile(void)
|
||||
/* Restore the old edittop. */
|
||||
openfile->edittop = edittop_save;
|
||||
|
||||
/* Restore the old place we want. */
|
||||
openfile->placewewant = pww_save;
|
||||
/* Set the desired x position to the current one. */
|
||||
openfile->placewewant = xplustabs();
|
||||
|
||||
/* Mark the file as modified if it changed. */
|
||||
if (openfile->current->lineno != was_current_lineno ||
|
||||
openfile->current_x != was_current_x)
|
||||
set_modified();
|
||||
|
||||
/* Update the cursor position to account for inserted lines. */
|
||||
reset_cursor();
|
||||
|
||||
ensure_line_is_visible();
|
||||
|
||||
refresh_needed = TRUE;
|
||||
}
|
||||
|
||||
@@ -1296,21 +1292,16 @@ void do_insertfile(void)
|
||||
free(given);
|
||||
}
|
||||
|
||||
/* Insert a file into a new buffer or the current buffer, depending on
|
||||
* whether the MULTIBUFFER flag is set. If we're in view mode, only
|
||||
* allow inserting a file into a new buffer. */
|
||||
/* If the current mode of operation allows it, go insert a file. */
|
||||
void do_insertfile_void(void)
|
||||
{
|
||||
if (ISSET(RESTRICTED)) {
|
||||
if (ISSET(RESTRICTED))
|
||||
show_restricted_warning();
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
if (ISSET(VIEW_MODE) && !ISSET(MULTIBUFFER))
|
||||
else if (ISSET(VIEW_MODE) && !ISSET(MULTIBUFFER))
|
||||
statusbar(_("Key invalid in non-multibuffer mode"));
|
||||
else
|
||||
#endif
|
||||
else
|
||||
do_insertfile();
|
||||
}
|
||||
|
||||
@@ -2230,10 +2221,7 @@ int do_writeout(bool exiting)
|
||||
/* If we're using restricted mode, and the filename isn't blank,
|
||||
* disable tab completion. */
|
||||
i = do_prompt(!ISSET(RESTRICTED) || openfile->filename[0] == '\0',
|
||||
#ifndef DISABLE_TABCOMP
|
||||
TRUE,
|
||||
#endif
|
||||
MWRITEFILE, given,
|
||||
TRUE, MWRITEFILE, given,
|
||||
#ifndef DISABLE_HISTORIES
|
||||
NULL,
|
||||
#endif
|
||||
@@ -2989,7 +2977,7 @@ bool writehist(FILE *hist, const filestruct *head)
|
||||
{
|
||||
const filestruct *item;
|
||||
|
||||
/* Write a history list from the oldest entry to the newest. */
|
||||
/* Write a history list, from the oldest item to the newest. */
|
||||
for (item = head; item != NULL; item = item->next) {
|
||||
size_t length = strlen(item->data);
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ void do_last_line(void)
|
||||
|
||||
/* Set the last line of the screen as the target for the cursor. */
|
||||
openfile->current_y = editwinrows - 1;
|
||||
ensure_line_is_visible();
|
||||
|
||||
refresh_needed = TRUE;
|
||||
focusing = FALSE;
|
||||
@@ -138,10 +139,9 @@ void do_para_begin(bool allow_update)
|
||||
filestruct *was_current = openfile->current;
|
||||
|
||||
if (openfile->current != openfile->fileage) {
|
||||
do {
|
||||
do
|
||||
openfile->current = openfile->current->prev;
|
||||
openfile->current_y--;
|
||||
} while (!begpar(openfile->current));
|
||||
while (!begpar(openfile->current));
|
||||
}
|
||||
|
||||
openfile->current_x = 0;
|
||||
@@ -175,7 +175,6 @@ void do_para_end(bool allow_update)
|
||||
inpar(openfile->current->next) &&
|
||||
!begpar(openfile->current->next)) {
|
||||
openfile->current = openfile->current->next;
|
||||
openfile->current_y++;
|
||||
}
|
||||
|
||||
if (openfile->current != openfile->filebot) {
|
||||
|
||||
54
src/nano.c
54
src/nano.c
@@ -469,11 +469,6 @@ void copy_from_filestruct(filestruct *somebuffer)
|
||||
/* Add the number of characters in the copied text to the file size. */
|
||||
openfile->totsize += get_totsize(openfile->fileage, openfile->filebot);
|
||||
|
||||
/* Update the current y-coordinate to account for the number of
|
||||
* lines the copied text has, less one since the first line will be
|
||||
* tacked onto the current line. */
|
||||
openfile->current_y += openfile->filebot->lineno - 1;
|
||||
|
||||
/* If we pasted onto the first line of the edit window, the corresponding
|
||||
* struct has been freed, so... point at the start of the copied text. */
|
||||
if (edittop_inside)
|
||||
@@ -1732,63 +1727,67 @@ int do_mouse(void)
|
||||
int mouse_x, mouse_y;
|
||||
int retval = get_mouseinput(&mouse_x, &mouse_y, TRUE);
|
||||
|
||||
/* If the click is wrong or already handled, we're done. */
|
||||
if (retval != 0)
|
||||
/* The click is wrong or already handled. */
|
||||
return retval;
|
||||
|
||||
/* We can click on the edit window to move the cursor. */
|
||||
/* If the click was in the edit window, put the cursor in that spot. */
|
||||
if (wmouse_trafo(edit, &mouse_y, &mouse_x, FALSE)) {
|
||||
bool sameline;
|
||||
/* Did they click on the line with the cursor? If they
|
||||
* clicked on the cursor, we set the mark. */
|
||||
bool sameline = (mouse_y == openfile->current_y);
|
||||
/* Whether the click was on the line where the cursor is. */
|
||||
filestruct *current_save = openfile->current;
|
||||
#ifndef NANO_TINY
|
||||
size_t current_x_save = openfile->current_x;
|
||||
#endif
|
||||
|
||||
sameline = (mouse_y == openfile->current_y);
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "mouse_y = %d, current_y = %ld\n", mouse_y, (long)openfile->current_y);
|
||||
#endif
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(SOFTWRAP)) {
|
||||
size_t i = 0;
|
||||
ssize_t current_row = 0;
|
||||
|
||||
openfile->current = openfile->edittop;
|
||||
|
||||
while (openfile->current->next != NULL && i < mouse_y) {
|
||||
openfile->current_y = i;
|
||||
i += strlenpt(openfile->current->data) / editwincols + 1;
|
||||
while (openfile->current->next != NULL && current_row < mouse_y) {
|
||||
current_row += strlenpt(openfile->current->data) / editwincols + 1;
|
||||
openfile->current = openfile->current->next;
|
||||
}
|
||||
|
||||
if (i > mouse_y) {
|
||||
if (current_row > mouse_y) {
|
||||
openfile->current = openfile->current->prev;
|
||||
current_row -= strlenpt(openfile->current->data) / editwincols + 1;
|
||||
openfile->current_x = actual_x(openfile->current->data,
|
||||
mouse_x + (mouse_y - openfile->current_y) * editwincols);
|
||||
((mouse_y - current_row) * editwincols) + mouse_x);
|
||||
} else
|
||||
openfile->current_x = actual_x(openfile->current->data, mouse_x);
|
||||
|
||||
openfile->current_y = current_row;
|
||||
ensure_line_is_visible();
|
||||
refresh_needed = TRUE;
|
||||
} else
|
||||
#endif /* NANO_TINY */
|
||||
{
|
||||
ssize_t current_row = openfile->current_y;
|
||||
|
||||
/* Move to where the click occurred. */
|
||||
for (; openfile->current_y < mouse_y && openfile->current !=
|
||||
openfile->filebot; openfile->current_y++)
|
||||
while (current_row < mouse_y && openfile->current->next != NULL) {
|
||||
openfile->current = openfile->current->next;
|
||||
for (; openfile->current_y > mouse_y && openfile->current !=
|
||||
openfile->fileage; openfile->current_y--)
|
||||
current_row++;
|
||||
}
|
||||
while (current_row > mouse_y && openfile->current->prev != NULL) {
|
||||
openfile->current = openfile->current->prev;
|
||||
current_row--;
|
||||
}
|
||||
|
||||
openfile->current_x = actual_x(openfile->current->data,
|
||||
get_page_start(xplustabs()) + mouse_x);
|
||||
get_page_start(xplustabs()) + mouse_x);
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Clicking where the cursor is toggles the mark, as does
|
||||
* clicking beyond the line length with the cursor at the end of
|
||||
* the line. */
|
||||
/* Clicking where the cursor is toggles the mark, as does clicking
|
||||
* beyond the line length with the cursor at the end of the line. */
|
||||
if (sameline && openfile->current_x == current_x_save)
|
||||
do_mark();
|
||||
else
|
||||
@@ -1796,7 +1795,8 @@ int do_mouse(void)
|
||||
/* The cursor moved; clean the cutbuffer on the next cut. */
|
||||
cutbuffer_reset();
|
||||
|
||||
edit_redraw(current_save);
|
||||
if (!ISSET(SOFTWRAP))
|
||||
edit_redraw(current_save);
|
||||
}
|
||||
|
||||
/* No more handling is needed. */
|
||||
|
||||
14
src/prompt.c
14
src/prompt.c
@@ -433,9 +433,7 @@ void update_the_statusbar(void)
|
||||
|
||||
/* Get a string of input at the statusbar prompt. */
|
||||
functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
|
||||
#ifndef DISABLE_TABCOMP
|
||||
bool allow_files, bool *listed,
|
||||
#endif
|
||||
#ifndef DISABLE_HISTORIES
|
||||
filestruct **history_list,
|
||||
#endif
|
||||
@@ -613,10 +611,7 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
|
||||
* The allow_tabs parameter indicates whether we should allow tabs to be
|
||||
* interpreted. The allow_files parameter indicates whether we should
|
||||
* allow all files (as opposed to just directories) to be tab completed. */
|
||||
int do_prompt(bool allow_tabs,
|
||||
#ifndef DISABLE_TABCOMP
|
||||
bool allow_files,
|
||||
#endif
|
||||
int do_prompt(bool allow_tabs, bool allow_files,
|
||||
int menu, const char *curranswer,
|
||||
#ifndef DISABLE_HISTORIES
|
||||
filestruct **history_list,
|
||||
@@ -626,9 +621,7 @@ int do_prompt(bool allow_tabs,
|
||||
va_list ap;
|
||||
int retval;
|
||||
functionptrtype func = NULL;
|
||||
#ifndef DISABLE_TABCOMP
|
||||
bool listed = FALSE;
|
||||
#endif
|
||||
/* Save a possible current statusbar x position. */
|
||||
size_t was_statusbar_x = statusbar_x;
|
||||
|
||||
@@ -646,10 +639,7 @@ int do_prompt(bool allow_tabs,
|
||||
/* Reserve five columns for colon plus angles plus answer, ":<aa>". */
|
||||
null_at(&prompt, actual_x(prompt, (COLS < 5) ? 0 : COLS - 5));
|
||||
|
||||
func = acquire_an_answer(&retval, allow_tabs,
|
||||
#ifndef DISABLE_TABCOMP
|
||||
allow_files, &listed,
|
||||
#endif
|
||||
func = acquire_an_answer(&retval, allow_tabs, allow_files, &listed,
|
||||
#ifndef DISABLE_HISTORIES
|
||||
history_list,
|
||||
#endif
|
||||
|
||||
13
src/proto.h
13
src/proto.h
@@ -276,7 +276,7 @@ void cutbuffer_reset(void);
|
||||
bool keeping_cutbuffer(void);
|
||||
void cut_line(void);
|
||||
#ifndef NANO_TINY
|
||||
void cut_marked(void);
|
||||
void cut_marked(bool *right_side_up);
|
||||
void cut_to_eol(void);
|
||||
void cut_to_eof(void);
|
||||
#endif
|
||||
@@ -348,7 +348,7 @@ const char *tail(const char *path);
|
||||
#ifndef DISABLE_HISTORIES
|
||||
char *histfilename(void);
|
||||
void load_history(void);
|
||||
bool writehist(FILE *hist, const filestruct *histhead);
|
||||
bool writehist(FILE *hist, const filestruct *head);
|
||||
void save_history(void);
|
||||
int check_dotnano(void);
|
||||
void load_poshistory(void);
|
||||
@@ -503,10 +503,7 @@ size_t get_statusbar_page_start(size_t start_col, size_t column);
|
||||
void reinit_statusbar_x(void);
|
||||
void reset_statusbar_cursor(void);
|
||||
void update_the_statusbar(void);
|
||||
int do_prompt(bool allow_tabs,
|
||||
#ifndef DISABLE_TABCOMP
|
||||
bool allow_files,
|
||||
#endif
|
||||
int do_prompt(bool allow_tabs, bool allow_files,
|
||||
int menu, const char *curranswer,
|
||||
#ifndef DISABLE_HISTORIES
|
||||
filestruct **history_list,
|
||||
@@ -746,8 +743,8 @@ void statusline(message_type importance, const char *msg, ...);
|
||||
void bottombars(int menu);
|
||||
void onekey(const char *keystroke, const char *desc, int length);
|
||||
void reset_cursor(void);
|
||||
void edit_draw(filestruct *fileptr, const char *converted, int
|
||||
line, size_t start);
|
||||
void edit_draw(filestruct *fileptr, const char *converted,
|
||||
int line, size_t from_col);
|
||||
int update_line(filestruct *fileptr, size_t index);
|
||||
bool need_horizontal_scroll(const size_t old_column, const size_t new_column);
|
||||
void edit_scroll(scroll_dir direction, ssize_t nlines);
|
||||
|
||||
132
src/search.c
132
src/search.c
@@ -38,23 +38,22 @@ static bool history_changed = FALSE;
|
||||
#ifdef HAVE_REGEX_H
|
||||
static bool regexp_compiled = FALSE;
|
||||
/* Have we compiled any regular expressions? */
|
||||
static bool bow_anchored = FALSE;
|
||||
/* Whether a regex starts with a beginning-of-word anchor. */
|
||||
|
||||
/* Compile the regular expression regexp to see if it's valid. Return
|
||||
* TRUE if it is, or FALSE otherwise. */
|
||||
/* Compile the given regular expression and store it in search_regexp.
|
||||
* Return TRUE if the expression is valid, and FALSE otherwise. */
|
||||
bool regexp_init(const char *regexp)
|
||||
{
|
||||
int rc;
|
||||
|
||||
assert(!regexp_compiled);
|
||||
|
||||
rc = regcomp(&search_regexp, fixbounds(regexp),
|
||||
int value = regcomp(&search_regexp, fixbounds(regexp),
|
||||
NANO_REG_EXTENDED | (ISSET(CASE_SENSITIVE) ? 0 : REG_ICASE));
|
||||
|
||||
if (rc != 0) {
|
||||
size_t len = regerror(rc, &search_regexp, NULL, 0);
|
||||
/* If regex compilation failed, show the error message. */
|
||||
if (value != 0) {
|
||||
size_t len = regerror(value, &search_regexp, NULL, 0);
|
||||
char *str = charalloc(len);
|
||||
|
||||
regerror(rc, &search_regexp, str, len);
|
||||
regerror(value, &search_regexp, str, len);
|
||||
statusline(ALERT, _("Bad regex \"%s\": %s"), regexp, str);
|
||||
free(str);
|
||||
|
||||
@@ -63,6 +62,10 @@ bool regexp_init(const char *regexp)
|
||||
|
||||
regexp_compiled = TRUE;
|
||||
|
||||
/* Remember whether the regex starts with a beginning-of-word anchor. */
|
||||
bow_anchored = (strncmp(regexp, "\\<", 2) == 0 ||
|
||||
strncmp(regexp, "\\b", 2) == 0);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -150,10 +153,7 @@ int search_init(bool replacing, bool use_answer)
|
||||
buf = mallocstrcpy(NULL, "");
|
||||
|
||||
/* This is now one simple call. It just does a lot. */
|
||||
i = do_prompt(FALSE,
|
||||
#ifndef DISABLE_TABCOMP
|
||||
TRUE,
|
||||
#endif
|
||||
i = do_prompt(FALSE, FALSE,
|
||||
replacing ? MREPLACE : MWHEREIS, backupstring,
|
||||
#ifndef DISABLE_HISTORIES
|
||||
&search_history,
|
||||
@@ -240,28 +240,28 @@ int search_init(bool replacing, bool use_answer)
|
||||
int findnextstr(const char *needle, bool whole_word_only, size_t *match_len,
|
||||
const filestruct *begin, size_t begin_x)
|
||||
{
|
||||
size_t found_len;
|
||||
/* The length of the match we find. */
|
||||
size_t found_len = strlen(needle);
|
||||
/* The length of a match -- will be recomputed for a regex. */
|
||||
int feedback = 0;
|
||||
/* When bigger than zero, show and wipe the "Searching..." message. */
|
||||
filestruct *fileptr = openfile->current;
|
||||
const char *rev_start = fileptr->data, *found = NULL;
|
||||
filestruct *line = openfile->current;
|
||||
const char *from = line->data, *found = NULL;
|
||||
size_t found_x;
|
||||
/* The x coordinate of a found occurrence. */
|
||||
time_t lastkbcheck = time(NULL);
|
||||
|
||||
/* rev_start might end up 1 character before the start or after the
|
||||
* end of the line. This won't be a problem because strstrwrapper()
|
||||
/* 'from' might end up 1 character before the start or after the end
|
||||
* of the line. This is fine because in that case strstrwrapper()
|
||||
* will return immediately and say that no match was found, and
|
||||
* rev_start will be properly set when the search continues on the
|
||||
* 'from' will be properly set when the search continues on the
|
||||
* previous or next line. */
|
||||
if (ISSET(BACKWARDS_SEARCH)) {
|
||||
if (openfile->current_x == 0)
|
||||
rev_start += -1;
|
||||
from += -1;
|
||||
else
|
||||
rev_start += move_mbleft(fileptr->data, openfile->current_x);
|
||||
from += move_mbleft(line->data, openfile->current_x);
|
||||
} else
|
||||
rev_start += move_mbright(fileptr->data, openfile->current_x);
|
||||
from += move_mbright(line->data, openfile->current_x);
|
||||
|
||||
enable_nodelay();
|
||||
|
||||
@@ -293,32 +293,41 @@ int findnextstr(const char *needle, bool whole_word_only, size_t *match_len,
|
||||
}
|
||||
|
||||
/* Search for the needle in the current line. */
|
||||
found = strstrwrapper(fileptr->data, needle, rev_start);
|
||||
found = strstrwrapper(line->data, needle, from);
|
||||
|
||||
if (found != NULL) {
|
||||
/* Remember the length of the potential match. */
|
||||
found_len =
|
||||
#ifdef HAVE_REGEX_H
|
||||
ISSET(USE_REGEXP) ?
|
||||
regmatches[0].rm_eo - regmatches[0].rm_so :
|
||||
#endif
|
||||
strlen(needle);
|
||||
/* When doing a regex search, compute the length of the match. */
|
||||
if (ISSET(USE_REGEXP)) {
|
||||
found_len = regmatches[0].rm_eo - regmatches[0].rm_so;
|
||||
|
||||
#ifndef DISABLE_SPELLER
|
||||
/* When we're spell checking, a match is only a true match when
|
||||
* it is a separate word. */
|
||||
if (whole_word_only) {
|
||||
if (is_separate_word(found - fileptr->data, found_len,
|
||||
fileptr->data))
|
||||
break;
|
||||
else {
|
||||
/* Maybe there is a whole word in the rest of the line. */
|
||||
rev_start = found + 1;
|
||||
continue;
|
||||
/* If the regex starts with a BOW anchor, check that the found
|
||||
* match actually is the start of a word. If not, continue. */
|
||||
if (bow_anchored && found != line->data) {
|
||||
size_t before = move_mbleft(line->data, found - line->data);
|
||||
|
||||
/* If a word char is before the match, skip this match. */
|
||||
if (is_word_mbchar(line->data + before, FALSE)) {
|
||||
if (ISSET(BACKWARDS_SEARCH))
|
||||
from = line->data + before;
|
||||
else
|
||||
from = found + move_mbright(found, 0);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} else
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
#ifndef DISABLE_SPELLER
|
||||
/* When we're spell checking, a match should be a separate word;
|
||||
* if it's not, continue looking in the rest of the line. */
|
||||
if (whole_word_only && !is_separate_word(found - line->data,
|
||||
found_len, line->data)) {
|
||||
from = found + move_mbright(found, 0);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
/* The match is valid. */
|
||||
break;
|
||||
}
|
||||
|
||||
/* If we're back at the beginning, then there is no needle. */
|
||||
@@ -330,12 +339,12 @@ int findnextstr(const char *needle, bool whole_word_only, size_t *match_len,
|
||||
|
||||
/* Move to the previous or next line in the file. */
|
||||
if (ISSET(BACKWARDS_SEARCH))
|
||||
fileptr = fileptr->prev;
|
||||
line = line->prev;
|
||||
else
|
||||
fileptr = fileptr->next;
|
||||
line = line->next;
|
||||
|
||||
/* If we've reached the start or end of the buffer, wrap around. */
|
||||
if (fileptr == NULL) {
|
||||
if (line == NULL) {
|
||||
#ifndef DISABLE_SPELLER
|
||||
/* When we're spell-checking, end-of-buffer means we're done. */
|
||||
if (whole_word_only) {
|
||||
@@ -344,9 +353,9 @@ int findnextstr(const char *needle, bool whole_word_only, size_t *match_len,
|
||||
}
|
||||
#endif
|
||||
if (ISSET(BACKWARDS_SEARCH))
|
||||
fileptr = openfile->filebot;
|
||||
line = openfile->filebot;
|
||||
else
|
||||
fileptr = openfile->fileage;
|
||||
line = openfile->fileage;
|
||||
|
||||
statusbar(_("Search Wrapped"));
|
||||
/* Delay the "Searching..." message for at least two seconds. */
|
||||
@@ -354,16 +363,16 @@ int findnextstr(const char *needle, bool whole_word_only, size_t *match_len,
|
||||
}
|
||||
|
||||
/* If we've reached the original starting line, take note. */
|
||||
if (fileptr == begin)
|
||||
if (line == begin)
|
||||
came_full_circle = TRUE;
|
||||
|
||||
/* Set the starting x to the start or end of the line. */
|
||||
rev_start = fileptr->data;
|
||||
from = line->data;
|
||||
if (ISSET(BACKWARDS_SEARCH))
|
||||
rev_start += strlen(fileptr->data);
|
||||
from += strlen(line->data);
|
||||
}
|
||||
|
||||
found_x = found - fileptr->data;
|
||||
found_x = found - line->data;
|
||||
|
||||
/* Ensure that the found occurrence is not beyond the starting x. */
|
||||
if (came_full_circle && ((!ISSET(BACKWARDS_SEARCH) && found_x > begin_x) ||
|
||||
@@ -376,9 +385,8 @@ int findnextstr(const char *needle, bool whole_word_only, size_t *match_len,
|
||||
disable_nodelay();
|
||||
|
||||
/* Set the current position to point at what we found. */
|
||||
openfile->current = fileptr;
|
||||
openfile->current = line;
|
||||
openfile->current_x = found_x;
|
||||
openfile->current_y = fileptr->lineno - openfile->edittop->lineno;
|
||||
|
||||
/* When requested, pass back the length of the match. */
|
||||
if (match_len != NULL)
|
||||
@@ -789,11 +797,7 @@ void do_replace(void)
|
||||
if (i != 0)
|
||||
return;
|
||||
|
||||
i = do_prompt(FALSE,
|
||||
#ifndef DISABLE_TABCOMP
|
||||
TRUE,
|
||||
#endif
|
||||
MREPLACEWITH, NULL,
|
||||
i = do_prompt(FALSE, FALSE, MREPLACEWITH, NULL,
|
||||
#ifndef DISABLE_HISTORIES
|
||||
&replace_history,
|
||||
#endif
|
||||
@@ -858,11 +862,8 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
functionptrtype func;
|
||||
|
||||
/* Ask for the line and column. */
|
||||
int i = do_prompt(FALSE,
|
||||
#ifndef DISABLE_TABCOMP
|
||||
TRUE,
|
||||
#endif
|
||||
MGOTOLINE, use_answer ? answer : NULL,
|
||||
int i = do_prompt(FALSE, FALSE, MGOTOLINE,
|
||||
use_answer ? answer : NULL,
|
||||
#ifndef DISABLE_HISTORIES
|
||||
NULL,
|
||||
#endif
|
||||
@@ -999,7 +1000,6 @@ bool find_bracket_match(bool reverse, const char *bracket_set)
|
||||
/* Set the current position to the found matching bracket. */
|
||||
openfile->current = fileptr;
|
||||
openfile->current_x = found - fileptr->data;
|
||||
openfile->current_y = fileptr->lineno - openfile->edittop->lineno;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
50
src/text.c
50
src/text.c
@@ -798,7 +798,7 @@ void do_undo(void)
|
||||
openfile->mark_begin_x = u->mark_begin_x;
|
||||
openfile->mark_set = TRUE;
|
||||
goto_line_posx(u->lineno, u->begin);
|
||||
cut_marked();
|
||||
cut_marked(NULL);
|
||||
free_filestruct(u->cutbuffer);
|
||||
u->cutbuffer = cutbuffer;
|
||||
u->cutbottom = cutbottom;
|
||||
@@ -823,10 +823,12 @@ void do_undo(void)
|
||||
statusline(HUSH, _("Undid action (%s)"), undidmsg);
|
||||
|
||||
renumber(f);
|
||||
|
||||
openfile->current_undo = openfile->current_undo->next;
|
||||
openfile->last_action = OTHER;
|
||||
openfile->mark_set = FALSE;
|
||||
openfile->placewewant = xplustabs();
|
||||
|
||||
openfile->totsize = u->wassize;
|
||||
set_modified();
|
||||
}
|
||||
@@ -974,6 +976,7 @@ void do_redo(void)
|
||||
openfile->last_action = OTHER;
|
||||
openfile->mark_set = FALSE;
|
||||
openfile->placewewant = xplustabs();
|
||||
|
||||
openfile->totsize = u->newsize;
|
||||
set_modified();
|
||||
}
|
||||
@@ -1368,15 +1371,21 @@ fprintf(stderr, " >> Updating... action = %d, openfile->last_action = %d, openf
|
||||
}
|
||||
case BACK:
|
||||
case DEL: {
|
||||
/* Add the removed character after or before earlier removed stuff. */
|
||||
char *char_buf = charalloc(mb_cur_max());
|
||||
int char_len = parse_mbchar(&openfile->current->data[openfile->current_x], char_buf, NULL);
|
||||
if (action == DEL) {
|
||||
if (openfile->current_x == u->begin) {
|
||||
/* They deleted more: add removed character after earlier stuff. */
|
||||
u->strdata = addstrings(u->strdata, strlen(u->strdata), char_buf, char_len);
|
||||
u->mark_begin_x = openfile->current_x;
|
||||
} else {
|
||||
} else if (openfile->current_x == u->begin - char_len) {
|
||||
/* They backspaced further: add removed character before earlier. */
|
||||
u->strdata = addstrings(char_buf, char_len, u->strdata, strlen(u->strdata));
|
||||
u->begin = openfile->current_x;
|
||||
} else {
|
||||
/* They deleted *elsewhere* on the line: start a new undo item. */
|
||||
free(char_buf);
|
||||
add_undo(u->type);
|
||||
return;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, " >> current undo data is \"%s\"\nu->begin = %lu\n", u->strdata, (unsigned long)u->begin);
|
||||
@@ -2117,9 +2126,6 @@ bool find_paragraph(size_t *const quote, size_t *const par)
|
||||
/* Number of lines in the paragraph we search for. */
|
||||
filestruct *current_save;
|
||||
/* The line at the beginning of the paragraph we search for. */
|
||||
ssize_t current_y_save;
|
||||
/* The y-coordinate at the beginning of the paragraph we search
|
||||
* for. */
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
if (quoterc != 0) {
|
||||
@@ -2168,7 +2174,6 @@ bool find_paragraph(size_t *const quote, size_t *const par)
|
||||
* of lines in this paragraph. */
|
||||
quote_len = quote_length(openfile->current->data);
|
||||
current_save = openfile->current;
|
||||
current_y_save = openfile->current_y;
|
||||
do_para_end(FALSE);
|
||||
par_len = openfile->current->lineno - current_save->lineno;
|
||||
|
||||
@@ -2179,7 +2184,6 @@ bool find_paragraph(size_t *const quote, size_t *const par)
|
||||
if (openfile->current_x > 0)
|
||||
par_len++;
|
||||
openfile->current = current_save;
|
||||
openfile->current_y = current_y_save;
|
||||
|
||||
/* Save the values of quote_len and par_len. */
|
||||
assert(quote != NULL && par != NULL);
|
||||
@@ -2451,7 +2455,6 @@ void do_justify(bool full_justify)
|
||||
|
||||
/* Go to the next line. */
|
||||
par_len--;
|
||||
openfile->current_y++;
|
||||
openfile->current = openfile->current->next;
|
||||
}
|
||||
|
||||
@@ -2462,7 +2465,6 @@ void do_justify(bool full_justify)
|
||||
/* Go to the next line, if possible. If there is no next line,
|
||||
* move to the end of the current line. */
|
||||
if (openfile->current != openfile->filebot) {
|
||||
openfile->current_y++;
|
||||
openfile->current = openfile->current->next;
|
||||
} else
|
||||
openfile->current_x = strlen(openfile->current->data);
|
||||
@@ -2480,9 +2482,8 @@ void do_justify(bool full_justify)
|
||||
}
|
||||
|
||||
/* We are now done justifying the paragraph or the file, so clean
|
||||
* up. current_y and totsize have been maintained above. If we
|
||||
* actually justified something, set last_par_line to the new end of
|
||||
* the paragraph. */
|
||||
* up. totsize has been maintained above. If we actually justified
|
||||
* something, set last_par_line to the new end of the paragraph. */
|
||||
if (first_par_line != NULL)
|
||||
last_par_line = openfile->current;
|
||||
|
||||
@@ -2672,11 +2673,7 @@ bool do_int_spell_fix(const char *word)
|
||||
spotlight(TRUE, exp_word);
|
||||
|
||||
/* Let the user supply a correctly spelled alternative. */
|
||||
proceed = (do_prompt(FALSE,
|
||||
#ifndef DISABLE_TABCOMP
|
||||
TRUE,
|
||||
#endif
|
||||
MSPELL, word,
|
||||
proceed = (do_prompt(FALSE, FALSE, MSPELL, word,
|
||||
#ifndef DISABLE_HISTORIES
|
||||
NULL,
|
||||
#endif
|
||||
@@ -2920,7 +2917,6 @@ const char *do_alt_speller(char *tempfile_name)
|
||||
int alt_spell_status;
|
||||
size_t current_x_save = openfile->current_x;
|
||||
size_t pww_save = openfile->placewewant;
|
||||
ssize_t current_y_save = openfile->current_y;
|
||||
ssize_t lineno_save = openfile->current->lineno;
|
||||
struct stat spellfileinfo;
|
||||
time_t timestamp;
|
||||
@@ -3070,7 +3066,6 @@ const char *do_alt_speller(char *tempfile_name)
|
||||
goto_line_posx(lineno_save, current_x_save);
|
||||
if (openfile->current_x > strlen(openfile->current->data))
|
||||
openfile->current_x = strlen(openfile->current->data);
|
||||
openfile->current_y = current_y_save;
|
||||
openfile->placewewant = pww_save;
|
||||
adjust_viewport(STATIONARY);
|
||||
|
||||
@@ -3079,9 +3074,11 @@ const char *do_alt_speller(char *tempfile_name)
|
||||
stat(tempfile_name, &spellfileinfo);
|
||||
if (spellfileinfo.st_mtime != timestamp) {
|
||||
set_modified();
|
||||
#ifndef NANO_TINY
|
||||
/* Flush the undo stack, to avoid making a mess when the user
|
||||
* tries to undo things in spell-corrected lines. */
|
||||
discard_until(NULL, openfile);
|
||||
#endif
|
||||
}
|
||||
#ifndef NANO_TINY
|
||||
/* Unblock SIGWINCHes again. */
|
||||
@@ -3467,7 +3464,6 @@ void do_formatter(void)
|
||||
FILE *temp_file;
|
||||
int format_status;
|
||||
ssize_t lineno_save = openfile->current->lineno;
|
||||
ssize_t current_y_save = openfile->current_y;
|
||||
size_t current_x_save = openfile->current_x;
|
||||
size_t pww_save = openfile->placewewant;
|
||||
pid_t pid_format;
|
||||
@@ -3549,7 +3545,6 @@ void do_formatter(void)
|
||||
goto_line_posx(lineno_save, current_x_save);
|
||||
if (openfile->current_x > strlen(openfile->current->data))
|
||||
openfile->current_x = strlen(openfile->current->data);
|
||||
openfile->current_y = current_y_save;
|
||||
openfile->placewewant = pww_save;
|
||||
adjust_viewport(STATIONARY);
|
||||
|
||||
@@ -3722,7 +3717,9 @@ void complete_a_word(void)
|
||||
int start_of_shard, shard_length = 0;
|
||||
int i = 0, j = 0;
|
||||
completion_word *some_word;
|
||||
#ifndef DISABLE_WRAPPING
|
||||
bool was_set_wrapping = !ISSET(NO_WRAP);
|
||||
#endif
|
||||
|
||||
/* If this is a fresh completion attempt... */
|
||||
if (pletion_line == NULL) {
|
||||
@@ -3825,19 +3822,20 @@ void complete_a_word(void)
|
||||
some_word->next = list_of_completions;
|
||||
list_of_completions = some_word;
|
||||
|
||||
#ifndef DISABLE_WRAPPING
|
||||
/* Temporarily disable wrapping so only one undo item is added. */
|
||||
SET(NO_WRAP);
|
||||
|
||||
#endif
|
||||
/* Inject the completion into the buffer. */
|
||||
do_output(&completion[shard_length],
|
||||
strlen(completion) - shard_length, FALSE);
|
||||
|
||||
#ifndef DISABLE_WRAPPING
|
||||
/* If needed, reenable wrapping and wrap the current line. */
|
||||
if (was_set_wrapping) {
|
||||
UNSET(NO_WRAP);
|
||||
do_wrap(openfile->current);
|
||||
}
|
||||
|
||||
#endif
|
||||
/* Set the position for a possible next search attempt. */
|
||||
pletion_x = ++i;
|
||||
|
||||
|
||||
531
src/winio.c
531
src/winio.c
@@ -2089,7 +2089,7 @@ void statusline(message_type importance, const char *msg, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char *compound, *message;
|
||||
size_t start_x;
|
||||
size_t start_col;
|
||||
bool bracketed;
|
||||
#ifndef NANO_TINY
|
||||
bool old_whitespace = ISSET(WHITESPACE_DISPLAY);
|
||||
@@ -2133,10 +2133,10 @@ void statusline(message_type importance, const char *msg, ...)
|
||||
message = display_string(compound, 0, COLS, FALSE);
|
||||
free(compound);
|
||||
|
||||
start_x = (COLS - strlenpt(message)) / 2;
|
||||
bracketed = (start_x > 1);
|
||||
start_col = (COLS - strlenpt(message)) / 2;
|
||||
bracketed = (start_col > 1);
|
||||
|
||||
wmove(bottomwin, 0, (bracketed ? start_x - 2 : start_x));
|
||||
wmove(bottomwin, 0, (bracketed ? start_col - 2 : start_col));
|
||||
wattron(bottomwin, interface_color_pair[STATUS_BAR]);
|
||||
if (bracketed)
|
||||
waddstr(bottomwin, "[ ");
|
||||
@@ -2290,35 +2290,33 @@ void reset_cursor(void)
|
||||
* the edit window. fileptr is the line to be painted, at row line of
|
||||
* the window. converted is the actual string to be written to the
|
||||
* window, with tabs and control characters replaced by strings of
|
||||
* regular characters. start is the column number of the first
|
||||
* regular characters. from_col is the column number of the first
|
||||
* character of this page. That is, the first character of converted
|
||||
* corresponds to character number actual_x(fileptr->data, start) of the
|
||||
* corresponds to character number actual_x(fileptr->data, from_col) of the
|
||||
* line. */
|
||||
void edit_draw(filestruct *fileptr, const char *converted, int
|
||||
line, size_t start)
|
||||
void edit_draw(filestruct *fileptr, const char *converted,
|
||||
int line, size_t from_col)
|
||||
{
|
||||
#if !defined(NANO_TINY) || !defined(DISABLE_COLOR)
|
||||
size_t startpos = actual_x(fileptr->data, start);
|
||||
size_t from_x = actual_x(fileptr->data, from_col);
|
||||
/* The position in fileptr->data of the leftmost character
|
||||
* that displays at least partially on the window. */
|
||||
size_t endpos = actual_x(fileptr->data, start + editwincols - 1) + 1;
|
||||
size_t till_x = actual_x(fileptr->data, from_col + editwincols - 1) + 1;
|
||||
/* The position in fileptr->data of the first character that is
|
||||
* completely off the window to the right.
|
||||
*
|
||||
* Note that endpos might be beyond the null terminator of the
|
||||
* string. */
|
||||
* completely off the window to the right. Note that till_x
|
||||
* might be beyond the null terminator of the string. */
|
||||
#endif
|
||||
|
||||
assert(openfile != NULL && fileptr != NULL && converted != NULL);
|
||||
assert(strlenpt(converted) <= editwincols);
|
||||
|
||||
#ifdef ENABLE_LINENUMBERS
|
||||
/* If line numbering is switched on, show a line number in front of
|
||||
/* If line numbering is switched on, put a line number in front of
|
||||
* the text -- but only for the parts that are not softwrapped. */
|
||||
if (margin > 0) {
|
||||
wattron(edit, interface_color_pair[LINE_NUMBER]);
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(SOFTWRAP) && startpos >= editwincols)
|
||||
if (ISSET(SOFTWRAP) && from_x != 0)
|
||||
mvwprintw(edit, line, 0, "%*s", margin - 1, " ");
|
||||
else
|
||||
#endif
|
||||
@@ -2327,7 +2325,7 @@ void edit_draw(filestruct *fileptr, const char *converted, int
|
||||
}
|
||||
#endif
|
||||
|
||||
/* First simply paint the line -- then we'll add colors or the
|
||||
/* First simply write the line -- afterward we'll add colors and the
|
||||
* marking highlight on just the pieces that need it. */
|
||||
mvwaddstr(edit, line, margin, converted);
|
||||
|
||||
@@ -2340,8 +2338,7 @@ void edit_draw(filestruct *fileptr, const char *converted, int
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_COLOR
|
||||
/* If color syntaxes are available and turned on, we need to display
|
||||
* them. */
|
||||
/* If color syntaxes are available and turned on, apply them. */
|
||||
if (openfile->colorstrings != NULL && !ISSET(NO_COLOR_SYNTAX)) {
|
||||
const colortype *varnish = openfile->colorstrings;
|
||||
|
||||
@@ -2349,274 +2346,260 @@ void edit_draw(filestruct *fileptr, const char *converted, int
|
||||
if (openfile->syntax->nmultis > 0)
|
||||
alloc_multidata_if_needed(fileptr);
|
||||
|
||||
/* Iterate through all the coloring regexes. */
|
||||
for (; varnish != NULL; varnish = varnish->next) {
|
||||
int x_start;
|
||||
/* Starting column for mvwaddnstr. Zero-based. */
|
||||
size_t index = 0;
|
||||
/* Where in the line we currently begin looking for a match. */
|
||||
int start_col;
|
||||
/* The starting column of a piece to paint. Zero-based. */
|
||||
int paintlen = 0;
|
||||
/* Number of chars to paint on this line. There are
|
||||
* COLS characters on a whole line. */
|
||||
size_t index;
|
||||
/* Index in converted where we paint. */
|
||||
regmatch_t startmatch;
|
||||
/* Match position for start_regex. */
|
||||
regmatch_t endmatch;
|
||||
/* Match position for end_regex. */
|
||||
/* The number of characters to paint. */
|
||||
const char *thetext;
|
||||
/* The place in converted from where painting starts. */
|
||||
regmatch_t startmatch, endmatch;
|
||||
/* Match positions of the start and end regexes. */
|
||||
|
||||
wattron(edit, varnish->attributes);
|
||||
/* Two notes about regexec(). A return value of zero means
|
||||
* that there is a match. Also, rm_eo is the first
|
||||
* non-matching character after the match. */
|
||||
|
||||
wattron(edit, varnish->attributes);
|
||||
|
||||
/* First case: varnish is a single-line expression. */
|
||||
if (varnish->end == NULL) {
|
||||
size_t k = 0;
|
||||
|
||||
/* We increment k by rm_eo, to move past the end of the
|
||||
/* We increment index by rm_eo, to move past the end of the
|
||||
* last match. Even though two matches may overlap, we
|
||||
* want to ignore them, so that we can highlight e.g. C
|
||||
* strings correctly. */
|
||||
while (k < endpos) {
|
||||
while (index < till_x) {
|
||||
/* Note the fifth parameter to regexec(). It says
|
||||
* not to match the beginning-of-line character
|
||||
* unless k is zero. If regexec() returns
|
||||
* unless index is zero. If regexec() returns
|
||||
* REG_NOMATCH, there are no more matches in the
|
||||
* line. */
|
||||
if (regexec(varnish->start, &fileptr->data[k], 1,
|
||||
&startmatch, (k == 0) ? 0 : REG_NOTBOL) ==
|
||||
REG_NOMATCH)
|
||||
if (regexec(varnish->start, &fileptr->data[index], 1,
|
||||
&startmatch, (index == 0) ? 0 : REG_NOTBOL) ==
|
||||
REG_NOMATCH)
|
||||
break;
|
||||
/* Translate the match to the beginning of the
|
||||
* line. */
|
||||
startmatch.rm_so += k;
|
||||
startmatch.rm_eo += k;
|
||||
|
||||
/* Skip over a zero-length regex match. */
|
||||
if (startmatch.rm_so == startmatch.rm_eo)
|
||||
startmatch.rm_eo++;
|
||||
else if (startmatch.rm_so < endpos &&
|
||||
startmatch.rm_eo > startpos) {
|
||||
x_start = (startmatch.rm_so <= startpos) ? 0 :
|
||||
strnlenpt(fileptr->data,
|
||||
startmatch.rm_so) - start;
|
||||
|
||||
index = actual_x(converted, x_start);
|
||||
|
||||
paintlen = actual_x(converted + index,
|
||||
strnlenpt(fileptr->data,
|
||||
startmatch.rm_eo) - start - x_start);
|
||||
|
||||
assert(0 <= x_start && 0 <= paintlen);
|
||||
|
||||
mvwaddnstr(edit, line, x_start + margin, converted +
|
||||
index, paintlen);
|
||||
if (startmatch.rm_so == startmatch.rm_eo) {
|
||||
index += startmatch.rm_eo + 1;
|
||||
continue;
|
||||
}
|
||||
k = startmatch.rm_eo;
|
||||
|
||||
/* Translate the match to the beginning of the line. */
|
||||
startmatch.rm_so += index;
|
||||
startmatch.rm_eo += index;
|
||||
index = startmatch.rm_eo;
|
||||
|
||||
/* If the matching piece is not visible, skip it. */
|
||||
if (startmatch.rm_so >= till_x ||
|
||||
startmatch.rm_eo <= from_x)
|
||||
continue;
|
||||
|
||||
start_col = (startmatch.rm_so <= from_x) ?
|
||||
0 : strnlenpt(fileptr->data,
|
||||
startmatch.rm_so) - from_col;
|
||||
|
||||
thetext = converted + actual_x(converted, start_col);
|
||||
|
||||
paintlen = actual_x(thetext, strnlenpt(fileptr->data,
|
||||
startmatch.rm_eo) - from_col - start_col);
|
||||
|
||||
mvwaddnstr(edit, line, margin + start_col,
|
||||
thetext, paintlen);
|
||||
}
|
||||
} else { /* Second case: varnish is a multiline expression. */
|
||||
const filestruct *start_line = fileptr->prev;
|
||||
/* The first line before fileptr that matches 'start'. */
|
||||
size_t start_col;
|
||||
/* Where the match starts in that line. */
|
||||
const filestruct *end_line;
|
||||
/* The line that matches 'end'. */
|
||||
goto tail_of_loop;
|
||||
}
|
||||
|
||||
/* First see if the multidata was maybe already calculated. */
|
||||
if (fileptr->multidata[varnish->id] == CNONE)
|
||||
/* Second case: varnish is a multiline expression. */
|
||||
const filestruct *start_line = fileptr->prev;
|
||||
/* The first line before fileptr that matches 'start'. */
|
||||
const filestruct *end_line = fileptr;
|
||||
/* The line that matches 'end'. */
|
||||
|
||||
/* First see if the multidata was maybe already calculated. */
|
||||
if (fileptr->multidata[varnish->id] == CNONE)
|
||||
goto tail_of_loop;
|
||||
else if (fileptr->multidata[varnish->id] == CWHOLELINE) {
|
||||
mvwaddnstr(edit, line, margin, converted, -1);
|
||||
goto tail_of_loop;
|
||||
} else if (fileptr->multidata[varnish->id] == CBEGINBEFORE) {
|
||||
regexec(varnish->end, fileptr->data, 1, &endmatch, 0);
|
||||
/* If the coloured part is scrolled off, skip it. */
|
||||
if (endmatch.rm_eo <= from_x)
|
||||
goto tail_of_loop;
|
||||
else if (fileptr->multidata[varnish->id] == CWHOLELINE) {
|
||||
mvwaddnstr(edit, line, margin, converted, -1);
|
||||
goto tail_of_loop;
|
||||
} else if (fileptr->multidata[varnish->id] == CBEGINBEFORE) {
|
||||
regexec(varnish->end, fileptr->data, 1, &endmatch, 0);
|
||||
/* If the coloured part is scrolled off, skip it. */
|
||||
if (endmatch.rm_eo <= startpos)
|
||||
goto tail_of_loop;
|
||||
paintlen = actual_x(converted, strnlenpt(fileptr->data,
|
||||
endmatch.rm_eo) - start);
|
||||
mvwaddnstr(edit, line, margin, converted, paintlen);
|
||||
goto tail_of_loop;
|
||||
} if (fileptr->multidata[varnish->id] == -1)
|
||||
/* Assume this until proven otherwise below. */
|
||||
fileptr->multidata[varnish->id] = CNONE;
|
||||
paintlen = actual_x(converted, strnlenpt(fileptr->data,
|
||||
endmatch.rm_eo) - from_col);
|
||||
mvwaddnstr(edit, line, margin, converted, paintlen);
|
||||
goto tail_of_loop;
|
||||
}
|
||||
|
||||
/* There is no precalculated multidata, so find it out now.
|
||||
* First check if the beginning of the line is colored by a
|
||||
* start on an earlier line, and an end on this line or later.
|
||||
*
|
||||
* So: find the first line before fileptr matching the start.
|
||||
* If every match on that line is followed by an end, then go
|
||||
* to step two. Otherwise, find a line after start_line that
|
||||
* matches the end. If that line is not before fileptr, then
|
||||
* paint the beginning of this line. */
|
||||
/* There is no precalculated multidata, or it is CENDAFTER or
|
||||
* CSTARTENDHERE. In all cases, find out what to paint. */
|
||||
|
||||
while (start_line != NULL && regexec(varnish->start,
|
||||
start_line->data, 1, &startmatch, 0) == REG_NOMATCH) {
|
||||
/* There is no start; but if there is an end on this line,
|
||||
* there is no need to look for starts on earlier lines. */
|
||||
if (regexec(varnish->end, start_line->data, 0, NULL, 0) == 0)
|
||||
goto step_two;
|
||||
start_line = start_line->prev;
|
||||
}
|
||||
/* When the multidata is unitialized, assume CNONE until one
|
||||
* of the steps below concludes otherwise. */
|
||||
if (fileptr->multidata[varnish->id] == -1)
|
||||
fileptr->multidata[varnish->id] = CNONE;
|
||||
|
||||
/* If no start was found, skip to the next step. */
|
||||
if (start_line == NULL)
|
||||
/* First check if the beginning of the line is colored by a
|
||||
* start on an earlier line, and an end on this line or later.
|
||||
*
|
||||
* So: find the first line before fileptr matching the start.
|
||||
* If every match on that line is followed by an end, then go
|
||||
* to step two. Otherwise, find a line after start_line that
|
||||
* matches the end. If that line is not before fileptr, then
|
||||
* paint the beginning of this line. */
|
||||
|
||||
while (start_line != NULL && regexec(varnish->start,
|
||||
start_line->data, 1, &startmatch, 0) == REG_NOMATCH) {
|
||||
/* There is no start; but if there is an end on this line,
|
||||
* there is no need to look for starts on earlier lines. */
|
||||
if (regexec(varnish->end, start_line->data, 0, NULL, 0) == 0)
|
||||
goto step_two;
|
||||
start_line = start_line->prev;
|
||||
}
|
||||
|
||||
/* If a found start has been qualified as an end earlier,
|
||||
* believe it and skip to the next step. */
|
||||
if (start_line->multidata != NULL &&
|
||||
/* If no start was found, skip to the next step. */
|
||||
if (start_line == NULL)
|
||||
goto step_two;
|
||||
|
||||
/* If a found start has been qualified as an end earlier,
|
||||
* believe it and skip to the next step. */
|
||||
if (start_line->multidata != NULL &&
|
||||
(start_line->multidata[varnish->id] == CBEGINBEFORE ||
|
||||
start_line->multidata[varnish->id] == CSTARTENDHERE))
|
||||
goto step_two;
|
||||
goto step_two;
|
||||
|
||||
/* Skip over a zero-length regex match. */
|
||||
if (startmatch.rm_so == startmatch.rm_eo)
|
||||
goto tail_of_loop;
|
||||
/* Skip over a zero-length regex match. */
|
||||
if (startmatch.rm_so == startmatch.rm_eo)
|
||||
goto tail_of_loop;
|
||||
|
||||
/* Now start_line is the first line before fileptr containing
|
||||
* a start match. Is there a start on that line not followed
|
||||
* by an end on that line? */
|
||||
start_col = 0;
|
||||
while (TRUE) {
|
||||
start_col += startmatch.rm_so;
|
||||
startmatch.rm_eo -= startmatch.rm_so;
|
||||
if (regexec(varnish->end, start_line->data +
|
||||
start_col + startmatch.rm_eo, 0, NULL,
|
||||
(start_col + startmatch.rm_eo == 0) ?
|
||||
/* Now start_line is the first line before fileptr containing
|
||||
* a start match. Is there a start on that line not followed
|
||||
* by an end on that line? */
|
||||
while (TRUE) {
|
||||
index += startmatch.rm_so;
|
||||
startmatch.rm_eo -= startmatch.rm_so;
|
||||
if (regexec(varnish->end, start_line->data + index +
|
||||
startmatch.rm_eo, 0, NULL,
|
||||
(index + startmatch.rm_eo == 0) ?
|
||||
0 : REG_NOTBOL) == REG_NOMATCH)
|
||||
/* No end found after this start. */
|
||||
break;
|
||||
start_col++;
|
||||
if (regexec(varnish->start, start_line->data + start_col,
|
||||
/* No end found after this start. */
|
||||
break;
|
||||
index++;
|
||||
if (regexec(varnish->start, start_line->data + index,
|
||||
1, &startmatch, REG_NOTBOL) == REG_NOMATCH)
|
||||
/* No later start on this line. */
|
||||
goto step_two;
|
||||
}
|
||||
/* Indeed, there is a start without an end on that line. */
|
||||
|
||||
/* We've already checked that there is no end before fileptr
|
||||
* and after the start. But is there an end after the start
|
||||
* at all? We don't paint unterminated starts. */
|
||||
end_line = fileptr;
|
||||
while (end_line != NULL && regexec(varnish->end,
|
||||
end_line->data, 1, &endmatch, 0) == REG_NOMATCH)
|
||||
end_line = end_line->next;
|
||||
|
||||
/* If no end was found, or it is too early, next step. */
|
||||
if (end_line == NULL)
|
||||
/* No later start on this line. */
|
||||
goto step_two;
|
||||
if (end_line == fileptr && endmatch.rm_eo <= startpos) {
|
||||
fileptr->multidata[varnish->id] = CBEGINBEFORE;
|
||||
goto step_two;
|
||||
}
|
||||
}
|
||||
/* Indeed, there is a start without an end on that line. */
|
||||
|
||||
/* Now paint the start of fileptr. If the start of fileptr
|
||||
* is on a different line from the end, paintlen is -1, which
|
||||
* means that everything on the line gets painted. Otherwise,
|
||||
* paintlen is the expanded location of the end of the match
|
||||
* minus the expanded location of the beginning of the page. */
|
||||
if (end_line != fileptr) {
|
||||
paintlen = -1;
|
||||
fileptr->multidata[varnish->id] = CWHOLELINE;
|
||||
/* We've already checked that there is no end between the start
|
||||
* and the current line. But is there an end after the start
|
||||
* at all? We don't paint unterminated starts. */
|
||||
while (end_line != NULL && regexec(varnish->end, end_line->data,
|
||||
1, &endmatch, 0) == REG_NOMATCH)
|
||||
end_line = end_line->next;
|
||||
|
||||
/* If there is no end, there is nothing to paint. */
|
||||
if (end_line == NULL)
|
||||
goto tail_of_loop;
|
||||
/* If the end is scrolled off to the left, next step. */
|
||||
if (end_line == fileptr && endmatch.rm_eo <= from_x) {
|
||||
fileptr->multidata[varnish->id] = CBEGINBEFORE;
|
||||
goto step_two;
|
||||
}
|
||||
|
||||
/* Now paint the start of the line. However, if the end match
|
||||
* is on a different line, paint the whole line, and go on. */
|
||||
if (end_line != fileptr) {
|
||||
mvwaddnstr(edit, line, margin, converted, -1);
|
||||
fileptr->multidata[varnish->id] = CWHOLELINE;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, " Marking for id %i line %i as CWHOLELINE\n", varnish->id, line);
|
||||
#endif
|
||||
} else {
|
||||
paintlen = actual_x(converted, strnlenpt(fileptr->data,
|
||||
endmatch.rm_eo) - start);
|
||||
fileptr->multidata[varnish->id] = CBEGINBEFORE;
|
||||
/* Don't bother looking for any more starts. */
|
||||
goto tail_of_loop;
|
||||
} else {
|
||||
paintlen = actual_x(converted, strnlenpt(fileptr->data,
|
||||
endmatch.rm_eo) - from_col);
|
||||
mvwaddnstr(edit, line, margin, converted, paintlen);
|
||||
fileptr->multidata[varnish->id] = CBEGINBEFORE;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, " Marking for id %i line %i as CBEGINBEFORE\n", varnish->id, line);
|
||||
#endif
|
||||
}
|
||||
mvwaddnstr(edit, line, margin, converted, paintlen);
|
||||
/* If the whole line has been painted, don't bother looking
|
||||
* for any more starts. */
|
||||
if (paintlen < 0)
|
||||
goto tail_of_loop;
|
||||
}
|
||||
step_two:
|
||||
/* Second step: look for starts on this line, but start
|
||||
* looking only after an end match, if there is one. */
|
||||
start_col = (paintlen == 0) ? 0 : endmatch.rm_eo;
|
||||
/* Second step: look for starts on this line, but begin
|
||||
* looking only after an end match, if there is one. */
|
||||
index = (paintlen == 0) ? 0 : endmatch.rm_eo;
|
||||
|
||||
while (start_col < endpos) {
|
||||
if (regexec(varnish->start, fileptr->data + start_col,
|
||||
1, &startmatch, (start_col == 0) ?
|
||||
0 : REG_NOTBOL) == REG_NOMATCH ||
|
||||
start_col + startmatch.rm_so >= endpos)
|
||||
/* No more starts on this line. */
|
||||
break;
|
||||
|
||||
/* Translate the match to be relative to the
|
||||
* beginning of the line. */
|
||||
startmatch.rm_so += start_col;
|
||||
startmatch.rm_eo += start_col;
|
||||
|
||||
x_start = (startmatch.rm_so <= startpos) ?
|
||||
0 : strnlenpt(fileptr->data,
|
||||
startmatch.rm_so) - start;
|
||||
|
||||
index = actual_x(converted, x_start);
|
||||
|
||||
if (regexec(varnish->end, fileptr->data +
|
||||
startmatch.rm_eo, 1, &endmatch,
|
||||
(startmatch.rm_eo == 0) ?
|
||||
while (regexec(varnish->start, fileptr->data + index,
|
||||
1, &startmatch, (index == 0) ?
|
||||
0 : REG_NOTBOL) == 0) {
|
||||
/* Translate the end match to be relative to
|
||||
* the beginning of the line. */
|
||||
endmatch.rm_so += startmatch.rm_eo;
|
||||
endmatch.rm_eo += startmatch.rm_eo;
|
||||
/* There is an end on this line. But does
|
||||
* it appear on this page, and is the match
|
||||
* more than zero characters long? */
|
||||
if (endmatch.rm_eo > startpos &&
|
||||
endmatch.rm_eo > startmatch.rm_so) {
|
||||
paintlen = actual_x(converted + index,
|
||||
strnlenpt(fileptr->data,
|
||||
endmatch.rm_eo) - start - x_start);
|
||||
/* Translate the match to be relative to the
|
||||
* beginning of the line. */
|
||||
startmatch.rm_so += index;
|
||||
startmatch.rm_eo += index;
|
||||
|
||||
assert(0 <= x_start && x_start < editwincols);
|
||||
start_col = (startmatch.rm_so <= from_x) ?
|
||||
0 : strnlenpt(fileptr->data,
|
||||
startmatch.rm_so) - from_col;
|
||||
|
||||
mvwaddnstr(edit, line, x_start + margin,
|
||||
converted + index, paintlen);
|
||||
if (paintlen > 0) {
|
||||
fileptr->multidata[varnish->id] = CSTARTENDHERE;
|
||||
thetext = converted + actual_x(converted, start_col);
|
||||
|
||||
if (regexec(varnish->end, fileptr->data + startmatch.rm_eo,
|
||||
1, &endmatch, (startmatch.rm_eo == 0) ?
|
||||
0 : REG_NOTBOL) == 0) {
|
||||
/* Translate the end match to be relative to
|
||||
* the beginning of the line. */
|
||||
endmatch.rm_so += startmatch.rm_eo;
|
||||
endmatch.rm_eo += startmatch.rm_eo;
|
||||
/* Only paint the match if it is visible on screen and
|
||||
* it is more than zero characters long. */
|
||||
if (endmatch.rm_eo > from_x &&
|
||||
endmatch.rm_eo > startmatch.rm_so) {
|
||||
paintlen = actual_x(thetext, strnlenpt(fileptr->data,
|
||||
endmatch.rm_eo) - from_col - start_col);
|
||||
|
||||
mvwaddnstr(edit, line, margin + start_col,
|
||||
thetext, paintlen);
|
||||
|
||||
fileptr->multidata[varnish->id] = CSTARTENDHERE;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, " Marking for id %i line %i as CSTARTENDHERE\n", varnish->id, line);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
start_col = endmatch.rm_eo;
|
||||
/* Skip over a zero-length match. */
|
||||
if (endmatch.rm_so == endmatch.rm_eo)
|
||||
start_col += 1;
|
||||
} else {
|
||||
/* There is no end on this line. But we haven't yet
|
||||
* looked for one on later lines. */
|
||||
end_line = fileptr->next;
|
||||
}
|
||||
index = endmatch.rm_eo;
|
||||
/* Skip over a zero-length match. */
|
||||
if (endmatch.rm_so == endmatch.rm_eo)
|
||||
index += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
while (end_line != NULL &&
|
||||
regexec(varnish->end, end_line->data,
|
||||
0, NULL, 0) == REG_NOMATCH)
|
||||
end_line = end_line->next;
|
||||
/* There is no end on this line. But maybe on later lines? */
|
||||
end_line = fileptr->next;
|
||||
|
||||
/* If there is no end, we're done on this line. */
|
||||
if (end_line == NULL)
|
||||
break;
|
||||
while (end_line != NULL && regexec(varnish->end, end_line->data,
|
||||
0, NULL, 0) == REG_NOMATCH)
|
||||
end_line = end_line->next;
|
||||
|
||||
assert(0 <= x_start && x_start < editwincols);
|
||||
/* If there is no end, we're done with this regex. */
|
||||
if (end_line == NULL)
|
||||
break;
|
||||
|
||||
/* Paint the rest of the line. */
|
||||
mvwaddnstr(edit, line, x_start + margin, converted + index, -1);
|
||||
fileptr->multidata[varnish->id] = CENDAFTER;
|
||||
/* Paint the rest of the line. */
|
||||
mvwaddnstr(edit, line, margin + start_col, thetext, -1);
|
||||
fileptr->multidata[varnish->id] = CENDAFTER;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, " Marking for id %i line %i as CENDAFTER\n", varnish->id, line);
|
||||
#endif
|
||||
/* We've painted to the end of the line, so don't
|
||||
* bother checking for any more starts. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* We've painted to the end of the line, so don't
|
||||
* bother checking for any more starts. */
|
||||
break;
|
||||
}
|
||||
tail_of_loop:
|
||||
wattroff(edit, varnish->attributes);
|
||||
@@ -2636,56 +2619,36 @@ void edit_draw(filestruct *fileptr, const char *converted, int
|
||||
/* The lines where the marked region begins and ends. */
|
||||
size_t top_x, bot_x;
|
||||
/* The x positions where the marked region begins and ends. */
|
||||
int x_start;
|
||||
/* The starting column for mvwaddnstr(). Zero-based. */
|
||||
int paintlen;
|
||||
/* Number of characters to paint on this line. There are
|
||||
* COLS characters on a whole line. */
|
||||
size_t index;
|
||||
/* Index in converted where we paint. */
|
||||
int start_col;
|
||||
/* The column where painting starts. Zero-based. */
|
||||
const char *thetext;
|
||||
/* The place in converted from where painting starts. */
|
||||
int paintlen = -1;
|
||||
/* The number of characters to paint. Negative means "all". */
|
||||
|
||||
mark_order(&top, &top_x, &bot, &bot_x, NULL);
|
||||
|
||||
if (top->lineno < fileptr->lineno || top_x < startpos)
|
||||
top_x = startpos;
|
||||
if (bot->lineno > fileptr->lineno || bot_x > endpos)
|
||||
bot_x = endpos;
|
||||
if (top->lineno < fileptr->lineno || top_x < from_x)
|
||||
top_x = from_x;
|
||||
if (bot->lineno > fileptr->lineno || bot_x > till_x)
|
||||
bot_x = till_x;
|
||||
|
||||
/* Only paint if the marked bit of fileptr is on this page. */
|
||||
if (top_x < endpos && bot_x > startpos) {
|
||||
assert(startpos <= top_x);
|
||||
/* Only paint if the marked part of the line is on this page. */
|
||||
if (top_x < till_x && bot_x > from_x) {
|
||||
/* Compute on which screen column to start painting. */
|
||||
start_col = strnlenpt(fileptr->data, top_x) - from_col;
|
||||
|
||||
/* x_start is the expanded location of the beginning of the
|
||||
* mark minus the beginning of the page. */
|
||||
x_start = strnlenpt(fileptr->data, top_x) - start;
|
||||
thetext = converted + actual_x(converted, start_col);
|
||||
|
||||
/* If the end of the mark is off the page, paintlen is -1,
|
||||
* meaning that everything on the line gets painted.
|
||||
* Otherwise, paintlen is the expanded location of the end
|
||||
* of the mark minus the expanded location of the beginning
|
||||
* of the mark. */
|
||||
if (bot_x >= endpos)
|
||||
paintlen = -1;
|
||||
else
|
||||
paintlen = strnlenpt(fileptr->data, bot_x) - (x_start + start);
|
||||
|
||||
/* If x_start is before the beginning of the page, shift
|
||||
* paintlen x_start characters to compensate, and put
|
||||
* x_start at the beginning of the page. */
|
||||
if (x_start < 0) {
|
||||
paintlen += x_start;
|
||||
x_start = 0;
|
||||
/* If the end of the mark is onscreen, compute how many
|
||||
* characters to paint. Otherwise, just paint all. */
|
||||
if (bot_x < till_x) {
|
||||
size_t end_col = strnlenpt(fileptr->data, bot_x) - from_col;
|
||||
paintlen = actual_x(thetext, end_col - start_col);
|
||||
}
|
||||
|
||||
assert(x_start >= 0 && x_start <= strlen(converted));
|
||||
|
||||
index = actual_x(converted, x_start);
|
||||
|
||||
if (paintlen > 0)
|
||||
paintlen = actual_x(converted + index, paintlen);
|
||||
|
||||
wattron(edit, hilite_attribute);
|
||||
mvwaddnstr(edit, line, x_start + margin, converted + index, paintlen);
|
||||
mvwaddnstr(edit, line, margin + start_col, thetext, paintlen);
|
||||
wattroff(edit, hilite_attribute);
|
||||
}
|
||||
}
|
||||
@@ -2699,15 +2662,12 @@ void edit_draw(filestruct *fileptr, const char *converted, int
|
||||
int update_line(filestruct *fileptr, size_t index)
|
||||
{
|
||||
int line = 0;
|
||||
/* The line in the edit window that we want to update. */
|
||||
/* The row in the edit window we will be updating. */
|
||||
int extralinesused = 0;
|
||||
char *converted;
|
||||
/* fileptr->data converted to have tabs and control characters
|
||||
* expanded. */
|
||||
/* The data of the line with tabs and control characters expanded. */
|
||||
size_t page_start;
|
||||
|
||||
assert(fileptr != NULL);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(SOFTWRAP)) {
|
||||
filestruct *tmp;
|
||||
@@ -2832,8 +2792,6 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
|
||||
ssize_t i;
|
||||
filestruct *foo;
|
||||
|
||||
assert(nlines > 0);
|
||||
|
||||
/* Part 1: nlines is the number of lines we're going to scroll the
|
||||
* text of the edit window. */
|
||||
|
||||
@@ -2893,12 +2851,10 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
|
||||
if (nlines > editwinrows)
|
||||
nlines = editwinrows;
|
||||
|
||||
/* If we scrolled up, we're on the line before the scrolled
|
||||
* region. */
|
||||
/* If we scrolled up, we're on the line before the scrolled region. */
|
||||
foo = openfile->edittop;
|
||||
|
||||
/* If we scrolled down, move down to the line before the scrolled
|
||||
* region. */
|
||||
/* If we scrolled down, move down to the line before the scrolled region. */
|
||||
if (direction == DOWNWARD) {
|
||||
for (i = editwinrows - nlines; i > 0 && foo != NULL; i--)
|
||||
foo = foo->next;
|
||||
@@ -2910,8 +2866,8 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
|
||||
* blank, so we don't need to draw it unless the mark is on or we're
|
||||
* not on the first page. */
|
||||
for (i = nlines; i > 0 && foo != NULL; i--) {
|
||||
if ((i == nlines && direction == DOWNWARD) || (i == 1 &&
|
||||
direction == UPWARD)) {
|
||||
if ((i == nlines && direction == DOWNWARD) ||
|
||||
(i == 1 && direction == UPWARD)) {
|
||||
if (need_horizontal_scroll(openfile->placewewant, 0))
|
||||
update_line(foo, (foo == openfile->current) ?
|
||||
openfile->current_x : 0);
|
||||
@@ -2920,6 +2876,7 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
|
||||
openfile->current_x : 0);
|
||||
foo = foo->next;
|
||||
}
|
||||
|
||||
compute_maxrows();
|
||||
}
|
||||
|
||||
@@ -3307,7 +3264,7 @@ void do_credits(void)
|
||||
|
||||
if (crpos < CREDIT_LEN) {
|
||||
const char *what;
|
||||
size_t start_x;
|
||||
size_t start_col;
|
||||
|
||||
if (credits[crpos] == NULL) {
|
||||
assert(0 <= xlpos && xlpos < XLCREDIT_LEN);
|
||||
@@ -3317,9 +3274,9 @@ void do_credits(void)
|
||||
} else
|
||||
what = credits[crpos];
|
||||
|
||||
start_x = COLS / 2 - strlenpt(what) / 2 - 1;
|
||||
start_col = COLS / 2 - strlenpt(what) / 2 - 1;
|
||||
mvwaddstr(edit, editwinrows - 1 - (editwinrows % 2),
|
||||
start_x, what);
|
||||
start_col, what);
|
||||
}
|
||||
|
||||
wrefresh(edit);
|
||||
|
||||
28
syntax/html.nanorc
Normal file
28
syntax/html.nanorc
Normal file
@@ -0,0 +1,28 @@
|
||||
## Here is an example for HTML.
|
||||
|
||||
syntax "html" "\.html?$"
|
||||
magic "HTML document text"
|
||||
comment "<!--|-->"
|
||||
|
||||
# Tags:
|
||||
color cyan start="<[[:alpha:]/!?]" end=">"
|
||||
# Bold, italic, and underlined:
|
||||
color brightmagenta "</?[biu]>"
|
||||
|
||||
# Named character references:
|
||||
color red "&[^;[:space:]]*;"
|
||||
# Strings:
|
||||
color green ""(\\.|[^"])*""
|
||||
|
||||
# Attributes:
|
||||
color red "(abbr|accept(-charset)?|accesskey|action|alink|align|alt|archive|axis|background|bgcolor|border)="
|
||||
color red "(cell(padding|spacing)|char(off|set)?|checked|cite|class(id)?|compact|code(base|tag)?|cols(pan)?)="
|
||||
color red "(content(editable)?|contextmenu|coords|data|datetime|declare|defer|dir|disabled|enctype)="
|
||||
color red "(for|frame(border)?|headers|height|hidden|href(lang)?|hspace|http-equiv|id|ismap)="
|
||||
color red "(label|lang|link|longdesc|margin(height|width)|maxlength|media|method|multiple)="
|
||||
color red "(name|nohref|noresize|noshade|object|onclick|onfocus|onload|onmouseover|profile|readonly|rel|rev)="
|
||||
color red "(rows(pan)?|rules|scheme|scope|scrolling|selected|shape|size|span|src|standby|start|style|summary)="
|
||||
color red "(tabindex|target|text|title|type|usemap|valign|value(type)?|vlink|vspace|width|xmlns|xml:space)="
|
||||
|
||||
# Comments:
|
||||
color yellow start="<!--" end="-->"
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user