Compare commits
119 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d2b198403 | ||
|
|
5ea46cacb6 | ||
|
|
fd759d5ca3 | ||
|
|
f34c8fdc6b | ||
|
|
1cf9deb603 | ||
|
|
4e5ea18394 | ||
|
|
4e9b3687ba | ||
|
|
99d2358510 | ||
|
|
08a52c1dab | ||
|
|
ce48ca2223 | ||
|
|
2dc9cbefd3 | ||
|
|
0f7b99b433 | ||
|
|
057348e1da | ||
|
|
ab21161a69 | ||
|
|
d8b6dbfffe | ||
|
|
d5177059e8 | ||
|
|
a9647b0508 | ||
|
|
37fd348a1d | ||
|
|
2aac470cb9 | ||
|
|
25ce5f6759 | ||
|
|
5d0b267aaa | ||
|
|
c2ed8277c2 | ||
|
|
d7ade1f346 | ||
|
|
de53c53c6e | ||
|
|
5ac108188d | ||
|
|
e683e32c74 | ||
|
|
7fe830fd20 | ||
|
|
07e199ff0e | ||
|
|
6f2da6b9b2 | ||
|
|
14a9c8aa0b | ||
|
|
52d7d5f55a | ||
|
|
0b6d6f45d2 | ||
|
|
0a79c78e05 | ||
|
|
ad827a6aef | ||
|
|
41580848e3 | ||
|
|
b455fa3a16 | ||
|
|
ff4a457d82 | ||
|
|
eae9f282de | ||
|
|
e39cf37026 | ||
|
|
6440aa9e47 | ||
|
|
745fab8293 | ||
|
|
a37ebcf2f8 | ||
|
|
92142bed34 | ||
|
|
83ec9e7d50 | ||
|
|
a0a0556993 | ||
|
|
33ac317132 | ||
|
|
9007c58bdd | ||
|
|
2456dd2a85 | ||
|
|
a44cf41d37 | ||
|
|
76e7aaf514 | ||
|
|
cb776fad88 | ||
|
|
a4f28694c8 | ||
|
|
82d737ee6d | ||
|
|
138add24c8 | ||
|
|
532d55c8bd | ||
|
|
3345e3407d | ||
|
|
52d1c20973 | ||
|
|
6898c60ba6 | ||
|
|
69d26c35fb | ||
|
|
4d9b5e92b3 | ||
|
|
18a2edfb84 | ||
|
|
4e95ee9f6e | ||
|
|
79ff393dc2 | ||
|
|
03bcaf6067 | ||
|
|
5891c4a542 | ||
|
|
3131d0c48a | ||
|
|
336b0ecbca | ||
|
|
32e76c4386 | ||
|
|
7d77521794 | ||
|
|
7f61fa1b55 | ||
|
|
98485c96d8 | ||
|
|
184cf609c0 | ||
|
|
e73e02fe10 | ||
|
|
ed2f0b349f | ||
|
|
d4e1d31ea4 | ||
|
|
bb4edd0136 | ||
|
|
c9b3a71d02 | ||
|
|
1b65b19abd | ||
|
|
35cd49ec50 | ||
|
|
6c7764862b | ||
|
|
9c88cab78c | ||
|
|
651bb5009f | ||
|
|
86c6cd1725 | ||
|
|
bd98ff02f6 | ||
|
|
057ef182cd | ||
|
|
67cdd5ee1e | ||
|
|
92896a708d | ||
|
|
57fa775f25 | ||
|
|
8d53aa3ad2 | ||
|
|
5b1fb56a8f | ||
|
|
6948d2e779 | ||
|
|
69429ce274 | ||
|
|
170679294b | ||
|
|
4b3f2771b5 | ||
|
|
a44def03a0 | ||
|
|
9f1b1e2b14 | ||
|
|
e99f0b609b | ||
|
|
5bb10d25ef | ||
|
|
edabd27cd8 | ||
|
|
97a5d1270a | ||
|
|
f729c6dae5 | ||
|
|
a3cc4e6ecd | ||
|
|
2a9536c4e8 | ||
|
|
1f960f7e34 | ||
|
|
3f4389b968 | ||
|
|
700c43bd42 | ||
|
|
2ec70b6466 | ||
|
|
cf9f32b009 | ||
|
|
fcd4468f90 | ||
|
|
7239fda971 | ||
|
|
47dffa483f | ||
|
|
266e0496ab | ||
|
|
dbb5e7cd8e | ||
|
|
80750632d0 | ||
|
|
d23283e249 | ||
|
|
7ffc7b0438 | ||
|
|
1a8c90eec7 | ||
|
|
ea40ebb648 | ||
|
|
1c8cdfd174 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -14,6 +14,7 @@ core
|
||||
/INSTALL
|
||||
/aclocal.m4
|
||||
/autom4te.cache
|
||||
/compile
|
||||
/config.cache
|
||||
/config.guess
|
||||
/config.h
|
||||
|
||||
305
ChangeLog
305
ChangeLog
@@ -1,3 +1,308 @@
|
||||
2015-04-13 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/search.c (do_replace_loop): Fix compilation with --enable-tiny.
|
||||
* README: Mention also the Savannah page for reporting bugs.
|
||||
|
||||
2015-04-12 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/browser.c (filesearch_init): Stop M-\ and M-/ in WhereisFile
|
||||
menu (reached via ^R ^T ^W) from doing also an unrequested search
|
||||
after having performed their function. Fixes Savannah bug #44790.
|
||||
* src/global.c (shortcut_init): Rebind ^Y and ^V in the WhereisFile
|
||||
menu from the pointless page_up() and page_down() to the effective
|
||||
first_file() and last_file(). Also unbind some other useless keys.
|
||||
* src/browser.c (filesearch_init): Remove an unused variable, and
|
||||
adjust the introductory comment for the recently tweaked logic.
|
||||
* src/rcfile.c (parse_linter, parse_formatter): Use mallocstrcpy()
|
||||
in a correct manner; don't let it free an unrelated string.
|
||||
|
||||
2015-04-11 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/search.c (do_replace_loop): Do not split off the marked region
|
||||
into a separate partition, but do the replacings in the current one,
|
||||
taking good care to stay within the boundaries of the region. This
|
||||
fixes an undo bug where the first part of a line would disappear if
|
||||
the region started in the middle of a line. Bug was reported here:
|
||||
https://lists.gnu.org/archive/html/nano-devel/2015-03/msg00077.html.
|
||||
Original idea and patch were by Mark Majeres.
|
||||
|
||||
2015-04-08 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/browser.c (browser_select_dirname, findnextfile): Rename
|
||||
'currselected' to 'looking_at', for more contrast with 'selected',
|
||||
and rename browser_select_filename() to browser_select_dirname().
|
||||
* src/text.c: Correct and adjust some comments.
|
||||
|
||||
2015-04-07 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/browser.c (do_fileresearch): Don't search for the empty string
|
||||
when nothing was sought yet (when historylog is set).
|
||||
* src/browser.c (filesearch_init): Remove an unfitting comment
|
||||
(there are no toggles here) and tweak some others.
|
||||
* src/search.c (do_search, do_research): Use the same variable as
|
||||
in the surrounding code, for consistency.
|
||||
* src/browser.c (findnextfile_wrap_reset): Elide this function,
|
||||
and rename 'search_last_file' to 'came_full_circle'.
|
||||
* src/browser.c (filesearch_init, do_fileresearch): Avoid setting
|
||||
'focusing' when searching only for filenames.
|
||||
* src/browser.c (findnextfile, do_filesearch, do_fileresearch):
|
||||
Greatly simplify the searching for the next matching filename.
|
||||
* src/{browser,files,help,prompt,text,winio}.c: Let the function
|
||||
bottombars() set the global variable 'currmenu' -- the displayed
|
||||
menu must necessarily be the active one.
|
||||
* src/browser.c (filesearch_abort): Elide this tiny function.
|
||||
* THANKS: Add the names of recent translators, and sort the list.
|
||||
* THANKS: A neater layout, plus two table headers.
|
||||
|
||||
2015-04-05 Benno Schulenberg <bensberg@justemail.net>
|
||||
* doc/texinfo/nano.texi: Expand on nano's features, condense the
|
||||
synopsis, and "online" means something else to most people.
|
||||
|
||||
2015-04-03 Benno Schulenberg <bensberg@justemail.net>
|
||||
* README: Update text to the fifth milestone, 2.4.x, plus tweaks.
|
||||
* src/rcfile.c: Remove two superfluous (because nested) #ifndefs.
|
||||
* src/rcfile.c (parse_rcfile): Ignore any magic when libmagic was
|
||||
disabled, and ignore a formatter when spell checking was disabled.
|
||||
|
||||
2015-03-28 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/search.c (search_init_globals, search_replace_abort),
|
||||
src/winio.c (edit_redraw), src/proto.h, src/global.c: When finding
|
||||
an off-screen string, put it on the center line of the screen and
|
||||
not on the bottom or top line. This restores the old behaviour
|
||||
that was unintentionally changed in r5149 six days ago.
|
||||
* src/winio.c (edit_refresh): When pasting lines on the bottom line,
|
||||
only scroll the required number of lines and not half a screen --
|
||||
that is, when smooth scrolling is enabled.
|
||||
* doc/syntax/changelog.nanorc: Also colour a series of changed files
|
||||
that spans more than one line.
|
||||
|
||||
2015-03-27 Mark Majeres <mark@engine12.com>
|
||||
* src/text.c (do_alt_speller): Adjust the end point of the marked
|
||||
region for any change in length of the region's last line.
|
||||
|
||||
2015-03-27 Benno Schulenberg <bensberg@justemail.net>
|
||||
* doc/syntax/patch.nanorc: Recognize also Debian package diffs.
|
||||
Fixes https://bugs.launchpad.net/ubuntu/+source/nano/+bug/1300565
|
||||
requested by Rolf Leggewie.
|
||||
* src/search.c (do_replace_loop): Adjust some whitespace and wrapping.
|
||||
* src/search.c (do_replace_loop): Place a call to edit_refresh better,
|
||||
and remove two unneeded ones. This greatly speeds up nano when doing
|
||||
a Replace All with *lots* of occurrences.
|
||||
* src/{color,global,nano,text,utils}.c: Normalize some whitespace.
|
||||
* src/global.c (strtosc): The linter is only available when colour is.
|
||||
* src/global.c, src/text.c: Treat the formatter like a speller, to fix
|
||||
compilation with --disable-speller. Fixes Savannah bug #44607.
|
||||
|
||||
2015-03-25 Benno Schulenberg <bensberg@justemail.net>
|
||||
* doc/syntax/debian.nanorc: Slightly widen and relax the header regex.
|
||||
* doc/syntax/python.nanorc: Hashes inside triple-quoted strings should
|
||||
not cause comment colouring. (Inside single-qouted strings neither,
|
||||
but then quotes in comments will be coloured like strings.) This
|
||||
solves https://bugs.launchpad.net/ubuntu/+source/nano/+bug/481363.
|
||||
* src/global.c (strtomenu): Remove mistaken menu name -- as the
|
||||
formatter allows no interaction it needs no associated menu.
|
||||
* src/text.c (do_formatter): Remove unneeded statement -- nothing
|
||||
has changed the value of 'currmenu'.
|
||||
* src/global.c (strtosc), doc/man/nanorc.5: Allow rebinding the
|
||||
linter when nano was configured with --disable-speller.
|
||||
|
||||
2015-03-23 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/text.c (do_alt_speller): Avoid the spell checker reporting
|
||||
an error when the marked region is zero bytes long. The message
|
||||
is not needed -- it gets printed by the caller. This generalizes
|
||||
the fix for Savannah bug #29393.
|
||||
* src/text.c (do_alt_speller): Do not unset the mark before the
|
||||
possible bailout because of a zero-sized region.
|
||||
* NEWS: Option --noread allows writing, not reading, to named pipes.
|
||||
|
||||
2015-03-22 Chris Allegretta <chrisa@asty.org>
|
||||
* src/text.c (do_alt_speller): timestamp can just be a time_t.
|
||||
Fixes compilation on win32 and macOS.
|
||||
|
||||
GNU nano 2.4.0 - 2015.03.22
|
||||
2015-03-22 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/chars.c (move_mbleft): Start looking for a multibyte char
|
||||
not at the start of the string, but only as far back as such a
|
||||
char can possibly be. Change suggested by Mark Majeres.
|
||||
* src/search.c (findnextstr): Step backward or forward not simply
|
||||
one byte but one character (possibly multibyte). Fixes Savannah
|
||||
bug #42175, reported by myself, and the finding of ghosts seen in
|
||||
https://lists.gnu.org/archive/html/nano-devel/2015-03/msg00055.html.
|
||||
* src/winio.c (edit_redraw): Do not center the current line when
|
||||
smooth scrolling is used. This fixes Savannah bug #42654.
|
||||
|
||||
2015-03-21 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/text.c (do_alt_speller): Remove some leftovers.
|
||||
* src/search.c: Place some comments better and unwrap some lines.
|
||||
|
||||
2015-03-21 Mark Majeres <mark@engine12.com>
|
||||
* src/text.c (do_alt_speller): Restore the positions of the mark
|
||||
and the cursor in a better way: to the columns where they were.
|
||||
This fixes Savannah bug #44542, reported by Benno Schulenberg.
|
||||
|
||||
2015-03-20 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/nano.c (finish_stdin_pager, cancel_stdin_pager, stdin_pager):
|
||||
Normalize the whitespace, remove an old comment, and place another
|
||||
one better.
|
||||
* src/text.c (do_undo): Make a message equal to another one. It
|
||||
was mistakenly changed in r4950. (This is translation-neutral.)
|
||||
* src/global.c (shortcut_init): Keep related items together in the
|
||||
^G help screen.
|
||||
|
||||
2015-03-17 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/text.c (do_alt_speller): Do not set the modified flag when
|
||||
an external spell checker didn't make any changes. This fixes
|
||||
Savannah bug #44320, reported by Cody A. Taylor.
|
||||
|
||||
2015-03-14 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/text.c (do_formatter): Fix a message plus a few comments.
|
||||
|
||||
2015-03-14 Mark Majeres <mark@engine12.com>
|
||||
* src/nano.c (renumber): Get out if there is nothing to renumber,
|
||||
to prevent do_undo() from falling over trying to renumber emptiness.
|
||||
This fixes Savannah bug #44488, reported by Dennis Decker Jensen.
|
||||
|
||||
2015-03-08 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/proto.h, src/nano.c: Fix compilation with --enable-tiny plus
|
||||
--enable-nanorc.
|
||||
* src/rcfile.c (parse_binding): Fix the rebinding of toggles.
|
||||
* doc/man/{nano.1,rnano.1,nanorc.5}, doc/texinfo/nano.texi: Update
|
||||
years and version numbers in the docs in anticipation of a release.
|
||||
* src/nano.c (version): Drop compile time from version information
|
||||
to enable a reproducible build. Proposed by Jérémy Bobbio and Jordi
|
||||
Mallach (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=774388).
|
||||
|
||||
2015-03-07 Benno Schulenberg <bensberg@justemail.net>
|
||||
* doc/man/nanorc.5, doc/texinfo/nano.texi: Add a note about the
|
||||
inherent imperfection of using regular expressions for syntax
|
||||
highlighting, as suggested by Mike Frysinger in bug #30962.
|
||||
* doc/man/nanorc.5: Improve the indentation of some lists.
|
||||
* doc/man/nanorc.5, doc/texinfo/nano.texi: Remove the mistaken
|
||||
square brackets around the arguments of "header" and "magic" --
|
||||
those arguments are not optional. Also add "formatter" to the
|
||||
texinfo document, and slightly improve its punctuation.
|
||||
|
||||
GNU nano 2.3.99pre3 - 2015.02.27
|
||||
2015-02-25 Chris Allegretta <chrisa@asty.org>
|
||||
* src/rcfile.c (parse_binding): Add an exception for do_toggle() as
|
||||
rebinding toggles broke with r5022. (Fixed in r5134.)
|
||||
|
||||
2015-02-21 Benno Schulenberg <bensberg@justemail.net>
|
||||
* README: Fix the explanation of how to subscribe to a mailing list.
|
||||
* doc/syntax/{java,lua,python,ruby}.nanorc: Wrap some overlong lines.
|
||||
|
||||
2015-02-18 Mike Frysinger <vapier@gentoo.org>
|
||||
* doc/syntax/sh.nanorc: Recognize also dash, openrc and runscript.
|
||||
|
||||
2015-02-16 Mike Frysinger <vapier@gentoo.org>
|
||||
* .gitignore: Ignore the autotools 'compile' file.
|
||||
|
||||
2015-02-15 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/file.c (do_lockfile): Also show the name of the affected file
|
||||
when finding a lock file, for when many files are opened at once.
|
||||
* src/file.c (do_lockfile): The user does the editing, not the editor.
|
||||
|
||||
2015-02-09 Chris Allegretta <chrisa@asty.org>
|
||||
* nano.spec.in: Add dependency on texinfo, docdir files for
|
||||
RPM file creation.
|
||||
|
||||
GNU nano 2.3.99pre2 - 2015.02.06
|
||||
2015-02-03 Alex Henrie <alexhenrie24@gmail.com>
|
||||
* src/cut.c (do_cut_text): Make sure to set modified even when
|
||||
using --enable-tiny.
|
||||
|
||||
2015-02-01 Kamil Dudka <kdudka@redhat.com>
|
||||
* src/files.c (write_lockfile): Avoid writing uninitialized bytes to
|
||||
the lock file -- a simple null_at() would not initialize the buffer.
|
||||
* src/files.c (do_lockfile): Make sure that 'lockprog' and 'lockuser'
|
||||
are terminated -- strncpy() does not guarantee that on its own.
|
||||
* src/files.c (do_lockfile): Avoid printing a wrong PID on the status
|
||||
bar due to treating serialized PID bytes as signed integers. This
|
||||
addresses https://bugzilla.redhat.com/1186384 reported by Don Swaner.
|
||||
* src/files.c (write_lockfile): Do not trim the nano version number
|
||||
-- snprintf() counts the trailing zero into the size limit.
|
||||
|
||||
2015-02-01 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/winio.c (do_credits): Add a general entry for all translators.
|
||||
* src/nano.c (version), src/winio.c (do_credits): Update the copyright
|
||||
years to include 2015.
|
||||
|
||||
2015-01-13 Chris Allegretta <chrisa@asty.org>
|
||||
* src/files.c (open_buffer): Check here for locking and properly
|
||||
handle choosing to not open a file when locked instead of in
|
||||
open_file(). Fixes Savannah bug #42373 reported by Benno Schulenberg.
|
||||
|
||||
GNU nano 2.3.99pre1 - 2015.01.06
|
||||
2015-01-03 Chris Allegretta <chrisa@asty.org>
|
||||
* New formatter code to support syntaxes like
|
||||
go which have tools to automatically lint and reformat the text for
|
||||
you (gofmt), which is lovely. rcfile option formatter, function
|
||||
text.c:do_formatter() and some other calls.
|
||||
|
||||
2014-12-28 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/files.c (do_lockfile): Gettextize the "File being edited"
|
||||
prompt, and improve its wording.
|
||||
* src/winio.c (do_credits): Remove the names of past translators
|
||||
from the Easter-egg scroll.
|
||||
* THANKS: Add a missing historical translator name.
|
||||
* src/winio.c (do_credits): Add Mark to the scroll, for all his
|
||||
undo work, colouring nano's interface, and other patches.
|
||||
|
||||
2014-11-30 Benno Schulenberg <bensberg@justemail.net>
|
||||
* doc/syntax/spec.nanorc: Colorize %pretrans and %posttrans fully.
|
||||
Original patch from Savannah patch #8573 by Daniel Vrátil.
|
||||
|
||||
2014-09-21 Benno Schulenberg <bensberg@justemail.net>
|
||||
* doc/syntax/{perl,python,ruby,sh}.nanorc: Recognize also header
|
||||
lines of the form "#!/usr/bin/env thing" besides "#!/bin/thing".
|
||||
This fixes Savannah bug #43270 reported by Kitty.
|
||||
|
||||
2014-08-29 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/text.c (do_justify): Replace the old get_shortcut() wrapper
|
||||
with the new func_from_key().
|
||||
|
||||
2014-08-10 Benno Schulenberg <bensberg@justemail.net>
|
||||
* doc/texinfo/nano.texi: Improve some wordings and formatting.
|
||||
|
||||
2014-08-07 Benno Schulenberg <bensberg@justemail.net>
|
||||
* doc/syntax/nanorc.nanorc: Remove a mistaken OR which causes a
|
||||
'Bad regex, empty (sub)expression' error on some systems. This
|
||||
fixes Savannah bug #42929 reported by Misty De Meo.
|
||||
|
||||
2014-08-03 Benno Schulenberg <bensberg@justemail.net>
|
||||
* doc/man/nano.1, doc/man/rnano.1: Tweak the formatting a bit so that
|
||||
po4a will create a nicer POT file.
|
||||
* doc/man/nanorc.5: Improve some of the wordings and formatting.
|
||||
|
||||
2014-08-02 Benno Schulenberg <bensberg@justemail.net>
|
||||
* doc/texinfo/nano.texi: Standardize the formatting of command-line
|
||||
options -- each one separately. Also add some more markup.
|
||||
|
||||
2014-08-01 Benno Schulenberg <bensberg@justemail.net>
|
||||
* doc/man/nano.1, doc/man/rnano.1: Separate short and long option
|
||||
by a comma instead of putting the long one between parentheses.
|
||||
And showing the required quotes around the argument of -Q.
|
||||
|
||||
2014-07-31 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/files.c (do_insertfile): Adjust some indentation.
|
||||
* src/prompt.c (do_statusbar_input), src/browser.c (do_browser):
|
||||
Reorder a few things, and adjust some whitespace.
|
||||
|
||||
2014-07-27 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/global.c (add_to_sclist): Remove the now unused and unneeded
|
||||
addition ability from this builder function of the shortcut list.
|
||||
* src/global.c (strtokeytype): Move this to a better place.
|
||||
* src/global.c (first_sc_for): Move this too to a better place.
|
||||
* src/prompt.c (do_yesno_prompt): Use the new and more direct
|
||||
func_from_key() wrapper instead of get_shortcut().
|
||||
* src/text.c (do_linter): Likewise.
|
||||
* src/files.c (do_insertfile, do_writeout): Likewise.
|
||||
|
||||
2014-07-24 Jordi Mallach <jordi@gnu.org>
|
||||
* doc/texinfo/nano.texi, doc/man/nanorc.5: Typo fix.
|
||||
|
||||
2014-07-22 Benno Schulenberg <bensberg@justemail.net>
|
||||
* doc/syntax/nanorc.nanorc: Remove 'undo' from the valid options.
|
||||
|
||||
2014-07-21 Jordi Mallach <jordi@gnu.org>
|
||||
* doc/nanorc.sample.in: Remove ‘undo’ section which is now obsolete.
|
||||
|
||||
GNU nano 2.3.6 - 2014.07.17
|
||||
2014-07-16 Jordi Mallach <jordi@gnu.org>
|
||||
* doc/man/rnano.1: Additional printing formatting improvement from
|
||||
Bjarni Ingi Gislason.
|
||||
|
||||
54
NEWS
54
NEWS
@@ -1,3 +1,53 @@
|
||||
2015.04.14 - GNU nano 2.4.1 "Glitch Gremlin" is released. This release
|
||||
includes several fixes for issues with the file browser
|
||||
menu, linter and formatter functions, spell checker,
|
||||
undo/redo with some specific marked-cutting situations,
|
||||
and some small improvements to the color syntax
|
||||
highlighting definitions. There are also various
|
||||
documentation and code comment updates included, and
|
||||
finally, fixes for compilation on non-GNU/Linux systems
|
||||
and certain configure combinations. Toasters!
|
||||
|
||||
2015.03.22 - GNU nano 2.4.0 "lizf" is released. This is the first
|
||||
stable release in many years, and brings together many
|
||||
new features from the 2.3 series, including:
|
||||
a fully functional undo system (now enabled by default),
|
||||
vim-compatible file locking, linter support, formatter
|
||||
support, syntax highlighting flexibility, and many fixes
|
||||
for issues reported since 2.2. Many sincere thanks
|
||||
to all of the bug reports, patches, well wishes and
|
||||
contributions from everyone who has continued to
|
||||
support us. Thank you for using nano!
|
||||
|
||||
|
||||
2015.02.27 - GNU nano 2.3.99pre3 "Ashley" is released. This is likely
|
||||
to be the last release before the next major (2.4.0)
|
||||
release. Please test it out and send us any feedback
|
||||
via the Savannah bug page for nano
|
||||
(https://savannah.gnu.org/bugs/?group=nano). This
|
||||
release includes fixes for rebinding toggles via
|
||||
nanorc, several memory alignment fixes, and documentation
|
||||
and build updates. As always thank you for using
|
||||
nano - Share and Enjoy!
|
||||
|
||||
2015.02.06 - GNU nano 2.3.99pre2 "Snowblind" is released. This release
|
||||
contains only fixes, including: a long-standing problem
|
||||
with cutting in nano-tiny, several memory alignment
|
||||
improvements, and issues with leftover file locks. Please
|
||||
keep reporting bugs so we can get a happy and healthy
|
||||
2.4.0 soon. Thanks for using nano!
|
||||
|
||||
2015.01.06 - GNU nano 2.3.99pre1 "Junior" is released. As the first
|
||||
2.4 release candidate there will be fewer new features
|
||||
but many bugfixes going forward. This release contains
|
||||
new support for language reformatters like Go's gofmt
|
||||
command which takes the place of the spelling checker.
|
||||
Fixes in this release include many syntax highlighting
|
||||
fixes and improvements, and documentation formatting updates.
|
||||
As always please report bugs via the Savannah bug page for
|
||||
nano (https://savannah.gnu.org/bugs/?group=nano), so we can
|
||||
release a super awesome and bug-free 2.4.0 soon!
|
||||
|
||||
2014.07.17 - GNU nano 2.3.6 "Columbo" is released. This release
|
||||
contains a fix for installing internationalization
|
||||
files. Also included are scattered documentation
|
||||
@@ -30,7 +80,7 @@
|
||||
substantial improvements to the undo/redo code, UTF-8
|
||||
handling, the configure script, and display of shortcuts
|
||||
on very wide terminals, New features include the
|
||||
ability to read named pipes (--noread), as well as
|
||||
ability to write to named pipes (--noread), as well as
|
||||
linter support (see the nanorc man page for details). Also
|
||||
included are much improved syntax highlighting code, and
|
||||
configurations for JSON, texinfo, Go, and a default syntax
|
||||
@@ -326,7 +376,7 @@
|
||||
2008.03.18 - GNU nano 2.1.0 "under old mismanagement" is released.
|
||||
This first release in the 2.1 development series
|
||||
introduces rebinadble keys for most actions inside
|
||||
the editor. Please see the nanorc(5) page for
|
||||
the editor. Please see the nanorc(5) page for
|
||||
more information on configuring key bindings. Please
|
||||
also report all keybinding bugs (crashes, missing
|
||||
menu functions) using the Savannah bug tracker URL,
|
||||
|
||||
63
README
63
README
@@ -6,24 +6,24 @@ Overview
|
||||
The nano project was started because of a few "problems" with the
|
||||
wonderfully easy-to-use and friendly Pico text editor.
|
||||
|
||||
First and foremost is its license: the Pine suite does not use the
|
||||
GPL or a GPL-friendly license, and has unclear restrictions on
|
||||
First and foremost was its license: the Pine suite does not use
|
||||
the GPL or a GPL-friendly license, and has unclear restrictions on
|
||||
redistribution. Because of this, Pine and Pico are not included
|
||||
with many GNU/Linux distributions. Also, other features (like go
|
||||
to line number or search and replace) were unavailable until
|
||||
recently or require a command line flag. Yuck.
|
||||
with many GNU/Linux distributions. Also, other features (like
|
||||
go-to-line-number or search-and-replace) were unavailable until
|
||||
recently or require a command-line flag. Yuck.
|
||||
|
||||
nano aims to solve these problems by emulating the functionality of
|
||||
Pico as closely as possible while addressing the problems above and
|
||||
perhaps providing other extra functionality.
|
||||
providing other extra functionality.
|
||||
|
||||
The nano editor is now an official GNU package. For more
|
||||
information on GNU and the Free Software Foundation, please see
|
||||
http://www.gnu.org/.
|
||||
The nano editor is an official GNU package. For more information on
|
||||
GNU and the Free Software Foundation, please see http://www.gnu.org/.
|
||||
|
||||
How to compile and install nano
|
||||
|
||||
Download the nano source code, then:
|
||||
|
||||
tar zxvf nano-x.y.z.tar.gz
|
||||
cd nano-x.y.z
|
||||
./configure
|
||||
@@ -32,41 +32,42 @@ How to compile and install nano
|
||||
|
||||
It's that simple. Use --prefix with configure to override the
|
||||
default installation directory of /usr/local.
|
||||
|
||||
If you configured with the "--enable-nanorc" option, after
|
||||
installation you might copy the doc/nanorc.sample to your home
|
||||
directory, rename it to ".nanorc", and then edit it according to
|
||||
your taste.
|
||||
|
||||
If you haven't configured with the "--disable-nanorc" option, after
|
||||
installation you may want to copy the doc/nanorc.sample to your
|
||||
home directory, rename it to ".nanorc", and then edit it according
|
||||
to your taste.
|
||||
|
||||
Web Page
|
||||
|
||||
http://www.nano-editor.org/
|
||||
|
||||
Mailing List and Bug Reports
|
||||
Mailing Lists and Bug Reports
|
||||
|
||||
Savannah hosts all the nano-related mailing-lists.
|
||||
|
||||
+ info-nano@gnu.org is a very low traffic list
|
||||
used to announce new nano versions or other important
|
||||
information about the project.
|
||||
+ info-nano@gnu.org is a very low traffic list used to announce
|
||||
new nano versions or other important information about the
|
||||
project.
|
||||
+ help-nano@gnu.org is for those seeking to get help without
|
||||
wanting to hear about the technical details of its
|
||||
development.
|
||||
+ nano-devel@gnu.org is the list used by the people
|
||||
that make nano and a general development discussion list, with
|
||||
moderate traffic.
|
||||
wanting to hear about the technical details of its development.
|
||||
+ nano-devel@gnu.org is the list used by the people that make
|
||||
nano and a general development discussion list, with moderate
|
||||
traffic.
|
||||
|
||||
To subscribe, send email to nano-<name>-request@gnu.org with a
|
||||
To subscribe, send email to <name>-request@gnu.org with a
|
||||
subject of "subscribe", where <name> is the list you want to
|
||||
subscribe to.
|
||||
|
||||
For general bug reports, send a description of the problem to
|
||||
nano@nano-editor.org or directly to the development list.
|
||||
For general bug reports, please file a description of the problem
|
||||
on the Savannah bug tracker page for nano
|
||||
(https://savannah.gnu.org/bugs/?group=nano). The issue may have
|
||||
already been reported, and we are better able to track the state
|
||||
of the issue and whom to notify when fixed, the more the bug
|
||||
tracker is used.
|
||||
|
||||
Current Status
|
||||
|
||||
GNU nano has reached its fourth stable milestone, 2.2.x.
|
||||
Development of new features continues in the 2.3.x branch, while
|
||||
2.2.x versions are dedicated to bug-fixing and polishing.
|
||||
|
||||
$Id$
|
||||
GNU nano has reached its fifth stable milestone, 2.4.x.
|
||||
Development of new features will continue in the 2.5.x branch,
|
||||
while 2.4.x versions are dedicated to bug-fixing and polishing.
|
||||
|
||||
141
THANKS
141
THANKS
@@ -2,81 +2,87 @@ The following people have helped GNU nano in some way or another.
|
||||
If we missed you here, let us know!
|
||||
|
||||
|
||||
Sharuzzaman Ahmat Raslan <sharuzzaman@excite.com>
|
||||
Malay translator
|
||||
Laurentiu Buzdugan <buzdugan@voyager.net> Romanian translator
|
||||
CHAO Wei-Lun <chaoweilun@pcmail.com.tw> Chinese (traditional) translator
|
||||
Ricardo Cárdenes Medina <ricardo@conisys.com> Spanish translator
|
||||
Marco Colombo <magicdice@inwind.it> Italian translator
|
||||
Yavor Doganov <yavor@doganov.org> Bulgarian translator
|
||||
Karl Eichwalder <keichwa@gmx.net> German translator
|
||||
Doruk Fisek <dfisek@fisek.com.tr> Turkish translator
|
||||
Jean-Philippe Guérard <jean-philippe.guerard@laposte.net>
|
||||
French translator
|
||||
Geir Helland <pjallabais@users.sourceforge.net> Norwegian Bokmål translator
|
||||
Tedi Heriyanto <tedi_h@gmx.net> Indonesian translator
|
||||
Václav Haisman <V.Haisman@sh.cvut.cz> Czech translator
|
||||
Szabolcs Horvath <horvaths@janus.gimsz.sulinet.hu>
|
||||
Hungarian translator
|
||||
Kalle Kivimaa <kalle.kivimaa@iki.fi> Finnish translator
|
||||
Eivind Kjørstad <ekj@vestdata.no> Norwegian Nynorsk translator
|
||||
Florian König <floki@bigfoot.com> German translator
|
||||
Wojciech Kotwica <wkotwica@post.pl> Polish translator
|
||||
Clement Laforet <clem_laf@wanadoo.fr> French translator
|
||||
Gergely Nagy <algernon@debian.org> Hungarian translator
|
||||
Kalle Olavi Niemitalo <kon@iki.fi> Finnish translator
|
||||
A. Murat EREN <meren@comu.edu.tr> Turkish translator
|
||||
Claudio Neves <cneves@nextis.com> Brazilian Portuguese translator
|
||||
Daniel Nylander <po@danielnylander.se> Swedish translator
|
||||
Michael Piefel <piefel@informatik.hu-berlin.de> German translator
|
||||
Sergey A. Ribalchenko <fisher@obu.ck.ua> Ukrainian and Russian translator
|
||||
Michel Robitaille <robitail@IRO.UMontreal.CA> French translator
|
||||
Christian Rose <menthos@menthos.com> Swedish translator
|
||||
Stig E Sandø <stig@ii.uib.no> Norwegian Bokmål translator
|
||||
Benno Schulenberg <benno@vertaalt.nl> Dutch and Esperanto translator
|
||||
Danilo Segan <dsegan@gmx.net> Serbian translator
|
||||
Keld Simonsen <keld@dkuug.dk> Danish translator
|
||||
Guus Sliepen <guus@nl.linux.org> Dutch translator
|
||||
Cezary Sliwa <sliwa@cft.edu.pl> Polish translator
|
||||
Pierre Tane <tanep@bigfoot.com> French translator
|
||||
Jacobo Tarrío <jtarrio@trasno.net> Galician translator
|
||||
Kjetil Torgrim Homme <kjetilho@linpro.no> Norwegian Nynorsk translator
|
||||
Miquel Vidal <miquel@sindominio.net> Catalan translator
|
||||
Phan Vinh Thinh <teppi82@gmail.com> Vietnamese translator
|
||||
Pauli Virtanen <pauli.virtanen@saunalahti.fi> Finnish translator
|
||||
Peio Ziarsolo <peio@sindominio.net> Basque translator
|
||||
Anton Zinoviev <zinoviev@debian.org> Bulgarian translator
|
||||
João Victor Duarte Martins <jvdm@sdf.lonestar.org>
|
||||
Brazilian Portuguese translator
|
||||
Kevin Patrick Scannell <kscanne@gmail.com> Irish translator
|
||||
Gabor Kelemen <kelemeng@gnome.hu> Hungarian translator
|
||||
Francisco Javier Tsao Santín <tsao@members.fsf.org>
|
||||
Galician translator
|
||||
Dimitriy Ryazantcev <DJm00n@mail.ru> Russian translator
|
||||
Clytie Siddall <clytie@riverland.net.au> Vietnamese translator
|
||||
LI Daobing <lidaobing@gmail.com> Chinese (simplified) translator
|
||||
Jorma Karvonen <karvonen.jorma@gmail.com> Finnish translator
|
||||
Aron Xu <happyaron.xu@gmail.com> Chinese (simplified) translator
|
||||
Pavel Fric <pavelfric@seznam.cz> Czech translator
|
||||
Pavel Maryanov <acid@jack.kiev.ua> Russian translator
|
||||
Sergey Poznyakoff <gray@gnu.org> Polish translator
|
||||
Ask Hjorth Larsen <asklarsen@gmail.com> Danish translator
|
||||
Trần Ngọc Quân <vnwildman@gmail.com> Vietnamese translator
|
||||
Klemen Košir <klemen913@gmail.com> Slovenian translator
|
||||
Yasuaki Taniguchi <yasuakit@gmail.com> Japanese translator
|
||||
Jorge González <aloriel@gmail.com> Spanish translator
|
||||
Johnny A. Solbu <johnny@solbu.net> Norwegian Bokmål translator
|
||||
Мирослав Николић <miroslavnikolic@rocketmail.com>
|
||||
Serbian translator
|
||||
Translations:
|
||||
============
|
||||
Sharuzzaman Ahmat Raslan <sharuzzaman@excite.com> Malay
|
||||
Josef Andersson <josef.andersson@fripost.org> Swedish
|
||||
Laurentiu Buzdugan <buzdugan@voyager.net> Romanian
|
||||
Mario Blättermann <mario.blaettermann@gmail.com> German
|
||||
Wei-Lun CHAO <chaoweilun@pcmail.com.tw> Chinese (traditional)
|
||||
Ricardo Cárdenes Medina <ricardo@conisys.com> Spanish
|
||||
Yuri Chornoivan <yurchor@ukr.net> Ukrainian
|
||||
Mihai Cristescu <mihai.cristescu@archlinux.info> Romanian
|
||||
Marco Colombo <magicdice@inwind.it> Italian
|
||||
Yavor Doganov <yavor@doganov.org> Bulgarian
|
||||
Karl Eichwalder <keichwa@gmx.net> German
|
||||
A. Murat EREN <meren@comu.edu.tr> Turkish
|
||||
Rafael Ferreira <rafael.f.f1@gmail.com> Brazilian Portuguese
|
||||
Doruk Fisek <dfisek@fisek.com.tr> Turkish
|
||||
Pavel Fric <pavelfric@seznam.cz> Czech
|
||||
Jorge González <aloriel@gmail.com> Spanish
|
||||
Jean-Philippe Guérard <jean-philippe.guerard@laposte.net> French
|
||||
Geir Helland <pjallabais@users.sourceforge.net> Norwegian Bokmål
|
||||
Tedi Heriyanto <tedi_h@gmx.net> Indonesian
|
||||
Václav Haisman <V.Haisman@sh.cvut.cz> Czech
|
||||
Kjetil Torgrim Homme <kjetilho@linpro.no> Norwegian Nynorsk
|
||||
Szabolcs Horvath <horvaths@janus.gimsz.sulinet.hu> Hungarian
|
||||
Jorma Karvonen <karvonen.jorma@gmail.com> Finnish
|
||||
Gabor Kelemen <kelemeng@gnome.hu> Hungarian
|
||||
Kalle Kivimaa <kalle.kivimaa@iki.fi> Finnish
|
||||
Eivind Kjørstad <ekj@vestdata.no> Norwegian Nynorsk
|
||||
Florian König <floki@bigfoot.com> German
|
||||
Klemen Košir <klemen913@gmail.com> Slovenian
|
||||
Wojciech Kotwica <wkotwica@post.pl> Polish
|
||||
Ask Hjorth Larsen <asklarsen@gmail.com> Danish
|
||||
Clement Laforet <clem_laf@wanadoo.fr> French
|
||||
LI Daobing <lidaobing@gmail.com> Chinese (simplified)
|
||||
João Victor Duarte Martins <jvdm@sdf.lonestar.org> Brazilian Portuguese
|
||||
Pavel Maryanov <acid@jack.kiev.ua> Russian
|
||||
Daniele Medri <madrid@linux.it> Italian
|
||||
Gergely Nagy <algernon@debian.org> Hungarian
|
||||
Kalle Olavi Niemitalo <kon@iki.fi> Finnish
|
||||
Мирослав Николић <miroslavnikolic@rocketmail.com> Serbian
|
||||
Claudio Neves <cneves@nextis.com> Brazilian Portuguese
|
||||
Daniel Nylander <po@danielnylander.se> Swedish
|
||||
Mikel Olasagasti <hey_neken@mundurat.net> Basque
|
||||
Michael Piefel <piefel@informatik.hu-berlin.de> German
|
||||
Sergey Poznyakoff <gray@gnu.org> Polish
|
||||
Trần Ngọc Quân <vnwildman@gmail.com> Vietnamese
|
||||
Sergey A. Ribalchenko <fisher@obu.ck.ua> Ukrainian and Russian
|
||||
Michel Robitaille <robitail@IRO.UMontreal.CA> French
|
||||
Christian Rose <menthos@menthos.com> Swedish
|
||||
Dimitriy Ryazantcev <DJm00n@mail.ru> Russian
|
||||
Stig E Sandø <stig@ii.uib.no> Norwegian Bokmål
|
||||
Kevin Patrick Scannell <kscanne@gmail.com> Irish
|
||||
Benno Schulenberg <benno@vertaalt.nl> Dutch and Esperanto
|
||||
Danilo Segan <dsegan@gmx.net> Serbian
|
||||
Clytie Siddall <clytie@riverland.net.au> Vietnamese
|
||||
Keld Simonsen <keld@dkuug.dk> Danish
|
||||
Guus Sliepen <guus@nl.linux.org> Dutch
|
||||
Cezary Sliwa <sliwa@cft.edu.pl> Polish
|
||||
Johnny A. Solbu <johnny@solbu.net> Norwegian Bokmål
|
||||
Pierre Tane <tanep@bigfoot.com> French
|
||||
Yasuaki Taniguchi <yasuakit@gmail.com> Japanese
|
||||
Jacobo Tarrío <jtarrio@trasno.net> Galician
|
||||
Francisco Javier Tsao Santín <tsao@members.fsf.org> Galician
|
||||
Miquel Vidal <miquel@sindominio.net> Catalan
|
||||
Phan Vinh Thinh <teppi82@gmail.com> Vietnamese
|
||||
Pauli Virtanen <pauli.virtanen@saunalahti.fi> Finnish
|
||||
Aron Xu <happyaron.xu@gmail.com> Chinese (simplified)
|
||||
Peio Ziarsolo <peio@sindominio.net> Basque
|
||||
Anton Zinoviev <zinoviev@debian.org> Bulgarian
|
||||
|
||||
|
||||
Other stuff:
|
||||
===========
|
||||
Ben Armstrong <synrg@sanctuary.nslug.ns.ca> Negative -r value idea, code
|
||||
Thomas Dickey <dickey@herndon4.his.com> Curses help and advice
|
||||
Sven Guckes <guckes@math.fu-berlin.de> Advice and Advocacy
|
||||
Sven Guckes <guckes@math.fu-berlin.de> Advice and advocacy
|
||||
Thijs Kinkhorst <thijs@kinkhorst.com> rnano.1 manpage
|
||||
Jim Knoble <jmknoble@pobox.com> Pico compat for browser
|
||||
Ryan Krebs <fluffy@highwire.stanford.edu> Many bug fixes and testing
|
||||
Roy Lanek <lanek@ranahminang.net> Advice and advocacy
|
||||
Mark Majeres <mark@engine12.com> Working undo/redo code
|
||||
Chuck Mead <csm@MoonGroup.com> Feedback and RPM stuff
|
||||
Mike Melanson <melanson@pcisys.net> Bugs
|
||||
Neil Parks <nparks@acsmail.com> Bug reports and fixes
|
||||
@@ -84,4 +90,5 @@ Jeremy Robichaud <robicj@yahoo.com> Beta tester
|
||||
Bill Soudan <wes0472@rit.edu> Regex code, etc
|
||||
Ken Tyler <kent@werple.net.au> Search fixes and more
|
||||
|
||||
|
||||
$Id$
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#
|
||||
# $Id$
|
||||
|
||||
AC_INIT([GNU nano], [2.3.6], [nano-devel@gnu.org], [nano])
|
||||
AC_INIT([GNU nano], [2.4.1], [nano-devel@gnu.org], [nano])
|
||||
AC_CONFIG_SRCDIR([src/nano.c])
|
||||
AC_CANONICAL_HOST
|
||||
AM_INIT_AUTOMAKE
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH NANO 1 "version 2.3.5" "June 2014"
|
||||
.TH NANO 1 "version 2.4.0" "March 2015"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
|
||||
@@ -30,7 +30,6 @@ nano \- Nano's ANOther editor, an enhanced free Pico clone
|
||||
.SH SYNOPSIS
|
||||
.B nano
|
||||
.RI [ options "] [[+" line , column "]\ " file "]..."
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
\fBnano\fP is a small, free and friendly editor which aims to replace
|
||||
@@ -46,65 +45,65 @@ Places the cursor on line number \fIline\fP and at column number \fIcolumn\fP
|
||||
(at least one of which must be specified) on startup, instead of the
|
||||
default line 1, column 1.
|
||||
.TP
|
||||
.B \-A (\-\-smarthome)
|
||||
.BR \-A ", " \-\-smarthome
|
||||
Make the Home key smarter. When Home is pressed anywhere but at the
|
||||
very beginning of non-whitespace characters on a line, the cursor will
|
||||
jump to that beginning (either forwards or backwards). If the cursor is
|
||||
already at that position, it will jump to the true beginning of the
|
||||
line.
|
||||
.TP
|
||||
.B \-B (\-\-backup)
|
||||
.BR \-B ", " \-\-backup
|
||||
When saving a file, back up the previous version of it to the current
|
||||
filename suffixed with a tilde (\fB~\fP).
|
||||
.TP
|
||||
.B \-C \fIdir\fP (\-\-backupdir=\fIdir\fP)
|
||||
.BR \-C\ \fIdirectory\fR ", " \-\-backupdir= \fIdirectory
|
||||
Set the directory where \fBnano\fP puts unique backup files, if file
|
||||
backups are enabled.
|
||||
.TP
|
||||
.B \-D (\-\-boldtext)
|
||||
.BR \-D ", " \-\-boldtext
|
||||
Use bold text instead of reverse video text.
|
||||
.TP
|
||||
.B \-E (\-\-tabstospaces)
|
||||
.BR \-E ", " \-\-tabstospaces
|
||||
Convert typed tabs to spaces.
|
||||
.TP
|
||||
.B \-F (\-\-multibuffer)
|
||||
.BR \-F ", " \-\-multibuffer
|
||||
Enable multiple file buffers (if support for them has been compiled in).
|
||||
.TP
|
||||
.B \-G (\-\-locking)
|
||||
.BR \-G ", " \-\-locking
|
||||
Enable vim-style file locking when editing files.
|
||||
.TP
|
||||
.B \-H (\-\-historylog)
|
||||
.BR \-H ", " \-\-historylog
|
||||
Log search and replace strings to \fI~/.nano/search_history\fP, so they can be
|
||||
retrieved in later sessions.
|
||||
.TP
|
||||
.B \-I (\-\-ignorercfiles)
|
||||
.BR \-I ", " \-\-ignorercfiles
|
||||
Don't look at the system's \fBnanorc\fP nor at \fB~/.nanorc\fP.
|
||||
.TP
|
||||
.B \-K (\-\-rebindkeypad)
|
||||
.BR \-K ", " \-\-rebindkeypad
|
||||
Interpret the numeric keypad keys so that they all work properly. You
|
||||
should only need to use this option if they don't, as mouse support
|
||||
won't work properly with this option enabled.
|
||||
.TP
|
||||
.B \-L (\-\-nonewlines)
|
||||
.BR \-L ", " \-\-nonewlines
|
||||
Don't add newlines to the ends of files.
|
||||
.TP
|
||||
.B \-N (\-\-noconvert)
|
||||
.BR \-N ", " \-\-noconvert
|
||||
Disable automatic conversion of files from DOS/Mac format.
|
||||
.TP
|
||||
.B \-O (\-\-morespace)
|
||||
.BR \-O ", " \-\-morespace
|
||||
Use the blank line below the titlebar as extra editing space.
|
||||
.TP
|
||||
.B \-P (\-\-poslog)
|
||||
.BR \-P ", " \-\-poslog
|
||||
Log and later read back the location of the cursor and place it there
|
||||
again.
|
||||
.TP
|
||||
.B \-Q \fIstr\fP (\-\-quotestr=\fIstr\fP)
|
||||
.BR "\-Q ""\fIcharacters\fB""" ", " "\-\-quotestr=""" \fIcharacters\fR """
|
||||
Set the quoting string for justifying. The default is
|
||||
"\fI^([\ \\t]*[#:>\\|}])+\fP" if extended regular expression support is
|
||||
available, or "\fI>\ \fP" otherwise. Note that \fI\\t\fP stands for a
|
||||
\fB"^([\ \\t]*[#:>\\|}])+"\fP if extended regular expression support is
|
||||
available, or \fB">\ "\fP otherwise. Note that \fB\\t\fP stands for a
|
||||
Tab.
|
||||
.TP
|
||||
.B \-R (\-\-restricted)
|
||||
.BR \-R ", " \-\-restricted
|
||||
Restricted mode: don't read or write to any file not specified on the
|
||||
command line; don't read any \fInanorc\fP files nor history files;
|
||||
don't allow suspending nor spell checking;
|
||||
@@ -113,80 +112,80 @@ different name if it already has one; and don't use backup files.
|
||||
This restricted mode is also accessible by invoking \fBnano\fP
|
||||
with any name beginning with 'r' (e.g. "rnano").
|
||||
.TP
|
||||
.B \-S (\-\-smooth)
|
||||
.BR \-S ", " \-\-smooth
|
||||
Enable smooth scrolling. Text will scroll line-by-line, instead of the
|
||||
usual chunk-by-chunk behavior.
|
||||
.TP
|
||||
.B \-T \fInumber\fP (\-\-tabsize=\fInumber\fP)
|
||||
.BR \-T\ \fInumber\fR ", " \-\-tabsize= \fInumber
|
||||
Set the size (width) of a tab to \fInumber\fP columns. The value of
|
||||
\fInumber\fP must be greater than 0. The default value is 8.
|
||||
.TP
|
||||
.B \-U (\-\-quickblank)
|
||||
.BR \-U ", " \-\-quickblank
|
||||
Do quick statusbar blanking. Statusbar messages will disappear after 1
|
||||
keystroke instead of 25. Note that \fB\-c\fP overrides this.
|
||||
.TP
|
||||
.B \-V (\-\-version)
|
||||
.BR \-V ", " \-\-version
|
||||
Show the current version number and exit.
|
||||
.TP
|
||||
.B \-W (\-\-wordbounds)
|
||||
.BR \-W ", " \-\-wordbounds
|
||||
Detect word boundaries more accurately by treating punctuation
|
||||
characters as part of a word.
|
||||
.TP
|
||||
.B \-Y \fIname\fP (\-\-syntax=\fIname\fP)
|
||||
.BR \-Y\ \fIname\fR ", " \-\-syntax= \fIname
|
||||
Specify the name of the syntax highlighting to use from among the ones
|
||||
defined in the \fInanorc\fP files.
|
||||
.TP
|
||||
.B \-c (\-\-const)
|
||||
.BR \-c ", " \-\-const
|
||||
Constantly show the cursor position. Note that this overrides \fB\-U\fP.
|
||||
.TP
|
||||
.B \-d (\-\-rebinddelete)
|
||||
.BR \-d ", " \-\-rebinddelete
|
||||
Interpret the Delete key differently so that both Backspace and Delete
|
||||
work properly. You should only need to use this option if Backspace
|
||||
acts like Delete on your system.
|
||||
.TP
|
||||
.B \-h (\-\-help)
|
||||
.BR \-h ", " \-\-help
|
||||
Show a summary of the available command-line options and exit.
|
||||
.TP
|
||||
.B \-i (\-\-autoindent)
|
||||
.BR \-i ", " \-\-autoindent
|
||||
Indent new lines to the previous line's indentation. Useful when
|
||||
editing source code.
|
||||
.TP
|
||||
.B \-k (\-\-cut)
|
||||
.BR \-k ", " \-\-cut
|
||||
Make the 'Cut Text' command (normally ^K) cut from the current cursor
|
||||
position to the end of the line, instead of cutting the entire line.
|
||||
.TP
|
||||
.B \-l (\-\-nofollow)
|
||||
.BR \-l ", " \-\-nofollow
|
||||
If the file being edited is a symbolic link, replace the link with
|
||||
a new file instead of following it. Good for editing files in
|
||||
\fI/tmp\fP, perhaps?
|
||||
.TP
|
||||
.B \-m (\-\-mouse)
|
||||
.BR \-m ", " \-\-mouse
|
||||
Enable mouse support, if available for your system. When enabled, mouse
|
||||
clicks can be used to place the cursor, set the mark (with a double
|
||||
click), and execute shortcuts. The mouse will work in the X Window
|
||||
System, and on the console when gpm is running. Text can still be
|
||||
selected through dragging by holding down the Shift key.
|
||||
.TP
|
||||
.B \-n (\-\-noread)
|
||||
.BR \-n ", " \-\-noread
|
||||
Treat any name given on the command line as a new file. This allows
|
||||
\fBnano\fR to write to named pipes: it will start with a blank buffer,
|
||||
and will write to the pipe when the user saves the "file". This way
|
||||
\fBnano\fR can be used as an editor in combination with for instance
|
||||
\fBgpg\fR without having to write sensitive data to disk first.
|
||||
.TP
|
||||
.B \-o \fIdir\fP (\-\-operatingdir=\fIdir\fP)
|
||||
.BR \-o\ \fIdirectory\fR ", " \-\-operatingdir= \fIdirectory
|
||||
Set the operating directory. This makes \fBnano\fP set up something
|
||||
similar to a chroot.
|
||||
.TP
|
||||
.B \-p (\-\-preserve)
|
||||
.BR \-p ", " \-\-preserve
|
||||
Preserve the XON and XOFF sequences (^Q and ^S) so they will be caught
|
||||
by the terminal.
|
||||
.TP
|
||||
.B \-q (\-\-quiet)
|
||||
.BR \-q ", " \-\-quiet
|
||||
Do not report errors in the \fInanorc\fP files nor ask them to be
|
||||
acknowledged by pressing Enter at startup.
|
||||
.TP
|
||||
.B \-r \fInumber\fP (\-\-fill=\fInumber\fP)
|
||||
.BR \-r\ \fInumber\fR ", " \-\-fill= \fInumber
|
||||
Hard-wrap lines at column \fInumber\fP. If this value is 0 or less, wrapping
|
||||
will occur at the width of the screen less \fInumber\fP columns, allowing
|
||||
the wrap point to vary along with the width of the screen if the screen
|
||||
@@ -194,28 +193,28 @@ is resized. The default value is \-8. This option conflicts with
|
||||
.B \-w
|
||||
-- the last one given takes effect.
|
||||
.TP
|
||||
.B \-s \fIprogram\fP (\-\-speller=\fIprogram\fP)
|
||||
Enable alternative spell checker command.
|
||||
.BR \-s\ \fIprogram\fR ", " \-\-speller= \fIprogram
|
||||
Use this alternative spell checker command.
|
||||
.TP
|
||||
.B \-t (\-\-tempfile)
|
||||
Always save changed buffer without prompting. Same as Pico's \fB\-t\fP
|
||||
.BR \-t ", " \-\-tempfile
|
||||
Always save a changed buffer without prompting. Same as Pico's \fB\-t\fP
|
||||
option.
|
||||
.TP
|
||||
.B \-v (\-\-view)
|
||||
.BR \-v ", " \-\-view
|
||||
View-file (read-only) mode.
|
||||
.TP
|
||||
.B \-w (\-\-nowrap)
|
||||
.BR \-w ", " \-\-nowrap
|
||||
Disable the hard-wrapping of long lines. This option conflicts with
|
||||
.B \-r
|
||||
-- the last one given takes effect.
|
||||
.TP
|
||||
.B \-x (\-\-nohelp)
|
||||
.BR \-x ", " \-\-nohelp
|
||||
Don't show the two help lines at the bottom of the screen.
|
||||
.TP
|
||||
.B \-z (\-\-suspend)
|
||||
.BR \-z ", " \-\-suspend
|
||||
Enable the suspend ability.
|
||||
.TP
|
||||
.B \-$ (\-\-softwrap)
|
||||
.BR \-$ ", " \-\-softwrap
|
||||
Enable 'soft wrapping'. This will make \fBnano\fP attempt to display the
|
||||
entire contents of any line, even if it is longer than the screen width, by
|
||||
continuing it over multiple screen lines. Since
|
||||
@@ -223,7 +222,7 @@ continuing it over multiple screen lines. Since
|
||||
this option last when using other options (e.g.\& 'nano \-wS$') or pass it
|
||||
separately (e.g.\& 'nano \-wS \-$').
|
||||
.TP
|
||||
.B \-a, \-b, \-e, \-f, \-g, \-j
|
||||
.BR \-a ", " \-b ", " \-e ", " \-f ", " \-g ", " \-j
|
||||
Ignored, for compatibility with Pico.
|
||||
|
||||
.SH INITIALIZATION FILE
|
||||
@@ -267,7 +266,7 @@ http://www.nano-editor.org/
|
||||
\fI/usr/share/doc/nano/\fP (or equivalent on your system)
|
||||
|
||||
.SH AUTHOR
|
||||
Chris Allegretta <chrisa@asty.org>, et al (see \fIAUTHORS\fP and
|
||||
Chris Allegretta <chrisa@asty.org>, et al (see the files \fIAUTHORS\fP and
|
||||
\fITHANKS\fP for details). This manual page was originally written by
|
||||
Jordi Mallach <jordi@gnu.org>, for the Debian system (but may be used by
|
||||
others).
|
||||
|
||||
137
doc/man/nanorc.5
137
doc/man/nanorc.5
@@ -2,7 +2,7 @@
|
||||
.\" $Id$
|
||||
.\"
|
||||
.\" Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
|
||||
.\" 2013, 2014 Free Software Foundation, Inc.
|
||||
.\" 2013, 2014, 2015 Free Software Foundation, Inc.
|
||||
.\"
|
||||
.\" This document is dual-licensed. You may distribute and/or modify it
|
||||
.\" under the terms of either of the following licenses:
|
||||
@@ -20,7 +20,7 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH NANORC 5 "version 2.3.5" "June 2014"
|
||||
.TH NANORC 5 "version 2.4.0" "March 2015"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.SH NAME
|
||||
@@ -38,38 +38,42 @@ commands, which can be used to configure nano on startup without using
|
||||
command-line options. Additionally, there are some commands to define
|
||||
syntax highlighting and to rebind keys -- see the two separate sections
|
||||
on those. \fBnano\fP reads one command per line.
|
||||
|
||||
.PP
|
||||
Options in \fInanorc\fP files take precedence over nano's defaults, and
|
||||
command-line options override \fInanorc\fP settings. Also, options are
|
||||
unset by default, except for those that take arguments.
|
||||
|
||||
Quotes inside string parameters don't have to be escaped with
|
||||
command-line options override \fInanorc\fP settings. Also, options that
|
||||
do not take an argument are unset by default. So using the \fBunset\fR
|
||||
command is only needed when wanting to override a setting of the system's
|
||||
\fInanorc\fR file in your own \fB~/.nanorc\fR. Options that take an
|
||||
argument cannot be unset.
|
||||
.PP
|
||||
Below, the \fIstring\fR parameters need to be enclosed in double quotes.
|
||||
Quotes inside these string parameters don't have to be escaped with
|
||||
backslashes. The last double quote in the string will be treated as its
|
||||
end. For example, for the \fBbrackets\fP option, "\fB"')>]}\fP" will
|
||||
match \fB"\fP, \fB'\fP, \fB)\fP, \fB>\fP, \fB]\fP, and \fB}\fP.
|
||||
|
||||
.PP
|
||||
The supported commands and arguments are:
|
||||
|
||||
.TP 3
|
||||
.B set/unset allow_insecure_backup
|
||||
.B set allow_insecure_backup
|
||||
When backing up files, allow the backup to succeed even if its permissions
|
||||
can't be (re)set due to special OS considerations. You should
|
||||
NOT enable this option unless you are sure you need it.
|
||||
.TP
|
||||
.B set/unset autoindent
|
||||
.B set autoindent
|
||||
Use auto-indentation.
|
||||
.TP
|
||||
.B set/unset backup
|
||||
.B set backup
|
||||
Create backup files by adding a tilde (\fB~\fP) to each file's name.
|
||||
.TP
|
||||
.B set backupdir "\fIdirectory\fP"
|
||||
Set the directory where \fBnano\fP puts unique backup files, if file
|
||||
backups are enabled.
|
||||
.TP
|
||||
.B set/unset backwards
|
||||
.B set backwards
|
||||
Do backwards searches by default.
|
||||
.TP
|
||||
.B set/unset boldtext
|
||||
.B set boldtext
|
||||
Use bold instead of reverse video for the titlebar, statusbar, key combos,
|
||||
and selected text. This can be overridden for the first three by setting
|
||||
the options \fBtitlecolor\fP, \fBstatuscolor\fP, and \fBkeycolor\fP.
|
||||
@@ -80,26 +84,26 @@ paragraphs. This may not include blank characters. Only closing
|
||||
punctuation (see \fBpunct\fP), optionally followed by the specified
|
||||
closing brackets, can end sentences. The default value is "\fB"')>]}\fP".
|
||||
.TP
|
||||
.B set/unset casesensitive
|
||||
.B set casesensitive
|
||||
Do case-sensitive searches by default.
|
||||
.TP
|
||||
.B set/unset const
|
||||
.B set const
|
||||
Constantly display the cursor position in the status bar.
|
||||
.TP
|
||||
.B set/unset cut
|
||||
.B set cut
|
||||
Use cut-to-end-of-line by default, instead of cutting the whole line.
|
||||
.TP
|
||||
.B set fill \fIn\fP
|
||||
Hard-wrap lines at column number \fIn\fP. If \fIn\fP is 0 or less, the
|
||||
maximum line length will be the screen width less \fIn\fP columns. The
|
||||
default value is \-8.
|
||||
.B set fill \fInumber\fR
|
||||
Hard-wrap lines at column number \fInumber\fR. If \fInumber\fR is 0 or less,
|
||||
the maximum line length will be the screen width less \fInumber\fP columns.
|
||||
The default value is \fB\-8\fR.
|
||||
.TP
|
||||
.B set functioncolor \fIfgcolor\fR,\fIbgcolor\fR
|
||||
Specify the color combination to use for the function descriptions
|
||||
in the two help lines at the bottom of the screen.
|
||||
See \fBset titlecolor\fR for more details.
|
||||
.TP
|
||||
.B set/unset historylog
|
||||
.B set historylog
|
||||
Enable the use of \fB~/.nano/search_history\fP for saving and reading
|
||||
search/replace strings.
|
||||
.TP
|
||||
@@ -108,7 +112,7 @@ Specify the color combination to use for the shortcut key combos
|
||||
in the two help lines at the bottom of the screen.
|
||||
See \fBset titlecolor\fR for more details.
|
||||
.TP
|
||||
.B set/unset locking
|
||||
.B set locking
|
||||
Enable vim-style lock-files for when editing files.
|
||||
.TP
|
||||
.B set matchbrackets "\fIstring\fP"
|
||||
@@ -117,32 +121,32 @@ searches. This may not include blank characters. The opening set must
|
||||
come before the closing set, and the two sets must be in the same order.
|
||||
The default value is "\fB(<[{)>]}\fP".
|
||||
.TP
|
||||
.B set/unset morespace
|
||||
.B set morespace
|
||||
Use the blank line below the titlebar as extra editing space.
|
||||
.TP
|
||||
.B set/unset mouse
|
||||
.B set mouse
|
||||
Enable mouse support, if available for your system. When enabled, mouse
|
||||
clicks can be used to place the cursor, set the mark (with a double
|
||||
click), and execute shortcuts. The mouse will work in the X Window
|
||||
System, and on the console when gpm is running. Text can still be
|
||||
selected through dragging by holding down the Shift key.
|
||||
.TP
|
||||
.B set/unset multibuffer
|
||||
.B set multibuffer
|
||||
Allow inserting files into their own buffers.
|
||||
.TP
|
||||
.B set/unset noconvert
|
||||
.B set noconvert
|
||||
Don't convert files from DOS/Mac format.
|
||||
.TP
|
||||
.B set/unset nofollow
|
||||
.B set nofollow
|
||||
Don't follow symlinks when writing files.
|
||||
.TP
|
||||
.B set/unset nohelp
|
||||
.B set nohelp
|
||||
Don't display the two help lines at the bottom of the screen.
|
||||
.TP
|
||||
.B set/unset nonewlines
|
||||
.B set nonewlines
|
||||
Don't automatically add a newline to the ends of files.
|
||||
.TP
|
||||
.B set/unset nowrap
|
||||
.B set nowrap
|
||||
Don't hard-wrap text at all.
|
||||
.TP
|
||||
.B set operatingdir "\fIdirectory\fP"
|
||||
@@ -151,10 +155,10 @@ subdirectories. Also, the current directory is changed to here, so
|
||||
files are inserted from this directory. By default, the operating
|
||||
directory feature is turned off.
|
||||
.TP
|
||||
.B set/unset poslog
|
||||
.B set poslog
|
||||
Save the cursor position of files between editing sessions.
|
||||
.TP
|
||||
.B set/unset preserve
|
||||
.B set preserve
|
||||
Preserve the XON and XOFF keys (^Q and ^S).
|
||||
.TP
|
||||
.B set punct "\fIstring\fP"
|
||||
@@ -163,11 +167,11 @@ paragraphs. This may not include blank characters. Only the
|
||||
specfified closing punctuation, optionally followed by closing brackets
|
||||
(see \fBbrackets\fP), can end sentences. The default value is "\fB!.?\fP".
|
||||
.TP
|
||||
.B set/unset quickblank
|
||||
.B set quickblank
|
||||
Do quick statusbar blanking. Statusbar messages will disappear after 1
|
||||
keystroke instead of 25.
|
||||
.TP
|
||||
.B set/unset quiet
|
||||
.B set quiet
|
||||
\fBnano\fP will not report errors in the \fInanorc\fP file nor ask them
|
||||
to be acknowledged by pressing Enter at startup. If this is used, it
|
||||
should be placed at the top of the file to be fully effective.
|
||||
@@ -180,30 +184,30 @@ otherwise a literal string. The default value is
|
||||
support, and "\fB>\ \fP" otherwise. Note that '\\t' stands for a literal
|
||||
Tab character.
|
||||
.TP
|
||||
.B set/unset rebinddelete
|
||||
.B set rebinddelete
|
||||
Interpret the Delete key differently so that both Backspace and Delete
|
||||
work properly. You should only need to use this option if Backspace
|
||||
acts like Delete on your system.
|
||||
.TP
|
||||
.B set/unset rebindkeypad
|
||||
.B set rebindkeypad
|
||||
Interpret the numeric keypad keys so that they all work properly. You
|
||||
should only need to use this option if they don't, as mouse support
|
||||
won't work properly with this option enabled.
|
||||
.TP
|
||||
.B set/unset regexp
|
||||
.B set regexp
|
||||
Do extended regular expression searches by default.
|
||||
.TP
|
||||
.B set/unset smarthome
|
||||
.B set smarthome
|
||||
Make the Home key smarter. When Home is pressed anywhere but at the
|
||||
very beginning of non-whitespace characters on a line, the cursor will
|
||||
jump to that beginning (either forwards or backwards). If the cursor is
|
||||
already at that position, it will jump to the true beginning of the
|
||||
line.
|
||||
.TP
|
||||
.B set/unset smooth
|
||||
.B set smooth
|
||||
Use smooth scrolling by default.
|
||||
.TP
|
||||
.B set/unset softwrap
|
||||
.B set softwrap
|
||||
Enable soft line wrapping for easier viewing of very long lines.
|
||||
.TP
|
||||
.B set speller "\fIspellprog\fP"
|
||||
@@ -214,17 +218,17 @@ calls \fIspell\fP.
|
||||
Specify the color combination to use for the statusbar.
|
||||
See \fBset titlecolor\fR for more details.
|
||||
.TP
|
||||
.B set/unset suspend
|
||||
.B set suspend
|
||||
Allow \fBnano\fP to be suspended.
|
||||
.TP
|
||||
.B set tabsize \fIn\fP
|
||||
Use a tab size of \fIn\fP columns. The value of \fIn\fP must be greater
|
||||
than 0. The default value is 8.
|
||||
.B set tabsize \fInumber\fR
|
||||
Use a tab size of \fInumber\fR columns. The value of \fInumber\fP must be
|
||||
greater than 0. The default value is \fB8\fR.
|
||||
.TP
|
||||
.B set/unset tabstospaces
|
||||
.B set tabstospaces
|
||||
Convert typed tabs to spaces.
|
||||
.TP
|
||||
.B set/unset tempfile
|
||||
.B set tempfile
|
||||
Save automatically on exit, don't prompt.
|
||||
.TP
|
||||
.B set titlecolor \fIfgcolor\fR,\fIbgcolor\fR
|
||||
@@ -233,20 +237,27 @@ Valid color names for foreground and background are:
|
||||
.BR white , \ black , \ red , \ blue , \ green , \ yellow , \ magenta ", and " cyan .
|
||||
And either "\fIfgcolor\fR" or ",\fIbgcolor\fR" may be left out.
|
||||
.TP
|
||||
.B set/unset view
|
||||
.B set view
|
||||
Disallow file modification.
|
||||
.TP
|
||||
.B set whitespace "\fIstring\fP"
|
||||
Set the two characters used to indicate the presence of tabs and
|
||||
spaces. They must be single-column characters.
|
||||
.TP
|
||||
.B set/unset wordbounds
|
||||
.B set wordbounds
|
||||
Detect word boundaries more accurately by treating punctuation
|
||||
characters as parts of words.
|
||||
|
||||
.SH SYNTAX HIGHLIGHTING
|
||||
Coloring the different syntactic elements of a file
|
||||
can be defined via the following commands:
|
||||
is done via regular expressions (see the \fBcolor\fR command below).
|
||||
This is inherently imperfect, because regular expressions are not
|
||||
powerful enough to fully parse a file. Nevertheless, regular
|
||||
expressions can do a lot and are easy to make, so they are a
|
||||
good fit for a small editor like \fBnano\fR.
|
||||
.sp
|
||||
A separate syntax can be defined for each kind of file
|
||||
via the following commands:
|
||||
.TP
|
||||
.BR syntax " ""\fIstr\fR"" [""\fIfileregex\fR"" ...]"
|
||||
Defines a syntax named \fIstr\fP which can be activated via the
|
||||
@@ -266,12 +277,17 @@ For the currently defined syntax, use the given \fIprogram\fR
|
||||
to invoke the linter (this overrides the speller function when
|
||||
defined).
|
||||
.TP
|
||||
.BR header " [""\fIregex\fR"" ...]
|
||||
.BI formatter " program " \fR[ "arg " \fR...]
|
||||
For the currently defined syntax, use the given \fIprogram\fR
|
||||
to automatically reformat text. Useful in certain programming
|
||||
languages (e.g. go).
|
||||
.TP
|
||||
.BR header " \fIregex\fR " ...
|
||||
For the currently defined syntax, add one or more regexes which will
|
||||
be compared against the very first line of the file to be edited,
|
||||
to determine whether this syntax should be used for that file.
|
||||
.TP
|
||||
.BR magic " [""\fIregex\fR"" ...]
|
||||
.BR magic " \fIregex\fR " ...
|
||||
For the currently defined syntax, add one or more regexes which
|
||||
will be compared against the result of querying the \fBmagic\fP
|
||||
database about the file to be edited, to determine whether this
|
||||
@@ -331,7 +347,8 @@ menus where it exists by using \fBall\fP).
|
||||
|
||||
.TP
|
||||
The format of \fIkey\fP should be one of:
|
||||
.TP
|
||||
.RS 3
|
||||
.TP 3
|
||||
.B ^
|
||||
followed by an alpha character or the word "Space".
|
||||
Example: ^C
|
||||
@@ -343,10 +360,11 @@ Example: M-C
|
||||
.B F
|
||||
followed by a numeric value from 1 to 16.
|
||||
Example: F10
|
||||
.RE
|
||||
|
||||
.TP
|
||||
|
||||
Valid \fIfunction\fP names to be bound include:
|
||||
|
||||
.RS 3
|
||||
.TP 2
|
||||
.B help
|
||||
Invokes the help viewer.
|
||||
@@ -400,6 +418,9 @@ Counts the number of words, lines and characters in the current buffer.
|
||||
Invokes a spell-checking program (or a linting program, if the current
|
||||
syntax highlighting defines one).
|
||||
.TP
|
||||
.B linter
|
||||
A synonym of \fBspeller\fR (for when the speller has not been configured).
|
||||
.TP
|
||||
.B justify
|
||||
Justifies the current paragraph.
|
||||
.TP
|
||||
@@ -464,7 +485,7 @@ Goes to the last line of the file.
|
||||
Goes to a specific line (and column if specified).
|
||||
.TP
|
||||
.B gototext
|
||||
Switches from targetting a line number to searching for text.
|
||||
Switches from targeting a line number to searching for text.
|
||||
.TP
|
||||
.B findbracket
|
||||
Moves the cursor to the bracket (brace, parenthesis, etc.) that matches
|
||||
@@ -608,10 +629,11 @@ Toggles automatic conversion of files from DOS/Mac format.
|
||||
.TP
|
||||
.B suspendenable
|
||||
Toggles whether the suspend sequence (normally ^Z) will suspend the editor window.
|
||||
.RE
|
||||
|
||||
.TP
|
||||
|
||||
Valid \fImenu\fP sections are:
|
||||
|
||||
.RS 3
|
||||
.TP 2
|
||||
.B main
|
||||
The main editor window where text is entered and edited.
|
||||
@@ -659,6 +681,7 @@ The 'go to directory' menu in the file browser.
|
||||
A special name that encompasses all menus.
|
||||
For \fBbind\fR it means all menus where the specified \fIfunction\fR exists;
|
||||
for \fBunbind\fR it means all menus where the specified \fIkey\fR exists.
|
||||
.RE
|
||||
|
||||
.SH FILES
|
||||
.TP
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.\" Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
.\" Skeleton based on nano-tiny.1:
|
||||
.\" Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
.\" $Id$
|
||||
.\"
|
||||
.\" Copyright (C) 2002, 2005, 2006, 2007, 2014 Free Software Foundation, Inc.
|
||||
.\"
|
||||
.\" This document is dual-licensed. You may distribute and/or modify it
|
||||
.\" under the terms of either of the following licenses:
|
||||
@@ -19,8 +19,7 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.\" $Id$
|
||||
.TH RNANO 1 "version 2.3.3" "April 2014"
|
||||
.TH RNANO 1 "version 2.4.0" "March 2015"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.SH NAME
|
||||
@@ -30,7 +29,6 @@ Pico clone
|
||||
.SH SYNOPSIS
|
||||
.B rnano
|
||||
.RI [ options "] [[+" line , column "]\ " file "]..."
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
\fBnano\fP is a small, free and friendly editor which aims to replace
|
||||
@@ -58,14 +56,13 @@ use backup files or spell checking.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-h (\-\-help)
|
||||
Show a summary of command line options and exit.
|
||||
.BR \-h ", " \-\-help
|
||||
Show a summary of command-line options and exit.
|
||||
.TP
|
||||
.B \-V (\-\-version)
|
||||
.BR \-V ", " \-\-version
|
||||
Show the current version number and exit.
|
||||
.PP
|
||||
See the \fBnano\fP(1) manpage for the complete documentation of
|
||||
\fBnano\fP.
|
||||
See the \fBnano\fP(1) manpage for all of the possible options.
|
||||
|
||||
.SH BUGS
|
||||
Please send any comments or bug reports to \fBnano@nano-editor.org\fP.
|
||||
@@ -79,7 +76,7 @@ of "subscribe".
|
||||
http://www.nano-editor.org/
|
||||
|
||||
.SH AUTHOR
|
||||
Chris Allegretta <chrisa@asty.org>, et al (see AUTHORS for details).
|
||||
Chris Allegretta <chrisa@asty.org>, et al (see the file AUTHORS for details).
|
||||
This manual page was originally written by Thijs Kinkhorst
|
||||
<thijs@kinkhorst.com>, for the Debian system (but may be used by
|
||||
others).
|
||||
|
||||
@@ -165,10 +165,6 @@
|
||||
## Save automatically on exit; don't prompt.
|
||||
# set tempfile
|
||||
|
||||
## Enable the new (EXPERIMENTAL) generic undo code, not just for line
|
||||
## cuts.
|
||||
# set undo
|
||||
|
||||
## Disallow file modification. Why would you want this in an rcfile? ;)
|
||||
# set view
|
||||
|
||||
|
||||
@@ -9,17 +9,17 @@ color red "^(19|20)[0-9-]{8}"
|
||||
# Email addresses.
|
||||
color yellow "<[^>]*@[^>]*>"
|
||||
|
||||
# Changed files.
|
||||
color magenta "[[:space:]]\*[[:space:]].*:"
|
||||
|
||||
# Command-line options.
|
||||
color cyan "[[:space:]]-[a-zA-Z\$]" "--[8a-z-]+"
|
||||
# Bug numbers.
|
||||
color cyan "bug #[0-9]{5}"
|
||||
# Bug and patch numbers.
|
||||
color cyan "bug #[0-9]{5,6}" "patch #[0-9]{4,5}"
|
||||
# Probable variables, for variety.
|
||||
color brightred "\<[A-Z_][0-9A-Z_]+\>"
|
||||
# Key sequences.
|
||||
color brightblue "\^[A-Z]" "\<M-." "\<F1?[0-9]" "(\^|M-)Space"
|
||||
|
||||
# Changed files.
|
||||
color magenta start="^( | {8})\* " end=":( |$)"
|
||||
|
||||
# Trailing whitespace.
|
||||
color ,green "[[:space:]]+$"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## Here is an example for apt's sources.list.
|
||||
|
||||
syntax "apt/sources.list" "sources\.list(\.old|~)?$" "apt/sources\.list\.d/.*\.list$"
|
||||
syntax "apt/sources.list" "sources\.list(~|\.old|\.save)?$" "sources\.list\.d/.*\.list(~|\.old|\.save)?$"
|
||||
|
||||
# Coloring the deb lines, working from tail to head. First the
|
||||
# components -- well, everything, and thus also the components.
|
||||
|
||||
@@ -40,3 +40,6 @@ color brightblue start="/\*" end="\*/"
|
||||
|
||||
# Trailing whitespace.
|
||||
color ,green "[[:space:]]+$"
|
||||
|
||||
# Set up the formatter since spelling is probably useless...
|
||||
formatter gofmt -w
|
||||
|
||||
@@ -5,7 +5,8 @@ magic "Java "
|
||||
|
||||
color green "\<(boolean|byte|char|double|float|int|long|new|short|this|transient|void)\>"
|
||||
color red "\<(break|case|catch|continue|default|do|else|finally|for|if|return|switch|throw|try|while)\>"
|
||||
color cyan "\<(abstract|class|extends|final|implements|import|instanceof|interface|native|package|private|protected|public|static|strictfp|super|synchronized|throws|volatile)\>"
|
||||
color cyan "\<(abstract|class|extends|final|implements|import|instanceof|interface|native)\>"
|
||||
color cyan "\<(package|private|protected|public|static|strictfp|super|synchronized|throws|volatile)\>"
|
||||
color red ""[^"]*""
|
||||
color yellow "\<(true|false|null)\>"
|
||||
color blue "//.*"
|
||||
|
||||
@@ -15,18 +15,20 @@ color brightyellow ":|\*|/|%|\+|-|\^|>|>=|<|<=|~=|=|\.\.|\<(not|and|or)\>"
|
||||
color brightblue "\<(do|end|while|repeat|until|if|elseif|then|else|for|in|function|local|return|break)\>"
|
||||
|
||||
# Keywords
|
||||
color brightyellow "\<(debug|string|math|table|io|coroutine|os)\>\."
|
||||
color brightyellow "\<(io|math|os|string|table|coroutine|debug)\>\."
|
||||
color brightyellow "\<(_G|_VERSION|assert|collectgarbage|dofile|error|getfenv|getmetatable|ipairs|load|loadfile|module|next|pairs|pcall|print|rawequal|rawget|rawset|require|select|setfenv|setmetatable|tonumber|tostring|type|unpack|xpcall)\s*\("
|
||||
|
||||
# Standard library
|
||||
color brightyellow "io\.\<(close|flush|input|lines|open|output|popen|read|tmpfile|type|write|stdin|stdout|stderr)\>"
|
||||
color brightyellow "math\.\<(abs|acos|asin|atan2|atan|ceil|cosh|cos|deg|exp|floor|fmod|frexp|huge|ldexp|log10|log|max|min|mod|modf|pi|pow|rad|random|randomseed|sinh|tan)\>"
|
||||
color brightyellow "math\.\<(abs|acos|asin|atan2|atan|ceil|cosh|cos|deg|exp|floor|fmod|frexp|huge|ldexp|log10|log)\>"
|
||||
color brightyellow "math\.\<(max|min|mod|modf|pi|pow|rad|random|randomseed|sinh|tan)\>"
|
||||
color brightyellow "os\.\<(clock|date|difftime|execute|exit|getenv|remove|rename|setlocale|time|tmpname)\>"
|
||||
color brightyellow "package\.\<(cpath|loaded|loadlib|path|preload|seeall)\>"
|
||||
color brightyellow "string\.\<(byte|char|dump|find|format|gmatch|gsub|len|lower|match|rep|reverse|sub|upper)\>"
|
||||
color brightyellow "table\.\<(concat|insert|maxn|remove|sort)\>"
|
||||
color brightyellow "coroutine\.\<(create|resume|running|status|wrap|yield)\>"
|
||||
color brightyellow "debug\.\<(debug|getfenv|gethook|getinfo|getlocal|getmetatable|getregistry|getupvalue|setfenv|sethook|setlocal|setmetatable|setupvalue|traceback)\>"
|
||||
color brightyellow "debug\.\<(debug|getfenv|gethook|getinfo|getlocal|getmetatable|getregistry|getupvalue)\>"
|
||||
color brightyellow "debug\.\<(setfenv|sethook|setlocal|setmetatable|setupvalue|traceback)\>"
|
||||
|
||||
# File handle methods
|
||||
color brightyellow "\:\<(close|flush|lines|read|seek|setvbuf|write)\>"
|
||||
|
||||
@@ -6,12 +6,12 @@ syntax "nanorc" "\.?nanorc$"
|
||||
icolor brightred "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|linter|i?color|extendsyntax).*$"
|
||||
|
||||
# Keywords
|
||||
icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(allow_insecure_backup|autoindent|backup|backwards|boldtext|casesensitive|const|cut|fill|historylog|locking|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nonewlines|nowrap|poslog|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|smarthome|smooth|softwrap|suspend|tabsize|tabstospaces|tempfile|undo|view|wordbounds)\>"
|
||||
icolor yellow "^[[:space:]]*set[[:space:]]+(functioncolor|keycolor||statuscolor|titlecolor)[[:space:]]+(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
|
||||
icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(allow_insecure_backup|autoindent|backup|backwards|boldtext|casesensitive|const|cut|fill|historylog|locking|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nonewlines|nowrap|poslog|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|smarthome|smooth|softwrap|suspend|tabsize|tabstospaces|tempfile|view|wordbounds)\>"
|
||||
icolor yellow "^[[:space:]]*set[[:space:]]+(functioncolor|keycolor|statuscolor|titlecolor)[[:space:]]+(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
|
||||
icolor brightgreen "^[[:space:]]*set[[:space:]]+(backupdir|brackets|functioncolor|keycolor|matchbrackets|operatingdir|punct|quotestr|speller|statuscolor|titlecolor|whitespace)[[:space:]]+"
|
||||
icolor brightgreen "^[[:space:]]*bind[[:space:]]+((\^|M-)([[:alpha:]]|space|[]]|[0-9_=+{}|;:'\",./<>\?-])|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+[[:alpha:]]+[[:space:]]+[[:alpha:]]+[[:space:]]*$"
|
||||
icolor brightgreen "^[[:space:]]*unbind[[:space:]]+((\^|M-)([[:alpha:]]|space|[]]|[0-9_=+{}|;:'\",./<>\?-])|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+[[:alpha:]]+[[:space:]]*$"
|
||||
icolor brightgreen "^[[:space:]]*extendsyntax[[:space:]]+[[:alpha:]]+[[:space:]]+(i?color|header|magic|linter)[[:space:]]+.*$"
|
||||
icolor brightgreen "^[[:space:]]*extendsyntax[[:space:]]+[[:alpha:]]+[[:space:]]+(i?color|header|magic|linter|formatter)[[:space:]]+.*$"
|
||||
icolor green "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|linter|extendsyntax)\>"
|
||||
|
||||
# Colors
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## Here is an example for patch files.
|
||||
|
||||
syntax "patch" "\.(patch|diff)$"
|
||||
syntax "patch" "\.(patch|diff|debdiff)$"
|
||||
magic "diff output text"
|
||||
|
||||
# Added lines.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
## Here is an example for Perl.
|
||||
|
||||
syntax "perl" "\.p[lm]$"
|
||||
header "^#!.*/perl[-0-9._]*"
|
||||
header "^#!.*perl[-0-9._]*"
|
||||
magic "Perl script text"
|
||||
|
||||
color red "\<(accept|alarm|atan2|bin(d|mode)|c(aller|h(dir|mod|op|own|root)|lose(dir)?|onnect|os|rypt)|d(bm(close|open)|efined|elete|ie|o|ump)|e(ach|of|val|x(ec|ists|it|p))|f(cntl|ileno|lock|ork))\>" "\<(get(c|login|peername|pgrp|ppid|priority|pwnam|(host|net|proto|serv)byname|pwuid|grgid|(host|net)byaddr|protobynumber|servbyport)|([gs]et|end)(pw|gr|host|net|proto|serv)ent|getsock(name|opt)|gmtime|goto|grep|hex|index|int|ioctl|join)\>" "\<(keys|kill|last|length|link|listen|local(time)?|log|lstat|m|mkdir|msg(ctl|get|snd|rcv)|next|oct|open(dir)?|ord|pack|pipe|pop|printf?|push|q|qq|qx|rand|re(ad(dir|link)?|cv|do|name|quire|set|turn|verse|winddir)|rindex|rmdir|s|scalar|seek(dir)?)\>" "\<(se(lect|mctl|mget|mop|nd|tpgrp|tpriority|tsockopt)|shift|shm(ctl|get|read|write)|shutdown|sin|sleep|socket(pair)?|sort|spli(ce|t)|sprintf|sqrt|srand|stat|study|substr|symlink|sys(call|read|tem|write)|tell(dir)?|time|tr(y)?|truncate|umask)\>" "\<(un(def|link|pack|shift)|utime|values|vec|wait(pid)?|wantarray|warn|write)\>"
|
||||
|
||||
@@ -1,22 +1,23 @@
|
||||
## Here is an example for Python.
|
||||
|
||||
syntax "python" "\.py$"
|
||||
header "^#!.*/python[-0-9._]*"
|
||||
header "^#!.*python[-0-9._]*"
|
||||
|
||||
# Function definitions.
|
||||
icolor brightblue "def [0-9A-Z_]+"
|
||||
# Keywords.
|
||||
color brightcyan "\<(and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|raise|return|try|while|with|yield)\>"
|
||||
color brightcyan "\<(and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from)\>"
|
||||
color brightcyan "\<(global|if|import|in|is|lambda|not|or|pass|print|raise|return|try|while|with|yield)\>"
|
||||
|
||||
# Strings.
|
||||
color brightgreen "['][^']*[^\\][']" "[']{3}.*[^\\][']{3}"
|
||||
color brightgreen "["][^"]*[^\\]["]" "["]{3}.*[^\\]["]{3}"
|
||||
# Comments.
|
||||
color brightred "(^|[[:blank:]])#.*$"
|
||||
# Multiline strings.
|
||||
color brightgreen start="\"\"\"([^"),]|$)" end="(^|[^(])\"\"\""
|
||||
color brightgreen start="'''([^'),]|$)" end="(^|[^(])'''"
|
||||
|
||||
# Comments.
|
||||
color brightred "(^|[[:blank:]])#.*$"
|
||||
# Reminders.
|
||||
color ,yellow "(FIXME|TODO|XXX)"
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
## Here is an example for Ruby.
|
||||
|
||||
syntax "ruby" "\.rb$"
|
||||
header "^#!.*/ruby[-0-9._]*"
|
||||
header "^#!.*ruby[-0-9._]*"
|
||||
|
||||
# Asciibetical list of reserved words.
|
||||
color yellow "\<(BEGIN|END|alias|and|begin|break|case|class|def|defined\?|do|else|elsif|end|ensure|false|for|if|in|module|next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)\>"
|
||||
# Reserved words.
|
||||
color yellow "\<(BEGIN|END|alias|and|begin|break|case|class|def|defined\?|do|else|elsif|end|ensure|false|for|if|in|module)\>"
|
||||
color yellow "\<(next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)\>"
|
||||
# Constants.
|
||||
color brightblue "(\$|@|@@)?\<[A-Z]+[0-9A-Z_a-z]*"
|
||||
# Ruby "symbols".
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
## Here is an example for Bourne shell scripts.
|
||||
|
||||
syntax "sh" "\.sh$"
|
||||
header "^#!.*/(ba|k|pdk)?sh[-0-9_]*"
|
||||
header "^#!.*((ba|da|k|pdk)?sh[-0-9_]*|openrc-run|runscript)"
|
||||
magic "(POSIX|Bourne.*) shell script text"
|
||||
|
||||
icolor brightgreen "^[0-9A-Z_]+\(\)"
|
||||
|
||||
@@ -24,8 +24,8 @@ color yellow start="%__" end="\ "
|
||||
color magenta start="%\{" end="\}"
|
||||
color yellow start="%\{__" end="\}"
|
||||
# Sections.
|
||||
color red "^%(build$|changelog|check$|clean$|description|files|install$|package|pre|prep$|preun|post|postun)"
|
||||
color red "^%(trigger|triggerin|triggerpostun|triggerun|verifyscript)"
|
||||
color red "^%(build$|changelog|check$|clean$|description|files|install$|package|pre|prep$|pretrans|preun)"
|
||||
color red "^%(post|posttrans|postun|trigger|triggerin|triggerpostun|triggerun|verifyscript)"
|
||||
# Conditionals and defines.
|
||||
color brightred "%(if|else|endif|define|global|undefine)"
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
@c This file has the new style title page commands.
|
||||
@c Run 'makeinfo' rather than 'texinfo-format-buffer'.
|
||||
@smallbook
|
||||
@set EDITION 0.2
|
||||
@set VERSION 2.3.5
|
||||
@set UPDATED June 2014
|
||||
@set EDITION 0.3
|
||||
@set VERSION 2.4.1
|
||||
@set UPDATED April 2015
|
||||
|
||||
@dircategory Editors
|
||||
@direntry
|
||||
@@ -23,7 +23,7 @@
|
||||
@titlepage
|
||||
@title GNU @code{nano}
|
||||
@subtitle a small and friendly text editor.
|
||||
@subtitle version 2.3.5
|
||||
@subtitle version 2.4.1
|
||||
|
||||
@author Chris Allegretta
|
||||
@page
|
||||
@@ -34,7 +34,7 @@ editor.
|
||||
This manual is part of the GNU @code{nano} distribution.@*
|
||||
@sp 4
|
||||
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
|
||||
2009, 2014 Free Software Foundation, Inc.
|
||||
2009, 2014, 2015 Free Software Foundation, Inc.
|
||||
|
||||
This document is dual-licensed. You may distribute and/or modify it
|
||||
under the terms of either of the following licenses:
|
||||
@@ -64,7 +64,7 @@ editor.
|
||||
@menu
|
||||
* Introduction::
|
||||
* Editor Basics::
|
||||
* Online Help::
|
||||
* Built-in Help::
|
||||
* Feature Toggles::
|
||||
* Nanorc Files::
|
||||
* The File Browser::
|
||||
@@ -77,10 +77,10 @@ editor.
|
||||
@chapter Introduction
|
||||
|
||||
GNU @code{nano} is a small and friendly text editor. Besides basic text
|
||||
editing, @code{nano} offers many extra features, like an interactive
|
||||
search-and-replace, go-to-line-and-column-number, auto-indentation,
|
||||
feature toggles, internationalization support, and filename tab
|
||||
completion.
|
||||
editing, @code{nano} offers many extra features, such as an interactive
|
||||
search-and-replace, undo/redo, syntax coloring, smooth scrolling,
|
||||
auto-indentation, go-to-line-and-column-number, feature toggles,
|
||||
file locking, backup files, and internationalization support.
|
||||
|
||||
@menu
|
||||
* Overview::
|
||||
@@ -98,208 +98,250 @@ as possible while offering a superset of Pico's functionality. See
|
||||
The usual way to invoke @code{nano} is:
|
||||
|
||||
@quotation
|
||||
@code{nano [OPTION]@dots{} [FILE]}
|
||||
@code{nano [FILE]}
|
||||
@end quotation
|
||||
|
||||
But it is also possible to edit several files in a row. Additionally,
|
||||
the cursor can be put on a desired line number by adding this number
|
||||
with a plus sign before any filename, and even in a desired column by
|
||||
adding it with a comma. So the complete synopsis is:
|
||||
But it is also possible to specify one or more options, and to edit
|
||||
several files in a row. Additionally, the cursor can be put on a
|
||||
specific line of a file by adding the line number
|
||||
with a plus sign before the filename, and even in a specific column by
|
||||
adding it with a comma. So the complete command synopsis is:
|
||||
|
||||
@quotation
|
||||
@code{nano [OPTION]@dots{} [[+LINE] FILE]@dots{}}
|
||||
|
||||
@code{nano [OPTION]@dots{} [[+,COLUMN] FILE]@dots{}}
|
||||
|
||||
@code{nano [OPTION]@dots{} [[+LINE,COLUMN] FILE]@dots{}}
|
||||
@code{nano [OPTION]@dots{} [[+LINE[,COLUMN]|+,COLUMN] FILE]@dots{}}
|
||||
@end quotation
|
||||
|
||||
Email bug reports to @email{nano@@nano-editor.org}.
|
||||
But normallly you would set your preferred options in your
|
||||
@file{.nanorc} file. And when the @code{poslog} option is set
|
||||
(making @code{nano} remember the cursor position), you will rarely
|
||||
need to specify a line number.
|
||||
|
||||
Please email any bug reports to @email{nano@@nano-editor.org}.
|
||||
Or file them at @url{https://savannah.gnu.org/bugs/?group=nano}.
|
||||
|
||||
@node Command Line Options
|
||||
@section Command Line Options
|
||||
|
||||
@code{nano} takes the following options from the command line:
|
||||
@command{nano} takes the following options from the command line:
|
||||
|
||||
@table @code
|
||||
@item +<line>,<column>
|
||||
Start at line number <line> and column number <column> (at least one of
|
||||
@table @option
|
||||
@item +@var{line},@var{column}
|
||||
Start at line number @var{line} and column number @var{column} (at least one of
|
||||
which must be specified) instead of the default of line 1, column 1.
|
||||
|
||||
@item -A, --smarthome
|
||||
@item -A
|
||||
@itemx --smarthome
|
||||
Make the Home key smarter. When Home is pressed anywhere but at the
|
||||
very beginning of non-whitespace characters on a line, the cursor will
|
||||
jump to that beginning (either forwards or backwards). If the cursor is
|
||||
already at that position, it will jump to the true beginning of the
|
||||
line.
|
||||
|
||||
@item -B, --backup
|
||||
@item -B
|
||||
@itemx --backup
|
||||
When saving a file, back up the previous version of it to the current
|
||||
filename suffixed with a ~.
|
||||
filename suffixed with a @samp{~}.
|
||||
|
||||
@item -C <dir>, --backupdir=<dir>
|
||||
Set the directory where @code{nano} puts unique backup files if file
|
||||
@item -C @var{directory}
|
||||
@itemx --backupdir=@var{directory}
|
||||
Set the directory where @command{nano} puts unique backup files if file
|
||||
backups are enabled.
|
||||
|
||||
@item -D, --boldtext
|
||||
@item -D
|
||||
@itemx --boldtext
|
||||
Use bold text instead of reverse video text.
|
||||
|
||||
@item -E, --tabstospaces
|
||||
@item -E
|
||||
@itemx --tabstospaces
|
||||
Convert typed tabs to spaces.
|
||||
|
||||
@item -F, --multibuffer
|
||||
@item -F
|
||||
@itemx --multibuffer
|
||||
Enable multiple file buffers (if support for them has been compiled in).
|
||||
|
||||
@item -G, --locking
|
||||
@item -G
|
||||
@itemx --locking
|
||||
Enable vim-style file locking when editing files.
|
||||
|
||||
@item -H, --historylog
|
||||
Log search and replace strings to ~/.nano/search_history, so they can be
|
||||
retrieved in later sessions.
|
||||
@item -H
|
||||
@itemx --historylog
|
||||
Log search and replace strings to @file{~/.nano/search_history},
|
||||
so they can be retrieved in later sessions.
|
||||
|
||||
@item -I, --ignorercfiles
|
||||
Don't look at the system's nanorc file nor at the user's ~/.nanorc.
|
||||
@item -I
|
||||
@itemx --ignorercfiles
|
||||
Don't look at the system's nanorc file nor at the user's @file{~/.nanorc}.
|
||||
|
||||
@item -K, --rebindkeypad
|
||||
@item -K
|
||||
@itemx --rebindkeypad
|
||||
Interpret the numeric keypad keys so that they all work properly. You
|
||||
should only need to use this option if they don't, as mouse support
|
||||
won't work properly with this option enabled.
|
||||
|
||||
@item -L, --nonewlines
|
||||
@item -L
|
||||
@itemx --nonewlines
|
||||
Don't add newlines to the ends of files.
|
||||
|
||||
@item -N, --noconvert
|
||||
@item -N
|
||||
@itemx --noconvert
|
||||
Disable automatic conversion of files from DOS/Mac format.
|
||||
|
||||
@item -O, --morespace
|
||||
@item -O
|
||||
@itemx --morespace
|
||||
Use the blank line below the titlebar as extra editing space.
|
||||
|
||||
@item -P, --poslog
|
||||
@item -P
|
||||
@itemx --poslog
|
||||
Log for each file the last location of the cursor, and read it
|
||||
back upon reopening the file and place it there again.
|
||||
|
||||
@item -Q <str>, --quotestr=<str>
|
||||
@item -Q "@var{characters}"
|
||||
@itemx --quotestr="@var{characters}"
|
||||
Set the quoting string for justifying. The default value is
|
||||
|
||||
@quotation
|
||||
@code{^([ \t]*[|>:@}#])+}
|
||||
"^([ \t]*[|>:@}#])+"
|
||||
@end quotation
|
||||
|
||||
if extended regular expression support is available, or "> " otherwise.
|
||||
if extended regular expression support is available, or @code{> } otherwise.
|
||||
Note that @code{\t} above stands for a literal Tab character.
|
||||
|
||||
@item -R, --restricted
|
||||
@item -R
|
||||
@itemx --restricted
|
||||
Restricted mode: don't read or write to any file not specified on the
|
||||
command line; don't read any nanorc files nor history files; don't allow
|
||||
suspending nor spell checking; don't
|
||||
allow a file to be appended to, prepended to, or saved under a different
|
||||
name if it already has one; and don't use backup files.
|
||||
This restricted mode is also accessible by invoking @code{nano} with
|
||||
any name beginning with 'r' (e.g. "rnano").
|
||||
This restricted mode is also accessible by invoking @command{nano} with
|
||||
any name beginning with @samp{r} (e.g. @command{rnano}).
|
||||
|
||||
@item -S, --smooth
|
||||
@item -S
|
||||
@itemx --smooth
|
||||
Enable smooth scrolling. Text will scroll line-by-line, instead of the
|
||||
usual chunk-by-chunk behavior.
|
||||
|
||||
@item -T <number>, --tabsize=<number>
|
||||
Set the displayed tab length to <number> columns. The value of <number>
|
||||
must be greater than 0. The default value is 8.
|
||||
@item -T @var{number}
|
||||
@itemx --tabsize=@var{number}
|
||||
Set the displayed tab length to @var{number} columns. The value of
|
||||
@var{number} must be greater than 0. The default value is @samp{8}.
|
||||
|
||||
@item -U, --quickblank
|
||||
@item -U
|
||||
@itemx --quickblank
|
||||
Do quick statusbar blanking. Statusbar messages will disappear after 1
|
||||
keystroke instead of 25. Note that -c overrides this.
|
||||
keystroke instead of 25. Note that @option{-c} overrides this.
|
||||
|
||||
@item -V, --version
|
||||
@item -V
|
||||
@itemx --version
|
||||
Show the current version number and exit.
|
||||
|
||||
@item -W, --wordbounds
|
||||
@item -W
|
||||
@itemx --wordbounds
|
||||
Detect word boundaries more accurately by treating punctuation
|
||||
characters as parts of words.
|
||||
|
||||
@item -Y <name>, --syntax=<name>
|
||||
@item -Y @var{name}
|
||||
@itemx --syntax=@var{name}
|
||||
Specify a specific syntax from the nanorc files to use for highlighting.
|
||||
See @xref{Syntax Highlighting}, for more info.
|
||||
|
||||
@item -c, --const
|
||||
@item -c
|
||||
@itemx --const
|
||||
Constantly display the cursor position and line number on the statusbar.
|
||||
Note that this overrides -U.
|
||||
Note that this overrides @option{-U}.
|
||||
|
||||
@item -d, --rebinddelete
|
||||
@item -d
|
||||
@itemx --rebinddelete
|
||||
Interpret the Delete key differently so that both Backspace and Delete
|
||||
work properly. You should only need to use this option if Backspace
|
||||
acts like Delete on your system.
|
||||
|
||||
@item -h, --help
|
||||
@item -h
|
||||
@itemx --help
|
||||
Show a summary of command-line options and exit.
|
||||
|
||||
@item -i, --autoindent
|
||||
@item -i
|
||||
@itemx --autoindent
|
||||
Automatically indent new lines to the same number of spaces and tabs as
|
||||
the previous line.
|
||||
|
||||
@item -k, --cut
|
||||
@item -k
|
||||
@itemx --cut
|
||||
Make the 'Cut Text' command (normally ^K) cut from the current cursor
|
||||
position to the end of the line, instead of cutting the entire line.
|
||||
|
||||
@item -l, --nofollow
|
||||
@item -l
|
||||
@itemx --nofollow
|
||||
When writing files, if the given file is a symbolic link, it is removed
|
||||
and a new file is created.
|
||||
|
||||
@item -m, --mouse
|
||||
@item -m
|
||||
@itemx --mouse
|
||||
Enable mouse support, if available for your system. When enabled, mouse
|
||||
clicks can be used to place the cursor, set the mark (with a double
|
||||
click), and execute shortcuts. The mouse will work in the X Window
|
||||
System, and on the console when gpm is running. Text can still be
|
||||
selected through dragging by holding down the Shift key.
|
||||
|
||||
@item -n, --noread
|
||||
@item -n
|
||||
@itemx --noread
|
||||
Treat any name given on the command line as a new file. This allows
|
||||
@code{nano} to write to named pipes: it will start with a blank buffer,
|
||||
@command{nano} to write to named pipes: it will start with a blank buffer,
|
||||
and will write to the pipe when the user saves the "file". This way
|
||||
@code{nano} can be used as an editor in combination with for instance
|
||||
@code{gpg} without having to write sensitive data to disk first.
|
||||
@command{nano} can be used as an editor in combination with for instance
|
||||
@command{gpg} without having to write sensitive data to disk first.
|
||||
|
||||
@item -o <dir>, --operatingdir=<dir>
|
||||
Set operating directory. Makes @code{nano} set up something similar to
|
||||
a chroot.
|
||||
@item -o @var{directory}
|
||||
@itemx --operatingdir=@var{directory}
|
||||
Set the operating directory. This makes @command{nano} set up something
|
||||
similar to a chroot.
|
||||
|
||||
@item -p, --preserve
|
||||
@item -p
|
||||
@itemx --preserve
|
||||
Preserve the ^Q (XON) and ^S (XOFF) sequences so data being sent to the
|
||||
editor can be stopped and started.
|
||||
|
||||
@item -q, --quiet
|
||||
@item -q
|
||||
@itemx --quiet
|
||||
Do not report errors in the nanorc file nor ask them to be acknowledged
|
||||
by pressing Enter at startup.
|
||||
|
||||
@item -r <number>, --fill=<number>
|
||||
Hard-wrap lines at column <number> (by inserting a newline character).
|
||||
@item -r @var{number}
|
||||
@itemx --fill=@var{number}
|
||||
Hard-wrap lines at column @var{number} (by inserting a newline character).
|
||||
If the given value is 0 or less, wrapping will occur at the width of
|
||||
the screen minus the given amount, allowing the wrapping width to
|
||||
vary along with the width of the screen if and when it is resized.
|
||||
The default value is -8. This option conflicts with -w -- the last
|
||||
one given takes effect.
|
||||
The default value is @samp{-8}. This option conflicts with @option{-w}
|
||||
-- the last one given takes effect.
|
||||
|
||||
@item -s <program>, --speller=<program>
|
||||
Invoke the given program as the spell checker. By default, @code{nano}
|
||||
uses the command specified in the SPELL environment variable, or, if
|
||||
SPELL is not set, its own interactive spell checker that requires the
|
||||
@code{spell} program to be installed on your system.
|
||||
@item -s @var{program}
|
||||
@itemx --speller=@var{program}
|
||||
Invoke the given program as the spell checker. By default, @command{nano}
|
||||
uses the command specified in the @env{SPELL} environment variable, or,
|
||||
if @env{SPELL} is not set, its own interactive spell checker that requires
|
||||
the @command{spell} program to be installed on your system.
|
||||
|
||||
@item -t, --tempfile
|
||||
@item -t
|
||||
@itemx --tempfile
|
||||
Don't ask whether or not to save the current contents of the file when
|
||||
exiting, assume yes. This is most useful when using @code{nano} as the
|
||||
exiting, assume yes. This is most useful when using @command{nano} as the
|
||||
composer of a mailer program.
|
||||
|
||||
@item -v, --view
|
||||
@item -v
|
||||
@itemx --view
|
||||
Don't allow the contents of the file to be altered. Note that this
|
||||
option should NOT be used in place of correct file permissions to
|
||||
implement a read-only file.
|
||||
|
||||
@item -w, --nowrap
|
||||
@item -w
|
||||
@itemx --nowrap
|
||||
Don't hard-wrap long lines at any length. This option conflicts with
|
||||
-r -- the last one given takes effect.
|
||||
@option{-r} -- the last one given takes effect.
|
||||
|
||||
@anchor{Expert Mode}
|
||||
@item -x, --nohelp
|
||||
@item -x
|
||||
@itemx --nohelp
|
||||
Expert Mode: don't show the Shortcut Lists at the bottom of the screen.
|
||||
This affects the location of the statusbar as well, as in Expert Mode it
|
||||
is located at the very bottom of the editor.
|
||||
@@ -307,19 +349,26 @@ is located at the very bottom of the editor.
|
||||
Note: When accessing the help system, Expert Mode is temporarily
|
||||
disabled to display the help-system navigation keys.
|
||||
|
||||
@item -z, --suspend
|
||||
Enable the ability to suspend @code{nano} using the system's suspend
|
||||
@item -z
|
||||
@itemx --suspend
|
||||
Enable the ability to suspend @command{nano} using the system's suspend
|
||||
keystroke (usually ^Z).
|
||||
|
||||
@item -$, --softwrap
|
||||
Enable 'soft wrapping'. This will make @code{nano} attempt to display the
|
||||
@item -$
|
||||
@itemx --softwrap
|
||||
Enable 'soft wrapping'. This will make @command{nano} attempt to display the
|
||||
entire contents of any line, even if it is longer than the screen width, by
|
||||
continuing it over multiple screen lines. Since
|
||||
'$' normally refers to a variable in the Unix shell, you should specify
|
||||
@samp{$} normally refers to a variable in the Unix shell, you should specify
|
||||
this option last when using other options (e.g. @code{nano -wS$}) or pass it
|
||||
separately (e.g. @code{nano -wS -$}).
|
||||
|
||||
@item -a, -b, -e, -f, -g, -j
|
||||
@item -a
|
||||
@itemx -b
|
||||
@itemx -e
|
||||
@itemx -f
|
||||
@itemx -g
|
||||
@itemx -j
|
||||
Ignored, for compatibility with Pico.
|
||||
@end table
|
||||
|
||||
@@ -441,12 +490,12 @@ The mouse will work in the X Window System, and on the console when gpm
|
||||
is running.
|
||||
|
||||
|
||||
@node Online Help
|
||||
@chapter Online Help
|
||||
@node Built-in Help
|
||||
@chapter Built-in Help
|
||||
|
||||
The online help system in @code{nano} is available by pressing ^G.
|
||||
It is fairly self-explanatory, documenting the various parts of the
|
||||
editor and available keystrokes. Navigation is via the ^Y (Page Up)
|
||||
The built-in help system in @code{nano} is available by pressing ^G.
|
||||
It is fairly self-explanatory. It documents the various parts of the
|
||||
editor and the available keystrokes. Navigation is via the ^Y (Page Up)
|
||||
and ^V (Page Down) keys. ^X exits the help system.
|
||||
|
||||
|
||||
@@ -532,8 +581,11 @@ and to rebind keys -- @xref{Syntax Highlighting}, and @xref{Rebinding Keys}.
|
||||
@code{nano} will read one command per line.
|
||||
|
||||
Options in nanorc files take precedence over @code{nano}'s defaults, and
|
||||
command-line options override nanorc settings. Options are also unset
|
||||
by default, except for those that take arguments.
|
||||
command-line options override nanorc settings. Also, options that do not
|
||||
take an argument are unset by default. So using the @code{unset} command
|
||||
is only needed when wanting to override a setting of the system's nanorc
|
||||
file in your own @file{~/.nanorc}. Options that take an argument cannot
|
||||
be unset.
|
||||
|
||||
Quotes inside string parameters don't have to be escaped with
|
||||
backslashes. The last double quote in the string will be treated as its
|
||||
@@ -553,15 +605,15 @@ The supported settings in a nanorc file are:
|
||||
|
||||
@table @code
|
||||
|
||||
@item set/unset allow_insecure_backup
|
||||
@item set allow_insecure_backup
|
||||
When backing up files, allow the backup to succeed even if its
|
||||
permissions can't be (re)set due to special OS considerations.
|
||||
You should NOT enable this option unless you are sure you need it.
|
||||
|
||||
@item set/unset autoindent
|
||||
@item set autoindent
|
||||
Use auto-indentation.
|
||||
|
||||
@item set/unset backup
|
||||
@item set backup
|
||||
When saving a file, back up the previous version of it to the current
|
||||
filename suffixed with a tilde (@code{~}).
|
||||
|
||||
@@ -569,88 +621,88 @@ filename suffixed with a tilde (@code{~}).
|
||||
Set the directory where @code{nano} puts unique backup files, if file
|
||||
backups are enabled.
|
||||
|
||||
@item set/unset backwards
|
||||
@item set backwards
|
||||
Do backwards searches by default.
|
||||
|
||||
@item set/unset boldtext
|
||||
@item set boldtext
|
||||
Use bold instead of reverse video for the titlebar, statusbar, key combos,
|
||||
and selected text. This can be overridden for the first three by setting
|
||||
the options "titlecolor", "statuscolor", and "keycolor".
|
||||
|
||||
@item set brackets "string"
|
||||
@item set brackets "@var{string}"
|
||||
Set the characters treated as closing brackets when justifying
|
||||
paragraphs. This may not include blank characters. Only closing
|
||||
punctuation (see "punct"), optionally followed by the specified
|
||||
closing brackets, can end sentences. The default value is
|
||||
|
||||
@quotation
|
||||
@code{""')>]@}"}
|
||||
""')>]@}"
|
||||
@end quotation
|
||||
|
||||
@item set/unset casesensitive
|
||||
@item set casesensitive
|
||||
Do case-sensitive searches by default.
|
||||
|
||||
@item set/unset const
|
||||
@item set const
|
||||
Constantly display the cursor position in the status bar.
|
||||
|
||||
@item set/unset cut
|
||||
@item set cut
|
||||
Use cut-to-end-of-line by default, instead of cutting the whole line.
|
||||
|
||||
@item set fill "n"
|
||||
Hard-wrap lines at column number "n". If "n" is 0 or less, the maximum line
|
||||
length will be the screen width less "n" columns. The default value is
|
||||
-8.
|
||||
@item set fill @var{number}
|
||||
Hard-wrap lines at column number @var{number}. If @var{number} is 0 or less,
|
||||
the maximum line length will be the screen width less @var{number} columns.
|
||||
The default value is -8.
|
||||
|
||||
@item set functioncolor fgcolor,bgcolor
|
||||
@item set functioncolor @var{fgcolor},@var{bgcolor}
|
||||
Specify the color combination to use for the function descriptions
|
||||
in the two help lines at the bottom of the screen.
|
||||
See "set titlecolor" for more details.
|
||||
See @code{set titlecolor} for more details.
|
||||
|
||||
@item set/unset historylog
|
||||
Enable the use of ~/.nano/search_history for saving and reading
|
||||
@item set historylog
|
||||
Enable the use of @file{~/.nano/search_history} for saving and reading
|
||||
search/replace strings.
|
||||
|
||||
@item set keycolor fgcolor,bgcolor
|
||||
@item set keycolor @var{fgcolor},@var{bgcolor}
|
||||
Specify the color combination to use for the shortcut key combos
|
||||
in the two help lines at the bottom of the screen.
|
||||
See "set titlecolor" for more details.
|
||||
See @code{set titlecolor} for more details.
|
||||
|
||||
@item set/unset locking
|
||||
@item set locking
|
||||
Enable vim-style lock-files for when editing files.
|
||||
|
||||
@item set matchbrackets "string"
|
||||
@item set matchbrackets "@var{string}"
|
||||
Set the opening and closing brackets that can be found by bracket
|
||||
searches. This may not include blank characters. The opening set must
|
||||
come before the closing set, and the two sets must be in the same order.
|
||||
The default value is
|
||||
|
||||
@quotation
|
||||
@code{"(<[@{)>]@}"}
|
||||
"(<[@{)>]@}"
|
||||
@end quotation
|
||||
|
||||
@item set/unset morespace
|
||||
@item set morespace
|
||||
Use the blank line below the titlebar as extra editing space.
|
||||
|
||||
@item set/unset mouse
|
||||
@item set mouse
|
||||
Enable mouse support, so that mouse clicks can be used to place the
|
||||
cursor, set the mark (with a double click), or execute shortcuts.
|
||||
|
||||
@item set/unset multibuffer
|
||||
@item set multibuffer
|
||||
Allow inserting files into their own buffers.
|
||||
|
||||
@item set/unset noconvert
|
||||
@item set noconvert
|
||||
Don't convert files from DOS/Mac format.
|
||||
|
||||
@item set/unset nofollow
|
||||
@item set nofollow
|
||||
Don't follow symlinks when writing files.
|
||||
|
||||
@item set/unset nohelp
|
||||
@item set nohelp
|
||||
Don't display the help lists at the bottom of the screen.
|
||||
|
||||
@item set/unset nonewlines
|
||||
@item set nonewlines
|
||||
Don't add newlines to the ends of files.
|
||||
|
||||
@item set/unset nowrap
|
||||
@item set nowrap
|
||||
Don't hard-wrap text at all.
|
||||
|
||||
@item set operatingdir "directory"
|
||||
@@ -659,102 +711,102 @@ subdirectories. Also, the current directory is changed to here, so
|
||||
files are inserted from this directory. By default, the operating
|
||||
directory feature is turned off.
|
||||
|
||||
@item set/unset poslog
|
||||
@item set poslog
|
||||
Save the cursor position of files between editing sessions.
|
||||
|
||||
@item set/unset preserve
|
||||
@item set preserve
|
||||
Preserve the XON and XOFF keys (^Q and ^S).
|
||||
|
||||
@item set punct "string"
|
||||
@item set punct "@var{string}"
|
||||
Set the characters treated as closing punctuation when justifying
|
||||
paragraphs. This may not include blank characters. Only the
|
||||
specified closing punctuation, optionally followed by closing brackets
|
||||
(see "brackets"), can end sentences. The default value is @code{"!.?"}.
|
||||
(see "brackets"), can end sentences. The default value is "!.?".
|
||||
|
||||
@item set/unset quickblank
|
||||
@item set quickblank
|
||||
Do quick statusbar blanking. Statusbar messages will disappear after 1
|
||||
keystroke instead of 25.
|
||||
|
||||
@item set/unset quiet
|
||||
@item set quiet
|
||||
When set, @code{nano} will not report errors in the nanorc file nor ask them
|
||||
to be acknowledged by pressing Enter at startup. If this option is used, it
|
||||
should be placed at the top of the file to be fully effective.
|
||||
|
||||
@item set quotestr "string"
|
||||
@item set quotestr "@var{string}"
|
||||
The email-quote string, used to justify email-quoted paragraphs. This
|
||||
is an extended regular expression if your system supports them,
|
||||
otherwise a literal string. The default value is
|
||||
|
||||
@quotation
|
||||
@code{"^([ \\t]*[#:>\\|@}])+"}
|
||||
"^([ \\t]*[#:>\\|@}])+"
|
||||
@end quotation
|
||||
|
||||
if you have extended regular expression support, and "> " otherwise.
|
||||
Note that '\\t' stands for a literal Tab character.
|
||||
|
||||
@item set/unset rebinddelete
|
||||
@item set rebinddelete
|
||||
Interpret the Delete key differently so that both Backspace and Delete
|
||||
work properly. You should only need to use this option if Backspace
|
||||
acts like Delete on your system.
|
||||
|
||||
@item set/unset rebindkeypad
|
||||
@item set rebindkeypad
|
||||
Interpret the numeric keypad keys so that they all work properly. You
|
||||
should only need to use this option if they don't, as mouse support
|
||||
won't work properly with this option enabled.
|
||||
|
||||
@item set/unset regexp
|
||||
@item set regexp
|
||||
Do extended regular expression searches by default.
|
||||
|
||||
@item set/unset smarthome
|
||||
@item set smarthome
|
||||
Make the Home key smarter. When Home is pressed anywhere but at the
|
||||
very beginning of non-whitespace characters on a line, the cursor will
|
||||
jump to that beginning (either forwards or backwards). If the cursor is
|
||||
already at that position, it will jump to the true beginning of the
|
||||
line.
|
||||
|
||||
@item set/unset smooth
|
||||
@item set smooth
|
||||
Use smooth scrolling by default.
|
||||
|
||||
@item set/unset softwrap
|
||||
@item set softwrap
|
||||
Enable soft line wrapping for easier viewing of very long lines.
|
||||
|
||||
@item set speller "spellprog"
|
||||
Use spelling checker "spellprog" instead of the built-in one, which
|
||||
calls "spell".
|
||||
|
||||
@item set statuscolor fgcolor,bgcolor
|
||||
@item set statuscolor @var{fgcolor},@var{bgcolor}
|
||||
Specify the color combination to use for the statusbar.
|
||||
See "set titlecolor" for more details.
|
||||
See @code{set titlecolor} for more details.
|
||||
|
||||
@item set/unset suspend
|
||||
@item set suspend
|
||||
Allow @code{nano} to be suspended.
|
||||
|
||||
@item set tabsize "n"
|
||||
Use a tab size of "n" columns. The value of "n" must be greater than 0.
|
||||
The default value is 8.
|
||||
@item set tabsize @var{number}
|
||||
Use a tab size of @var{number} columns. The value of @var{number} must be
|
||||
greater than 0. The default value is 8.
|
||||
|
||||
@item set/unset tabstospaces
|
||||
@item set tabstospaces
|
||||
Convert typed tabs to spaces.
|
||||
|
||||
@item set/unset tempfile
|
||||
@item set tempfile
|
||||
Save automatically on exit, don't prompt.
|
||||
|
||||
@item set titlecolor fgcolor,bgcolor
|
||||
@item set titlecolor @var{fgcolor},@var{bgcolor}
|
||||
Specify the color combination to use for the titlebar.
|
||||
Valid color names for foreground and background are:
|
||||
white, black, red, blue, green, yellow, magenta, and cyan.
|
||||
And either "fgcolor" or ",bgcolor" may be left out.
|
||||
And either @var{fgcolor} or @var{,bgcolor} may be left out.
|
||||
|
||||
@item set/unset view
|
||||
@item set view
|
||||
Disallow file modification.
|
||||
|
||||
@anchor{Whitespace}
|
||||
@item set whitespace "string"
|
||||
@item set whitespace "@var{string}"
|
||||
Set the two characters used to indicate the presence of tabs and
|
||||
spaces. They must be single-column characters. The default pair
|
||||
for a UTF-8 locale is "»·", and for other locales ">.".
|
||||
|
||||
@item set/unset wordbounds
|
||||
@item set wordbounds
|
||||
Detect word boundaries more accurately by treating punctuation
|
||||
characters as part of a word.
|
||||
|
||||
@@ -763,7 +815,14 @@ characters as part of a word.
|
||||
@node Syntax Highlighting
|
||||
@section Syntax Highlighting
|
||||
|
||||
Coloring the different syntactic elements of a file can be defined
|
||||
Coloring the different syntactic elements of a file
|
||||
is done via regular expressions (see the @code{color} command below).
|
||||
This is inherently imperfect, because regular expressions are not
|
||||
powerful enough to fully parse a file. Nevertheless, regular
|
||||
expressions can do a lot and are easy to make, so they are a
|
||||
good fit for a small editor like @code{nano}.
|
||||
|
||||
A separate syntax can be defined for each kind of file
|
||||
via the following commands in a nanorc file:
|
||||
|
||||
@table @code
|
||||
@@ -784,12 +843,16 @@ syntax's "fileregex".
|
||||
For the currently defined syntax, use the given program to invoke the
|
||||
linter (this overrides the speller function when defined).
|
||||
|
||||
@item formatter program [arg @dots{}]
|
||||
For the currently defined syntax, use the given program to automatically
|
||||
reformat text. Useful in certain programming languages (e.g. go).
|
||||
|
||||
@item header "regex" @dots{}
|
||||
For the currently defined syntax, add one or more regexes which will
|
||||
be compared against the very first line of the file to be edited,
|
||||
to determine whether this syntax should be used for that file.
|
||||
|
||||
@item magic ["regex" @dots{}]
|
||||
@item magic "regex" @dots{}
|
||||
For the currently defined syntax, add one or more regexes which will be
|
||||
compared against the result of querying the magic database about the file
|
||||
to be edited, to determine whether this syntax should be used for that
|
||||
@@ -989,7 +1052,7 @@ Goes to the last line of the file.
|
||||
Goes to a specific line (and column if specified).
|
||||
|
||||
@item gototext
|
||||
Switches from targetting a line number to searching for text.
|
||||
Switches from targeting a line number to searching for text.
|
||||
|
||||
@item findbracket
|
||||
Moves the cursor to the bracket (brace, parenthesis, etc.) that matches
|
||||
|
||||
@@ -11,7 +11,7 @@ Group : Applications/Editors
|
||||
URL : http://www.nano-editor.org/
|
||||
Source : http://www.nano-editor.org/dist/v2.3/%{name}-%{version}.tar.gz
|
||||
BuildRoot : %{_tmppath}/%{name}-%{version}-root
|
||||
BuildRequires : autoconf, automake, gettext-devel, ncurses-devel
|
||||
BuildRequires : autoconf, automake, gettext-devel, ncurses-devel, texinfo
|
||||
|
||||
%description
|
||||
GNU nano is a small and friendly text editor. It aims to emulate the
|
||||
@@ -33,6 +33,7 @@ rm -f %{buildroot}%{_infodir}/dir
|
||||
%defattr(-,root,root)
|
||||
%doc AUTHORS COPYING ChangeLog INSTALL NEWS README THANKS TODO doc/faq.html doc/nanorc.sample
|
||||
%{_bindir}/*
|
||||
%{_docdir}/nano/*
|
||||
%{_mandir}/man*/*
|
||||
%{_mandir}/fr/man*/*
|
||||
%{_infodir}/nano.info*
|
||||
|
||||
783
po/nano.pot
783
po/nano.pot
File diff suppressed because it is too large
Load Diff
805
po/pt_BR.po
805
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
788
po/zh_CN.po
788
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
788
po/zh_TW.po
788
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
230
src/browser.c
230
src/browser.c
@@ -3,7 +3,8 @@
|
||||
* browser.c *
|
||||
* *
|
||||
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, *
|
||||
* 2010, 2011, 2013, 2014 Free Software Foundation, Inc. *
|
||||
* 2010, 2011, 2013, 2014, 2015 Free Software Foundation, Inc. *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 3, or (at your option) *
|
||||
@@ -39,10 +40,7 @@ static int width = 0;
|
||||
static int longest = 0;
|
||||
/* The number of columns in the longest filename in the list. */
|
||||
static size_t selected = 0;
|
||||
/* The currently selected filename in the list. This variable
|
||||
* is zero-based. */
|
||||
static bool search_last_file = FALSE;
|
||||
/* Have we gone past the last file while searching? */
|
||||
/* The currently selected filename in the list; zero-based. */
|
||||
|
||||
/* Our main file browser function. path is the tilde-expanded path we
|
||||
* start browsing from. */
|
||||
@@ -52,8 +50,7 @@ char *do_browser(char *path, DIR *dir)
|
||||
int kbinput;
|
||||
bool old_const_update = ISSET(CONST_UPDATE);
|
||||
char *prev_dir = NULL;
|
||||
/* The directory we were in, if any, before backing up via
|
||||
* browsing to "..". */
|
||||
/* The directory we were in before backing up to "..". */
|
||||
char *ans = NULL;
|
||||
/* The last answer the user typed at the statusbar prompt. */
|
||||
size_t old_selected;
|
||||
@@ -63,7 +60,6 @@ char *do_browser(char *path, DIR *dir)
|
||||
|
||||
curs_set(0);
|
||||
blank_statusbar();
|
||||
currmenu = MBROWSER;
|
||||
bottombars(MBROWSER);
|
||||
wnoutrefresh(bottomwin);
|
||||
|
||||
@@ -92,7 +88,7 @@ char *do_browser(char *path, DIR *dir)
|
||||
/* If prev_dir isn't NULL, select the directory saved in it, and
|
||||
* then blow it away. */
|
||||
if (prev_dir != NULL) {
|
||||
browser_select_filename(prev_dir);
|
||||
browser_select_dirname(prev_dir);
|
||||
|
||||
free(prev_dir);
|
||||
prev_dir = NULL;
|
||||
@@ -137,19 +133,16 @@ char *do_browser(char *path, DIR *dir)
|
||||
width) + (mouse_x / (longest + 2));
|
||||
|
||||
/* If they clicked beyond the end of a row,
|
||||
* select the filename at the end of that
|
||||
* row. */
|
||||
* select the last filename in that row. */
|
||||
if (mouse_x > width * (longest + 2))
|
||||
selected--;
|
||||
|
||||
/* If we're off the screen, select the last
|
||||
* filename. */
|
||||
/* If we're off the screen, select the last filename. */
|
||||
if (selected > filelist_len - 1)
|
||||
selected = filelist_len - 1;
|
||||
|
||||
/* If we selected the same filename as last
|
||||
* time, put back the Enter key so that it's
|
||||
* read in. */
|
||||
/* If we selected the same filename as last time,
|
||||
* put back the Enter key so that it's read in. */
|
||||
if (old_selected == selected)
|
||||
unget_kbinput(sc_seq_or(do_enter_void, 0), FALSE, FALSE);
|
||||
}
|
||||
@@ -203,7 +196,6 @@ char *do_browser(char *path, DIR *dir)
|
||||
browser_refresh, _("Go To Directory"));
|
||||
|
||||
curs_set(0);
|
||||
currmenu = MBROWSER;
|
||||
bottombars(MBROWSER);
|
||||
|
||||
/* If the directory begins with a newline (i.e. an
|
||||
@@ -268,12 +260,12 @@ char *do_browser(char *path, DIR *dir)
|
||||
} else if (func == do_up_void) {
|
||||
if (selected >= width)
|
||||
selected -= width;
|
||||
} else if (func == do_left) {
|
||||
if (selected > 0)
|
||||
selected--;
|
||||
} else if (func == do_down_void) {
|
||||
if (selected + width <= filelist_len - 1)
|
||||
selected += width;
|
||||
} else if (func == do_left) {
|
||||
if (selected > 0)
|
||||
selected--;
|
||||
} else if (func == do_right) {
|
||||
if (selected < filelist_len - 1)
|
||||
selected++;
|
||||
@@ -581,8 +573,7 @@ void browser_refresh(void)
|
||||
/* The maximum length of the file information in
|
||||
* columns: seven for "--", "(dir)", or the file size,
|
||||
* and 12 for "(parent dir)". */
|
||||
bool dots = (COLS >= 15 && filetaillen >= longest -
|
||||
foomaxlen - 1);
|
||||
bool dots = (COLS >= 15 && filetaillen >= longest - foomaxlen - 1);
|
||||
/* Do we put an ellipsis before the filename? Don't set
|
||||
* this to TRUE if we have fewer than 15 columns (i.e.
|
||||
* one column for padding, plus seven columns for a
|
||||
@@ -692,56 +683,37 @@ void browser_refresh(void)
|
||||
wnoutrefresh(edit);
|
||||
}
|
||||
|
||||
/* Look for needle. If we find it, set selected to its location. Note
|
||||
* that needle must be an exact match for a file in the list. The
|
||||
* return value specifies whether we found anything. */
|
||||
bool browser_select_filename(const char *needle)
|
||||
/* Look for needle. If we find it, set selected to its location.
|
||||
* Note that needle must be an exact match for a file in the list. */
|
||||
void browser_select_dirname(const char *needle)
|
||||
{
|
||||
size_t currselected;
|
||||
bool found = FALSE;
|
||||
size_t looking_at = 0;
|
||||
|
||||
for (currselected = 0; currselected < filelist_len;
|
||||
currselected++) {
|
||||
if (strcmp(filelist[currselected], needle) == 0) {
|
||||
found = TRUE;
|
||||
for (; looking_at < filelist_len; looking_at++) {
|
||||
if (strcmp(filelist[looking_at], needle) == 0) {
|
||||
selected = looking_at;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found)
|
||||
selected = currselected;
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
/* Set up the system variables for a filename search. Return -1 if the
|
||||
* search should be canceled (due to Cancel, a blank search string, or a
|
||||
* failed regcomp()), return 0 on success, and return 1 on rerun calling
|
||||
* program. */
|
||||
/* Set up the system variables for a filename search. Return -1 or -2 if
|
||||
* the search should be canceled (due to Cancel or a blank search string),
|
||||
* return 0 when we have a string, and return a positive value when some
|
||||
* function was run. */
|
||||
int filesearch_init(void)
|
||||
{
|
||||
int i = 0;
|
||||
int input;
|
||||
char *buf;
|
||||
static char *backupstring = NULL;
|
||||
/* The search string we'll be using. */
|
||||
|
||||
/* If backupstring doesn't exist, initialize it to "". */
|
||||
if (backupstring == NULL)
|
||||
backupstring = mallocstrcpy(NULL, "");
|
||||
|
||||
/* We display the search prompt below. If the user types a partial
|
||||
* search string and then Replace or a toggle, we will return to
|
||||
* do_search() or do_replace() and be called again. In that case,
|
||||
* we should put the same search string back up. */
|
||||
|
||||
search_init_globals();
|
||||
if (last_search == NULL)
|
||||
last_search = mallocstrcpy(NULL, "");
|
||||
|
||||
if (last_search[0] != '\0') {
|
||||
char *disp = display_string(last_search, 0, COLS / 3, FALSE);
|
||||
|
||||
buf = charalloc(strlen(disp) + 7);
|
||||
/* We use (COLS / 3) here because we need to see more on the
|
||||
* line. */
|
||||
/* We use (COLS / 3) here because we need to see more on the line. */
|
||||
sprintf(buf, " [%s%s]", disp,
|
||||
(strlenpt(last_search) > COLS / 3) ? "..." : "");
|
||||
free(disp);
|
||||
@@ -749,11 +721,11 @@ int filesearch_init(void)
|
||||
buf = mallocstrcpy(NULL, "");
|
||||
|
||||
/* This is now one simple call. It just does a lot. */
|
||||
i = do_prompt(FALSE,
|
||||
input = do_prompt(FALSE,
|
||||
#ifndef DISABLE_TABCOMP
|
||||
TRUE,
|
||||
#endif
|
||||
MWHEREISFILE, backupstring,
|
||||
MWHEREISFILE, NULL,
|
||||
#ifndef DISABLE_HISTORIES
|
||||
&search_history,
|
||||
#endif
|
||||
@@ -762,100 +734,83 @@ int filesearch_init(void)
|
||||
/* Release buf now that we don't need it anymore. */
|
||||
free(buf);
|
||||
|
||||
free(backupstring);
|
||||
backupstring = NULL;
|
||||
/* If only Enter was pressed but we have a previous string, it's okay. */
|
||||
if (input == -2 && *last_search != '\0')
|
||||
return 0;
|
||||
|
||||
/* Cancel any search, or just return with no previous search. */
|
||||
if (i == -1 || (i < 0 && *last_search == '\0') || (i == 0 &&
|
||||
*answer == '\0')) {
|
||||
/* Otherwise negative inputs are a bailout. */
|
||||
if (input < 0)
|
||||
statusbar(_("Cancelled"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return input;
|
||||
}
|
||||
|
||||
/* Look for needle. If no_sameline is TRUE, skip over selected when
|
||||
* looking for needle. begin is the location of the filename where we
|
||||
* first started searching. The return value specifies whether we found
|
||||
* anything. */
|
||||
bool findnextfile(bool no_sameline, size_t begin, const char *needle)
|
||||
/* Look for the given needle in the list of files. */
|
||||
void findnextfile(const char *needle)
|
||||
{
|
||||
size_t currselected = selected;
|
||||
/* The location in the current file list of the match we
|
||||
* find. */
|
||||
const char *filetail = tail(filelist[currselected]);
|
||||
size_t looking_at = selected;
|
||||
/* The location in the file list of the filename we're looking at. */
|
||||
bool came_full_circle = FALSE;
|
||||
/* Have we reached the starting file again? */
|
||||
const char *filetail = tail(filelist[looking_at]);
|
||||
/* The filename we display, minus the path. */
|
||||
const char *rev_start = filetail, *found = NULL;
|
||||
|
||||
/* Look for needle in the current filename we're searching. */
|
||||
/* Step through each filename in the list until a match is found or
|
||||
* we've come back to the point where we started. */
|
||||
while (TRUE) {
|
||||
found = strstrwrapper(filetail, needle, rev_start);
|
||||
|
||||
/* We've found a potential match. If we're not allowed to find
|
||||
* a match on the same filename we started on and this potential
|
||||
* match is on that line, continue searching. */
|
||||
if (found != NULL && (!no_sameline || currselected != begin))
|
||||
/* If we've found a match and it's not the same filename where
|
||||
* we started, then we're done. */
|
||||
if (found != NULL && looking_at != selected)
|
||||
break;
|
||||
|
||||
/* We've finished processing the filenames, so get out. */
|
||||
if (search_last_file) {
|
||||
/* If we've found a match and we're back at the beginning, then
|
||||
* it's the only occurrence. */
|
||||
if (found != NULL && came_full_circle) {
|
||||
statusbar(_("This is the only occurrence"));
|
||||
break;
|
||||
}
|
||||
|
||||
if (came_full_circle) {
|
||||
/* We're back at the beginning and didn't find anything. */
|
||||
not_found_msg(needle);
|
||||
return FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Move to the next filename in the list. If we've reached the
|
||||
* end of the list, wrap around. */
|
||||
if (currselected < filelist_len - 1)
|
||||
currselected++;
|
||||
if (looking_at < filelist_len - 1)
|
||||
looking_at++;
|
||||
else {
|
||||
currselected = 0;
|
||||
looking_at = 0;
|
||||
statusbar(_("Search Wrapped"));
|
||||
}
|
||||
|
||||
/* We've reached the original starting file. */
|
||||
if (currselected == begin)
|
||||
search_last_file = TRUE;
|
||||
if (looking_at == selected)
|
||||
/* We've reached the original starting file. */
|
||||
came_full_circle = TRUE;
|
||||
|
||||
filetail = tail(filelist[currselected]);
|
||||
filetail = tail(filelist[looking_at]);
|
||||
|
||||
rev_start = filetail;
|
||||
}
|
||||
|
||||
/* We've definitely found something. */
|
||||
selected = currselected;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Clear the flag indicating that a search reached the last file in the
|
||||
* list. We need to do this just before a new search. */
|
||||
void findnextfile_wrap_reset(void)
|
||||
{
|
||||
search_last_file = FALSE;
|
||||
}
|
||||
|
||||
/* Abort the current filename search. Clean up by setting the current
|
||||
* shortcut list to the browser shortcut list, and displaying it. */
|
||||
void filesearch_abort(void)
|
||||
{
|
||||
currmenu = MBROWSER;
|
||||
bottombars(MBROWSER);
|
||||
/* Select the one we've found. */
|
||||
selected = looking_at;
|
||||
}
|
||||
|
||||
/* Search for a filename. */
|
||||
void do_filesearch(void)
|
||||
{
|
||||
size_t begin = selected;
|
||||
bool didfind;
|
||||
|
||||
UNSET(CASE_SENSITIVE);
|
||||
UNSET(USE_REGEXP);
|
||||
UNSET(BACKWARDS_SEARCH);
|
||||
|
||||
if (filesearch_init() != 0) {
|
||||
/* Cancelled or a blank search string. */
|
||||
filesearch_abort();
|
||||
/* Cancelled, or a blank search string, or done something. */
|
||||
bottombars(MBROWSER);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -872,50 +827,21 @@ void do_filesearch(void)
|
||||
update_history(&search_history, answer);
|
||||
#endif
|
||||
|
||||
findnextfile_wrap_reset();
|
||||
didfind = findnextfile(FALSE, begin, answer);
|
||||
findnextfile(answer);
|
||||
|
||||
/* Check to see if there's only one occurrence of the string and
|
||||
* we're on it now. */
|
||||
if (selected == begin && didfind) {
|
||||
/* Do the search again, skipping over the current line. We
|
||||
* should only end up back at the same position if the string
|
||||
* isn't found again, in which case it's the only occurrence. */
|
||||
didfind = findnextfile(TRUE, begin, answer);
|
||||
if (selected == begin && !didfind)
|
||||
statusbar(_("This is the only occurrence"));
|
||||
}
|
||||
|
||||
filesearch_abort();
|
||||
bottombars(MBROWSER);
|
||||
}
|
||||
|
||||
/* Search for the last filename without prompting. */
|
||||
/* Search for the last given filename again without prompting. */
|
||||
void do_fileresearch(void)
|
||||
{
|
||||
size_t begin = selected;
|
||||
bool didfind;
|
||||
if (last_search == NULL)
|
||||
last_search = mallocstrcpy(NULL, "");
|
||||
|
||||
search_init_globals();
|
||||
|
||||
if (last_search[0] != '\0') {
|
||||
findnextfile_wrap_reset();
|
||||
didfind = findnextfile(FALSE, begin, answer);
|
||||
|
||||
/* Check to see if there's only one occurrence of the string and
|
||||
* we're on it now. */
|
||||
if (selected == begin && didfind) {
|
||||
/* Do the search again, skipping over the current line. We
|
||||
* should only end up back at the same position if the
|
||||
* string isn't found again, in which case it's the only
|
||||
* occurrence. */
|
||||
didfind = findnextfile(TRUE, begin, answer);
|
||||
if (selected == begin && !didfind)
|
||||
statusbar(_("This is the only occurrence"));
|
||||
}
|
||||
} else
|
||||
statusbar(_("No current search pattern"));
|
||||
|
||||
filesearch_abort();
|
||||
if (last_search[0] == '\0')
|
||||
statusbar(_("No current search pattern"));
|
||||
else
|
||||
findnextfile(last_search);
|
||||
}
|
||||
|
||||
/* Select the first file in the list. */
|
||||
|
||||
10
src/chars.c
10
src/chars.c
@@ -484,12 +484,18 @@ int parse_mbchar(const char *buf, char *chr, size_t *col)
|
||||
* before the one at pos. */
|
||||
size_t move_mbleft(const char *buf, size_t pos)
|
||||
{
|
||||
size_t before = 0, char_len = 0;
|
||||
size_t before, char_len = 0;
|
||||
|
||||
assert(buf != NULL && pos <= strlen(buf));
|
||||
|
||||
/* There is no library function to move backward one multibyte
|
||||
* character. Here is the naive, O(pos) way to do it. */
|
||||
* character. So we just start groping for one at the farthest
|
||||
* possible point. */
|
||||
if (mb_cur_max() > pos)
|
||||
before = 0;
|
||||
else
|
||||
before = pos - mb_cur_max();
|
||||
|
||||
while (before < pos) {
|
||||
char_len = parse_mbchar(buf + before, NULL, NULL);
|
||||
before += char_len;
|
||||
|
||||
@@ -269,9 +269,9 @@ void color_update(void)
|
||||
/* Open the magic database and get a diagnosis of the file. */
|
||||
cookie = magic_open(MAGIC_SYMLINK |
|
||||
#ifdef DEBUG
|
||||
MAGIC_DEBUG | MAGIC_CHECK |
|
||||
MAGIC_DEBUG | MAGIC_CHECK |
|
||||
#endif
|
||||
MAGIC_ERROR);
|
||||
MAGIC_ERROR);
|
||||
if (cookie == NULL || magic_load(cookie, NULL) < 0)
|
||||
statusbar(_("magic_load() failed: %s"), strerror(errno));
|
||||
else {
|
||||
|
||||
@@ -219,10 +219,9 @@ void do_cut_text(
|
||||
|
||||
/* Leave the text in the cutbuffer, and mark the file as
|
||||
* modified. */
|
||||
if (!copy_text) {
|
||||
set_modified();
|
||||
}
|
||||
if (!copy_text)
|
||||
#endif /* !NANO_TINY */
|
||||
set_modified();
|
||||
|
||||
/* Update the screen. */
|
||||
edit_refresh_needed = TRUE;
|
||||
|
||||
147
src/files.c
147
src/files.c
@@ -126,6 +126,7 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
|
||||
pid_t mypid;
|
||||
uid_t myuid;
|
||||
struct passwd *mypwuid;
|
||||
struct stat fileinfo;
|
||||
char *lockdata = charalloc(1024);
|
||||
char myhostname[32];
|
||||
ssize_t lockdatalen = 1024;
|
||||
@@ -145,8 +146,10 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (delete_lockfile(lockfilename) < 0)
|
||||
return -1;
|
||||
/* Check if the lock exists before we try to delete it...*/
|
||||
if (stat(lockfilename, &fileinfo) != -1)
|
||||
if (delete_lockfile(lockfilename) < 0)
|
||||
return -1;
|
||||
|
||||
if (ISSET(INSECURE_BACKUP))
|
||||
cflags = O_WRONLY | O_CREAT | O_APPEND;
|
||||
@@ -156,11 +159,13 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
|
||||
fd = open(lockfilename, cflags,
|
||||
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
|
||||
|
||||
/* Maybe we just don't have write access. Don't stop us from
|
||||
* opening the file at all, just don't set the lock_filename and
|
||||
* return success. */
|
||||
if (fd < 0 && errno == EACCES)
|
||||
return 1;
|
||||
/* Maybe we just don't have write access. Print an error message
|
||||
and continue. */
|
||||
if (fd < 0) {
|
||||
statusbar(_("Error writing lock file %s: %s"), lockfilename,
|
||||
strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Now we've got a safe file stream. If the previous open() call
|
||||
* failed, this will return NULL. */
|
||||
@@ -190,12 +195,12 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
|
||||
* our lockfile' message in here...
|
||||
*
|
||||
* This is likely very wrong, so this is a WIP. */
|
||||
null_at(&lockdata, lockdatalen);
|
||||
memset(lockdata, 0, lockdatalen);
|
||||
lockdata[0] = 0x62;
|
||||
lockdata[1] = 0x30;
|
||||
lockdata[24] = mypid % 256;
|
||||
lockdata[25] = mypid / 256;
|
||||
snprintf(&lockdata[2], 10, "nano %s", VERSION);
|
||||
snprintf(&lockdata[2], 11, "nano %s", VERSION);
|
||||
strncpy(&lockdata[28], mypwuid->pw_name, 16);
|
||||
strncpy(&lockdata[68], myhostname, 31);
|
||||
strncpy(&lockdata[108], origfilename, 768);
|
||||
@@ -229,8 +234,8 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
|
||||
int delete_lockfile(const char *lockfilename)
|
||||
{
|
||||
if (unlink(lockfilename) < 0 && errno != ENOENT) {
|
||||
statusbar(_("Error deleting lock file %s: %s"), lockfilename,
|
||||
strerror(errno));
|
||||
statusbar(_("Error deleting lock file %s: %s"), lockfilename,
|
||||
strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
@@ -248,7 +253,7 @@ int do_lockfile(const char *filename)
|
||||
+ strlen(locking_suffix) + 3;
|
||||
char *lockfilename = charalloc(lockfilesize);
|
||||
char *lockfiledir = NULL;
|
||||
char lockprog[12], lockuser[16];
|
||||
static char lockprog[11], lockuser[17];
|
||||
struct stat fileinfo;
|
||||
int lockfd, lockpid;
|
||||
|
||||
@@ -279,7 +284,7 @@ int do_lockfile(const char *filename)
|
||||
return -1;
|
||||
}
|
||||
strncpy(lockprog, &lockbuf[2], 10);
|
||||
lockpid = lockbuf[25] * 256 + lockbuf[24];
|
||||
lockpid = (unsigned char)lockbuf[25] * 256 + (unsigned char)lockbuf[24];
|
||||
strncpy(lockuser, &lockbuf[28], 16);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "lockpid = %d\n", lockpid);
|
||||
@@ -288,8 +293,9 @@ int do_lockfile(const char *filename)
|
||||
fprintf(stderr, "user which created this lock file should be %s\n",
|
||||
lockuser);
|
||||
#endif
|
||||
sprintf(promptstr, "File being edited (by %s, PID %d, user %s), continue?",
|
||||
lockprog, lockpid, lockuser);
|
||||
/* TRANSLATORS: The second %s is the name of the user, the third that of the editor. */
|
||||
sprintf(promptstr, _("File %s is being edited (by %s with %s, PID %d); continue?"),
|
||||
filename, lockuser, lockprog, lockpid);
|
||||
ans = do_yesno_prompt(FALSE, promptstr);
|
||||
if (ans < 1) {
|
||||
blank_statusbar();
|
||||
@@ -314,6 +320,7 @@ int do_lockfile(const char *filename)
|
||||
* necessary, and then open and read the file, if applicable. */
|
||||
void open_buffer(const char *filename, bool undoable)
|
||||
{
|
||||
bool quiet = FALSE;
|
||||
bool new_buffer = (openfile == NULL
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
|| ISSET(MULTIBUFFER)
|
||||
@@ -337,13 +344,31 @@ void open_buffer(const char *filename, bool undoable)
|
||||
|
||||
/* If we're loading into a new buffer, add a new entry to
|
||||
* openfile. */
|
||||
if (new_buffer)
|
||||
if (new_buffer) {
|
||||
make_new_buffer();
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(LOCKING) && filename[0] != '\0') {
|
||||
int lockstatus = do_lockfile(filename);
|
||||
if (lockstatus < 0) {
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
if (openfile->next) {
|
||||
close_buffer(TRUE);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
} else if (lockstatus == 0) {
|
||||
quiet = TRUE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* If the filename isn't blank, and we are not in NOREAD_MODE,
|
||||
* open the file. Otherwise, treat it as a new file. */
|
||||
rc = (filename[0] != '\0' && !ISSET(NOREAD_MODE)) ?
|
||||
open_file(filename, new_buffer, &f) : -2;
|
||||
open_file(filename, new_buffer, quiet, &f) : -2;
|
||||
|
||||
/* If we have a file, and we're loading into a new buffer, update
|
||||
* the filename. */
|
||||
@@ -395,7 +420,7 @@ void replace_buffer(const char *filename)
|
||||
|
||||
/* If the filename isn't blank, open the file. Otherwise, treat it
|
||||
* as a new file. */
|
||||
rc = (filename[0] != '\0') ? open_file(filename, TRUE, &f) : -2;
|
||||
rc = (filename[0] != '\0') ? open_file(filename, TRUE, FALSE, &f) : -2;
|
||||
|
||||
/* Reinitialize the text of the current buffer. */
|
||||
free_filestruct(openfile->fileage);
|
||||
@@ -431,14 +456,15 @@ void display_buffer(void)
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
/* Switch to the next file buffer if next_buf is TRUE. Otherwise,
|
||||
* switch to the previous file buffer. */
|
||||
void switch_to_prevnext_buffer(bool next_buf)
|
||||
void switch_to_prevnext_buffer(bool next_buf, bool quiet)
|
||||
{
|
||||
assert(openfile != NULL);
|
||||
|
||||
/* If only one file buffer is open, indicate it on the statusbar and
|
||||
* get out. */
|
||||
if (openfile == openfile->next) {
|
||||
statusbar(_("No more open file buffers"));
|
||||
if (quiet == FALSE)
|
||||
statusbar(_("No more open file buffers"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -454,9 +480,10 @@ void switch_to_prevnext_buffer(bool next_buf)
|
||||
display_buffer();
|
||||
|
||||
/* Indicate the switch on the statusbar. */
|
||||
statusbar(_("Switched to %s"),
|
||||
((openfile->filename[0] == '\0') ? _("New Buffer") :
|
||||
openfile->filename));
|
||||
if (quiet == FALSE)
|
||||
statusbar(_("Switched to %s"),
|
||||
((openfile->filename[0] == '\0') ? _("New Buffer") :
|
||||
openfile->filename));
|
||||
|
||||
#ifdef DEBUG
|
||||
dump_filestruct(openfile->current);
|
||||
@@ -467,19 +494,21 @@ void switch_to_prevnext_buffer(bool next_buf)
|
||||
/* Switch to the previous entry in the openfile filebuffer. */
|
||||
void switch_to_prev_buffer_void(void)
|
||||
{
|
||||
switch_to_prevnext_buffer(FALSE);
|
||||
switch_to_prevnext_buffer(FALSE, FALSE);
|
||||
}
|
||||
|
||||
/* Switch to the next entry in the openfile filebuffer. */
|
||||
void switch_to_next_buffer_void(void)
|
||||
{
|
||||
switch_to_prevnext_buffer(TRUE);
|
||||
switch_to_prevnext_buffer(TRUE, FALSE);
|
||||
}
|
||||
|
||||
/* Delete an entry from the openfile filebuffer, and switch to the one
|
||||
* after it. Return TRUE on success, or FALSE if there are no more open
|
||||
* file buffers. */
|
||||
bool close_buffer(void)
|
||||
* file buffers.
|
||||
* quiet - should we print messages switching bufers
|
||||
*/
|
||||
bool close_buffer(bool quiet)
|
||||
{
|
||||
assert(openfile != NULL);
|
||||
|
||||
@@ -492,7 +521,7 @@ bool close_buffer(void)
|
||||
#endif
|
||||
|
||||
/* Switch to the next file buffer. */
|
||||
switch_to_next_buffer_void();
|
||||
switch_to_prevnext_buffer(TRUE, quiet);
|
||||
|
||||
/* Close the file buffer we had open before. */
|
||||
unlink_opennode(openfile->prev);
|
||||
@@ -888,10 +917,10 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkw
|
||||
* Return -2 if we say "New File", -1 if the file isn't opened, and the
|
||||
* fd opened otherwise. The file might still have an error while reading
|
||||
* with a 0 return value. *f is set to the opened file. */
|
||||
int open_file(const char *filename, bool newfie, FILE **f)
|
||||
int open_file(const char *filename, bool newfie, bool quiet, FILE **f)
|
||||
{
|
||||
struct stat fileinfo, fileinfo2;
|
||||
int fd, quiet = 0;
|
||||
int fd;
|
||||
char *full_filename;
|
||||
|
||||
assert(filename != NULL && f != NULL);
|
||||
@@ -906,16 +935,6 @@ int open_file(const char *filename, bool newfie, FILE **f)
|
||||
full_filename = mallocstrcpy(NULL, filename);
|
||||
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(LOCKING)) {
|
||||
int lockstatus = do_lockfile(full_filename);
|
||||
if (lockstatus < 0)
|
||||
return -1;
|
||||
else if (lockstatus == 0)
|
||||
quiet = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (stat(full_filename, &fileinfo) == -1) {
|
||||
/* Well, maybe we can open the file even if the OS says it's
|
||||
* not there. */
|
||||
@@ -1026,13 +1045,10 @@ void do_insertfile(
|
||||
size_t current_x_save = openfile->current_x;
|
||||
ssize_t current_y_save = openfile->current_y;
|
||||
bool edittop_inside = FALSE;
|
||||
const sc *s;
|
||||
#ifndef NANO_TINY
|
||||
bool right_side_up = FALSE, single_line = FALSE;
|
||||
#endif
|
||||
|
||||
currmenu = MINSERTFILE;
|
||||
|
||||
while (TRUE) {
|
||||
#ifndef NANO_TINY
|
||||
if (execute) {
|
||||
@@ -1084,14 +1100,13 @@ void do_insertfile(
|
||||
break;
|
||||
} else {
|
||||
size_t pww_save = openfile->placewewant;
|
||||
functionptrtype func = func_from_key(&i);
|
||||
|
||||
ans = mallocstrcpy(ans, answer);
|
||||
|
||||
s = get_shortcut(&i);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
if (s && s->scfunc == new_buffer_void) {
|
||||
if (func == new_buffer_void) {
|
||||
/* Don't allow toggling if we're in view mode. */
|
||||
if (!ISSET(VIEW_MODE))
|
||||
TOGGLE(MULTIBUFFER);
|
||||
@@ -1100,14 +1115,14 @@ void do_insertfile(
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
if (s && s->scfunc == flip_execute_void) {
|
||||
if (func == flip_execute_void) {
|
||||
execute = !execute;
|
||||
continue;
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
if (s && s->scfunc == to_files_void) {
|
||||
if (func == to_files_void) {
|
||||
char *tmp = do_browse_from(answer);
|
||||
|
||||
if (tmp == NULL)
|
||||
@@ -1131,18 +1146,18 @@ void do_insertfile(
|
||||
continue;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Keep track of whether the mark begins inside the
|
||||
* partition and will need adjustment. */
|
||||
if (openfile->mark_set) {
|
||||
filestruct *top, *bot;
|
||||
size_t top_x, bot_x;
|
||||
/* Keep track of whether the mark begins inside the
|
||||
* partition and will need adjustment. */
|
||||
if (openfile->mark_set) {
|
||||
filestruct *top, *bot;
|
||||
size_t top_x, bot_x;
|
||||
|
||||
mark_order((const filestruct **)&top, &top_x,
|
||||
mark_order((const filestruct **)&top, &top_x,
|
||||
(const filestruct **)&bot, &bot_x,
|
||||
&right_side_up);
|
||||
|
||||
single_line = (top == bot);
|
||||
}
|
||||
single_line = (top == bot);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
@@ -2234,9 +2249,6 @@ bool do_writeout(bool exiting)
|
||||
static bool did_credits = FALSE;
|
||||
#endif
|
||||
bool retval = FALSE;
|
||||
const sc *s;
|
||||
|
||||
currmenu = MWRITEFILE;
|
||||
|
||||
if (exiting && openfile->filename[0] != '\0' && ISSET(TEMP_FILE)) {
|
||||
retval = write_file(openfile->filename, NULL, FALSE, OVERWRITE,
|
||||
@@ -2306,11 +2318,12 @@ bool do_writeout(bool exiting)
|
||||
retval = FALSE;
|
||||
break;
|
||||
} else {
|
||||
functionptrtype func = func_from_key(&i);
|
||||
|
||||
ans = mallocstrcpy(ans, answer);
|
||||
s = get_shortcut(&i);
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
if (s && s->scfunc == to_files_void) {
|
||||
if (func == to_files_void) {
|
||||
char *tmp = do_browse_from(answer);
|
||||
|
||||
if (tmp == NULL)
|
||||
@@ -2322,26 +2335,26 @@ bool do_writeout(bool exiting)
|
||||
} else
|
||||
#endif /* !DISABLE_BROWSER */
|
||||
#ifndef NANO_TINY
|
||||
if (s && s->scfunc == dos_format_void) {
|
||||
if (func == dos_format_void) {
|
||||
openfile->fmt = (openfile->fmt == DOS_FILE) ? NIX_FILE :
|
||||
DOS_FILE;
|
||||
continue;
|
||||
} else if (s && s->scfunc == mac_format_void) {
|
||||
} else if (func == mac_format_void) {
|
||||
openfile->fmt = (openfile->fmt == MAC_FILE) ? NIX_FILE :
|
||||
MAC_FILE;
|
||||
continue;
|
||||
} else if (s && s->scfunc == backup_file_void) {
|
||||
} else if (func == backup_file_void) {
|
||||
TOGGLE(BACKUP_FILE);
|
||||
continue;
|
||||
} else
|
||||
#endif /* !NANO_TINY */
|
||||
if (s && s->scfunc == prepend_void) {
|
||||
if (func == prepend_void) {
|
||||
append = (append == PREPEND) ? OVERWRITE : PREPEND;
|
||||
continue;
|
||||
} else if (s && s->scfunc == append_void) {
|
||||
} else if (func == append_void) {
|
||||
append = (append == APPEND) ? OVERWRITE : APPEND;
|
||||
continue;
|
||||
} else if (s && s->scfunc == do_help_void) {
|
||||
} else if (func == do_help_void) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
294
src/global.c
294
src/global.c
@@ -42,6 +42,8 @@ bool meta_key;
|
||||
/* Whether the current keystroke is a Meta key. */
|
||||
bool func_key;
|
||||
/* Whether the current keystroke is an extended keypad value. */
|
||||
bool focusing = FALSE;
|
||||
/* Whether an update of the edit window should center the cursor. */
|
||||
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
ssize_t fill = 0;
|
||||
@@ -137,9 +139,9 @@ char *backup_dir = NULL;
|
||||
/* The directory where we store backup files. */
|
||||
|
||||
const char *locking_prefix = ".";
|
||||
/* Prefix of how to store the vim-style lock file. */
|
||||
/* Prefix of how to store the vim-style lock file. */
|
||||
const char *locking_suffix = ".swp";
|
||||
/* Suffix of the vim-style lock file. */
|
||||
/* Suffix of the vim-style lock file. */
|
||||
#endif
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
char *operating_dir = NULL;
|
||||
@@ -223,7 +225,7 @@ size_t length_of_list(int menu)
|
||||
size_t i = 0;
|
||||
|
||||
for (f = allfuncs; f != NULL; f = f->next)
|
||||
if ((f->menus & menu) != 0
|
||||
if ((f->menus & menu) != 0
|
||||
#ifndef DISABLE_HELP
|
||||
&& strlen(f->help) > 0
|
||||
#endif
|
||||
@@ -285,21 +287,7 @@ void flip_execute_void(void)
|
||||
{
|
||||
}
|
||||
|
||||
/* Set the type of command key based on the string. */
|
||||
key_type strtokeytype(const char *str)
|
||||
{
|
||||
if (str[0] == '^')
|
||||
return CONTROL;
|
||||
else if (str[0] == 'M')
|
||||
return META;
|
||||
else if (str[0] == 'F')
|
||||
return FKEY;
|
||||
else
|
||||
return RAWINPUT;
|
||||
}
|
||||
|
||||
/* Add a string to the function list struct.
|
||||
* Does not allow updates, not yet anyway. */
|
||||
/* Add a function to the function list. */
|
||||
void add_to_funcs(void (*func)(void), int menus, const char *desc, const char *help,
|
||||
bool blank_after, bool viewok)
|
||||
{
|
||||
@@ -326,54 +314,26 @@ void add_to_funcs(void (*func)(void), int menus, const char *desc, const char *h
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Return the first shortcut in the list of shortcuts that
|
||||
* matches the given func in the given menu. */
|
||||
const sc *first_sc_for(int menu, void (*func)(void))
|
||||
{
|
||||
const sc *s;
|
||||
|
||||
for (s = sclist; s != NULL; s = s->next)
|
||||
if ((s->menu & menu) && s->scfunc == func)
|
||||
return s;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Whoops, returning null given func %ld in menu %x\n", (long)func, menu);
|
||||
#endif
|
||||
/* Otherwise... */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* Add a string to the shortcut list.
|
||||
* Allows updates to existing entries in the list. */
|
||||
/* Add a key combo to the shortcut list. */
|
||||
void add_to_sclist(int menu, const char *scstring, void (*func)(void), int toggle)
|
||||
{
|
||||
sc *s;
|
||||
static sc *tailsc;
|
||||
sc *s = (sc *)nmalloc(sizeof(sc));
|
||||
|
||||
if (sclist == NULL) {
|
||||
sclist = (sc *)nmalloc(sizeof(sc));
|
||||
s = sclist;
|
||||
s->next = NULL;
|
||||
} else {
|
||||
for (s = sclist; s->next != NULL; s = s->next)
|
||||
if (s->menu == menu && s->keystr == scstring)
|
||||
break;
|
||||
/* Start the list, or tack on the next item. */
|
||||
if (sclist == NULL)
|
||||
sclist = s;
|
||||
else
|
||||
tailsc->next = s;
|
||||
tailsc = s;
|
||||
s->next = NULL;
|
||||
|
||||
if (s->menu != menu || s->keystr != scstring) { /* i.e. this is not a replace... */
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "No match found...\n");
|
||||
#endif
|
||||
s->next = (sc *)nmalloc(sizeof(sc));
|
||||
s = s->next;
|
||||
s->next = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
s->type = strtokeytype(scstring);
|
||||
/* Fill in the data. */
|
||||
s->menu = menu;
|
||||
s->scfunc = func;
|
||||
s->toggle = toggle;
|
||||
s->keystr = (char *) scstring;
|
||||
s->scfunc = func;
|
||||
s->type = strtokeytype(scstring);
|
||||
assign_keyinfo(s);
|
||||
|
||||
#ifdef DEBUG
|
||||
@@ -391,6 +351,23 @@ void replace_scs_for(void (*oldfunc)(void), void (*newfunc)(void))
|
||||
s->scfunc = newfunc;
|
||||
}
|
||||
|
||||
/* Return the first shortcut in the list of shortcuts that
|
||||
* matches the given func in the given menu. */
|
||||
const sc *first_sc_for(int menu, void (*func)(void))
|
||||
{
|
||||
const sc *s;
|
||||
|
||||
for (s = sclist; s != NULL; s = s->next)
|
||||
if ((s->menu & menu) && s->scfunc == func)
|
||||
return s;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Whoops, returning null given func %ld in menu %x\n", (long)func, menu);
|
||||
#endif
|
||||
/* Otherwise... */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Return the given menu's first shortcut sequence, or the default value
|
||||
* (2nd arg). Assumes currmenu for the menu to check. */
|
||||
int sc_seq_or(void (*func)(void), int defaultval)
|
||||
@@ -399,7 +376,7 @@ int sc_seq_or(void (*func)(void), int defaultval)
|
||||
|
||||
if (s) {
|
||||
meta_key = (s->type == META);
|
||||
return s->seq;
|
||||
return s->seq;
|
||||
}
|
||||
/* else */
|
||||
return defaultval;
|
||||
@@ -416,21 +393,34 @@ functionptrtype func_from_key(int *kbinput)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Return the type of command key based on the given string. */
|
||||
key_type strtokeytype(const char *str)
|
||||
{
|
||||
if (str[0] == '^')
|
||||
return CONTROL;
|
||||
else if (str[0] == 'M')
|
||||
return META;
|
||||
else if (str[0] == 'F')
|
||||
return FKEY;
|
||||
else
|
||||
return RAWINPUT;
|
||||
}
|
||||
|
||||
/* Assign the info to the shortcut struct.
|
||||
* Assumes keystr is already assigned, naturally. */
|
||||
void assign_keyinfo(sc *s)
|
||||
{
|
||||
if (s->type == CONTROL) {
|
||||
assert(strlen(s->keystr) > 1);
|
||||
s->seq = s->keystr[1] - 64;
|
||||
assert(strlen(s->keystr) > 1);
|
||||
s->seq = s->keystr[1] - 64;
|
||||
} else if (s->type == META) {
|
||||
assert(strlen(s->keystr) > 2);
|
||||
s->seq = tolower((int) s->keystr[2]);
|
||||
assert(strlen(s->keystr) > 2);
|
||||
s->seq = tolower((int) s->keystr[2]);
|
||||
} else if (s->type == FKEY) {
|
||||
assert(strlen(s->keystr) > 1);
|
||||
s->seq = KEY_F0 + atoi(&s->keystr[1]);
|
||||
assert(strlen(s->keystr) > 1);
|
||||
s->seq = KEY_F0 + atoi(&s->keystr[1]);
|
||||
} else /* RAWINPUT */
|
||||
s->seq = (int) s->keystr[0];
|
||||
s->seq = (int) s->keystr[0];
|
||||
|
||||
/* Override some keys which don't bind as easily as we'd like. */
|
||||
if (s->type == CONTROL && (!strcasecmp(&s->keystr[1], "space")))
|
||||
@@ -651,6 +641,9 @@ void shortcut_init(void)
|
||||
const char *nano_lint_msg = N_("Invoke the linter, if available");
|
||||
const char *nano_prevlint_msg = N_("Go to previous linter msg");
|
||||
const char *nano_nextlint_msg = N_("Go to next linter msg");
|
||||
#ifndef DISABLE_SPELLER
|
||||
const char *nano_formatter_msg = N_("Invoke formatter, if available");
|
||||
#endif
|
||||
#endif
|
||||
#endif /* !DISABLE_HELP */
|
||||
|
||||
@@ -661,9 +654,9 @@ void shortcut_init(void)
|
||||
#endif
|
||||
|
||||
while (allfuncs != NULL) {
|
||||
subnfunc *f = allfuncs;
|
||||
allfuncs = allfuncs->next;
|
||||
free(f);
|
||||
subnfunc *f = allfuncs;
|
||||
allfuncs = allfuncs->next;
|
||||
free(f);
|
||||
}
|
||||
|
||||
/* Start populating the different menus with functions. */
|
||||
@@ -746,7 +739,11 @@ void shortcut_init(void)
|
||||
|
||||
#ifndef DISABLE_COLOR
|
||||
add_to_funcs(do_linter, MMAIN,
|
||||
N_("To Linter"), IFSCHELP(nano_lint_msg), BLANKAFTER, NOVIEW);
|
||||
N_("To Linter"), IFSCHELP(nano_lint_msg), TOGETHER, NOVIEW);
|
||||
#ifndef DISABLE_SPELLER
|
||||
add_to_funcs(do_formatter, MMAIN,
|
||||
N_("Formatter"), IFSCHELP(nano_formatter_msg), BLANKAFTER, NOVIEW);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef NANO_TINY
|
||||
@@ -933,28 +930,28 @@ void shortcut_init(void)
|
||||
* specified on the command line, and the fifth is useless since
|
||||
* backups are disabled. */
|
||||
if (!ISSET(RESTRICTED)) {
|
||||
add_to_funcs(dos_format_void, MWRITEFILE,
|
||||
N_("DOS Format"), IFSCHELP(nano_dos_msg), TOGETHER, NOVIEW);
|
||||
add_to_funcs(dos_format_void, MWRITEFILE,
|
||||
N_("DOS Format"), IFSCHELP(nano_dos_msg), TOGETHER, NOVIEW);
|
||||
|
||||
add_to_funcs(mac_format_void, MWRITEFILE,
|
||||
N_("Mac Format"), IFSCHELP(nano_mac_msg), TOGETHER, NOVIEW);
|
||||
add_to_funcs(mac_format_void, MWRITEFILE,
|
||||
N_("Mac Format"), IFSCHELP(nano_mac_msg), TOGETHER, NOVIEW);
|
||||
|
||||
add_to_funcs(append_void, MWRITEFILE,
|
||||
N_("Append"), IFSCHELP(nano_append_msg), TOGETHER, NOVIEW);
|
||||
add_to_funcs(prepend_void, MWRITEFILE,
|
||||
N_("Prepend"), IFSCHELP(nano_prepend_msg), TOGETHER, NOVIEW);
|
||||
add_to_funcs(append_void, MWRITEFILE,
|
||||
N_("Append"), IFSCHELP(nano_append_msg), TOGETHER, NOVIEW);
|
||||
add_to_funcs(prepend_void, MWRITEFILE,
|
||||
N_("Prepend"), IFSCHELP(nano_prepend_msg), TOGETHER, NOVIEW);
|
||||
|
||||
add_to_funcs(backup_file_void, MWRITEFILE,
|
||||
N_("Backup File"), IFSCHELP(nano_backup_msg), TOGETHER, NOVIEW);
|
||||
add_to_funcs(backup_file_void, MWRITEFILE,
|
||||
N_("Backup File"), IFSCHELP(nano_backup_msg), TOGETHER, NOVIEW);
|
||||
}
|
||||
|
||||
/* If we're using restricted mode, file insertion is disabled, and
|
||||
* thus command execution and the multibuffer toggle have no place. */
|
||||
if (!ISSET(RESTRICTED)) {
|
||||
add_to_funcs(flip_execute_void, MINSERTFILE,
|
||||
add_to_funcs(flip_execute_void, MINSERTFILE,
|
||||
N_("Execute Command"), IFSCHELP(nano_execute_msg), TOGETHER, NOVIEW);
|
||||
|
||||
add_to_funcs(flip_execute_void, MEXTCMD,
|
||||
add_to_funcs(flip_execute_void, MEXTCMD,
|
||||
read_file_tag, IFSCHELP(nano_insert_msg), TOGETHER, NOVIEW);
|
||||
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
@@ -1015,6 +1012,10 @@ void shortcut_init(void)
|
||||
#ifndef DISABLE_SPELLER
|
||||
add_to_sclist(MMAIN, "^T", do_spell, 0);
|
||||
add_to_sclist(MMAIN, "F12", do_spell, 0);
|
||||
#ifndef DISABLE_COLOR
|
||||
add_to_sclist(MMAIN, "^T", do_formatter, 0);
|
||||
add_to_sclist(MMAIN, "F12", do_formatter, 0);
|
||||
#endif
|
||||
#else
|
||||
#ifndef DISABLE_COLOR
|
||||
add_to_sclist(MMAIN, "^T", do_linter, 0);
|
||||
@@ -1026,12 +1027,12 @@ void shortcut_init(void)
|
||||
add_to_sclist(MMAIN, "^_", do_gotolinecolumn_void, 0);
|
||||
add_to_sclist(MMAIN, "M-G", do_gotolinecolumn_void, 0);
|
||||
add_to_sclist(MMAIN, "F13", do_gotolinecolumn_void, 0);
|
||||
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE|MLINTER, "^Y", do_page_up, 0);
|
||||
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE|MLINTER, "F7", do_page_up, 0);
|
||||
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE|MLINTER, "PgUp", do_page_up, 0);
|
||||
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE|MLINTER, "^V", do_page_down, 0);
|
||||
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE|MLINTER, "F8", do_page_down, 0);
|
||||
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE|MLINTER, "PgDn", do_page_down, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "^Y", do_page_up, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "F7", do_page_up, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "PgUp", do_page_up, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "^V", do_page_down, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "F8", do_page_down, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "PgDn", do_page_down, 0);
|
||||
add_to_sclist(MMAIN|MHELP, "M-\\", do_first_line, 0);
|
||||
add_to_sclist(MMAIN|MHELP, "M-|", do_first_line, 0);
|
||||
add_to_sclist(MMAIN|MHELP, "M-/", do_last_line, 0);
|
||||
@@ -1156,11 +1157,13 @@ void shortcut_init(void)
|
||||
#ifndef DISABLE_BROWSER
|
||||
add_to_sclist(MBROWSER|MWHEREISFILE, "M-\\", do_first_file, 0);
|
||||
add_to_sclist(MBROWSER|MWHEREISFILE, "M-|", do_first_file, 0);
|
||||
add_to_sclist(MWHEREISFILE, "^Y", do_first_file, 0);
|
||||
add_to_sclist(MBROWSER|MWHEREISFILE, "M-/", do_last_file, 0);
|
||||
add_to_sclist(MBROWSER|MWHEREISFILE, "M-?", do_last_file, 0);
|
||||
add_to_sclist(MBROWSER|MWHEREISFILE, "^_", goto_dir_void, 0);
|
||||
add_to_sclist(MBROWSER|MWHEREISFILE, "M-G", goto_dir_void, 0);
|
||||
add_to_sclist(MBROWSER|MWHEREISFILE, "F13", goto_dir_void, 0);
|
||||
add_to_sclist(MWHEREISFILE, "^V", do_last_file, 0);
|
||||
add_to_sclist(MBROWSER, "^_", goto_dir_void, 0);
|
||||
add_to_sclist(MBROWSER, "M-G", goto_dir_void, 0);
|
||||
add_to_sclist(MBROWSER, "F13", goto_dir_void, 0);
|
||||
#endif
|
||||
add_to_sclist(MWRITEFILE, "M-D", dos_format_void, 0);
|
||||
add_to_sclist(MWRITEFILE, "M-M", mac_format_void, 0);
|
||||
@@ -1190,17 +1193,24 @@ void shortcut_init(void)
|
||||
}
|
||||
|
||||
#ifndef DISABLE_COLOR
|
||||
void set_lint_shortcuts(void)
|
||||
void set_lint_or_format_shortcuts(void)
|
||||
{
|
||||
#ifndef DISABLE_SPELLER
|
||||
replace_scs_for(do_spell, do_linter);
|
||||
if (openfile->syntax->formatter) {
|
||||
replace_scs_for(do_spell, do_formatter);
|
||||
replace_scs_for(do_linter, do_formatter);
|
||||
} else {
|
||||
replace_scs_for(do_spell, do_linter);
|
||||
replace_scs_for(do_formatter, do_linter);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void set_spell_shortcuts(void)
|
||||
{
|
||||
#ifndef DISABLE_SPELLER
|
||||
replace_scs_for(do_linter, do_spell);
|
||||
replace_scs_for(do_formatter, do_spell);
|
||||
replace_scs_for(do_linter, do_spell);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@@ -1221,44 +1231,44 @@ const subnfunc *sctofunc(sc *s)
|
||||
const char *flagtostr(int flag)
|
||||
{
|
||||
switch (flag) {
|
||||
case NO_HELP:
|
||||
/* TRANSLATORS: The next seventeen strings are toggle descriptions;
|
||||
* they are best kept shorter than 40 characters, but may be longer. */
|
||||
return N_("Help mode");
|
||||
case CONST_UPDATE:
|
||||
return N_("Constant cursor position display");
|
||||
case MORE_SPACE:
|
||||
return N_("Use of one more line for editing");
|
||||
case SMOOTH_SCROLL:
|
||||
return N_("Smooth scrolling");
|
||||
case SOFTWRAP:
|
||||
return N_("Soft wrapping of overlong lines");
|
||||
case WHITESPACE_DISPLAY:
|
||||
return N_("Whitespace display");
|
||||
case NO_COLOR_SYNTAX:
|
||||
return N_("Color syntax highlighting");
|
||||
case SMART_HOME:
|
||||
return N_("Smart home key");
|
||||
case AUTOINDENT:
|
||||
return N_("Auto indent");
|
||||
case CUT_TO_END:
|
||||
return N_("Cut to end");
|
||||
case NO_WRAP:
|
||||
return N_("Hard wrapping of overlong lines");
|
||||
case TABS_TO_SPACES:
|
||||
return N_("Conversion of typed tabs to spaces");
|
||||
case BACKUP_FILE:
|
||||
return N_("Backup files");
|
||||
case MULTIBUFFER:
|
||||
return N_("Multiple file buffers");
|
||||
case USE_MOUSE:
|
||||
return N_("Mouse support");
|
||||
case NO_CONVERT:
|
||||
return N_("No conversion from DOS/Mac format");
|
||||
case SUSPEND:
|
||||
return N_("Suspension");
|
||||
default:
|
||||
return "?????";
|
||||
case NO_HELP:
|
||||
/* TRANSLATORS: The next seventeen strings are toggle descriptions;
|
||||
* they are best kept shorter than 40 characters, but may be longer. */
|
||||
return N_("Help mode");
|
||||
case CONST_UPDATE:
|
||||
return N_("Constant cursor position display");
|
||||
case MORE_SPACE:
|
||||
return N_("Use of one more line for editing");
|
||||
case SMOOTH_SCROLL:
|
||||
return N_("Smooth scrolling");
|
||||
case SOFTWRAP:
|
||||
return N_("Soft wrapping of overlong lines");
|
||||
case WHITESPACE_DISPLAY:
|
||||
return N_("Whitespace display");
|
||||
case NO_COLOR_SYNTAX:
|
||||
return N_("Color syntax highlighting");
|
||||
case SMART_HOME:
|
||||
return N_("Smart home key");
|
||||
case AUTOINDENT:
|
||||
return N_("Auto indent");
|
||||
case CUT_TO_END:
|
||||
return N_("Cut to end");
|
||||
case NO_WRAP:
|
||||
return N_("Hard wrapping of overlong lines");
|
||||
case TABS_TO_SPACES:
|
||||
return N_("Conversion of typed tabs to spaces");
|
||||
case BACKUP_FILE:
|
||||
return N_("Backup files");
|
||||
case MULTIBUFFER:
|
||||
return N_("Multiple file buffers");
|
||||
case USE_MOUSE:
|
||||
return N_("Mouse support");
|
||||
case NO_CONVERT:
|
||||
return N_("No conversion from DOS/Mac format");
|
||||
case SUSPEND:
|
||||
return N_("Suspension");
|
||||
default:
|
||||
return "?????";
|
||||
}
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
@@ -1310,6 +1320,10 @@ sc *strtosc(char *input)
|
||||
else if (!strcasecmp(input, "tospell") ||
|
||||
!strcasecmp(input, "speller"))
|
||||
s->scfunc = do_spell;
|
||||
#endif
|
||||
#ifndef DISABLE_COLOR
|
||||
else if (!strcasecmp(input, "linter"))
|
||||
s->scfunc = do_linter;
|
||||
#endif
|
||||
else if (!strcasecmp(input, "curpos") ||
|
||||
!strcasecmp(input, "cursorpos"))
|
||||
@@ -1569,7 +1583,7 @@ void thanks_for_all_the_fish(void)
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
if (backup_dir != NULL)
|
||||
free(backup_dir);
|
||||
free(backup_dir);
|
||||
#endif
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
if (operating_dir != NULL)
|
||||
@@ -1663,14 +1677,14 @@ void thanks_for_all_the_fish(void)
|
||||
#endif
|
||||
/* Free the functions and shortcuts lists. */
|
||||
while (allfuncs != NULL) {
|
||||
subnfunc *f = allfuncs;
|
||||
allfuncs = allfuncs->next;
|
||||
free(f);
|
||||
subnfunc *f = allfuncs;
|
||||
allfuncs = allfuncs->next;
|
||||
free(f);
|
||||
}
|
||||
while (sclist != NULL) {
|
||||
sc *s = sclist;
|
||||
sclist = sclist->next;
|
||||
free(s);
|
||||
sc *s = sclist;
|
||||
sclist = sclist->next;
|
||||
free(s);
|
||||
}
|
||||
#ifndef DISABLE_NANORC
|
||||
if (homedir != NULL)
|
||||
|
||||
@@ -62,10 +62,6 @@ void do_help(void (*refresh_func)(void))
|
||||
|
||||
assert(help_text != NULL);
|
||||
|
||||
/* Set currmenu to allow clicking on the help screen's shortcut
|
||||
* list, after help_init() is called. */
|
||||
currmenu = MHELP;
|
||||
|
||||
if (ISSET(NO_HELP)) {
|
||||
/* Make sure that the help screen's shortcut list will actually
|
||||
* be displayed. */
|
||||
@@ -158,15 +154,14 @@ void do_help(void (*refresh_func)(void))
|
||||
}
|
||||
}
|
||||
|
||||
currmenu = oldmenu;
|
||||
|
||||
if (old_no_help) {
|
||||
blank_bottombars();
|
||||
wnoutrefresh(bottomwin);
|
||||
currmenu = oldmenu;
|
||||
SET(NO_HELP);
|
||||
window_init();
|
||||
} else
|
||||
bottombars(currmenu);
|
||||
bottombars(oldmenu);
|
||||
|
||||
curs_set(1);
|
||||
refresh_func();
|
||||
|
||||
49
src/nano.c
49
src/nano.c
@@ -178,7 +178,8 @@ void renumber(filestruct *fileptr)
|
||||
{
|
||||
ssize_t line;
|
||||
|
||||
assert(fileptr != NULL);
|
||||
if (fileptr == NULL)
|
||||
return;
|
||||
|
||||
line = (fileptr->prev == NULL) ? 0 : fileptr->prev->lineno;
|
||||
|
||||
@@ -365,8 +366,7 @@ void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
|
||||
|
||||
/* Renumber starting with the line after the original
|
||||
* file_bot. */
|
||||
if (file_bot_save->next != NULL)
|
||||
renumber(file_bot_save->next);
|
||||
renumber(file_bot_save->next);
|
||||
}
|
||||
|
||||
/* Since the text has now been saved, remove it from the
|
||||
@@ -719,9 +719,9 @@ void die_save_file(const char *die_filename
|
||||
_("Too many backup files?"));
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Try and chmod/chown the save file to the values of the original file, but
|
||||
dont worry if it fails because we're supposed to be bailing as fast
|
||||
as possible. */
|
||||
/* Try and chmod/chown the save file to the values of the original file,
|
||||
* but don't worry if it fails because we're supposed to be bailing as
|
||||
* fast as possible. */
|
||||
if (die_stat) {
|
||||
int shush;
|
||||
shush = chmod(retval, die_stat->st_mode);
|
||||
@@ -960,9 +960,8 @@ void usage(void)
|
||||
* it was compiled with. */
|
||||
void version(void)
|
||||
{
|
||||
printf(_(" GNU nano version %s (compiled %s, %s)\n"), VERSION,
|
||||
__TIME__, __DATE__);
|
||||
printf(" (C) 1999..2014 Free Software Foundation, Inc.\n");
|
||||
printf(_(" GNU nano, version %s\n"), VERSION);
|
||||
printf(" (C) 1999..2015 Free Software Foundation, Inc.\n");
|
||||
printf(
|
||||
_(" Email: nano@nano-editor.org Web: http://www.nano-editor.org/"));
|
||||
printf(_("\n Compiled options:"));
|
||||
@@ -1146,13 +1145,13 @@ void do_exit(void)
|
||||
if (i == 0 || (i == 1 && do_writeout(TRUE))) {
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(LOCKING) && openfile->lock_filename)
|
||||
delete_lockfile(openfile->lock_filename);
|
||||
if (ISSET(LOCKING) && openfile->lock_filename)
|
||||
delete_lockfile(openfile->lock_filename);
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
/* Exit only if there are no more open file buffers. */
|
||||
if (!close_buffer())
|
||||
if (!close_buffer(FALSE))
|
||||
#endif
|
||||
finish();
|
||||
/* If the user canceled, we go on. */
|
||||
@@ -1181,20 +1180,20 @@ void finish_stdin_pager(void)
|
||||
|
||||
/* Read whatever we did get from stdin. */
|
||||
f = fopen("/dev/stdin", "rb");
|
||||
if (f == NULL)
|
||||
nperror("fopen");
|
||||
if (f == NULL)
|
||||
nperror("fopen");
|
||||
|
||||
read_file(f, 0, "stdin", TRUE, FALSE);
|
||||
ttystdin = open("/dev/tty", O_RDONLY);
|
||||
if (!ttystdin)
|
||||
die(_("Couldn't reopen stdin from keyboard, sorry\n"));
|
||||
die(_("Couldn't reopen stdin from keyboard, sorry\n"));
|
||||
|
||||
dup2(ttystdin,0);
|
||||
close(ttystdin);
|
||||
if (!pager_input_aborted)
|
||||
tcgetattr(0, &oldterm);
|
||||
if (!pager_sig_failed && sigaction(SIGINT, &pager_oldaction, NULL) == -1)
|
||||
nperror("sigaction");
|
||||
nperror("sigaction");
|
||||
terminal_init();
|
||||
doupdate();
|
||||
}
|
||||
@@ -1202,7 +1201,6 @@ void finish_stdin_pager(void)
|
||||
/* Cancel reading from stdin like a pager. */
|
||||
RETSIGTYPE cancel_stdin_pager(int signal)
|
||||
{
|
||||
/* Currently do nothing, just handle the intr silently. */
|
||||
pager_input_aborted = TRUE;
|
||||
}
|
||||
|
||||
@@ -1214,13 +1212,13 @@ void stdin_pager(void)
|
||||
tcsetattr(0, TCSANOW, &oldterm);
|
||||
fprintf(stderr, _("Reading from stdin, ^C to abort\n"));
|
||||
|
||||
/* Set things up so that Ctrl-C will cancel the new process. */
|
||||
/* Enable interpretation of the special control keys so that
|
||||
* we get SIGINT when Ctrl-C is pressed. */
|
||||
#ifndef NANO_TINY
|
||||
enable_signals();
|
||||
#endif
|
||||
|
||||
/* Set things up so that SIGINT will cancel the new process. */
|
||||
if (sigaction(SIGINT, NULL, &pager_newaction) == -1) {
|
||||
pager_sig_failed = TRUE;
|
||||
nperror("sigaction");
|
||||
@@ -1284,9 +1282,8 @@ RETSIGTYPE handle_hupterm(int signal)
|
||||
/* Handler for SIGTSTP (suspend). */
|
||||
RETSIGTYPE do_suspend(int signal)
|
||||
{
|
||||
|
||||
if (ISSET(RESTRICTED)) {
|
||||
nano_disabled_msg();
|
||||
nano_disabled_msg();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1482,13 +1479,13 @@ void do_toggle(int flag)
|
||||
desc = (char *) _(flagtostr(flag));
|
||||
statusbar("%s %s", desc, enabled ? _("enabled") : _("disabled"));
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* Bleh. */
|
||||
void do_toggle_void(void)
|
||||
{
|
||||
;
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* Disable extended input and output processing in our terminal
|
||||
* settings. */
|
||||
@@ -1806,7 +1803,7 @@ int do_mouse(void)
|
||||
mouse_x, (unsigned long)openfile->current_x);
|
||||
#endif
|
||||
} else {
|
||||
openfile->current_x = actual_x(openfile->current->data, mouse_x);
|
||||
openfile->current_x = actual_x(openfile->current->data, mouse_x);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "do_mouse(): i <= mouse_y, mouse_x = %d, setting current_x to = %lu\n",
|
||||
mouse_x, (unsigned long)openfile->current_x);
|
||||
@@ -2483,8 +2480,8 @@ int main(int argc, char **argv)
|
||||
do_rcfile();
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "After rebinding keys...\n");
|
||||
print_sclist();
|
||||
fprintf(stderr, "After rebinding keys...\n");
|
||||
print_sclist();
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
@@ -2741,7 +2738,7 @@ int main(int argc, char **argv)
|
||||
icol = 1;
|
||||
}
|
||||
#ifndef DISABLE_HISTORIES
|
||||
else {
|
||||
else {
|
||||
/* See if we have a POS history to use if we haven't overridden it. */
|
||||
ssize_t savedposline, savedposcol;
|
||||
if (check_poshistory(argv[i], &savedposline, &savedposcol))
|
||||
@@ -2826,7 +2823,7 @@ int main(int argc, char **argv)
|
||||
if (ISSET(CONST_UPDATE) && get_key_buffer_len() == 0)
|
||||
do_cursorpos(TRUE);
|
||||
|
||||
currmenu = MMAIN;
|
||||
currmenu = MMAIN;
|
||||
|
||||
/* Read in and interpret characters. */
|
||||
do_input(TRUE);
|
||||
|
||||
@@ -251,6 +251,8 @@ typedef struct syntaxtype {
|
||||
/* The colors used in this syntax. */
|
||||
char *linter;
|
||||
/* The command to lint this type of file. */
|
||||
char *formatter;
|
||||
/* Use this formatter command (for programming lang mainly) */
|
||||
int nmultis;
|
||||
/* How many multi-line strings this syntax has. */
|
||||
struct syntaxtype *next;
|
||||
|
||||
33
src/prompt.c
33
src/prompt.c
@@ -151,15 +151,15 @@ int do_statusbar_input(bool *ran_func, bool *finished,
|
||||
if (!ISSET(RESTRICTED) || openfile->filename[0] ==
|
||||
'\0' || currmenu != MWRITEFILE)
|
||||
do_statusbar_cut_text();
|
||||
} else if (s->scfunc == do_right)
|
||||
do_statusbar_right();
|
||||
else if (s->scfunc == do_left)
|
||||
} else if (s->scfunc == do_left)
|
||||
do_statusbar_left();
|
||||
else if (s->scfunc == do_right)
|
||||
do_statusbar_right();
|
||||
#ifndef NANO_TINY
|
||||
else if (s->scfunc == do_next_word_void)
|
||||
do_statusbar_next_word(FALSE);
|
||||
else if (s->scfunc == do_prev_word_void)
|
||||
do_statusbar_prev_word(FALSE);
|
||||
else if (s->scfunc == do_next_word_void)
|
||||
do_statusbar_next_word(FALSE);
|
||||
#endif
|
||||
else if (s->scfunc == do_home)
|
||||
do_statusbar_home();
|
||||
@@ -340,13 +340,12 @@ void do_statusbar_home(void)
|
||||
statusbar_x = 0;
|
||||
|
||||
statusbar_pww = statusbar_xplustabs();
|
||||
} else {
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
statusbar_x = 0;
|
||||
statusbar_pww = statusbar_xplustabs();
|
||||
#ifndef NANO_TINY
|
||||
}
|
||||
#endif
|
||||
|
||||
if (need_statusbar_horizontal_update(pww_save))
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
@@ -431,14 +430,13 @@ void do_statusbar_cut_text(void)
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(CUT_TO_END))
|
||||
null_at(&answer, statusbar_x);
|
||||
else {
|
||||
else
|
||||
#endif
|
||||
{
|
||||
null_at(&answer, 0);
|
||||
statusbar_x = 0;
|
||||
statusbar_pww = statusbar_xplustabs();
|
||||
#ifndef NANO_TINY
|
||||
}
|
||||
#endif
|
||||
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
}
|
||||
@@ -777,7 +775,7 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answer, (unsigned long) statusbar_x);
|
||||
fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answer, (unsigned long) statusbar_x);
|
||||
#endif
|
||||
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
@@ -901,7 +899,6 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answe
|
||||
wnoutrefresh(bottomwin);
|
||||
}
|
||||
|
||||
|
||||
#ifndef DISABLE_HISTORIES
|
||||
/* Set the current position in the history list to the bottom,
|
||||
* and free magichistory if we need to. */
|
||||
@@ -913,7 +910,6 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answe
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* We've finished putting in an answer or run a normal shortcut's
|
||||
* associated function, so reset statusbar_x and statusbar_pww. If
|
||||
* we've finished putting in an answer, reset the statusbar cursor
|
||||
@@ -973,7 +969,6 @@ int do_prompt(bool allow_tabs,
|
||||
|
||||
prompt = charalloc(((COLS - 4) * mb_cur_max()) + 1);
|
||||
|
||||
currmenu = menu;
|
||||
bottombars(menu);
|
||||
|
||||
va_start(ap, msg);
|
||||
@@ -1045,7 +1040,6 @@ int do_yesno_prompt(bool all, const char *msg)
|
||||
const char *yesstr; /* String of Yes characters accepted. */
|
||||
const char *nostr; /* Same for No. */
|
||||
const char *allstr; /* And All, surprise! */
|
||||
const sc *s;
|
||||
int oldmenu = currmenu;
|
||||
|
||||
assert(msg != NULL);
|
||||
@@ -1106,15 +1100,16 @@ int do_yesno_prompt(bool all, const char *msg)
|
||||
|
||||
do {
|
||||
int kbinput;
|
||||
functionptrtype func;
|
||||
#ifndef DISABLE_MOUSE
|
||||
int mouse_x, mouse_y;
|
||||
#endif
|
||||
|
||||
currmenu = MYESNO;
|
||||
kbinput = get_kbinput(bottomwin);
|
||||
s = get_shortcut(&kbinput);
|
||||
func = func_from_key(&kbinput);
|
||||
|
||||
if (s && s->scfunc == do_cancel)
|
||||
if (func == do_cancel)
|
||||
ok = -1;
|
||||
#ifndef DISABLE_MOUSE
|
||||
else if (kbinput == KEY_MOUSE) {
|
||||
@@ -1146,7 +1141,7 @@ int do_yesno_prompt(bool all, const char *msg)
|
||||
}
|
||||
}
|
||||
#endif /* !DISABLE_MOUSE */
|
||||
else if (s && s->scfunc == total_refresh) {
|
||||
else if (func == total_refresh) {
|
||||
total_redraw();
|
||||
continue;
|
||||
} else {
|
||||
|
||||
19
src/proto.h
19
src/proto.h
@@ -34,6 +34,7 @@ extern bool jump_buf_main;
|
||||
|
||||
extern bool meta_key;
|
||||
extern bool func_key;
|
||||
extern bool focusing;
|
||||
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
extern ssize_t fill;
|
||||
@@ -148,10 +149,9 @@ char *do_browse_from(const char *inpath);
|
||||
void browser_init(const char *path, DIR *dir);
|
||||
functionptrtype parse_browser_input(int *kbinput);
|
||||
void browser_refresh(void);
|
||||
bool browser_select_filename(const char *needle);
|
||||
void browser_select_dirname(const char *needle);
|
||||
int filesearch_init(void);
|
||||
bool findnextfile(bool no_sameline, size_t begin, const char *needle);
|
||||
void findnextfile_wrap_reset(void);
|
||||
void findnextfile(const char *needle);
|
||||
void filesearch_abort(void);
|
||||
void do_filesearch(void);
|
||||
void do_fileresearch(void);
|
||||
@@ -283,15 +283,15 @@ void replace_buffer(const char *filename);
|
||||
#endif
|
||||
void display_buffer(void);
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
void switch_to_prevnext_buffer(bool next);
|
||||
void switch_to_prevnext_buffer(bool next, bool quiet);
|
||||
void switch_to_prev_buffer_void(void);
|
||||
void switch_to_next_buffer_void(void);
|
||||
bool close_buffer(void);
|
||||
bool close_buffer(bool quiet);
|
||||
#endif
|
||||
filestruct *read_line(char *buf, filestruct *prevnode, bool
|
||||
*first_line_ins, size_t buf_len);
|
||||
void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkwritable);
|
||||
int open_file(const char *filename, bool newfie, FILE **f);
|
||||
int open_file(const char *filename, bool newfie, bool quiet, FILE **f);
|
||||
char *get_next_filename(const char *name, const char *suffix);
|
||||
void do_insertfile(
|
||||
#ifndef NANO_TINY
|
||||
@@ -359,7 +359,7 @@ void assign_keyinfo(sc *s);
|
||||
void print_sclist(void);
|
||||
void shortcut_init(void);
|
||||
#ifndef DISABLE_COLOR
|
||||
void set_lint_shortcuts(void);
|
||||
void set_lint_or_format_shortcuts(void);
|
||||
void set_spell_shortcuts(void);
|
||||
#endif
|
||||
const subnfunc *sctofunc(sc *s);
|
||||
@@ -480,8 +480,8 @@ RETSIGTYPE do_continue(int signal);
|
||||
RETSIGTYPE handle_sigwinch(int signal);
|
||||
void allow_pending_sigwinch(bool allow);
|
||||
void do_toggle(int flag);
|
||||
void do_toggle_void(void);
|
||||
#endif
|
||||
void do_toggle_void(void);
|
||||
void disable_extended_io(void);
|
||||
#ifdef USE_SLANG
|
||||
void disable_signals(void);
|
||||
@@ -688,6 +688,7 @@ void do_spell(void);
|
||||
#endif
|
||||
#ifndef DISABLE_COLOR
|
||||
void do_linter(void);
|
||||
void do_formatter(void);
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
void do_wordlinechar_count(void);
|
||||
@@ -780,7 +781,7 @@ void check_statusblank(void);
|
||||
char *display_string(const char *buf, size_t start_col, size_t len, bool
|
||||
dollars);
|
||||
void titlebar(const char *path);
|
||||
void set_modified(void);
|
||||
extern void set_modified(void);
|
||||
void statusbar(const char *msg, ...);
|
||||
void bottombars(int menu);
|
||||
void onekey(const char *keystroke, const char *desc, size_t len);
|
||||
|
||||
59
src/rcfile.c
59
src/rcfile.c
@@ -328,6 +328,7 @@ void parse_syntax(char *ptr)
|
||||
endsyntax->next = NULL;
|
||||
endsyntax->nmultis = 0;
|
||||
endsyntax->linter = NULL;
|
||||
endsyntax->formatter = NULL;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Starting a new syntax type: \"%s\"\n", nameptr);
|
||||
@@ -513,6 +514,10 @@ void parse_binding(char *ptr, bool dobind)
|
||||
if (f->scfunc == newsc->scfunc)
|
||||
mask = mask | f->menus;
|
||||
|
||||
/* Handle the special case of the toggles. */
|
||||
if (newsc->scfunc == do_toggle_void)
|
||||
mask = MMAIN;
|
||||
|
||||
/* Now limit the given menu to those where the function exists. */
|
||||
if (is_universal(newsc->scfunc))
|
||||
menu = menu & MMOST;
|
||||
@@ -596,11 +601,7 @@ static void _parse_include(char *file)
|
||||
fprintf(stderr, "Parsing file \"%s\"\n", file);
|
||||
#endif
|
||||
|
||||
parse_rcfile(rcstream
|
||||
#ifndef DISABLE_COLOR
|
||||
, TRUE
|
||||
#endif
|
||||
);
|
||||
parse_rcfile(rcstream, TRUE);
|
||||
}
|
||||
|
||||
void parse_include(char *ptr)
|
||||
@@ -902,11 +903,10 @@ void parse_header_exp(char *ptr)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef DISABLE_COLOR
|
||||
#ifdef HAVE_LIBMAGIC
|
||||
/* Parse the magic regexes that may influence the choice of syntax. */
|
||||
void parse_magic_exp(char *ptr)
|
||||
{
|
||||
#ifdef HAVE_LIBMAGIC
|
||||
regexlisttype *endmagic = NULL;
|
||||
|
||||
assert(ptr != NULL);
|
||||
@@ -966,11 +966,10 @@ void parse_magic_exp(char *ptr)
|
||||
} else
|
||||
free(newmagic);
|
||||
}
|
||||
#endif /* HAVE_LIBMAGIC */
|
||||
}
|
||||
#endif /* !DISABLE_COLOR */
|
||||
#endif /* HAVE_LIBMAGIC */
|
||||
|
||||
/* Parse the linter requested for this syntax. Simple? */
|
||||
/* Parse the linter requested for this syntax. */
|
||||
void parse_linter(char *ptr)
|
||||
{
|
||||
assert(ptr != NULL);
|
||||
@@ -993,8 +992,36 @@ void parse_linter(char *ptr)
|
||||
if (!strcmp(ptr, "\"\""))
|
||||
endsyntax->linter = NULL;
|
||||
else
|
||||
endsyntax->linter = mallocstrcpy(syntaxes->linter, ptr);
|
||||
endsyntax->linter = mallocstrcpy(NULL, ptr);
|
||||
}
|
||||
|
||||
#ifndef DISABLE_SPELLER
|
||||
/* Parse the formatter requested for this syntax. */
|
||||
void parse_formatter(char *ptr)
|
||||
{
|
||||
assert(ptr != NULL);
|
||||
|
||||
if (syntaxes == NULL) {
|
||||
rcfile_error(
|
||||
N_("Cannot add formatter without a syntax command"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (*ptr == '\0') {
|
||||
rcfile_error(N_("Missing formatter command"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (endsyntax->formatter != NULL)
|
||||
free(endsyntax->formatter);
|
||||
|
||||
/* Let them unset the formatter by using "". */
|
||||
if (!strcmp(ptr, "\"\""))
|
||||
endsyntax->formatter = NULL;
|
||||
else
|
||||
endsyntax->formatter = mallocstrcpy(NULL, ptr);
|
||||
}
|
||||
#endif /* !DISABLE_SPELLER */
|
||||
#endif /* !DISABLE_COLOR */
|
||||
|
||||
/* Check whether the user has unmapped every shortcut for a
|
||||
@@ -1121,7 +1148,11 @@ void parse_rcfile(FILE *rcstream
|
||||
parse_syntax(ptr);
|
||||
}
|
||||
else if (strcasecmp(keyword, "magic") == 0)
|
||||
#ifdef HAVE_LIBMAGIC
|
||||
parse_magic_exp(ptr);
|
||||
#else
|
||||
;
|
||||
#endif
|
||||
else if (strcasecmp(keyword, "header") == 0)
|
||||
parse_header_exp(ptr);
|
||||
else if (strcasecmp(keyword, "color") == 0)
|
||||
@@ -1130,6 +1161,12 @@ void parse_rcfile(FILE *rcstream
|
||||
parse_colors(ptr, TRUE);
|
||||
else if (strcasecmp(keyword, "linter") == 0)
|
||||
parse_linter(ptr);
|
||||
else if (strcasecmp(keyword, "formatter") == 0)
|
||||
#ifndef DISABLE_SPELLER
|
||||
parse_formatter(ptr);
|
||||
#else
|
||||
;
|
||||
#endif
|
||||
#endif /* !DISABLE_COLOR */
|
||||
else if (strcasecmp(keyword, "bind") == 0)
|
||||
parse_binding(ptr, TRUE);
|
||||
|
||||
122
src/search.c
122
src/search.c
@@ -106,6 +106,7 @@ void not_found_msg(const char *str)
|
||||
void search_replace_abort(void)
|
||||
{
|
||||
display_main_list();
|
||||
focusing = FALSE;
|
||||
#ifndef NANO_TINY
|
||||
if (openfile->mark_set)
|
||||
edit_refresh();
|
||||
@@ -118,6 +119,7 @@ void search_replace_abort(void)
|
||||
/* Initialize the global search and replace strings. */
|
||||
void search_init_globals(void)
|
||||
{
|
||||
focusing = TRUE;
|
||||
if (last_search == NULL)
|
||||
last_search = mallocstrcpy(NULL, "");
|
||||
if (last_replace == NULL)
|
||||
@@ -161,8 +163,7 @@ int search_init(bool replacing, bool use_answer)
|
||||
char *disp = display_string(last_search, 0, COLS / 3, FALSE);
|
||||
|
||||
buf = charalloc(strlen(disp) + 7);
|
||||
/* We use (COLS / 3) here because we need to see more on the
|
||||
* line. */
|
||||
/* We use (COLS / 3) here because we need to see more on the line. */
|
||||
sprintf(buf, " [%s%s]", disp,
|
||||
(strlenpt(last_search) > COLS / 3) ? "..." : "");
|
||||
free(disp);
|
||||
@@ -287,9 +288,9 @@ bool findnextstr(
|
||||
rev_start +=
|
||||
#ifndef NANO_TINY
|
||||
ISSET(BACKWARDS_SEARCH) ?
|
||||
openfile->current_x - 1 :
|
||||
((openfile->current_x == 0) ? -1 : move_mbleft(fileptr->data, openfile->current_x)) :
|
||||
#endif
|
||||
openfile->current_x + 1;
|
||||
move_mbright(fileptr->data, openfile->current_x);
|
||||
|
||||
/* Look for needle in the current line we're searching. */
|
||||
enable_nodelay();
|
||||
@@ -347,8 +348,8 @@ bool findnextstr(
|
||||
break;
|
||||
}
|
||||
|
||||
/* We've finished processing the file, so get out. */
|
||||
if (search_last_line) {
|
||||
/* We've finished processing the file, so get out. */
|
||||
not_found_msg(needle);
|
||||
disable_nodelay();
|
||||
return FALSE;
|
||||
@@ -367,9 +368,8 @@ bool findnextstr(
|
||||
}
|
||||
#endif
|
||||
|
||||
/* We've reached the start or end of the buffer, so wrap
|
||||
* around. */
|
||||
if (fileptr == NULL) {
|
||||
/* We've reached the start or end of the buffer, so wrap around. */
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(BACKWARDS_SEARCH)) {
|
||||
fileptr = openfile->filebot;
|
||||
@@ -384,8 +384,8 @@ bool findnextstr(
|
||||
statusbar(_("Search Wrapped"));
|
||||
}
|
||||
|
||||
/* We've reached the original starting line. */
|
||||
if (fileptr == begin)
|
||||
/* We've reached the original starting line. */
|
||||
search_last_line = TRUE;
|
||||
|
||||
rev_start = fileptr->data;
|
||||
@@ -445,8 +445,7 @@ void do_search(void)
|
||||
i = search_init(FALSE, FALSE);
|
||||
|
||||
if (i == -1)
|
||||
/* Cancel, Go to Line, blank search string, or regcomp()
|
||||
* failed. */
|
||||
/* Cancel, Go to Line, blank search string, or regcomp() failed. */
|
||||
search_replace_abort();
|
||||
else if (i == -2)
|
||||
/* Replace. */
|
||||
@@ -491,7 +490,7 @@ void do_search(void)
|
||||
* back at the same position if the string isn't found again, in
|
||||
* which case it's the only occurrence. */
|
||||
if (ISSET(USE_REGEXP) && regexp_bol_or_eol(&search_regexp,
|
||||
last_search)) {
|
||||
answer)) {
|
||||
didfind = findnextstr(
|
||||
#ifndef DISABLE_SPELLER
|
||||
FALSE,
|
||||
@@ -557,7 +556,7 @@ void do_research(void)
|
||||
FALSE,
|
||||
#endif
|
||||
TRUE, openfile->current, openfile->current_x,
|
||||
answer, NULL);
|
||||
last_search, NULL);
|
||||
if (fileptr == openfile->current && fileptr_x ==
|
||||
openfile->current_x && !didfind)
|
||||
statusbar(_("This is the only occurrence"));
|
||||
@@ -693,25 +692,26 @@ ssize_t do_replace_loop(
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
bool old_mark_set = openfile->mark_set;
|
||||
filestruct *edittop_save = openfile->edittop, *top, *bot;
|
||||
filestruct *top, *bot;
|
||||
size_t top_x, bot_x;
|
||||
bool right_side_up = FALSE;
|
||||
/* TRUE if (mark_begin, mark_begin_x) is the top of the mark,
|
||||
* FALSE if (current, current_x) is. */
|
||||
|
||||
if (old_mark_set) {
|
||||
/* If the mark is on, partition the filestruct so that it
|
||||
* contains only the marked text, set edittop to the top of the
|
||||
* partition, turn the mark off, and refresh the screen. */
|
||||
/* If the mark is on, frame the region, and turn the mark off. */
|
||||
mark_order((const filestruct **)&top, &top_x,
|
||||
(const filestruct **)&bot, &bot_x, &right_side_up);
|
||||
filepart = partition_filestruct(top, top_x, bot, bot_x);
|
||||
openfile->edittop = openfile->fileage;
|
||||
openfile->mark_set = FALSE;
|
||||
#ifndef DISABLE_COLOR
|
||||
reset_multis(openfile->current, TRUE);
|
||||
#endif
|
||||
edit_refresh();
|
||||
|
||||
/* Start either at the top or the bottom of the marked region. */
|
||||
if (!ISSET(BACKWARDS_SEARCH)) {
|
||||
openfile->current = top;
|
||||
openfile->current_x = (top_x == 0 ? 0 : top_x - 1);
|
||||
} else {
|
||||
openfile->current = bot;
|
||||
openfile->current_x = bot_x;
|
||||
}
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
@@ -735,17 +735,27 @@ ssize_t do_replace_loop(
|
||||
, real_current, *real_current_x, needle, &match_len)) {
|
||||
int i = 0;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (old_mark_set) {
|
||||
/* When we've found an occurrence outside of the marked region,
|
||||
* stop the fanfare. */
|
||||
if (openfile->current->lineno > bot->lineno ||
|
||||
openfile->current->lineno < top->lineno ||
|
||||
(openfile->current == bot && openfile->current_x > bot_x) ||
|
||||
(openfile->current == top && openfile->current_x < top_x))
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
/* If the bol_or_eol flag is set, we've found a match on the
|
||||
* beginning line already, and we're still on the beginning line
|
||||
* after the search, it means that we've wrapped around, so
|
||||
* we're done. */
|
||||
if (bol_or_eol && begin_line && openfile->current ==
|
||||
real_current)
|
||||
if (bol_or_eol && begin_line && openfile->current == real_current)
|
||||
break;
|
||||
/* Otherwise, set the begin_line flag if we've found a match on
|
||||
* the beginning line, reset the bol_or_eol flag, and
|
||||
* continue. */
|
||||
* the beginning line, reset the bol_or_eol flag, and continue. */
|
||||
else {
|
||||
if (openfile->current == real_current)
|
||||
begin_line = TRUE;
|
||||
@@ -753,9 +763,6 @@ ssize_t do_replace_loop(
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!replaceall)
|
||||
edit_refresh();
|
||||
|
||||
/* Indicate that we found the search string. */
|
||||
if (numreplaced == -1)
|
||||
numreplaced = 0;
|
||||
@@ -766,6 +773,8 @@ ssize_t do_replace_loop(
|
||||
xpt, strnlenpt(openfile->current->data,
|
||||
openfile->current_x + match_len) - xpt, FALSE);
|
||||
|
||||
edit_refresh();
|
||||
|
||||
curs_set(0);
|
||||
|
||||
do_replace_highlight(TRUE, exp_word);
|
||||
@@ -789,8 +798,7 @@ ssize_t do_replace_loop(
|
||||
#ifdef HAVE_REGEX_H
|
||||
/* Set the bol_or_eol flag if we're doing a bol and/or eol regex
|
||||
* replace ("^", "$", or "^$"). */
|
||||
if (ISSET(USE_REGEXP) && regexp_bol_or_eol(&search_regexp,
|
||||
needle))
|
||||
if (ISSET(USE_REGEXP) && regexp_bol_or_eol(&search_regexp, needle))
|
||||
bol_or_eol = TRUE;
|
||||
#endif
|
||||
|
||||
@@ -799,15 +807,14 @@ ssize_t do_replace_loop(
|
||||
size_t length_change;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
update_undo(REPLACE);
|
||||
add_undo(REPLACE);
|
||||
#endif
|
||||
if (i == 2)
|
||||
replaceall = TRUE;
|
||||
|
||||
copy = replace_line(needle);
|
||||
|
||||
length_change = strlen(copy) -
|
||||
strlen(openfile->current->data);
|
||||
length_change = strlen(copy) - strlen(openfile->current->data);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* If the mark was on and (mark_begin, mark_begin_x) was the
|
||||
@@ -821,6 +828,7 @@ ssize_t do_replace_loop(
|
||||
openfile->mark_begin_x = openfile->current_x;
|
||||
else
|
||||
openfile->mark_begin_x += length_change;
|
||||
bot_x = openfile->mark_begin_x;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -831,15 +839,14 @@ ssize_t do_replace_loop(
|
||||
/* Keep real_current_x in sync with the text changes. */
|
||||
if (openfile->current == real_current &&
|
||||
openfile->current_x <= *real_current_x) {
|
||||
if (*real_current_x <
|
||||
openfile->current_x + match_len)
|
||||
*real_current_x = openfile->current_x +
|
||||
match_len;
|
||||
if (*real_current_x < openfile->current_x + match_len)
|
||||
*real_current_x = openfile->current_x + match_len;
|
||||
*real_current_x += length_change;
|
||||
}
|
||||
#ifndef NANO_TINY
|
||||
}
|
||||
bot_x = *real_current_x;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Set the cursor at the last character of the replacement
|
||||
* text, so searching will resume after the replacement
|
||||
@@ -850,16 +857,19 @@ ssize_t do_replace_loop(
|
||||
#endif
|
||||
openfile->current_x += match_len + length_change - 1;
|
||||
|
||||
/* Cleanup. */
|
||||
/* Clean up. */
|
||||
openfile->totsize += mbstrlen(copy) -
|
||||
mbstrlen(openfile->current->data);
|
||||
free(openfile->current->data);
|
||||
openfile->current->data = copy;
|
||||
|
||||
#ifndef DISABLE_COLOR
|
||||
reset_multis(openfile->current, TRUE);
|
||||
/* Reset the precalculated multiline-regex hints only when
|
||||
* the first replacement has been made. */
|
||||
if (numreplaced == 0)
|
||||
reset_multis(openfile->current, TRUE);
|
||||
#endif
|
||||
edit_refresh();
|
||||
|
||||
if (!replaceall) {
|
||||
#ifndef DISABLE_COLOR
|
||||
/* If color syntaxes are available and turned on, we
|
||||
@@ -877,16 +887,12 @@ ssize_t do_replace_loop(
|
||||
}
|
||||
}
|
||||
|
||||
if (numreplaced == -1)
|
||||
not_found_msg(needle);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (old_mark_set) {
|
||||
/* If the mark was on, unpartition the filestruct so that it
|
||||
* contains all the text again, set edittop back to what it was
|
||||
* before, turn the mark back on, and refresh the screen. */
|
||||
unpartition_filestruct(&filepart);
|
||||
openfile->edittop = edittop_save;
|
||||
if (old_mark_set)
|
||||
openfile->mark_set = TRUE;
|
||||
edit_refresh();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* If the NO_NEWLINES flag isn't set, and text has been added to the
|
||||
@@ -913,8 +919,7 @@ void do_replace(void)
|
||||
|
||||
i = search_init(TRUE, FALSE);
|
||||
if (i == -1) {
|
||||
/* Cancel, Go to Line, blank search string, or regcomp()
|
||||
* failed. */
|
||||
/* Cancel, Go to Line, blank search string, or regcomp() failed. */
|
||||
search_replace_abort();
|
||||
return;
|
||||
} else if (i == -2) {
|
||||
@@ -951,8 +956,7 @@ void do_replace(void)
|
||||
edit_refresh, _("Replace with"));
|
||||
|
||||
#ifndef DISABLE_HISTORIES
|
||||
/* Add this replace string to the replace history list. i == 0
|
||||
* means that the string is not "". */
|
||||
/* If the replace string is not "", add it to the replace history list. */
|
||||
if (i == 0)
|
||||
update_history(&replace_history, answer);
|
||||
#endif
|
||||
@@ -1085,7 +1089,6 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
/* If allow_update is TRUE, update the screen. */
|
||||
if (allow_update) {
|
||||
edit_refresh();
|
||||
|
||||
display_main_list();
|
||||
}
|
||||
}
|
||||
@@ -1144,8 +1147,8 @@ bool find_bracket_match(bool reverse, const char *bracket_set)
|
||||
mbrevstrpbrk(fileptr->data, bracket_set, rev_start) :
|
||||
mbstrpbrk(rev_start, bracket_set));
|
||||
|
||||
/* We've found a potential match. */
|
||||
if (found != NULL)
|
||||
/* We've found a potential match. */
|
||||
break;
|
||||
|
||||
if (reverse) {
|
||||
@@ -1156,8 +1159,8 @@ bool find_bracket_match(bool reverse, const char *bracket_set)
|
||||
current_y_find++;
|
||||
}
|
||||
|
||||
/* We've reached the start or end of the buffer, so get out. */
|
||||
if (fileptr == NULL)
|
||||
/* We've reached the start or end of the buffer, so get out. */
|
||||
return FALSE;
|
||||
|
||||
rev_start = fileptr->data;
|
||||
@@ -1373,8 +1376,7 @@ void update_history(filestruct **h, const char *s)
|
||||
bar = p->next;
|
||||
unlink_node(foo);
|
||||
delete_node(foo);
|
||||
if (bar != NULL)
|
||||
renumber(bar);
|
||||
renumber(bar);
|
||||
}
|
||||
|
||||
/* If the history is full, delete the beginning entry to make room
|
||||
|
||||
278
src/text.c
278
src/text.c
@@ -442,7 +442,7 @@ void do_undo(void)
|
||||
|
||||
filestruct *f = fsfromline(u->mark_begin_lineno);
|
||||
if (!f) {
|
||||
statusbar(_("Internal error: can't match line %ld. Please save your work."), (long)u->mark_begin_lineno);
|
||||
statusbar(_("Internal error: can't match line %d. Please save your work."), u->mark_begin_lineno);
|
||||
return;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
@@ -1883,6 +1883,10 @@ void do_justify(bool full_justify)
|
||||
bool filebot_inpar = FALSE;
|
||||
/* Whether the text at filebot is part of the current
|
||||
* paragraph. */
|
||||
int kbinput;
|
||||
/* The first keystroke after a justification. */
|
||||
functionptrtype func;
|
||||
/* The function associated with that keystroke. */
|
||||
|
||||
/* We save these variables to be restored if the user
|
||||
* unjustifies. */
|
||||
@@ -1897,9 +1901,6 @@ void do_justify(bool full_justify)
|
||||
#endif
|
||||
bool modified_save = openfile->modified;
|
||||
|
||||
int kbinput;
|
||||
const sc *s;
|
||||
|
||||
/* Move to the beginning of the current line, so that justifying at
|
||||
* the end of the last line of the file, if that line isn't blank,
|
||||
* will work the first time through. */
|
||||
@@ -2212,15 +2213,14 @@ void do_justify(bool full_justify)
|
||||
|
||||
/* Display the shortcut list with UnJustify. */
|
||||
uncutfunc->desc = unjust_tag;
|
||||
currmenu = MMAIN;
|
||||
display_main_list();
|
||||
|
||||
/* Now get a keystroke and see if it's unjustify. If not, put back
|
||||
* the keystroke and return. */
|
||||
kbinput = do_input(FALSE);
|
||||
s = get_shortcut(&kbinput);
|
||||
func = func_from_key(&kbinput);
|
||||
|
||||
if (s && s->scfunc == do_uncut_text) {
|
||||
if (func == do_uncut_text) {
|
||||
/* Splice the justify buffer back into the file, but only if we
|
||||
* actually justified something. */
|
||||
if (first_par_line != NULL) {
|
||||
@@ -2245,8 +2245,8 @@ void do_justify(bool full_justify)
|
||||
* replaced with the unjustified paragraph. */
|
||||
unpartition_filestruct(&filepart);
|
||||
|
||||
/* Renumber starting with the beginning line of the old
|
||||
* partition. */
|
||||
/* Renumber, starting with the beginning line of the old
|
||||
* partition. */
|
||||
renumber(top_save);
|
||||
|
||||
/* Restore the justify we just did (ungrateful user!). */
|
||||
@@ -2522,7 +2522,7 @@ const char *do_int_speller(const char *tempfile_name)
|
||||
|
||||
/* A new process to run sort in. */
|
||||
if ((pid_sort = fork()) == 0) {
|
||||
/* Child continues (i.e. future spell process). Replace the
|
||||
/* Child continues (i.e. future sort process). Replace the
|
||||
* standard input with the standard output of the old pipe. */
|
||||
if (dup2(spell_fd[0], STDIN_FILENO) != STDIN_FILENO)
|
||||
goto close_pipes_and_exit;
|
||||
@@ -2535,8 +2535,7 @@ const char *do_int_speller(const char *tempfile_name)
|
||||
|
||||
close(sort_fd[1]);
|
||||
|
||||
/* Start the sort program. Use -f to remove mixed case. If
|
||||
* this isn't portable, let me know. */
|
||||
/* Start the sort program. Use -f to ignore case. */
|
||||
execlp("sort", "sort", "-f", NULL);
|
||||
|
||||
/* This should not be reached if sort is found. */
|
||||
@@ -2625,7 +2624,7 @@ const char *do_int_speller(const char *tempfile_name)
|
||||
search_replace_abort();
|
||||
edit_refresh_needed = TRUE;
|
||||
|
||||
/* Process the end of the spell process. */
|
||||
/* Process the end of the three processes. */
|
||||
waitpid(pid_spell, &spell_status, 0);
|
||||
waitpid(pid_sort, &sort_status, 0);
|
||||
waitpid(pid_uniq, &uniq_status, 0);
|
||||
@@ -2660,9 +2659,10 @@ 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;
|
||||
pid_t pid_spell;
|
||||
char *ptr;
|
||||
static int arglen = 3;
|
||||
@@ -2671,11 +2671,9 @@ const char *do_alt_speller(char *tempfile_name)
|
||||
bool old_mark_set = openfile->mark_set;
|
||||
bool added_magicline = FALSE;
|
||||
/* Whether we added a magicline after filebot. */
|
||||
bool right_side_up = FALSE;
|
||||
/* TRUE if (mark_begin, mark_begin_x) is the top of the mark,
|
||||
* FALSE if (current, current_x) is. */
|
||||
filestruct *top, *bot;
|
||||
size_t top_x, bot_x;
|
||||
bool right_side_up = FALSE;
|
||||
ssize_t mb_lineno_save = 0;
|
||||
/* We're going to close the current file, and open the output of
|
||||
* the alternate spell command. The line that mark_begin points
|
||||
@@ -2684,7 +2682,17 @@ const char *do_alt_speller(char *tempfile_name)
|
||||
size_t totsize_save = openfile->totsize;
|
||||
/* Our saved value of totsize, used when we spell-check a marked
|
||||
* selection. */
|
||||
#endif
|
||||
|
||||
/* Get the timestamp and the size of the temporary file. */
|
||||
stat(tempfile_name, &spellfileinfo);
|
||||
timestamp = spellfileinfo.st_mtime;
|
||||
|
||||
/* If the number of bytes to check is zero, get out. */
|
||||
if (spellfileinfo.st_size == 0)
|
||||
return NULL;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (old_mark_set) {
|
||||
/* If the mark is on, save the number of the line it starts on,
|
||||
* and then turn the mark off. */
|
||||
@@ -2693,14 +2701,9 @@ const char *do_alt_speller(char *tempfile_name)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (openfile->totsize == 0) {
|
||||
statusbar(_("Finished checking spelling"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
endwin();
|
||||
|
||||
/* Set up an argument list to pass execvp(). */
|
||||
/* Set up an argument list to pass to execvp(). */
|
||||
if (spellargs == NULL) {
|
||||
spellargs = (char **)nmalloc(arglen * sizeof(char *));
|
||||
|
||||
@@ -2793,24 +2796,18 @@ const char *do_alt_speller(char *tempfile_name)
|
||||
#ifndef NANO_TINY
|
||||
if (old_mark_set) {
|
||||
filestruct *top_save = openfile->fileage;
|
||||
/* Adjust the end point of the marked region for any change in
|
||||
length of the region's last line. */
|
||||
if (right_side_up)
|
||||
current_x_save = strlen(openfile->filebot->data);
|
||||
else
|
||||
openfile->mark_begin_x = strlen(openfile->filebot->data);
|
||||
|
||||
/* If the mark was on, the NO_NEWLINES flag isn't set, and we
|
||||
* added a magicline, remove it now. */
|
||||
if (!ISSET(NO_NEWLINES) && added_magicline)
|
||||
remove_magicline();
|
||||
|
||||
/* Put the beginning and the end of the mark at the beginning
|
||||
* and the end of the spell-checked text. */
|
||||
if (openfile->fileage == openfile->filebot)
|
||||
bot_x += top_x;
|
||||
if (right_side_up) {
|
||||
openfile->mark_begin_x = top_x;
|
||||
current_x_save = bot_x;
|
||||
} else {
|
||||
current_x_save = top_x;
|
||||
openfile->mark_begin_x = bot_x;
|
||||
}
|
||||
|
||||
/* Unpartition the filestruct so that it contains all the text
|
||||
* again. Note that we've replaced the marked text originally
|
||||
* in the partition with the spell-checked marked text in the
|
||||
@@ -2826,23 +2823,23 @@ const char *do_alt_speller(char *tempfile_name)
|
||||
openfile->totsize = totsize_save;
|
||||
|
||||
/* Assign mark_begin to the line where the mark began before. */
|
||||
do_gotopos(mb_lineno_save, openfile->mark_begin_x,
|
||||
current_y_save, 0);
|
||||
openfile->mark_begin = openfile->current;
|
||||
|
||||
/* Assign mark_begin_x to the location in mark_begin where the
|
||||
* mark began before, adjusted for any shortening of the
|
||||
* line. */
|
||||
openfile->mark_begin_x = openfile->current_x;
|
||||
openfile->mark_begin = fsfromline(mb_lineno_save);
|
||||
|
||||
/* Turn the mark back on. */
|
||||
openfile->mark_set = TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Go back to the old position, and mark the file as modified. */
|
||||
do_gotopos(lineno_save, current_x_save, current_y_save, pww_save);
|
||||
set_modified();
|
||||
/* Go back to the old position. */
|
||||
goto_line_posx(lineno_save, current_x_save);
|
||||
openfile->current_y = current_y_save;
|
||||
edit_update(NONE);
|
||||
|
||||
/* Stat the temporary file again, and mark the buffer as modified only
|
||||
* if this file was changed since it was written. */
|
||||
stat(tempfile_name, &spellfileinfo);
|
||||
if (spellfileinfo.st_mtime != timestamp)
|
||||
set_modified();
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Handle a pending SIGWINCH again. */
|
||||
@@ -2915,7 +2912,6 @@ void do_spell(void)
|
||||
/* Cleanup things to do after leaving the linter. */
|
||||
void lint_cleanup(void)
|
||||
{
|
||||
currmenu = MMAIN;
|
||||
display_main_list();
|
||||
}
|
||||
|
||||
@@ -2934,7 +2930,6 @@ void do_linter(void)
|
||||
static char **lintargs = NULL;
|
||||
char *lintcopy;
|
||||
char *convendptr = NULL;
|
||||
const sc *s;
|
||||
lintstruct *lints = NULL, *tmplint = NULL, *curlint = NULL;
|
||||
|
||||
if (!openfile->syntax || !openfile->syntax->linter) {
|
||||
@@ -2973,7 +2968,7 @@ void do_linter(void)
|
||||
statusbar(_("Invoking linter, please wait"));
|
||||
doupdate();
|
||||
|
||||
/* Set up an argument list to pass execvp(). */
|
||||
/* Set up an argument list to pass to execvp(). */
|
||||
if (lintargs == NULL) {
|
||||
lintargs = (char **)nmalloc(arglen * sizeof(char *));
|
||||
|
||||
@@ -2988,13 +2983,13 @@ void do_linter(void)
|
||||
}
|
||||
lintargs[arglen - 2] = openfile->filename;
|
||||
|
||||
/* A new process to run linter. */
|
||||
/* A new process to run the linter in. */
|
||||
if ((pid_lint = fork()) == 0) {
|
||||
|
||||
/* Child continues (i.e. future spell process). */
|
||||
/* Child continues (i.e. future linting process). */
|
||||
close(lint_fd[0]);
|
||||
|
||||
/* Send spell's standard output/err to the pipe. */
|
||||
/* Send the linter's standard output + err to the pipe. */
|
||||
if (dup2(lint_fd[1], STDOUT_FILENO) != STDOUT_FILENO)
|
||||
exit(1);
|
||||
if (dup2(lint_fd[1], STDERR_FILENO) != STDERR_FILENO)
|
||||
@@ -3028,7 +3023,7 @@ void do_linter(void)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Read in the returned spelling errors. */
|
||||
/* Read in the returned syntax errors. */
|
||||
read_buff_read = 0;
|
||||
read_buff_size = pipe_buff_size + 1;
|
||||
read_buff = read_buff_ptr = charalloc(read_buff_size);
|
||||
@@ -3052,7 +3047,7 @@ void do_linter(void)
|
||||
fprintf(stderr, "text.c:do_lint:Raw output: %s\n", read_buff);
|
||||
#endif
|
||||
|
||||
/* Process output. */
|
||||
/* Process the output. */
|
||||
read_buff_word = read_buff_ptr = read_buff;
|
||||
|
||||
while (*read_buff_ptr != '\0') {
|
||||
@@ -3120,7 +3115,9 @@ void do_linter(void)
|
||||
read_buff_ptr++;
|
||||
}
|
||||
|
||||
/* Process the end of the lint process. */
|
||||
/* Process the end of the linting process.
|
||||
* XXX: The return value should be checked.
|
||||
* Will make an invocation-error routine. */
|
||||
waitpid(pid_lint, &lint_status, 0);
|
||||
|
||||
free(read_buff);
|
||||
@@ -3131,13 +3128,13 @@ void do_linter(void)
|
||||
return;
|
||||
}
|
||||
|
||||
currmenu = MLINTER;
|
||||
bottombars(MLINTER);
|
||||
tmplint = NULL;
|
||||
curlint = lints;
|
||||
while (1) {
|
||||
while (TRUE) {
|
||||
ssize_t tmpcol = 1;
|
||||
int kbinput;
|
||||
functionptrtype func;
|
||||
|
||||
if (curlint->colno > 0)
|
||||
tmpcol = curlint->colno;
|
||||
@@ -3193,30 +3190,24 @@ void do_linter(void)
|
||||
}
|
||||
|
||||
kbinput = get_kbinput(bottomwin);
|
||||
s = get_shortcut(&kbinput);
|
||||
func = func_from_key(&kbinput);
|
||||
tmplint = curlint;
|
||||
|
||||
if (!s)
|
||||
continue;
|
||||
else if (s->scfunc == do_cancel)
|
||||
if (func == do_cancel)
|
||||
break;
|
||||
else if (s->scfunc == do_help_void) {
|
||||
else if (func == do_help_void) {
|
||||
tmplint = NULL;
|
||||
do_help_void();
|
||||
} else if (s->scfunc == do_page_down) {
|
||||
} else if (func == do_page_down) {
|
||||
if (curlint->next != NULL)
|
||||
curlint = curlint->next;
|
||||
else {
|
||||
else
|
||||
statusbar(_("At last message"));
|
||||
continue;
|
||||
}
|
||||
} else if (s->scfunc == do_page_up) {
|
||||
} else if (func == do_page_up) {
|
||||
if (curlint->prev != NULL)
|
||||
curlint = curlint->prev;
|
||||
else {
|
||||
else
|
||||
statusbar(_("At first message"));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
blank_statusbar();
|
||||
@@ -3230,6 +3221,153 @@ free_lints_and_return:
|
||||
}
|
||||
lint_cleanup();
|
||||
}
|
||||
|
||||
#ifndef DISABLE_SPELLER
|
||||
/* Run a formatter for the current syntax. This expects the formatter
|
||||
* to be non-interactive and operate on a file in-place, which we'll
|
||||
* pass it on the command line. */
|
||||
void do_formatter(void)
|
||||
{
|
||||
bool status;
|
||||
FILE *temp_file;
|
||||
char *temp = safe_tempfile(&temp_file);
|
||||
int format_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;
|
||||
pid_t pid_format;
|
||||
char *ptr;
|
||||
static int arglen = 3;
|
||||
static char **formatargs = NULL;
|
||||
char *finalstatus = NULL;
|
||||
|
||||
/* Check whether we're using syntax highlighting
|
||||
* and the formatter option is set. */
|
||||
if (openfile->syntax == NULL || openfile->syntax->formatter == NULL) {
|
||||
statusbar(_("Error: no formatter defined"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (ISSET(RESTRICTED)) {
|
||||
nano_disabled_msg();
|
||||
return;
|
||||
}
|
||||
|
||||
if (temp == NULL) {
|
||||
statusbar(_("Error writing temp file: %s"), strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
/* We're not supporting partial formatting, oi vey. */
|
||||
openfile->mark_set = FALSE;
|
||||
status = write_file(temp, temp_file, TRUE, OVERWRITE, FALSE);
|
||||
|
||||
if (!status) {
|
||||
statusbar(_("Error writing temp file: %s"), strerror(errno));
|
||||
free(temp);
|
||||
return;
|
||||
}
|
||||
|
||||
if (openfile->totsize == 0) {
|
||||
statusbar(_("Finished"));
|
||||
return;
|
||||
}
|
||||
|
||||
blank_bottombars();
|
||||
statusbar(_("Invoking formatter, please wait"));
|
||||
doupdate();
|
||||
|
||||
endwin();
|
||||
|
||||
/* Set up an argument list to pass to execvp(). */
|
||||
if (formatargs == NULL) {
|
||||
formatargs = (char **)nmalloc(arglen * sizeof(char *));
|
||||
|
||||
formatargs[0] = strtok(openfile->syntax->formatter, " ");
|
||||
while ((ptr = strtok(NULL, " ")) != NULL) {
|
||||
arglen++;
|
||||
formatargs = (char **)nrealloc(formatargs, arglen *
|
||||
sizeof(char *));
|
||||
formatargs[arglen - 3] = ptr;
|
||||
}
|
||||
formatargs[arglen - 1] = NULL;
|
||||
}
|
||||
formatargs[arglen - 2] = temp;
|
||||
|
||||
/* Start a new process for the formatter. */
|
||||
if ((pid_format = fork()) == 0) {
|
||||
/* Start the formatting program; we are using $PATH. */
|
||||
execvp(formatargs[0], formatargs);
|
||||
|
||||
/* Should not be reached, if the formatter is found! */
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* If we couldn't fork, get out. */
|
||||
if (pid_format < 0) {
|
||||
statusbar(_("Could not fork"));
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Don't handle a pending SIGWINCH until the alternate format checker
|
||||
* is finished and we've loaded the format-checked file back in. */
|
||||
allow_pending_sigwinch(FALSE);
|
||||
#endif
|
||||
|
||||
/* Wait for the formatter to finish. */
|
||||
wait(&format_status);
|
||||
|
||||
/* Reenter curses mode. */
|
||||
doupdate();
|
||||
|
||||
/* Restore the terminal to its previous state. */
|
||||
terminal_init();
|
||||
|
||||
/* Turn the cursor back on for sure. */
|
||||
curs_set(1);
|
||||
|
||||
/* The screen might have been resized. If it has, reinitialize all
|
||||
* the windows based on the new screen dimensions. */
|
||||
window_init();
|
||||
|
||||
if (!WIFEXITED(format_status) ||
|
||||
WEXITSTATUS(format_status) != 0) {
|
||||
char *format_error;
|
||||
char *invoke_error = _("Error invoking \"%s\"");
|
||||
|
||||
format_error =
|
||||
charalloc(strlen(invoke_error) +
|
||||
strlen(openfile->syntax->formatter) + 1);
|
||||
sprintf(format_error, invoke_error, openfile->syntax->formatter);
|
||||
finalstatus = format_error;
|
||||
} else {
|
||||
/* Replace the text of the current buffer with the formatted text. */
|
||||
replace_buffer(temp);
|
||||
|
||||
/* Go back to the old position, and mark the file as modified. */
|
||||
do_gotopos(lineno_save, current_x_save, current_y_save, pww_save);
|
||||
set_modified();
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Handle a pending SIGWINCH again. */
|
||||
allow_pending_sigwinch(TRUE);
|
||||
#endif
|
||||
|
||||
finalstatus = _("Finished formatting");
|
||||
}
|
||||
|
||||
unlink(temp);
|
||||
free(temp);
|
||||
|
||||
/* If the formatter printed any error messages onscreen, make
|
||||
* sure that they're cleared off. */
|
||||
total_refresh();
|
||||
|
||||
statusbar(finalstatus);
|
||||
}
|
||||
#endif /* !DISABLE_SPELLER */
|
||||
#endif /* !DISABLE_COLOR */
|
||||
|
||||
#ifndef NANO_TINY
|
||||
|
||||
@@ -643,7 +643,7 @@ filestruct *fsfromline(ssize_t lineno)
|
||||
for (; f->lineno != lineno && f != openfile->fileage; f = f->prev)
|
||||
;
|
||||
else
|
||||
for (; f->lineno != lineno && f->next != NULL; f = f->next)
|
||||
for (; f->lineno != lineno && f->next != NULL; f = f->next)
|
||||
;
|
||||
|
||||
if (f->lineno != lineno)
|
||||
|
||||
42
src/winio.c
42
src/winio.c
@@ -2344,6 +2344,9 @@ void bottombars(int menu)
|
||||
subnfunc *f;
|
||||
const sc *s;
|
||||
|
||||
/* Set the global variable to the given menu. */
|
||||
currmenu = menu;
|
||||
|
||||
if (ISSET(NO_HELP))
|
||||
return;
|
||||
|
||||
@@ -3160,10 +3163,8 @@ void edit_redraw(filestruct *old_current, size_t pww_save)
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* Put edittop in range of current, get the difference in lines
|
||||
* between the original edittop and the current edittop, and
|
||||
* then restore the original edittop. */
|
||||
edit_update(CENTER);
|
||||
/* Make sure the current line is on the screen. */
|
||||
edit_update((ISSET(SMOOTH_SCROLL) && !focusing) ? NONE : CENTER);
|
||||
|
||||
/* Update old_current if we're not on the same page as
|
||||
* before. */
|
||||
@@ -3229,9 +3230,8 @@ void edit_refresh(void)
|
||||
(long)openfile->current->lineno, (long)openfile->edittop->lineno, maxrows);
|
||||
#endif
|
||||
|
||||
/* Put the top line of the edit window in range of the current
|
||||
* line. */
|
||||
edit_update(CENTER);
|
||||
/* Make sure the current line is on the screen. */
|
||||
edit_update(ISSET(SMOOTH_SCROLL) ? NONE : CENTER);
|
||||
}
|
||||
|
||||
foo = openfile->edittop;
|
||||
@@ -3323,8 +3323,9 @@ void total_refresh(void)
|
||||
void display_main_list(void)
|
||||
{
|
||||
#ifndef DISABLE_COLOR
|
||||
if (openfile->syntax && openfile->syntax->linter)
|
||||
set_lint_shortcuts();
|
||||
if (openfile->syntax
|
||||
&& (openfile->syntax->formatter || openfile->syntax->linter))
|
||||
set_lint_or_format_shortcuts();
|
||||
else
|
||||
set_spell_shortcuts();
|
||||
#endif
|
||||
@@ -3435,8 +3436,8 @@ void do_replace_highlight(bool highlight, const char *word)
|
||||
}
|
||||
|
||||
#ifndef DISABLE_EXTRA
|
||||
#define CREDIT_LEN 57
|
||||
#define XLCREDIT_LEN 8
|
||||
#define CREDIT_LEN 54
|
||||
#define XLCREDIT_LEN 9
|
||||
|
||||
/* Easter egg: Display credits. Assume nodelay(edit) and scrollok(edit)
|
||||
* are FALSE. */
|
||||
@@ -3458,15 +3459,11 @@ void do_credits(void)
|
||||
"Rocco Corsi",
|
||||
"David Lawrence Ramsey",
|
||||
"David Benbennick",
|
||||
"Mark Majeres",
|
||||
"Mike Frysinger",
|
||||
"Benno Schulenberg",
|
||||
"Ken Tyler",
|
||||
"Sven Guckes",
|
||||
NULL, /* credits[16], handled below. */
|
||||
"Pauli Virtanen",
|
||||
"Daniele Medri",
|
||||
"Clement Laforet",
|
||||
"Tedi Heriyanto",
|
||||
"Bill Soudan",
|
||||
"Christian Weisgerber",
|
||||
"Erik Andersen",
|
||||
@@ -3485,6 +3482,7 @@ void do_credits(void)
|
||||
"Richard Kolb II",
|
||||
NULL, /* "The Free Software Foundation" */
|
||||
"Linus Torvalds",
|
||||
NULL, /* "the many translators and the TP" */
|
||||
NULL, /* "For ncurses:" */
|
||||
"Thomas Dickey",
|
||||
"Pavel Curtis",
|
||||
@@ -3496,7 +3494,7 @@ void do_credits(void)
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"(C) 1999 - 2014",
|
||||
"(C) 1999 - 2015",
|
||||
"Free Software Foundation, Inc.",
|
||||
"",
|
||||
"",
|
||||
@@ -3511,20 +3509,12 @@ void do_credits(void)
|
||||
N_("Brought to you by:"),
|
||||
N_("Special thanks to:"),
|
||||
N_("The Free Software Foundation"),
|
||||
N_("the many translators and the TP"),
|
||||
N_("For ncurses:"),
|
||||
N_("and anyone else we forgot..."),
|
||||
N_("Thank you for using nano!")
|
||||
};
|
||||
|
||||
/* credits[16]: Make sure this name is displayed properly, since we
|
||||
* can't dynamically assign it above, using Unicode 00F6 (Latin
|
||||
* Small Letter O with Diaresis) if applicable. */
|
||||
credits[16] =
|
||||
#ifdef ENABLE_UTF8
|
||||
using_utf8() ? "Florian K\xC3\xB6nig" :
|
||||
#endif
|
||||
"Florian K\xF6nig";
|
||||
|
||||
if (!old_more_space || !old_no_help) {
|
||||
SET(MORE_SPACE);
|
||||
SET(NO_HELP);
|
||||
|
||||
Reference in New Issue
Block a user