Compare commits
86 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd8ce7af8e | ||
|
|
c5a0c9b6b2 | ||
|
|
6520aa0079 | ||
|
|
3d8b9895b8 | ||
|
|
9026e04c73 | ||
|
|
92befae93d | ||
|
|
dbbc14e0ac | ||
|
|
8b80ec3e1a | ||
|
|
a71a2f9a0c | ||
|
|
56ce5f2ba8 | ||
|
|
5ebdd3fe6e | ||
|
|
426e6d37c5 | ||
|
|
4dd9aadf8a | ||
|
|
5ecd81bd19 | ||
|
|
b4a955512e | ||
|
|
33c7a4ca95 | ||
|
|
40d34862fd | ||
|
|
bee670424e | ||
|
|
8dffb00fd9 | ||
|
|
403e87c0a0 | ||
|
|
942bb39547 | ||
|
|
52b7a41ea4 | ||
|
|
6807e06a74 | ||
|
|
84cd0abd6f | ||
|
|
6a70d2b6e2 | ||
|
|
16482f99b8 | ||
|
|
621eb904b3 | ||
|
|
84ff9ebb91 | ||
|
|
a2038a9b2b | ||
|
|
a969adf804 | ||
|
|
59b0f81bfa | ||
|
|
6ad3d3d6c0 | ||
|
|
ca70885564 | ||
|
|
cfa20c3f42 | ||
|
|
4781d4d351 | ||
|
|
ef1a3b08ae | ||
|
|
4063fce6a0 | ||
|
|
3db2beefd3 | ||
|
|
5907f8801b | ||
|
|
c68398f18f | ||
|
|
d653aeab93 | ||
|
|
491e02f532 | ||
|
|
f1a47a2aae | ||
|
|
7b23878b42 | ||
|
|
5cdadc3eb1 | ||
|
|
8f89e23adb | ||
|
|
8302ff700b | ||
|
|
a32d21c759 | ||
|
|
f8214440c2 | ||
|
|
c1b08302df | ||
|
|
afd8a4e804 | ||
|
|
88b740179a | ||
|
|
9ce41543ed | ||
|
|
e4775c2060 | ||
|
|
cd7c3483b4 | ||
|
|
8075e454a9 | ||
|
|
93b1c1bea6 | ||
|
|
aa14526cb3 | ||
|
|
d29d49aece | ||
|
|
e8f90789e9 | ||
|
|
c830b8f51c | ||
|
|
28beb3f9c5 | ||
|
|
08fd5b349b | ||
|
|
6971db773b | ||
|
|
c620fc6aa9 | ||
|
|
7e09f2c64a | ||
|
|
968c07fc81 | ||
|
|
858e75e4cf | ||
|
|
a05180ed2d | ||
|
|
00533854c0 | ||
|
|
dc3610fc8e | ||
|
|
a33a4f00e5 | ||
|
|
509b091c47 | ||
|
|
9ea5eef200 | ||
|
|
e701bb01aa | ||
|
|
a3102cd4cf | ||
|
|
da67883508 | ||
|
|
03c3e2b7c0 | ||
|
|
4953dcec20 | ||
|
|
f5155786e1 | ||
|
|
a9abc3d95f | ||
|
|
09cabcad5d | ||
|
|
f162a6a2ab | ||
|
|
5a3de7f117 | ||
|
|
7b5cc1dcda | ||
|
|
2b38547875 |
102
ChangeLog
102
ChangeLog
@@ -1,3 +1,105 @@
|
||||
Changes between v2.8.4 and v2.8.5:
|
||||
----------------------------------
|
||||
|
||||
Benno Schulenberg (35):
|
||||
bindings: in the tiny version exclude word jumping from the prompts
|
||||
bump version numbers and add a news item for the 2.8.5 release
|
||||
display: don't let a SIGCONT write anything to the screen
|
||||
display: don't show the cursor while we are busy calculating its position
|
||||
display: redraw title bar and edit window only when needed
|
||||
display: show the cursor position also when searching took a while
|
||||
docs: avoid a double "see" for cross references in the HTML manual
|
||||
docs: spell "title bar" and "status bar" correctly
|
||||
gnulib: update to its current state
|
||||
input: give an appropriate message when there are too many errors
|
||||
startup: allow negative line and column numbers on the command line
|
||||
startup: allow positioning the cursor also when reading standard input
|
||||
startup: always open with the file that was mentioned first
|
||||
startup: don't crash when opening standard input would fail
|
||||
startup: don't mark the buffer as modified when in view mode
|
||||
startup: don't mark the buffer as modified when nothing was read
|
||||
startup: don't try placing the cursor when reading standard input failed
|
||||
startup: don't use position history when reading from standard input
|
||||
suspension: fake a SIGWINCH when coming back out of the background
|
||||
suspension: remove a duplicate setting of the HUP and TERM handler
|
||||
syntax: default: allow leading whitespace before a hash comment
|
||||
tweaks: adjust indentation after preceding changes
|
||||
tweaks: avoid compiler warning about implicit type
|
||||
tweaks: be consistent in the spelling of title bar and status bar
|
||||
tweaks: don't bother calculating the position when we won't show it
|
||||
tweaks: elide a function that should not be a separate one
|
||||
tweaks: elide a variable
|
||||
tweaks: frob a few comments, and elide and #ifndef
|
||||
tweaks: reduce the scope of three variables, and rename them besides
|
||||
tweaks: reduce the scope of two variables, and rename them too
|
||||
tweaks: rename a function and a variable, to better match what they do
|
||||
tweaks: rename a variable, and frob a couple of comments
|
||||
tweaks: rename two functions and a variable, and invert its logic
|
||||
tweaks: reshuffle some stuff, to put related things closer together
|
||||
tweaks: unglobalize the nodelay_mode variable
|
||||
|
||||
|
||||
Changes between v2.8.3 and v2.8.4:
|
||||
----------------------------------
|
||||
|
||||
Benno Schulenberg (11):
|
||||
build: correct the inverted logic for the nanorc man page
|
||||
bump version numbers and add a news item for the 2.8.4 release
|
||||
gnulib: update to its current state
|
||||
syntax: default: color also hash comments and email addresses
|
||||
syntax: php: color "static" again as "function", like it used to be
|
||||
tweaks: adjust the indentation after the preceding change
|
||||
tweaks: avoid an unused-variable warning when using --disable-comment
|
||||
tweaks: do actual screen refreshes in a single call, when possible
|
||||
tweaks: remove the no-op x$disable tests
|
||||
tweaks: reorder three items in the Info document
|
||||
tweaks: reshuffle a few things to reduce duplication
|
||||
|
||||
|
||||
Changes between v2.8.2 and v2.8.3:
|
||||
----------------------------------
|
||||
|
||||
Benno Schulenberg (34):
|
||||
bindings: allow toggling a new buffer when multiple buffers are enabled
|
||||
build: don't use a dummy dependency, as it breaks non-GNU makes
|
||||
build: for Solaris, tell the linker where to find clock_gettime()
|
||||
build: use backticks to avoid a warning during autoreconf
|
||||
build: use the "force" mechanism to always run the revision rule
|
||||
bump version numbers and add a news item for the 2.8.3 release
|
||||
chars: optimize moving a character left in the non-UTF-8 case
|
||||
chars: probe for a valid UTF-8 starter byte, instead of overstepping
|
||||
chars: valid UTF-8 codes are at most 4 bytes long, so look only that far
|
||||
display: keep the cursor put, also when toggling nohelp or morespace
|
||||
files: don't ask "save anyway" when user orders to discard the buffer
|
||||
history: don't save the cursor position for temporary help files
|
||||
moving: limit the target column when it is beyond the last chunk
|
||||
replacing: don't let placewewant influence the placement of the cursor
|
||||
startup: don't call delwin() with NULL, to avoid crashing on Solaris
|
||||
syntax: makefile: color comments only at start of line or after whitespace
|
||||
syntax: nanohelp: color also ^6 as a shortcut keystroke
|
||||
syntax: php: color also variable names, and color more reserved words
|
||||
syntax: php: recognize also the .phtml and .php7 extensions
|
||||
syntax: xml: recognize an XML file also by its first line
|
||||
tweaks: add another warning for an impossible condition
|
||||
tweaks: adjust whitespace and comments after the preceding change
|
||||
tweaks: avoid an empty function call in tiny version with line numbers
|
||||
tweaks: exclude from the tiny version five error-betraying messages
|
||||
tweaks: exclude from the tiny version two messages that will never occur
|
||||
tweaks: fix compilation with --enable-tiny ...-help and ...-multibuffer
|
||||
tweaks: remove an old fault-catching message
|
||||
tweaks: remove five dummy function definitions from the tiny version
|
||||
tweaks: rename three empty functions, and reshuffle some others
|
||||
tweaks: rewrap a couple of old items in NEWS, and fix an article
|
||||
tweaks: swap a comparison, to be clearer
|
||||
tweaks: transform the token DISABLE_BROWSER to ENABLE_BROWSER
|
||||
tweaks: transform the token DISABLE_NANORC to ENABLE_NANORC
|
||||
tweaks: transform the token DISABLE_TABCOMP to ENABLE_TABCOMP
|
||||
|
||||
David Lawrence Ramsey (2):
|
||||
display: ensure smooth scrolling when the edit window is resized
|
||||
tweaks: fix several whitespace irregularities
|
||||
|
||||
|
||||
Changes between v2.8.1 and v2.8.2:
|
||||
----------------------------------
|
||||
|
||||
|
||||
69
NEWS
69
NEWS
@@ -1,3 +1,20 @@
|
||||
2017.06.25 - GNU nano 2.8.5 "Farouche" avoids a crash when waking from
|
||||
a suspension that was induced from the outside, allows
|
||||
negative line and column numbers on the command line,
|
||||
avoids some flickering when resizing the screen while
|
||||
in the file browser, opens files in the order they were
|
||||
mentioned on the command line, and does not pretend to
|
||||
have woken from suspension when receiving a SIGCONT.
|
||||
|
||||
2017.05.21 - GNU nano 2.8.4 "Our Version of Events" includes the nanorc
|
||||
man page again.
|
||||
|
||||
2017.05.18 - GNU nano 2.8.3 "Hirsch" fixes a misplacement of the spotlight
|
||||
during interactive replacing, avoids build failures on AIX
|
||||
and Solaris, fixes a crash on Solaris, speeds up backwards
|
||||
searching, improves PHP syntax highlighting, and no longer
|
||||
asks “save anyway?” when the user ^Q discards the buffer.
|
||||
|
||||
2017.05.04 - GNU nano 2.8.2 "Krats" adds another new feature: it makes
|
||||
the ^G help texts searchable with ^W. Apart from that,
|
||||
it fixes a crash when resizing the window in the middle
|
||||
@@ -266,13 +283,12 @@
|
||||
handling of --tempfile mode, and better handling of
|
||||
command line arguments when also attempting to specify
|
||||
+<line number>. As always, please file any bugs you
|
||||
find at the Savannah page for nano, at
|
||||
https://savannah.gnu.org/bugs/index.php?42639 and
|
||||
thanks for using nano.
|
||||
find via https://savannah.gnu.org/bugs/?group=nano
|
||||
and thanks for using nano.
|
||||
|
||||
2014.06.02 - GNU nano 2.3.4 won't leave you high, won't leave you dry. This
|
||||
release contains only a small number of fixes, but in
|
||||
particular allows nano to compile on non-UTF-8 curses
|
||||
2014.06.02 - GNU nano 2.3.4 won't leave you high, won't leave you dry.
|
||||
This release contains only a small number of fixes, but
|
||||
in particular allows nano to compile on non-UTF-8 curses
|
||||
implementations (i.e. libncursesw). Other small fixes to
|
||||
the undo implementation and the default syntax config are
|
||||
also included. As always, Share and Enjoy!
|
||||
@@ -532,16 +548,16 @@
|
||||
an internal error occurs in the undo code, and fixes for
|
||||
various combinations of configure-time options and
|
||||
compiler flags. Also included is new support for
|
||||
changing the rc file name at configure time, and
|
||||
using GNU-style regexes for word-boundaries on systems
|
||||
which do not support them natively, as well as the ever
|
||||
popular translation updates. Rock the tarball.
|
||||
changing the rc file name at configure time, and using
|
||||
GNU-style regexes for word-boundaries on systems which
|
||||
do not support them natively, as well as the ever popular
|
||||
translation updates. Rock the tarball.
|
||||
|
||||
2008.08.09 - GNU nano 2.1.4 "I told you so!" is released. This release
|
||||
includes fixes for several severe issues with the new
|
||||
undo/redo code. Also the behavior of writing
|
||||
files when using backup mode has changed as well: if writing
|
||||
the backup file fails, nano will not attempt to write the
|
||||
undo/redo code. Also the behavior of writing files when
|
||||
using backup mode has changed as well: if writing the
|
||||
backup file fails, nano will not attempt to write the
|
||||
current file. This should help folks who enjoy "extreme
|
||||
text editing", i.e. editing files on file systems which
|
||||
are likely to run out of space; see Savannah bug #24000.
|
||||
@@ -1247,28 +1263,27 @@
|
||||
Have fun with it.
|
||||
|
||||
2001.03.22 - GNU Nano 1.0 is released! The autoindent wrapping bug
|
||||
has been fixed, as well as strange bug when using Pico
|
||||
has been fixed, as well as a strange bug when using Pico
|
||||
mode and regex search. There have also been some minor
|
||||
spelling and documentation updates. As stated on the
|
||||
website, there are currently no known bugs with nano,
|
||||
but some will pop up eventually and they will be
|
||||
addressed in subsequent releases. We hope you enjoy
|
||||
this first stable release of nano, and as always,
|
||||
feedback is welcome! nano@nano-editor.org.
|
||||
feedback is welcome! <nano@nano-editor.org>
|
||||
|
||||
|
||||
2001.02.19 - Nano 0.9.99pre3 brings a lot of changes! The most
|
||||
important being that nano is now officially a GNU
|
||||
program. Some changes have been made for GNU
|
||||
compatibility (like the default list of shortcuts, "^G
|
||||
Get Help" is now listed and "^_ Goto Line" is not). The
|
||||
Yes/No/All keys have finally been internationalized
|
||||
also. All in all, quite a few changes, considering nano
|
||||
is supposed to be in a code freeze. But there are the
|
||||
usual helping of bugfixes, a nasty bug when cutting text
|
||||
in -k mode and some compatibility issues with older
|
||||
ncurses libraries have also been fixed. All in all, a
|
||||
lot to see.
|
||||
2001.02.19 - Nano 0.9.99pre3 brings a lot of changes! The most important
|
||||
being that nano is now officially a GNU program. Some
|
||||
changes have been made for GNU compatibility (like in the
|
||||
default list of shortcuts: "^G Get Help" is now listed
|
||||
and "^_ Goto Line" is not). The Yes/No/All keys have
|
||||
finally been internationalized also. All in all, quite
|
||||
a few changes, considering nano is supposed to be in
|
||||
a code freeze. But there are the usual helping of
|
||||
bugfixes, a nasty bug when cutting text in -k mode and
|
||||
some compatibility issues with older ncurses libraries
|
||||
have also been fixed. All in all, a lot to see.
|
||||
|
||||
2001.01.31 - Nano 0.9.99pre2 is released. Not surprisingly, all that is
|
||||
new is bugfixes, bugfixes, bugfixes. There were a few
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Generate configure & friends for GIT users.
|
||||
|
||||
gnulib_url="git://git.sv.gnu.org/gnulib.git"
|
||||
gnulib_hash="3eee3a1e3c5b8883e0d4934bfc1326ee605cb7c1"
|
||||
gnulib_hash="736844e30bb369d203d45503a7cab9f560113cab"
|
||||
|
||||
modules="
|
||||
futimens
|
||||
|
||||
79
configure.ac
79
configure.ac
@@ -16,7 +16,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
AC_INIT([GNU nano], [2.8.2], [nano-devel@gnu.org], [nano])
|
||||
AC_INIT([GNU nano], [2.8.5], [nano-devel@gnu.org], [nano])
|
||||
AC_CONFIG_SRCDIR([src/nano.c])
|
||||
AC_CANONICAL_HOST
|
||||
AM_INIT_AUTOMAKE([1.14])
|
||||
@@ -64,8 +64,13 @@ dnl Checks for options.
|
||||
|
||||
AC_ARG_ENABLE(browser,
|
||||
AS_HELP_STRING([--disable-browser], [Disable the built-in file browser]))
|
||||
if test "x$enable_browser" = xno; then
|
||||
AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in file browser.])
|
||||
if test "x$enable_tiny" = xyes; then
|
||||
if test "x$enable_browser" != xyes; then
|
||||
enable_browser=no
|
||||
fi
|
||||
fi
|
||||
if test "x$enable_browser" != xno; then
|
||||
AC_DEFINE(ENABLE_BROWSER, 1, [Define this to enable the built-in file browser.])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(color,
|
||||
@@ -93,10 +98,8 @@ if test "x$enable_tiny" = xyes; then
|
||||
enable_comment=no
|
||||
fi
|
||||
fi
|
||||
if test "x$disable_comment" != xyes; then
|
||||
if test "x$enable_comment" != xno; then
|
||||
AC_DEFINE(ENABLE_COMMENT, 1, [Define this to enable the comment/uncomment function.])
|
||||
fi
|
||||
if test "x$enable_comment" != xno; then
|
||||
AC_DEFINE(ENABLE_COMMENT, 1, [Define this to enable the comment/uncomment function.])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(extra,
|
||||
@@ -110,7 +113,7 @@ AS_HELP_STRING([--disable-help], [Disable the built-in help texts]))
|
||||
if test "x$enable_tiny" = xyes; then
|
||||
if test "x$enable_help" = xyes; then
|
||||
if test "x$enable_multibuffer" != xyes; then
|
||||
AC_MSG_ERROR([--enable-help cannot work without --enable-multibuffer])
|
||||
AC_MSG_ERROR([--enable-help needs --enable-multibuffer to work])
|
||||
fi
|
||||
else
|
||||
enable_help=no
|
||||
@@ -124,10 +127,8 @@ if test "x$enable_multibuffer" = xno; then
|
||||
enable_help=no
|
||||
fi
|
||||
fi
|
||||
if test "x$disable_help" != xyes; then
|
||||
if test "x$enable_help" != xno; then
|
||||
AC_DEFINE(ENABLE_HELP, 1, [Define this to enable the Ctrl+G help texts.])
|
||||
fi
|
||||
if test "x$enable_help" != xno; then
|
||||
AC_DEFINE(ENABLE_HELP, 1, [Define this to enable the Ctrl+G help texts.])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(histories,
|
||||
@@ -152,10 +153,8 @@ if test "x$enable_tiny" = xyes; then
|
||||
enable_linenumbers=no
|
||||
fi
|
||||
fi
|
||||
if test "x$disable_linenumbers" != xyes; then
|
||||
if test "x$enable_linenumbers" != xno; then
|
||||
AC_DEFINE(ENABLE_LINENUMBERS, 1, [Define this to enable line numbering.])
|
||||
fi
|
||||
if test "x$enable_linenumbers" != xno; then
|
||||
AC_DEFINE(ENABLE_LINENUMBERS, 1, [Define this to enable line numbering.])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(mouse,
|
||||
@@ -165,10 +164,8 @@ if test "x$enable_tiny" = xyes; then
|
||||
enable_mouse=no
|
||||
fi
|
||||
fi
|
||||
if test "x$disable_mouse" != xyes; then
|
||||
if test "x$enable_mouse" != xno; then
|
||||
AC_DEFINE(ENABLE_MOUSE, 1, [Define this to enable mouse support.])
|
||||
fi
|
||||
if test "x$enable_mouse" != xno; then
|
||||
AC_DEFINE(ENABLE_MOUSE, 1, [Define this to enable mouse support.])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(multibuffer,
|
||||
@@ -178,17 +175,19 @@ if test "x$enable_tiny" = xyes; then
|
||||
enable_multibuffer=no
|
||||
fi
|
||||
fi
|
||||
if test "x$disable_multibuffer" != xyes; then
|
||||
if test "x$enable_multibuffer" != xno; then
|
||||
AC_DEFINE(ENABLE_MULTIBUFFER, 1, [Define this to enable multiple file buffers.])
|
||||
fi
|
||||
if test "x$enable_multibuffer" != xno; then
|
||||
AC_DEFINE(ENABLE_MULTIBUFFER, 1, [Define this to enable multiple file buffers.])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(nanorc,
|
||||
AS_HELP_STRING([--disable-nanorc], [Disable the use of .nanorc files]))
|
||||
if test "x$enable_nanorc" = xno; then
|
||||
AC_DEFINE(DISABLE_NANORC, 1, [Define this to disable the use of .nanorc files.])
|
||||
else
|
||||
if test "x$enable_tiny" = xyes; then
|
||||
if test "x$enable_nanorc" != xyes; then
|
||||
enable_nanorc=no
|
||||
fi
|
||||
fi
|
||||
if test "x$enable_nanorc" != xno; then
|
||||
AC_DEFINE(ENABLE_NANORC, 1, [Define this to enable the use of .nanorc files.])
|
||||
nanorc_support=yes
|
||||
fi
|
||||
|
||||
@@ -206,8 +205,13 @@ fi
|
||||
|
||||
AC_ARG_ENABLE(tabcomp,
|
||||
AS_HELP_STRING([--disable-tabcomp], [Disable the tab-completion functions]))
|
||||
if test "x$enable_tabcomp" = xno; then
|
||||
AC_DEFINE(DISABLE_TABCOMP, 1, [Define this to disable the tab-completion functions for filenames and search strings.])
|
||||
if test "x$enable_tiny" = xyes; then
|
||||
if test "x$enable_tabcomp" != xyes; then
|
||||
enable_tabcomp=no
|
||||
fi
|
||||
fi
|
||||
if test "x$enable_tabcomp" != xno; then
|
||||
AC_DEFINE(ENABLE_TABCOMP, 1, [Define this to have tab completion for filenames and search strings.])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(wordcomp,
|
||||
@@ -219,10 +223,8 @@ if test "x$enable_tiny" = xyes; then
|
||||
enable_wordcomp=no
|
||||
fi
|
||||
fi
|
||||
if test "x$disable_wordcomp" != xyes; then
|
||||
if test "x$enable_wordcomp" != xno; then
|
||||
AC_DEFINE(ENABLE_WORDCOMPLETION, 1, [Define this to enable the word-completion function.])
|
||||
fi
|
||||
if test "x$enable_wordcomp" != xno; then
|
||||
AC_DEFINE(ENABLE_WORDCOMPLETION, 1, [Define this to enable the word-completion function.])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(wrapping,
|
||||
@@ -249,15 +251,12 @@ AC_ARG_ENABLE(tiny,
|
||||
AS_HELP_STRING([--enable-tiny], [Disable features for the sake of size]))
|
||||
if test "x$enable_tiny" = xyes; then
|
||||
AC_DEFINE(NANO_TINY, 1, [Define this to make the nano executable as small as possible.])
|
||||
if test "x$enable_browser" != xyes; then
|
||||
AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in file browser.])
|
||||
fi
|
||||
if test "x$enable_color" != xyes; then
|
||||
AC_DEFINE(DISABLE_COLOR, 1, [Define this to disable syntax highlighting.])
|
||||
color_support=no
|
||||
else
|
||||
if test "x$enable_nanorc" != xyes; then
|
||||
AC_MSG_ERROR([--enable-color with --enable-tiny cannot work without --enable-nanorc])
|
||||
AC_MSG_ERROR([--enable-color needs --enable-nanorc to work])
|
||||
fi
|
||||
fi
|
||||
if test "x$enable_extra" != xyes; then
|
||||
@@ -272,18 +271,12 @@ if test "x$enable_tiny" = xyes; then
|
||||
if test "x$enable_libmagic" != xyes; then
|
||||
enable_libmagic=no
|
||||
fi
|
||||
if test "x$enable_nanorc" != xyes; then
|
||||
AC_DEFINE(DISABLE_NANORC, 1, [Define this to disable the use of .nanorc files.])
|
||||
fi
|
||||
if test "x$enable_operatingdir" != xyes; then
|
||||
AC_DEFINE(DISABLE_OPERATINGDIR, 1, [Define this to disable the setting of an operating directory (a chroot of sorts).])
|
||||
fi
|
||||
if test "x$enable_speller" != xyes; then
|
||||
AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the spell-checker functions.])
|
||||
fi
|
||||
if test "x$enable_tabcomp" != xyes; then
|
||||
AC_DEFINE(DISABLE_TABCOMP, 1, [Define this to disable the tab-completion functions for files and search strings.])
|
||||
fi
|
||||
if test "x$enable_wrapping" != xyes; then
|
||||
AC_DEFINE(DISABLE_WRAPPING, 1, [Define this to disable all text wrapping.])
|
||||
fi
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
<h2><a name="1.3"></a>1.3. Why the name change from TIP?</h2>
|
||||
<blockquote><p>On January 10, 2000, TIP was officially renamed to nano because of a namespace conflict with another program called 'tip'. The original 'tip' program "establishes a full duplex terminal connection to a remote host", and was included with many older Unix systems (and newer ones like Solaris). The conflict was not noticed at first because there is no 'tip' utility included with most GNU/Linux distributions (where nano was developed).</p></blockquote>
|
||||
<h2><a name="1.4"></a>1.4. What is the current version of nano?</h2>
|
||||
<blockquote><p>The current version of nano <i>should</i> be <b>2.8.2</b>. Of course, you should always check the <a href="https://nano-editor.org/">nano homepage</a> to see what the latest and greatest version is.</p></blockquote>
|
||||
<blockquote><p>The current version of nano <i>should</i> be <b>2.8.5</b>. Of course, you should always check the <a href="https://nano-editor.org/">nano homepage</a> to see what the latest and greatest version is.</p></blockquote>
|
||||
<h2><a name="1.5"></a>1.5. I want to read the man page without having to download the program!</h2>
|
||||
<blockquote><p>Jeez, demanding, aren't we? Okay, look <a href="https://nano-editor.org/dist/latest/nano.1.html">here</a>.</p></blockquote>
|
||||
<hr width="100%">
|
||||
@@ -161,7 +161,7 @@
|
||||
<blockquote><p>To use multiple file buffers, you must not have configured nano with <b>--disable-multibuffer</b> nor with <b>--enable-tiny</b> (use <b>nano -V</b> to check the compilation options). Then when you want to insert a file into its own buffer instead of into the current file, just hit <b>Meta-F</b> after typing <b>^R</b>. If you always want files to be loaded into their own buffers, use the <b>--multibuffer</b> or <b>-F</b> flag when you invoke nano.</p>
|
||||
<p>You can move between the buffers you have open with the <b>Meta-<</b> and <b>Meta-></b> keys, or more easily without holding Shift: <b>Meta-,</b> and <b>Meta-.</b> (clear as mud, right? =-). When you have more than one file buffer open, the ^X shortcut will say "Close", instead of the normal "Exit" when only one buffer is open.</p></blockquote>
|
||||
<h2><a name="3.8"></a>3.8. Tell me more about this verbatim input stuff!</h2>
|
||||
<blockquote><p>When you want to insert a literal character into the file you're editing, such as a control character that nano usually treats as a command, first press <b>Meta-V</b> (if you're not at a prompt, you'll get the message "Verbatim Input" on the statusbar), then press the key(s) that generate the character you want.</p>
|
||||
<blockquote><p>When you want to insert a literal character into the file you're editing, such as a control character that nano usually treats as a command, first press <b>Meta-V</b> (if you're not at a prompt, you'll get the message "Verbatim Input" on the status bar), then press the key(s) that generate the character you want.</p>
|
||||
<p>Alternatively, if you've enabled Unicode support (see section <a href="#5.3">5.3</a>), you can press <b>Meta-V</b> and then type a six-digit hexadecimal code (from 000000 to 10FFFF, case-insensitive), and the character with the corresponding value will be inserted. The statubar will change to "Unicode Input: ......" when you do this.</p></blockquote>
|
||||
<h2><a name="3.9a"></a>3.9a. How do I make a .nanorc file that will be read when I start nano?</h2>
|
||||
<blockquote><p>It's not hard at all! But, your nano must <b>not</b> have been compiled with <b>--disable-nanorc</b>. Then simply copy the <b>sample.nanorc</b> that came with the nano source or your nano package (most likely in /usr/doc/nano) to .nanorc in your home directory. If you didn't get one, the syntax of the file is simple. Flags are turned on and off by using the words <b>set</b> and <b>unset</b> plus the long option name for the feature. For example, "set nowrap" or "set smarthome".</p></blockquote>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH NANO 1 "version 2.8.2" "May 2017"
|
||||
.TH NANO 1 "version 2.8.5" "June 2017"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
|
||||
.SH NAME
|
||||
@@ -113,7 +113,7 @@ Don't add newlines to the ends of files.
|
||||
Disable automatic conversion of files from DOS/Mac format.
|
||||
.TP
|
||||
.BR \-O ", " \-\-morespace
|
||||
Use the blank line below the titlebar as extra editing space.
|
||||
Use the blank line below the title bar as extra editing space.
|
||||
.TP
|
||||
.BR \-P ", " \-\-positionlog
|
||||
For the 200 most recent files, log the last position of the cursor,
|
||||
@@ -144,7 +144,7 @@ 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
|
||||
.BR \-U ", " \-\-quickblank
|
||||
Do quick statusbar blanking: statusbar messages will disappear after 1
|
||||
Do quick status-bar blanking: status-bar messages will disappear after 1
|
||||
keystroke instead of 25. Note that \fB\-c\fP overrides this.
|
||||
.TP
|
||||
.BR \-V ", " \-\-version
|
||||
@@ -164,7 +164,7 @@ Specify the name of the syntax highlighting to use from among the ones
|
||||
defined in the \fInanorc\fP files.
|
||||
.TP
|
||||
.BR \-c ", " \-\-constantshow
|
||||
Constantly show the cursor position on the statusbar.
|
||||
Constantly show the cursor position on the status bar.
|
||||
Note that this overrides \fB\-U\fP.
|
||||
.TP
|
||||
.BR \-d ", " \-\-rebinddelete
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
|
||||
@smallbook
|
||||
@set EDITION 0.4
|
||||
@set VERSION 2.8.2
|
||||
@set UPDATED May 2017
|
||||
@set VERSION 2.8.5
|
||||
@set UPDATED June 2017
|
||||
|
||||
@dircategory Editors
|
||||
@direntry
|
||||
@@ -21,7 +21,7 @@
|
||||
@titlepage
|
||||
@title GNU @code{nano}
|
||||
@subtitle a small and friendly text editor
|
||||
@subtitle version 2.8.2
|
||||
@subtitle version 2.8.5
|
||||
|
||||
@author Chris Allegretta
|
||||
@page
|
||||
@@ -81,8 +81,9 @@ file locking, backup files, and internationalization support.
|
||||
|
||||
The original goal for @code{nano} was to be a complete bug-for-bug
|
||||
emulation of Pico. But currently the goal is to be as compatible
|
||||
as possible while offering a superset of Pico's functionality. See
|
||||
@xref{Pico Compatibility}, for more info.
|
||||
as possible while offering a superset of Pico's functionality.
|
||||
@xref{Pico Compatibility} for more details on how @code{nano} and
|
||||
Pico differ.
|
||||
|
||||
Please report bugs via @url{https://savannah.gnu.org/bugs/?group=nano}.
|
||||
|
||||
@@ -107,7 +108,7 @@ adding it with a comma. So a more complete command synopsis is:
|
||||
@end quotation
|
||||
|
||||
Normally, however, you set your preferred options in a @file{.nanorc}
|
||||
file (see @xref{Nanorc Files}). And when using @code{set positionlog}
|
||||
file (@pxref{Nanorc Files}). And when using @code{set positionlog}
|
||||
(making @code{nano} remember the cursor position when you close a file),
|
||||
you will rarely need to specify a line number.
|
||||
|
||||
@@ -182,7 +183,7 @@ Disable automatic conversion of files from DOS/Mac format.
|
||||
|
||||
@item -O
|
||||
@itemx --morespace
|
||||
Use the blank line below the titlebar as extra editing space.
|
||||
Use the blank line below the title bar as extra editing space.
|
||||
|
||||
@item -P
|
||||
@itemx --positionlog
|
||||
@@ -219,7 +220,7 @@ Set the displayed tab length to @var{number} columns. The value of
|
||||
|
||||
@item -U
|
||||
@itemx --quickblank
|
||||
Do quick statusbar blanking. Statusbar messages will disappear after 1
|
||||
Do quick status-bar blanking: status-bar messages will disappear after 1
|
||||
keystroke instead of 25. Note that option @option{-c}
|
||||
(@option{--constantshow}) overrides this.
|
||||
|
||||
@@ -240,12 +241,13 @@ should be considered as parts of words. This overrides option
|
||||
|
||||
@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.
|
||||
Specify the syntax to be used for highlighting.
|
||||
@xref{Syntax Highlighting} for more info.
|
||||
|
||||
@item -c
|
||||
@itemx --constantshow
|
||||
Constantly display the cursor position and line number on the statusbar.
|
||||
Constantly display the cursor position (line number, column number,
|
||||
and character number) on the status bar.
|
||||
Note that this overrides option @option{-U} (@option{--quickblank}).
|
||||
|
||||
@item -d
|
||||
@@ -351,7 +353,7 @@ Don't hard-wrap long lines at any length. This option conflicts with
|
||||
@item -x
|
||||
@itemx --nohelp
|
||||
Expert Mode: don't show the Shortcut List at the bottom of the screen.
|
||||
This affects the location of the statusbar as well, as in Expert Mode it
|
||||
This affects the location of the status bar as well, as in Expert Mode it
|
||||
is located at the very bottom of the editor.
|
||||
|
||||
Note: When accessing the help system, Expert Mode is temporarily
|
||||
@@ -475,21 +477,21 @@ If necessary, it can be toggled off manually with another ^6 or M-A.
|
||||
@section Screen Layout
|
||||
|
||||
The default screen of nano consists of five areas. From top to bottom
|
||||
these are: the titlebar, a blank line, the edit window, the statusbar,
|
||||
these are: the title bar, a blank line, the edit window, the status bar,
|
||||
and two help lines.
|
||||
|
||||
The titlebar consists of
|
||||
The title bar consists of
|
||||
three sections: left, center and right. The section on the left
|
||||
displays the version of @code{nano} being used. The center section
|
||||
displays the current filename, or "New Buffer" if the file has not yet
|
||||
been named. The section on the right displays "Modified" if the
|
||||
file has been modified since it was last saved or opened.
|
||||
|
||||
The statusbar is the third line from the bottom of the screen. It
|
||||
The status bar is the third line from the bottom of the screen. It
|
||||
shows important and informational messages. Any error messages that
|
||||
occur from using the editor will appear on the statusbar. Any questions
|
||||
that are asked of the user will be asked on the statusbar, and any user
|
||||
input (search strings, filenames, etc.) will be input on the statusbar.
|
||||
occur from using the editor will appear on the status bar. Any questions
|
||||
that are asked of the user will be asked on the status bar, and any user
|
||||
input (search strings, filenames, etc.) will be input on the status bar.
|
||||
|
||||
The two help lines at the bottom of the screen show some of the most
|
||||
essential functions of the editor. These two lines are called the
|
||||
@@ -545,7 +547,7 @@ and ^V (Page Down) keys. ^X exits the help system.
|
||||
|
||||
Toggles allow you to change on-the-fly certain aspects of the editor
|
||||
which would normally be specified via command-line options. They are
|
||||
invoked via Meta-key sequences (see @xref{Commands}, for more info).
|
||||
invoked via Meta-key sequences (@pxref{Commands} for more info).
|
||||
The following global toggles are available:
|
||||
|
||||
@table @code
|
||||
@@ -581,8 +583,7 @@ toggles the @code{-N} (@code{--noconvert}) command-line option.
|
||||
toggles the @code{-O} (@code{--morespace}) command-line option.
|
||||
|
||||
@item Whitespace Display Toggle (Meta-P)
|
||||
toggles the whitespace-display mode.
|
||||
See @xref{Whitespace}, for more info.
|
||||
toggles the whitespace-display mode (@pxref{Whitespace}).
|
||||
|
||||
@item Tabs to Spaces Toggle (Meta-Q)
|
||||
toggles the @code{-E} (@code{--tabstospaces}) command-line option.
|
||||
@@ -594,18 +595,18 @@ toggles the @code{-S} (@code{--smooth}) command-line option.
|
||||
toggles the @code{-x} (@code{--nohelp}) command-line option.
|
||||
|
||||
@item Color Syntax Highlighting Toggle (Meta-Y)
|
||||
toggles color syntax highlighting if you have color syntaxes in your
|
||||
nanorc. See @xref{Syntax Highlighting}, for more info.
|
||||
toggles color syntax highlighting (if your nanorc defines syntaxes
|
||||
--- @pxref{Syntax Highlighting}).
|
||||
|
||||
@item Suspension Toggle (Meta-Z)
|
||||
toggles the @code{-z} (@code{--suspend}) command-line option.
|
||||
|
||||
@item Soft Wrapping Toggle (Meta-$)
|
||||
toggles the @code{-$} (@code{--softwrap}) command-line option.
|
||||
|
||||
@item Line Numbers Toggle (Meta-#)
|
||||
toggles the @code{-l} (@code{--linenumbers}) command-line option.
|
||||
|
||||
@item Soft Wrapping Toggle (Meta-$)
|
||||
toggles the @code{-$} (@code{--softwrap}) command-line option.
|
||||
|
||||
@end table
|
||||
|
||||
|
||||
@@ -621,7 +622,7 @@ from @file{~/.nanorc}.
|
||||
A nanorc file accepts a series of "set" and "unset" commands, which can
|
||||
be used to configure @code{nano} on startup without using command-line
|
||||
options. Additionally, there are some commands to define syntax highlighting
|
||||
and to rebind keys --- @xref{Syntax Highlighting}, and @xref{Rebinding Keys}.
|
||||
and to rebind keys --- @pxref{Syntax Highlighting} and @ref{Rebinding Keys}.
|
||||
@code{nano} will read one command per line.
|
||||
|
||||
Options in nanorc files take precedence over @code{nano}'s defaults, and
|
||||
@@ -671,7 +672,7 @@ The uniquely numbered files are stored in the specified directory.
|
||||
Do backwards searches by default.
|
||||
|
||||
@item set boldtext
|
||||
Use bold instead of reverse video for the titlebar, statusbar, key combos,
|
||||
Use bold instead of reverse video for the title bar, status bar, key combos,
|
||||
line numbers, and selected text. This can be overridden for the first four
|
||||
by setting the options @code{titlecolor}, @code{statuscolor}, @code{keycolor},
|
||||
and @code{numbercolor}.
|
||||
@@ -687,7 +688,7 @@ closing brackets, can end sentences. The default value is
|
||||
Do case-sensitive searches by default.
|
||||
|
||||
@item set constantshow
|
||||
Constantly display the cursor position in the status bar.
|
||||
Constantly display the cursor position on the status bar.
|
||||
(The old form of this option, @code{set const}, is deprecated.)
|
||||
|
||||
@item set cut
|
||||
@@ -728,7 +729,7 @@ come before the closing set, and the two sets must be in the same order.
|
||||
The default value is @t{"(<[@{)>]@}"}.
|
||||
|
||||
@item set morespace
|
||||
Use the blank line below the titlebar as extra editing space.
|
||||
Use the blank line below the title bar as extra editing space.
|
||||
|
||||
@item set mouse
|
||||
Enable mouse support, so that mouse clicks can be used to place the
|
||||
@@ -779,7 +780,7 @@ specified closing punctuation, optionally followed by closing brackets
|
||||
The default value is @t{"!.?"}.
|
||||
|
||||
@item set quickblank
|
||||
Do quick statusbar blanking. Statusbar messages will disappear after 1
|
||||
Do quick status-bar blanking: status-bar messages will disappear after 1
|
||||
keystroke instead of 25.
|
||||
|
||||
@item set quiet
|
||||
@@ -830,7 +831,7 @@ Use spelling checker "spellprog" instead of the built-in one, which
|
||||
calls "spell".
|
||||
|
||||
@item set statuscolor @var{fgcolor},@var{bgcolor}
|
||||
Specify the color combination to use for the statusbar.
|
||||
Specify the color combination to use for the status bar.
|
||||
See @code{set titlecolor} for more details.
|
||||
|
||||
@item set suspend
|
||||
@@ -847,7 +848,7 @@ Convert typed tabs to spaces.
|
||||
Save automatically on exit, don't prompt.
|
||||
|
||||
@item set titlecolor @var{fgcolor},@var{bgcolor}
|
||||
Specify the color combination to use for the titlebar.
|
||||
Specify the color combination to use for the title bar.
|
||||
Valid color names for foreground and background are:
|
||||
white, black, blue, green, red, cyan, yellow, and magenta.
|
||||
The name of the foreground color may be prefixed with 'bright'.
|
||||
@@ -1271,7 +1272,7 @@ Toggles the presence of the two-line list of key bindings at the bottom of the s
|
||||
Toggles the constant display of the current line, column, and character positions.
|
||||
|
||||
@item morespace
|
||||
Toggles the presence of the blank line which 'separates' the titlebar from the file text.
|
||||
Toggles the presence of the blank line that 'separates' the title bar from the file text.
|
||||
|
||||
@item smoothscroll
|
||||
Toggles smooth scrolling (when moving around with the arrow keys).
|
||||
@@ -1387,7 +1388,7 @@ searching via ^W (or 'w') and changing directories via ^_ (or 'g'). The
|
||||
behavior of the Enter (or 's') key varies by what is currently selected.
|
||||
If the currently selected object is a directory, the file browser will
|
||||
enter and display the contents of the directory. If the object is a
|
||||
file, this filename and path are copied to the statusbar, and the file
|
||||
file, this filename and path are copied to the status bar, and the file
|
||||
browser exits.
|
||||
|
||||
|
||||
@@ -1419,6 +1420,16 @@ the .nanorc file), @code{nano} will store the position of the cursor
|
||||
when you close a file, and will place the cursor in that position
|
||||
again when you later reopen the file.
|
||||
|
||||
@item Current Cursor Position
|
||||
The output of the "Display Cursor Position" command (^C) displays
|
||||
not only the current line and character position of the cursor,
|
||||
but also (between the two) the current column position.
|
||||
|
||||
@item Spell Checking
|
||||
In the internal spell checker misspelled words are sorted alphabetically
|
||||
and trimmed for uniqueness, such that the words 'apple' and 'Apple' will
|
||||
be prompted for correction separately.
|
||||
|
||||
@item Writing Selected Text to Files
|
||||
When using the Write-Out key (^O), text that has been selected using the
|
||||
marking key (^^) can not just be written out to a new (or existing) file,
|
||||
@@ -1444,18 +1455,8 @@ browser is just a file browser, not a file manager.
|
||||
Many options which alter the functionality of the program can be
|
||||
"toggled" on or off using Meta key sequences, meaning the program does
|
||||
not have to be restarted to turn a particular feature on or off.
|
||||
See the internal help function (^G) for a list of features that
|
||||
can be toggled. Or see @xref{Feature Toggles} instead.
|
||||
|
||||
@item Current Cursor Position
|
||||
The output of the "Display Cursor Position" command (^C) displays
|
||||
not only the current line and character position of the cursor,
|
||||
but also (between the two) the current column position.
|
||||
|
||||
@item Spell Checking
|
||||
In the internal spell checker misspelled words are sorted alphabetically
|
||||
and trimmed for uniqueness, such that the words 'apple' and 'Apple' will
|
||||
be prompted for correction separately.
|
||||
@xref{Feature Toggles} for a list of options that can be toggled.
|
||||
Or see the list at the end the main internal help text (^G) instead.
|
||||
|
||||
@end table
|
||||
|
||||
@@ -1530,7 +1531,7 @@ option, which causes a file to be read into a separate buffer by default.
|
||||
Disable support for reading the nanorc files at startup. With such
|
||||
support, you can store custom settings in a system-wide and a per-user
|
||||
nanorc file rather than having to pass command-line options to get
|
||||
the desired behavior. See @xref{Nanorc Files}, for more info.
|
||||
the desired behavior. @xref{Nanorc Files} for more info.
|
||||
Disabling this also eliminates the @code{-I} and @code{-q} command-line
|
||||
options; the first inhibits the reading of nanorcfiles, and the second
|
||||
suppresses warnings about errors in those files.
|
||||
|
||||
14
doc/nanorc.5
14
doc/nanorc.5
@@ -16,7 +16,7 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH NANORC 5 "version 2.8.2" "May 2017"
|
||||
.TH NANORC 5 "version 2.8.5" "June 2017"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
|
||||
.SH NAME
|
||||
@@ -74,7 +74,7 @@ The uniquely numbered files are stored in the specified \fIdirectory\fR.
|
||||
Do backwards searches by default.
|
||||
.TP
|
||||
.B set boldtext
|
||||
Use bold instead of reverse video for the titlebar, statusbar, key combos,
|
||||
Use bold instead of reverse video for the title bar, status bar, key combos,
|
||||
line numbers, and selected text. This can be overridden for the first four
|
||||
by setting the options \fBtitlecolor\fP, \fBstatuscolor\fP, \fBkeycolor\fP,
|
||||
and \fBnumbercolor\fP.
|
||||
@@ -130,7 +130,7 @@ come before the closing set, and the two sets must be in the same order.
|
||||
The default value is "\fB(<[{)>]}\fP".
|
||||
.TP
|
||||
.B set morespace
|
||||
Use the blank line below the titlebar as extra editing space.
|
||||
Use the blank line below the title bar as extra editing space.
|
||||
.TP
|
||||
.B set mouse
|
||||
Enable mouse support, if available for your system. When enabled, mouse
|
||||
@@ -183,7 +183,7 @@ specfified closing punctuation, optionally followed by closing brackets
|
||||
(see \fBbrackets\fP), can end sentences. The default value is "\fB!.?\fP".
|
||||
.TP
|
||||
.B set quickblank
|
||||
Do quick statusbar blanking. Statusbar messages will disappear after 1
|
||||
Do quick status-bar blanking: status-bar messages will disappear after 1
|
||||
keystroke instead of 25.
|
||||
.TP
|
||||
.B set quiet
|
||||
@@ -234,7 +234,7 @@ Use spelling checker \fIspellprog\fP instead of the built-in one, which
|
||||
calls \fIspell\fP.
|
||||
.TP
|
||||
.B set statuscolor \fIfgcolor\fR,\fIbgcolor\fR
|
||||
Specify the color combination to use for the statusbar.
|
||||
Specify the color combination to use for the status bar.
|
||||
See \fBset titlecolor\fR for more details.
|
||||
.TP
|
||||
.B set suspend
|
||||
@@ -251,7 +251,7 @@ Convert typed tabs to spaces.
|
||||
Save automatically on exit, don't prompt.
|
||||
.TP
|
||||
.B set titlecolor \fIfgcolor\fR,\fIbgcolor\fR
|
||||
Specify the color combination to use for the titlebar.
|
||||
Specify the color combination to use for the title bar.
|
||||
Valid names for the foreground and background colors are:
|
||||
.BR white ", " black ", " blue ", " green ", " red ", " cyan ", " yellow ", and " magenta .
|
||||
The name of the foreground color may be prefixed with \fBbright\fR.
|
||||
@@ -666,7 +666,7 @@ Toggles the presence of the two-line list of key bindings at the bottom of the s
|
||||
Toggles the constant display of the current line, column, and character positions.
|
||||
.TP
|
||||
.B morespace
|
||||
Toggles the presence of the blank line which 'separates' the titlebar from the file text.
|
||||
Toggles the presence of the blank line that 'separates' the title bar from the file text.
|
||||
.TP
|
||||
.B smoothscroll
|
||||
Toggles smooth scrolling (when moving around with the arrow keys).
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH RNANO 1 "version 2.8.2" "May 2017"
|
||||
.TH RNANO 1 "version 2.8.5" "June 2017"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
|
||||
.SH NAME
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
## Do case-sensitive searches by default.
|
||||
# set casesensitive
|
||||
|
||||
## Constantly display the cursor position in the statusbar. Note that
|
||||
## Constantly display the cursor position in the status bar. Note that
|
||||
## this overrides "quickblank".
|
||||
# set constantshow
|
||||
## (The old form, 'const', is deprecated.)
|
||||
@@ -76,7 +76,7 @@
|
||||
## come before the latter set, and both must be in the same order.
|
||||
# set matchbrackets "(<[{)>]}"
|
||||
|
||||
## Use the blank line below the titlebar as extra editing space.
|
||||
## Use the blank line below the title bar as extra editing space.
|
||||
# set morespace
|
||||
|
||||
## Enable mouse support, if available for your system. When enabled,
|
||||
@@ -124,7 +124,7 @@
|
||||
## sentences.
|
||||
# set punct "!.?"
|
||||
|
||||
## Do quick statusbar blanking. Statusbar messages will disappear after
|
||||
## Do quick status-bar blanking. Status-bar messages will disappear after
|
||||
## 1 keystroke instead of 26. Note that "const" overrides this.
|
||||
# set quickblank
|
||||
|
||||
|
||||
823
po/nano.pot
823
po/nano.pot
File diff suppressed because it is too large
Load Diff
824
po/pt_BR.po
824
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
821
po/zh_CN.po
821
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
821
po/zh_TW.po
821
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@ AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" -DSYSCONFDIR=\"$(sysconfdir)\" \
|
||||
CLEANFILES = revision.h
|
||||
|
||||
if BUILDING_FROM_GIT
|
||||
SOMETHING = "REVISION \"$(shell git describe --tags 2>/dev/null)\""
|
||||
SOMETHING = "REVISION \"`git describe --tags 2>/dev/null`\""
|
||||
else
|
||||
SOMETHING = "NOTHING \"from tarball\""
|
||||
endif
|
||||
@@ -12,12 +12,13 @@ endif
|
||||
nano.o: revision.h
|
||||
winio.o: revision.h
|
||||
|
||||
revision.h: update_revision
|
||||
# Always run the commands in this rule. But update the target
|
||||
# only when the revision actually changed.
|
||||
revision.h: FORCE
|
||||
@[ -f $@ ] || touch $@
|
||||
@echo "#define $(SOMETHING)" | cmp -s $@ - || \
|
||||
echo "#define $(SOMETHING)" > $@
|
||||
|
||||
.PHONY: update_revision
|
||||
echo "#define $(SOMETHING)" > $@
|
||||
FORCE:
|
||||
|
||||
bin_PROGRAMS = nano
|
||||
nano_SOURCES = browser.c \
|
||||
@@ -38,7 +39,7 @@ nano_SOURCES = browser.c \
|
||||
utils.c \
|
||||
winio.c
|
||||
|
||||
nano_LDADD = @LIBINTL@ $(top_builddir)/lib/libgnu.a
|
||||
nano_LDADD = @LIBINTL@ $(top_builddir)/lib/libgnu.a $(LIB_CLOCK_GETTIME)
|
||||
|
||||
install-exec-hook:
|
||||
cd $(DESTDIR)$(bindir) && rm -f rnano && $(LN_S) nano rnano
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
|
||||
static char **filelist = NULL;
|
||||
/* The list of files to display in the file browser. */
|
||||
@@ -183,14 +183,12 @@ char *do_browser(char *path)
|
||||
} else if (func == do_right) {
|
||||
if (selected < filelist_len - 1)
|
||||
selected++;
|
||||
#ifndef NANO_TINY
|
||||
} else if (func == do_prev_word_void) {
|
||||
selected -= (selected % width);
|
||||
} else if (func == do_next_word_void) {
|
||||
selected += width - 1 - (selected % width);
|
||||
if (selected >= filelist_len)
|
||||
selected = filelist_len - 1;
|
||||
#endif
|
||||
} else if (func == do_up_void) {
|
||||
if (selected >= width)
|
||||
selected -= width;
|
||||
@@ -812,4 +810,4 @@ char *strip_last_component(const char *path)
|
||||
return copy;
|
||||
}
|
||||
|
||||
#endif /* !DISABLE_BROWSER */
|
||||
#endif /* ENABLE_BROWSER */
|
||||
|
||||
51
src/chars.c
51
src/chars.c
@@ -374,24 +374,39 @@ 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, char_len = 0;
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
size_t before, char_len = 0;
|
||||
|
||||
assert(pos <= strlen(buf));
|
||||
if (pos < 4)
|
||||
before = 0;
|
||||
else {
|
||||
const char *ptr = buf + pos;
|
||||
|
||||
/* There is no library function to move backward one multibyte
|
||||
* character. So we just start groping for one at the farthest
|
||||
* possible point. */
|
||||
if (pos < MAXCHARLEN)
|
||||
before = 0;
|
||||
else
|
||||
before = pos - MAXCHARLEN;
|
||||
/* Probe for a valid starter byte in the preceding four bytes. */
|
||||
if ((signed char)*(--ptr) > -65)
|
||||
before = pos - 1;
|
||||
else if ((signed char)*(--ptr) > -65)
|
||||
before = pos - 2;
|
||||
else if ((signed char)*(--ptr) > -65)
|
||||
before = pos - 3;
|
||||
else if ((signed char)*(--ptr) > -65)
|
||||
before = pos - 4;
|
||||
else
|
||||
before = pos - 1;
|
||||
}
|
||||
|
||||
while (before < pos) {
|
||||
char_len = parse_mbchar(buf + before, NULL, NULL);
|
||||
before += char_len;
|
||||
}
|
||||
/* Move forward again until we reach the original character,
|
||||
* so we know the length of its preceding the character. */
|
||||
while (before < pos) {
|
||||
char_len = parse_mbchar(buf + before, NULL, NULL);
|
||||
before += char_len;
|
||||
}
|
||||
|
||||
return before - char_len;
|
||||
return before - char_len;
|
||||
} else
|
||||
#endif
|
||||
return (pos == 0 ? 0 : pos - 1);
|
||||
}
|
||||
|
||||
/* Return the index in buf of the beginning of the multibyte character
|
||||
@@ -671,7 +686,7 @@ char *mbrevstrpbrk(const char *head, const char *accept, const char *pointer)
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
#if !defined(DISABLE_NANORC) && (!defined(NANO_TINY) || !defined(DISABLE_JUSTIFY))
|
||||
#if defined(ENABLE_NANORC) && (!defined(NANO_TINY) || !defined(DISABLE_JUSTIFY))
|
||||
/* Return TRUE if the string s contains one or more blank characters,
|
||||
* and FALSE otherwise. */
|
||||
bool has_blank_chars(const char *s)
|
||||
@@ -704,7 +719,7 @@ bool has_blank_mbchars(const char *s)
|
||||
#endif
|
||||
return has_blank_chars(s);
|
||||
}
|
||||
#endif /* !DISABLE_NANORC && (!NANO_TINY || !DISABLE_JUSTIFY) */
|
||||
#endif /* ENABLE_NANORC && (!NANO_TINY || !DISABLE_JUSTIFY) */
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
/* Return TRUE if wc is valid Unicode, and FALSE otherwise. */
|
||||
@@ -717,7 +732,7 @@ bool is_valid_unicode(wchar_t wc)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_NANORC
|
||||
#ifdef ENABLE_NANORC
|
||||
/* Check if the string s is a valid multibyte string. Return TRUE if it
|
||||
* is, and FALSE otherwise. */
|
||||
bool is_valid_mbstring(const char *s)
|
||||
@@ -729,4 +744,4 @@ bool is_valid_mbstring(const char *s)
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
#endif /* !DISABLE_NANORC */
|
||||
#endif /* ENABLE_NANORC */
|
||||
|
||||
@@ -292,7 +292,7 @@ void do_uncut_text(void)
|
||||
set_modified();
|
||||
|
||||
/* Update current_y to account for the inserted lines. */
|
||||
place_the_cursor();
|
||||
place_the_cursor(TRUE);
|
||||
|
||||
refresh_needed = TRUE;
|
||||
|
||||
|
||||
51
src/files.c
51
src/files.c
@@ -1106,14 +1106,13 @@ void do_insertfile(void)
|
||||
} else {
|
||||
ssize_t was_current_lineno = openfile->current->lineno;
|
||||
size_t was_current_x = openfile->current_x;
|
||||
#if !defined(NANO_TINY) || !defined(DISABLE_BROWSER)
|
||||
#if !defined(NANO_TINY) || defined(ENABLE_BROWSER) || defined(ENABLE_MULTIBUFFER)
|
||||
functionptrtype func = func_from_key(&i);
|
||||
#endif
|
||||
given = mallocstrcpy(given, answer);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (func == new_buffer_void) {
|
||||
if (func == flip_newbuffer) {
|
||||
/* Don't allow toggling when in view mode. */
|
||||
if (!ISSET(VIEW_MODE))
|
||||
TOGGLE(MULTIBUFFER);
|
||||
@@ -1122,13 +1121,13 @@ void do_insertfile(void)
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
if (func == flip_execute_void) {
|
||||
#ifndef NANO_TINY
|
||||
if (func == flip_execute) {
|
||||
execute = !execute;
|
||||
continue;
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
#endif
|
||||
#ifdef ENABLE_BROWSER
|
||||
if (func == to_files_void) {
|
||||
char *chosen = do_browse_from(answer);
|
||||
|
||||
@@ -1199,7 +1198,7 @@ void do_insertfile(void)
|
||||
set_modified();
|
||||
|
||||
/* Update current_y to account for inserted lines. */
|
||||
place_the_cursor();
|
||||
place_the_cursor(TRUE);
|
||||
|
||||
refresh_needed = TRUE;
|
||||
}
|
||||
@@ -2128,11 +2127,12 @@ int do_writeout(bool exiting)
|
||||
msg = (method == PREPEND) ? _("Prepend Selection to File") :
|
||||
(method == APPEND) ? _("Append Selection to File") :
|
||||
_("Write Selection to File");
|
||||
else if (method != OVERWRITE)
|
||||
msg = (method == PREPEND) ? _("File Name to Prepend to") :
|
||||
_("File Name to Append to");
|
||||
else
|
||||
#endif /* !NANO_TINY */
|
||||
msg = (method == PREPEND) ? _("File Name to Prepend to") :
|
||||
(method == APPEND) ? _("File Name to Append to") :
|
||||
_("File Name to Write");
|
||||
msg = _("File Name to Write");
|
||||
|
||||
present_path = mallocstrcpy(present_path, "./");
|
||||
|
||||
@@ -2157,24 +2157,15 @@ int do_writeout(bool exiting)
|
||||
} else {
|
||||
functionptrtype func = func_from_key(&i);
|
||||
|
||||
/* Upon request, abandon the buffer, if user is sure. */
|
||||
/* Upon request, abandon the buffer. */
|
||||
if (func == discard_buffer) {
|
||||
if (openfile->modified)
|
||||
i = do_yesno_prompt(FALSE,
|
||||
_("Save modified buffer anyway? "));
|
||||
else
|
||||
i = 0;
|
||||
|
||||
if (i == 0) {
|
||||
free(given);
|
||||
return 2; /* Yes, discard the buffer. */
|
||||
} else
|
||||
continue; /* Go back to the filename prompt. */
|
||||
free(given);
|
||||
return 2;
|
||||
}
|
||||
|
||||
given = mallocstrcpy(given, answer);
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
if (func == to_files_void) {
|
||||
char *chosen = do_browse_from(answer);
|
||||
|
||||
@@ -2185,7 +2176,7 @@ int do_writeout(bool exiting)
|
||||
free(answer);
|
||||
answer = chosen;
|
||||
} else
|
||||
#endif /* !DISABLE_BROWSER */
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
if (func == dos_format_void) {
|
||||
openfile->fmt = (openfile->fmt == DOS_FILE) ? NIX_FILE :
|
||||
@@ -2386,7 +2377,7 @@ char *real_dir_from_tilde(const char *buf)
|
||||
return retval;
|
||||
}
|
||||
|
||||
#if !defined(DISABLE_TABCOMP) || !defined(DISABLE_BROWSER)
|
||||
#if defined(ENABLE_TABCOMP) || defined(ENABLE_BROWSER)
|
||||
/* Our sort routine for file listings. Sort alphabetically and
|
||||
* case-insensitively, and sort directories before filenames. */
|
||||
int diralphasort(const void *va, const void *vb)
|
||||
@@ -2423,7 +2414,7 @@ void free_chararray(char **array, size_t len)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_TABCOMP
|
||||
#ifdef ENABLE_TABCOMP
|
||||
/* Is the given path a directory? */
|
||||
bool is_dir(const char *buf)
|
||||
{
|
||||
@@ -2747,7 +2738,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place,
|
||||
|
||||
return buf;
|
||||
}
|
||||
#endif /* !DISABLE_TABCOMP */
|
||||
#endif /* ENABLE_TABCOMP */
|
||||
|
||||
/* Return the filename part of the given path. */
|
||||
const char *tail(const char *path)
|
||||
@@ -3003,7 +2994,7 @@ void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos)
|
||||
poshiststruct *posptr, *theone, *posprev = NULL;
|
||||
char *fullpath = get_full_path(filename);
|
||||
|
||||
if (fullpath == NULL || fullpath[strlen(fullpath) - 1] == '/') {
|
||||
if (fullpath == NULL || fullpath[strlen(fullpath) - 1] == '/' || inhelp) {
|
||||
free(fullpath);
|
||||
return;
|
||||
}
|
||||
@@ -3075,7 +3066,7 @@ bool has_old_position(const char *file, ssize_t *line, ssize_t *column)
|
||||
free(fullpath);
|
||||
|
||||
if (posptr == NULL)
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
|
||||
*line = posptr->lineno;
|
||||
*column = posptr->xno;
|
||||
|
||||
147
src/global.c
147
src/global.c
@@ -57,6 +57,9 @@ bool have_palette = FALSE;
|
||||
/* Whether the colors for the current syntax have been initialized. */
|
||||
#endif
|
||||
|
||||
bool suppress_cursorpos = FALSE;
|
||||
/* Should we skip constant position display for current keystroke? */
|
||||
|
||||
message_type lastmessage = HUSH;
|
||||
/* Messages of type HUSH should not overwrite type MILD nor ALERT. */
|
||||
|
||||
@@ -95,14 +98,14 @@ char *present_path = NULL;
|
||||
|
||||
unsigned flags[4] = {0, 0, 0, 0};
|
||||
/* Our flag containing the states of all global options. */
|
||||
WINDOW *topwin;
|
||||
WINDOW *topwin = NULL;
|
||||
/* The top portion of the window, where we display the version
|
||||
* number of nano, the name of the current file, and whether the
|
||||
* current file has been modified. */
|
||||
WINDOW *edit;
|
||||
WINDOW *edit = NULL;
|
||||
/* The middle portion of the window, i.e. the edit window, where
|
||||
* we display the current file we're editing. */
|
||||
WINDOW *bottomwin;
|
||||
WINDOW *bottomwin = NULL;
|
||||
/* The bottom portion of the window, where we display statusbar
|
||||
* messages, the statusbar prompt, and a list of shortcuts. */
|
||||
int editwinrows = 0;
|
||||
@@ -146,9 +149,6 @@ char *quoteerr = NULL;
|
||||
char *word_chars = NULL;
|
||||
/* Nonalphanumeric characters that also form words. */
|
||||
|
||||
bool nodelay_mode = FALSE;
|
||||
/* Are we checking for a cancel wile doing something? */
|
||||
|
||||
char *answer = NULL;
|
||||
/* The answer string used by the statusbar prompt. */
|
||||
|
||||
@@ -266,10 +266,13 @@ void regexp_void(void)
|
||||
void backwards_void(void)
|
||||
{
|
||||
}
|
||||
void flip_replace(void)
|
||||
{
|
||||
}
|
||||
void gototext_void(void)
|
||||
{
|
||||
}
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
void to_files_void(void)
|
||||
{
|
||||
}
|
||||
@@ -277,6 +280,7 @@ void goto_dir_void(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
void dos_format_void(void)
|
||||
{
|
||||
}
|
||||
@@ -292,18 +296,18 @@ void prepend_void(void)
|
||||
void backup_file_void(void)
|
||||
{
|
||||
}
|
||||
void flip_execute(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
void flip_newbuffer(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
void discard_buffer(void)
|
||||
{
|
||||
}
|
||||
void new_buffer_void(void)
|
||||
{
|
||||
}
|
||||
void flip_replace_void(void)
|
||||
{
|
||||
}
|
||||
void flip_execute_void(void)
|
||||
{
|
||||
}
|
||||
|
||||
/* Add a function to the function list. */
|
||||
void add_to_funcs(void (*func)(void), int menus, const char *desc, const char *help,
|
||||
@@ -489,11 +493,8 @@ void shortcut_init(void)
|
||||
const char *whereis_next_tag = N_("WhereIs Next");
|
||||
|
||||
#ifdef ENABLE_HELP
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
/* TRANSLATORS: The next long series of strings are shortcut descriptions;
|
||||
* they are best kept shorter than 56 characters, but may be longer. */
|
||||
const char *nano_justify_msg = N_("Justify the current paragraph");
|
||||
#endif
|
||||
const char *nano_cancel_msg = N_("Cancel the current function");
|
||||
const char *nano_help_msg = N_("Display this help text");
|
||||
const char *nano_exit_msg =
|
||||
@@ -509,7 +510,7 @@ void shortcut_init(void)
|
||||
N_("Insert another file into the current one");
|
||||
const char *nano_whereis_msg =
|
||||
N_("Search for a string or a regular expression");
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
const char *nano_browser_whereis_msg = N_("Search for a string");
|
||||
const char *nano_browser_refresh_msg = N_("Refresh the file list");
|
||||
#ifndef NANO_TINY
|
||||
@@ -585,6 +586,7 @@ void shortcut_init(void)
|
||||
N_("Cut from the cursor position to the end of the file");
|
||||
#endif
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
const char *nano_justify_msg = N_("Justify the current paragraph");
|
||||
const char *nano_fulljustify_msg = N_("Justify the entire file");
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
@@ -619,9 +621,6 @@ void shortcut_init(void)
|
||||
const char *nano_next_history_msg =
|
||||
N_("Recall the next search/replace string");
|
||||
#endif
|
||||
#ifndef DISABLE_BROWSER
|
||||
const char *nano_tofiles_msg = N_("Go to file browser");
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
const char *nano_dos_msg = N_("Toggle the use of DOS format");
|
||||
const char *nano_mac_msg = N_("Toggle the use of Mac format");
|
||||
@@ -629,12 +628,13 @@ void shortcut_init(void)
|
||||
const char *nano_prepend_msg = N_("Toggle prepending");
|
||||
const char *nano_backup_msg = N_("Toggle backing up of the original file");
|
||||
const char *nano_execute_msg = N_("Execute external command");
|
||||
#endif
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
const char *nano_newbuffer_msg = N_("Toggle the use of a new buffer");
|
||||
#endif
|
||||
#endif
|
||||
const char *nano_discard_buffer_msg = N_("Close buffer without saving it");
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
const char *nano_tofiles_msg = N_("Go to file browser");
|
||||
const char *nano_exitbrowser_msg = N_("Exit from the file browser");
|
||||
const char *nano_firstfile_msg = N_("Go to the first file in the list");
|
||||
const char *nano_lastfile_msg = N_("Go to the last file in the list");
|
||||
@@ -667,12 +667,12 @@ void shortcut_init(void)
|
||||
add_to_funcs(do_cancel, ((MMOST & ~MMAIN & ~MBROWSER) | MYESNO),
|
||||
N_("Cancel"), IFSCHELP(nano_cancel_msg), BLANKAFTER, VIEW);
|
||||
|
||||
add_to_funcs(do_exit, MMAIN,
|
||||
add_to_funcs(do_exit, MMAIN|MHELP,
|
||||
exit_tag, IFSCHELP(nano_exit_msg), TOGETHER, VIEW);
|
||||
/* Remember the entry for Exit, to be able to replace it with Close. */
|
||||
exitfunc = tailfunc;
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
add_to_funcs(do_exit, MBROWSER,
|
||||
exit_tag, IFSCHELP(nano_exitbrowser_msg), TOGETHER, VIEW);
|
||||
#endif
|
||||
@@ -709,7 +709,7 @@ void shortcut_init(void)
|
||||
add_to_funcs(do_replace, MMAIN,
|
||||
replace_tag, IFSCHELP(nano_replace_msg), TOGETHER, NOVIEW);
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
add_to_funcs(do_search, MBROWSER,
|
||||
whereis_tag, IFSCHELP(nano_browser_whereis_msg), TOGETHER, VIEW);
|
||||
|
||||
@@ -720,15 +720,10 @@ void shortcut_init(void)
|
||||
#ifdef ENABLE_HELP
|
||||
/* The description ("x") and blank_after (0) are irrelevant,
|
||||
* because the help viewer does not have a help text. */
|
||||
add_to_funcs(do_exit, MHELP, exit_tag, "x", 0, VIEW);
|
||||
|
||||
add_to_funcs(total_refresh, MHELP, refresh_tag, "x", 0, VIEW);
|
||||
|
||||
add_to_funcs(do_search, MHELP, whereis_tag, "x", 0, VIEW);
|
||||
add_to_funcs(do_research, MHELP, whereis_next_tag, "x", 0, VIEW);
|
||||
|
||||
add_to_funcs(do_up_void, MHELP, prev_line_tag, "x", 0, VIEW);
|
||||
add_to_funcs(do_down_void, MHELP, next_line_tag, "x" , 0, VIEW);
|
||||
#endif
|
||||
|
||||
add_to_funcs(do_cut_text_void, MMAIN,
|
||||
@@ -789,10 +784,10 @@ void shortcut_init(void)
|
||||
add_to_funcs(backwards_void, MWHEREIS|MREPLACE,
|
||||
N_("Backwards"), IFSCHELP(nano_reverse_msg), TOGETHER, VIEW);
|
||||
|
||||
add_to_funcs(flip_replace_void, MWHEREIS,
|
||||
add_to_funcs(flip_replace, MWHEREIS,
|
||||
replace_tag, IFSCHELP(nano_replace_msg), BLANKAFTER, VIEW);
|
||||
|
||||
add_to_funcs(flip_replace_void, MREPLACE,
|
||||
add_to_funcs(flip_replace, MREPLACE,
|
||||
N_("No Replace"), IFSCHELP(nano_whereis_msg), BLANKAFTER, VIEW);
|
||||
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
@@ -820,7 +815,7 @@ void shortcut_init(void)
|
||||
N_("Back"), IFSCHELP(nano_back_msg), TOGETHER, VIEW);
|
||||
add_to_funcs(do_right, MMAIN,
|
||||
N_("Forward"), IFSCHELP(nano_forward_msg), TOGETHER, VIEW);
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
add_to_funcs(do_left, MBROWSER,
|
||||
N_("Back"), IFSCHELP(nano_backfile_msg), TOGETHER, VIEW);
|
||||
add_to_funcs(do_right, MBROWSER,
|
||||
@@ -837,9 +832,9 @@ void shortcut_init(void)
|
||||
add_to_funcs(do_end_void, MMAIN,
|
||||
N_("End"), IFSCHELP(nano_end_msg), BLANKAFTER, VIEW);
|
||||
|
||||
add_to_funcs(do_up_void, MMAIN|MBROWSER,
|
||||
add_to_funcs(do_up_void, MMAIN|MHELP|MBROWSER,
|
||||
prev_line_tag, IFSCHELP(nano_prevline_msg), TOGETHER, VIEW);
|
||||
add_to_funcs(do_down_void, MMAIN|MBROWSER,
|
||||
add_to_funcs(do_down_void, MMAIN|MHELP|MBROWSER,
|
||||
next_line_tag, IFSCHELP(nano_nextline_msg), TOGETHER, VIEW);
|
||||
#ifndef NANO_TINY
|
||||
add_to_funcs(do_scroll_up, MMAIN,
|
||||
@@ -992,20 +987,20 @@ void shortcut_init(void)
|
||||
/* 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, MINSERTFILE,
|
||||
N_("Execute Command"), IFSCHELP(nano_execute_msg), TOGETHER, NOVIEW);
|
||||
|
||||
add_to_funcs(flip_execute_void, MEXTCMD,
|
||||
add_to_funcs(flip_execute, MEXTCMD,
|
||||
read_file_tag, IFSCHELP(nano_insert_msg), TOGETHER, NOVIEW);
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
add_to_funcs(new_buffer_void, MINSERTFILE|MEXTCMD,
|
||||
N_("New Buffer"), IFSCHELP(nano_newbuffer_msg), TOGETHER, NOVIEW);
|
||||
#endif
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (!ISSET(RESTRICTED))
|
||||
add_to_funcs(flip_newbuffer, MINSERTFILE|MEXTCMD,
|
||||
N_("New Buffer"), IFSCHELP(nano_newbuffer_msg), TOGETHER, NOVIEW);
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
if (!ISSET(RESTRICTED))
|
||||
add_to_funcs(to_files_void, MWRITEFILE|MINSERTFILE,
|
||||
N_("To Files"), IFSCHELP(nano_tofiles_msg), TOGETHER, VIEW);
|
||||
@@ -1024,7 +1019,7 @@ void shortcut_init(void)
|
||||
add_to_funcs(discard_buffer, MWRITEFILE,
|
||||
N_("Discard buffer"), IFSCHELP(nano_discard_buffer_msg), BLANKAFTER, NOVIEW);
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
add_to_funcs(do_research, MBROWSER,
|
||||
whereis_next_tag, IFSCHELP(nano_whereis_next_msg), TOGETHER, VIEW);
|
||||
add_to_funcs(total_refresh, MBROWSER,
|
||||
@@ -1127,15 +1122,15 @@ void shortcut_init(void)
|
||||
if (using_utf8()) {
|
||||
add_to_sclist(MMOST, "\xE2\x86\x90", KEY_LEFT, do_left, 0);
|
||||
add_to_sclist(MMOST, "\xE2\x86\x92", KEY_RIGHT, do_right, 0);
|
||||
add_to_sclist(MMOST, "^\xE2\x86\x90", CONTROL_LEFT, do_prev_word_void, 0);
|
||||
add_to_sclist(MMOST, "^\xE2\x86\x92", CONTROL_RIGHT, do_next_word_void, 0);
|
||||
add_to_sclist(MSOME, "^\xE2\x86\x90", CONTROL_LEFT, do_prev_word_void, 0);
|
||||
add_to_sclist(MSOME, "^\xE2\x86\x92", CONTROL_RIGHT, do_next_word_void, 0);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
add_to_sclist(MMOST, "Left", KEY_LEFT, do_left, 0);
|
||||
add_to_sclist(MMOST, "Right", KEY_RIGHT, do_right, 0);
|
||||
add_to_sclist(MMOST, "^Left", CONTROL_LEFT, do_prev_word_void, 0);
|
||||
add_to_sclist(MMOST, "^Right", CONTROL_RIGHT, do_next_word_void, 0);
|
||||
add_to_sclist(MSOME, "^Left", CONTROL_LEFT, do_prev_word_void, 0);
|
||||
add_to_sclist(MSOME, "^Right", CONTROL_RIGHT, do_next_word_void, 0);
|
||||
}
|
||||
add_to_sclist(MMOST, "M-Space", 0, do_prev_word_void, 0);
|
||||
add_to_sclist(MMOST, "^Space", 0, do_next_word_void, 0);
|
||||
@@ -1234,7 +1229,7 @@ void shortcut_init(void)
|
||||
add_to_sclist(MWHEREIS|MREPLACE, "M-C", 0, case_sens_void, 0);
|
||||
add_to_sclist(MWHEREIS|MREPLACE, "M-R", 0, regexp_void, 0);
|
||||
add_to_sclist(MWHEREIS|MREPLACE, "M-B", 0, backwards_void, 0);
|
||||
add_to_sclist(MWHEREIS|MREPLACE, "^R", 0, flip_replace_void, 0);
|
||||
add_to_sclist(MWHEREIS|MREPLACE, "^R", 0, flip_replace, 0);
|
||||
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE, "^Y", 0, do_first_line, 0);
|
||||
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE, "^V", 0, do_last_line, 0);
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
@@ -1257,7 +1252,7 @@ void shortcut_init(void)
|
||||
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP, "Down", KEY_DOWN, get_history_newer_void, 0);
|
||||
}
|
||||
#endif
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
add_to_sclist(MWHEREISFILE, "^Y", 0, do_first_file, 0);
|
||||
add_to_sclist(MWHEREISFILE, "^V", 0, do_last_file, 0);
|
||||
add_to_sclist(MBROWSER|MWHEREISFILE, "M-\\", 0, do_first_file, 0);
|
||||
@@ -1284,11 +1279,14 @@ void shortcut_init(void)
|
||||
add_to_sclist(MWRITEFILE, "M-A", 0, append_void, 0);
|
||||
add_to_sclist(MWRITEFILE, "M-P", 0, prepend_void, 0);
|
||||
add_to_sclist(MWRITEFILE, "M-B", 0, backup_file_void, 0);
|
||||
add_to_sclist(MINSERTFILE|MEXTCMD, "^X", 0, flip_execute_void, 0);
|
||||
add_to_sclist(MINSERTFILE|MEXTCMD, "M-F", 0, new_buffer_void, 0);
|
||||
add_to_sclist(MINSERTFILE|MEXTCMD, "^X", 0, flip_execute, 0);
|
||||
}
|
||||
#endif
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (!ISSET(RESTRICTED))
|
||||
add_to_sclist(MINSERTFILE|MEXTCMD, "M-F", 0, flip_newbuffer, 0);
|
||||
#endif
|
||||
#ifdef ENABLE_BROWSER
|
||||
/* In restricted mode, don't allow entering the file browser. */
|
||||
if (!ISSET(RESTRICTED))
|
||||
add_to_sclist(MWRITEFILE|MINSERTFILE, "^T", 0, to_files_void, 0);
|
||||
@@ -1296,7 +1294,7 @@ void shortcut_init(void)
|
||||
add_to_sclist(MHELP|MBROWSER, "^C", 0, do_exit, 0);
|
||||
/* Allow exiting from the file browser and the help viewer with
|
||||
* the same key as they were entered. */
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
add_to_sclist(MBROWSER, "^T", 0, do_exit, 0);
|
||||
#endif
|
||||
#ifdef ENABLE_HELP
|
||||
@@ -1401,7 +1399,7 @@ const char *flagtostr(int flag)
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
#ifndef DISABLE_NANORC
|
||||
#ifdef ENABLE_NANORC
|
||||
/* Interpret a function string given in the rc file, and return a
|
||||
* shortcut struct with the corresponding function filled in. */
|
||||
sc *strtosc(const char *input)
|
||||
@@ -1497,18 +1495,10 @@ sc *strtosc(const char *input)
|
||||
s->scfunc = do_scroll_up;
|
||||
else if (!strcasecmp(input, "scrolldown"))
|
||||
s->scfunc = do_scroll_down;
|
||||
else if (!strcasecmp(input, "prevword"))
|
||||
s->scfunc = do_prev_word_void;
|
||||
else if (!strcasecmp(input, "nextword"))
|
||||
s->scfunc = do_next_word_void;
|
||||
else if (!strcasecmp(input, "cutwordleft"))
|
||||
s->scfunc = do_cut_prev_word;
|
||||
else if (!strcasecmp(input, "cutwordright"))
|
||||
s->scfunc = do_cut_next_word;
|
||||
else if (!strcasecmp(input, "prevblock"))
|
||||
s->scfunc = do_prev_block;
|
||||
else if (!strcasecmp(input, "nextblock"))
|
||||
s->scfunc = do_next_block;
|
||||
else if (!strcasecmp(input, "findbracket"))
|
||||
s->scfunc = do_find_bracket;
|
||||
else if (!strcasecmp(input, "wordcount"))
|
||||
@@ -1530,10 +1520,18 @@ sc *strtosc(const char *input)
|
||||
else if (!strcasecmp(input, "down") ||
|
||||
!strcasecmp(input, "nextline"))
|
||||
s->scfunc = do_down_void;
|
||||
else if (!strcasecmp(input, "prevword"))
|
||||
s->scfunc = do_prev_word_void;
|
||||
else if (!strcasecmp(input, "nextword"))
|
||||
s->scfunc = do_next_word_void;
|
||||
else if (!strcasecmp(input, "home"))
|
||||
s->scfunc = do_home_void;
|
||||
else if (!strcasecmp(input, "end"))
|
||||
s->scfunc = do_end_void;
|
||||
else if (!strcasecmp(input, "prevblock"))
|
||||
s->scfunc = do_prev_block;
|
||||
else if (!strcasecmp(input, "nextblock"))
|
||||
s->scfunc = do_next_block;
|
||||
else if (!strcasecmp(input, "pageup") ||
|
||||
!strcasecmp(input, "prevpage"))
|
||||
s->scfunc = do_page_up;
|
||||
@@ -1573,7 +1571,7 @@ sc *strtosc(const char *input)
|
||||
s->scfunc = backwards_void;
|
||||
else if (!strcasecmp(input, "flipreplace") ||
|
||||
!strcasecmp(input, "dontreplace")) /* Deprecated. Remove in 2018. */
|
||||
s->scfunc = flip_replace_void;
|
||||
s->scfunc = flip_replace;
|
||||
else if (!strcasecmp(input, "gototext"))
|
||||
s->scfunc = gototext_void;
|
||||
#ifndef DISABLE_HISTORIES
|
||||
@@ -1594,14 +1592,14 @@ sc *strtosc(const char *input)
|
||||
else if (!strcasecmp(input, "backup"))
|
||||
s->scfunc = backup_file_void;
|
||||
else if (!strcasecmp(input, "flipexecute"))
|
||||
s->scfunc = flip_execute_void;
|
||||
s->scfunc = flip_execute;
|
||||
#endif
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
else if (!strcasecmp(input, "flipnewbuffer") ||
|
||||
!strcasecmp(input, "newbuffer")) /* Deprecated. Remove in 2018. */
|
||||
s->scfunc = new_buffer_void;
|
||||
s->scfunc = flip_newbuffer;
|
||||
#endif
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
else if (!strcasecmp(input, "tofiles") ||
|
||||
!strcasecmp(input, "browser"))
|
||||
s->scfunc = to_files_void;
|
||||
@@ -1700,7 +1698,7 @@ int strtomenu(const char *input)
|
||||
#endif
|
||||
else if (!strcasecmp(input, "linter"))
|
||||
return MLINTER;
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
else if (!strcasecmp(input, "browser"))
|
||||
return MBROWSER;
|
||||
else if (!strcasecmp(input, "whereisfile"))
|
||||
@@ -1710,7 +1708,7 @@ int strtomenu(const char *input)
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
#endif /* !DISABLE_NANORC */
|
||||
#endif /* ENABLE_NANORC */
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
@@ -1721,7 +1719,8 @@ int strtomenu(const char *input)
|
||||
* function unless debugging is turned on. */
|
||||
void thanks_for_all_the_fish(void)
|
||||
{
|
||||
delwin(topwin);
|
||||
if (topwin != NULL)
|
||||
delwin(topwin);
|
||||
delwin(edit);
|
||||
delwin(bottomwin);
|
||||
|
||||
@@ -1816,7 +1815,7 @@ void thanks_for_all_the_fish(void)
|
||||
sclist = sclist->next;
|
||||
free(s);
|
||||
}
|
||||
#ifndef DISABLE_NANORC
|
||||
#ifdef ENABLE_NANORC
|
||||
free(homedir);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -271,7 +271,7 @@ void do_help(void)
|
||||
title = NULL;
|
||||
inhelp = FALSE;
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
if (oldmenu == MBROWSER || oldmenu == MWHEREISFILE || oldmenu == MGOTODIR)
|
||||
browser_refresh();
|
||||
else
|
||||
@@ -353,7 +353,7 @@ void help_init(void)
|
||||
htx[1] = NULL;
|
||||
htx[2] = NULL;
|
||||
}
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
else if (currmenu == MBROWSER) {
|
||||
htx[0] = N_("File Browser Help Text\n\n "
|
||||
"The file browser is used to visually browse the "
|
||||
@@ -391,7 +391,7 @@ void help_init(void)
|
||||
htx[1] = NULL;
|
||||
htx[2] = NULL;
|
||||
}
|
||||
#endif /* !DISABLE_BROWSER */
|
||||
#endif /* ENABLE_BROWSER */
|
||||
#ifndef DISABLE_SPELLER
|
||||
else if (currmenu == MSPELL) {
|
||||
htx[0] = N_("Spell Check Help Text\n\n "
|
||||
|
||||
@@ -55,7 +55,7 @@ void get_edge_and_target(size_t *leftedge, size_t *target_column)
|
||||
if (ISSET(SOFTWRAP)) {
|
||||
size_t realspan = strlenpt(openfile->current->data);
|
||||
|
||||
if (openfile->placewewant < realspan)
|
||||
if (realspan > openfile->placewewant)
|
||||
realspan = openfile->placewewant;
|
||||
|
||||
*leftedge = (realspan / editwincols) * editwincols;
|
||||
|
||||
371
src/nano.c
371
src/nano.c
@@ -45,7 +45,7 @@
|
||||
static int oldinterval = -1;
|
||||
/* Used to store the user's original mouse click interval. */
|
||||
#endif
|
||||
#ifndef DISABLE_NANORC
|
||||
#ifdef ENABLE_NANORC
|
||||
static bool no_rcfiles = FALSE;
|
||||
/* Should we ignore all rcfiles? */
|
||||
#endif
|
||||
@@ -59,6 +59,9 @@ static struct termios oldterm;
|
||||
static struct sigaction act;
|
||||
/* Used to set up all our fun signal handlers. */
|
||||
|
||||
static bool input_was_aborted = FALSE;
|
||||
/* Whether reading from standard input was aborted via ^C. */
|
||||
|
||||
/* Create a new linestruct node. Note that we do not set prevnode->next
|
||||
* to the new line. */
|
||||
filestruct *make_new_node(filestruct *prevnode)
|
||||
@@ -677,14 +680,17 @@ void die_save_file(const char *die_filename, struct stat *die_stat)
|
||||
/* Initialize the three window portions nano uses. */
|
||||
void window_init(void)
|
||||
{
|
||||
/* First delete existing windows, in case of resizing. */
|
||||
delwin(topwin);
|
||||
topwin = NULL;
|
||||
delwin(edit);
|
||||
delwin(bottomwin);
|
||||
/* When resizing, first delete the existing windows. */
|
||||
if (edit != NULL) {
|
||||
if (topwin != NULL)
|
||||
delwin(topwin);
|
||||
delwin(edit);
|
||||
delwin(bottomwin);
|
||||
}
|
||||
|
||||
/* If the terminal is very flat, don't set up a titlebar. */
|
||||
if (LINES < 3) {
|
||||
topwin = NULL;
|
||||
editwinrows = 1;
|
||||
/* Set up two subwindows. If the terminal is just one line,
|
||||
* edit window and statusbar window will cover each other. */
|
||||
@@ -804,7 +810,7 @@ void usage(void)
|
||||
print_opt("-H", "--historylog",
|
||||
N_("Log & read search/replace string history"));
|
||||
#endif
|
||||
#ifndef DISABLE_NANORC
|
||||
#ifdef ENABLE_NANORC
|
||||
if (!ISSET(RESTRICTED))
|
||||
print_opt("-I", "--ignorercfiles", N_("Don't look at nanorc files"));
|
||||
#endif
|
||||
@@ -848,7 +854,7 @@ void usage(void)
|
||||
print_opt("-c", "--constantshow", N_("Constantly show cursor position"));
|
||||
print_opt("-d", "--rebinddelete",
|
||||
N_("Fix Backspace/Delete confusion problem"));
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
if (!ISSET(RESTRICTED))
|
||||
print_opt("-g", "--showcursor", N_("Show cursor in file browser"));
|
||||
#endif
|
||||
@@ -869,7 +875,7 @@ void usage(void)
|
||||
N_("Set operating directory"));
|
||||
#endif
|
||||
print_opt("-p", "--preserve", N_("Preserve XON (^Q) and XOFF (^S) keys"));
|
||||
#ifndef DISABLE_NANORC
|
||||
#ifdef ENABLE_NANORC
|
||||
if (!ISSET(RESTRICTED))
|
||||
print_opt("-q", "--quiet",
|
||||
N_("Silently ignore startup issues like rc file errors"));
|
||||
@@ -916,7 +922,7 @@ void version(void)
|
||||
|
||||
#ifdef NANO_TINY
|
||||
printf(" --enable-tiny");
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
printf(" --enable-browser");
|
||||
#endif
|
||||
#ifndef DISABLE_COLOR
|
||||
@@ -943,7 +949,7 @@ void version(void)
|
||||
#ifdef ENABLE_MOUSE
|
||||
printf(" --enable-mouse");
|
||||
#endif
|
||||
#ifndef DISABLE_NANORC
|
||||
#ifdef ENABLE_NANORC
|
||||
printf(" --enable-nanorc");
|
||||
#endif
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
@@ -955,14 +961,14 @@ void version(void)
|
||||
#ifndef DISABLE_SPELLER
|
||||
printf(" --enable-speller");
|
||||
#endif
|
||||
#ifndef DISABLE_TABCOMP
|
||||
#ifdef ENABLE_TABCOMP
|
||||
printf(" --enable-tabcomp");
|
||||
#endif
|
||||
#ifndef DISABLE_WRAPPING
|
||||
printf(" --enable-wrapping");
|
||||
#endif
|
||||
#else /* !NANO_TINY */
|
||||
#ifdef DISABLE_BROWSER
|
||||
#ifndef ENABLE_BROWSER
|
||||
printf(" --disable-browser");
|
||||
#endif
|
||||
#ifdef DISABLE_COLOR
|
||||
@@ -995,7 +1001,7 @@ void version(void)
|
||||
#ifndef ENABLE_MULTIBUFFER
|
||||
printf(" --disable-multibuffer");
|
||||
#endif
|
||||
#ifdef DISABLE_NANORC
|
||||
#ifndef ENABLE_NANORC
|
||||
printf(" --disable-nanorc");
|
||||
#endif
|
||||
#ifdef DISABLE_OPERATINGDIR
|
||||
@@ -1004,7 +1010,7 @@ void version(void)
|
||||
#ifdef DISABLE_SPELLER
|
||||
printf(" --disable-speller");
|
||||
#endif
|
||||
#ifdef DISABLE_TABCOMP
|
||||
#ifndef ENABLE_TABCOMP
|
||||
printf(" --disable-tabcomp");
|
||||
#endif
|
||||
#ifndef ENABLE_WORDCOMPLETION
|
||||
@@ -1097,54 +1103,26 @@ void do_cancel(void)
|
||||
;
|
||||
}
|
||||
|
||||
static struct sigaction pager_oldaction, pager_newaction;
|
||||
/* Make a note that reading from stdin was concluded with ^C. */
|
||||
RETSIGTYPE make_a_note(int signal)
|
||||
{
|
||||
input_was_aborted = TRUE;
|
||||
}
|
||||
|
||||
/* Read whatever comes from standard input into a new buffer. */
|
||||
bool scoop_stdin(void)
|
||||
{
|
||||
struct sigaction oldaction, newaction;
|
||||
/* Original and temporary handlers for SIGINT. */
|
||||
static bool pager_sig_failed = FALSE;
|
||||
/* Did sigaction() fail without changing the signal handlers? */
|
||||
static bool pager_input_aborted = FALSE;
|
||||
/* Did someone invoke the pager and abort it via ^C? */
|
||||
bool setup_failed = FALSE;
|
||||
/* Whether setting up the SIGINT handler failed. */
|
||||
FILE *stream;
|
||||
int thetty;
|
||||
|
||||
/* Things which need to be run regardless of whether
|
||||
* we finished the stdin pipe correctly or not. */
|
||||
void finish_stdin_pager(void)
|
||||
{
|
||||
FILE *f;
|
||||
int ttystdin;
|
||||
|
||||
/* Read whatever we did get from stdin. */
|
||||
f = fopen("/dev/stdin", "rb");
|
||||
if (f == NULL)
|
||||
nperror("fopen");
|
||||
|
||||
read_file(f, 0, "stdin", TRUE, FALSE);
|
||||
openfile->edittop = openfile->fileage;
|
||||
|
||||
ttystdin = open("/dev/tty", O_RDONLY);
|
||||
if (!ttystdin)
|
||||
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");
|
||||
terminal_init();
|
||||
doupdate();
|
||||
}
|
||||
|
||||
/* Cancel reading from stdin like a pager. */
|
||||
RETSIGTYPE cancel_stdin_pager(int signal)
|
||||
{
|
||||
pager_input_aborted = TRUE;
|
||||
}
|
||||
|
||||
/* Let nano read stdin for the first file at least. */
|
||||
void stdin_pager(void)
|
||||
{
|
||||
/* Exit from curses mode and put the terminal into its original state. */
|
||||
endwin();
|
||||
if (!pager_input_aborted)
|
||||
tcsetattr(0, TCSANOW, &oldterm);
|
||||
tcsetattr(0, TCSANOW, &oldterm);
|
||||
|
||||
fprintf(stderr, _("Reading from stdin, ^C to abort\n"));
|
||||
|
||||
#ifndef NANO_TINY
|
||||
@@ -1153,23 +1131,59 @@ void stdin_pager(void)
|
||||
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;
|
||||
/* Set things up so that SIGINT will cancel the reading. */
|
||||
if (sigaction(SIGINT, NULL, &newaction) == -1) {
|
||||
setup_failed = TRUE;
|
||||
nperror("sigaction");
|
||||
} else {
|
||||
pager_newaction.sa_handler = cancel_stdin_pager;
|
||||
if (sigaction(SIGINT, &pager_newaction, &pager_oldaction) == -1) {
|
||||
pager_sig_failed = TRUE;
|
||||
newaction.sa_handler = make_a_note;
|
||||
if (sigaction(SIGINT, &newaction, &oldaction) == -1) {
|
||||
setup_failed = TRUE;
|
||||
nperror("sigaction");
|
||||
}
|
||||
}
|
||||
|
||||
/* Open standard input. */
|
||||
stream = fopen("/dev/stdin", "rb");
|
||||
if (stream == NULL) {
|
||||
int errnumber = errno;
|
||||
|
||||
terminal_init();
|
||||
doupdate();
|
||||
statusline(ALERT, _("Failed to open stdin: %s"), strerror(errnumber));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Read the input into a new buffer. */
|
||||
open_buffer("", FALSE);
|
||||
finish_stdin_pager();
|
||||
read_file(stream, 0, "stdin", TRUE, FALSE);
|
||||
openfile->edittop = openfile->fileage;
|
||||
|
||||
/* Reconnect the tty as the input source. */
|
||||
thetty = open("/dev/tty", O_RDONLY);
|
||||
if (!thetty)
|
||||
die(_("Couldn't reopen stdin from keyboard, sorry\n"));
|
||||
dup2(thetty, 0);
|
||||
close(thetty);
|
||||
|
||||
/* If things went well, store the current state of the terminal. */
|
||||
if (!input_was_aborted)
|
||||
tcgetattr(0, &oldterm);
|
||||
|
||||
/* If it was changed, restore the handler for SIGINT. */
|
||||
if (!setup_failed && sigaction(SIGINT, &oldaction, NULL) == -1)
|
||||
nperror("sigaction");
|
||||
|
||||
terminal_init();
|
||||
doupdate();
|
||||
|
||||
if (!ISSET(VIEW_MODE) && openfile->totsize > 0)
|
||||
set_modified();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Initialize the signal handlers. */
|
||||
/* Register half a dozen signal handlers. */
|
||||
void signal_init(void)
|
||||
{
|
||||
/* Trap SIGINT and SIGQUIT because we want them to do useful things. */
|
||||
@@ -1193,25 +1207,23 @@ void signal_init(void)
|
||||
sigaction(SIGWINCH, &act, NULL);
|
||||
#endif
|
||||
|
||||
/* Trap normal suspend (^Z) so we can handle it ourselves. */
|
||||
if (!ISSET(SUSPEND)) {
|
||||
act.sa_handler = SIG_IGN;
|
||||
#ifdef SIGTSTP
|
||||
sigaction(SIGTSTP, &act, NULL);
|
||||
#endif
|
||||
} else {
|
||||
if (ISSET(SUSPEND)) {
|
||||
/* Block all other signals in the suspend and continue handlers.
|
||||
* If we don't do this, other stuff interrupts them! */
|
||||
sigfillset(&act.sa_mask);
|
||||
|
||||
act.sa_handler = do_suspend;
|
||||
#ifdef SIGTSTP
|
||||
/* Trap a normal suspend (^Z) so we can handle it ourselves. */
|
||||
act.sa_handler = do_suspend;
|
||||
sigaction(SIGTSTP, &act, NULL);
|
||||
#endif
|
||||
|
||||
act.sa_handler = do_continue;
|
||||
#ifdef SIGCONT
|
||||
act.sa_handler = do_continue;
|
||||
sigaction(SIGCONT, &act, NULL);
|
||||
#endif
|
||||
} else {
|
||||
#ifdef SIGTSTP
|
||||
act.sa_handler = SIG_IGN;
|
||||
sigaction(SIGTSTP, &act, NULL);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -1240,21 +1252,13 @@ RETSIGTYPE do_suspend(int signal)
|
||||
/* Restore the old terminal settings. */
|
||||
tcsetattr(0, TCSANOW, &oldterm);
|
||||
|
||||
/* Trap SIGHUP and SIGTERM so we can properly deal with them while
|
||||
* suspended. */
|
||||
act.sa_handler = handle_hupterm;
|
||||
#ifdef SIGHUP
|
||||
sigaction(SIGHUP, &act, NULL);
|
||||
#endif
|
||||
sigaction(SIGTERM, &act, NULL);
|
||||
|
||||
/* Do what mutt does: send ourselves a SIGSTOP. */
|
||||
#ifdef SIGSTOP
|
||||
/* Do what mutt does: send ourselves a SIGSTOP. */
|
||||
kill(0, SIGSTOP);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* The version of above function that is bound to a key. */
|
||||
/* Put nano to sleep (if suspension is enabled). */
|
||||
void do_suspend_void(void)
|
||||
{
|
||||
if (ISSET(SUSPEND))
|
||||
@@ -1274,14 +1278,14 @@ RETSIGTYPE do_continue(int signal)
|
||||
#endif
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Perhaps the user resized the window while we slept. So act as if,
|
||||
* and restore the terminal to its previous state in the process. */
|
||||
regenerate_screen();
|
||||
/* Perhaps the user resized the window while we slept. */
|
||||
the_window_resized = TRUE;
|
||||
#else
|
||||
/* Restore the state of the terminal and redraw the whole screen. */
|
||||
/* Put the terminal in the desired state again. */
|
||||
terminal_init();
|
||||
total_refresh();
|
||||
#endif
|
||||
/* Tickle the input routine so it will update the screen. */
|
||||
ungetch(KEY_F0);
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
@@ -1333,21 +1337,16 @@ void regenerate_screen(void)
|
||||
SLsmg_reset_smg();
|
||||
SLsmg_init_smg();
|
||||
#else
|
||||
/* Do the equivalent of what Minimum Profit does: Leave and
|
||||
* immediately reenter curses mode. */
|
||||
/* Do the equivalent of what Minimum Profit does: leave and immediately
|
||||
* reenter curses mode. */
|
||||
endwin();
|
||||
doupdate();
|
||||
#endif
|
||||
|
||||
/* Restore the terminal to its previous state. */
|
||||
/* Put the terminal in the desired state again, recreate the subwindows
|
||||
* with their (new) sizes, and redraw the contents of these windows. */
|
||||
terminal_init();
|
||||
|
||||
/* Do the equivalent of what both mutt and Minimum Profit do:
|
||||
* Reinitialize all the windows based on the new screen
|
||||
* dimensions. */
|
||||
window_init();
|
||||
|
||||
/* Redraw the contents of the windows that need it. */
|
||||
total_refresh();
|
||||
}
|
||||
|
||||
@@ -1361,9 +1360,7 @@ void allow_sigwinch(bool allow)
|
||||
sigaddset(&winch, SIGWINCH);
|
||||
sigprocmask(allow ? SIG_UNBLOCK : SIG_BLOCK, &winch, NULL);
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Handle the global toggle specified in flag. */
|
||||
void do_toggle(int flag)
|
||||
{
|
||||
@@ -1386,6 +1383,7 @@ void do_toggle(int flag)
|
||||
case MORE_SPACE:
|
||||
case NO_HELP:
|
||||
window_init();
|
||||
focusing = FALSE;
|
||||
total_refresh();
|
||||
break;
|
||||
case SUSPEND:
|
||||
@@ -1619,7 +1617,7 @@ int do_input(bool allow_funcs)
|
||||
/* If the keystroke isn't a shortcut nor a toggle, it's a normal text
|
||||
* character: add the character to the input buffer -- or display a
|
||||
* warning when we're in view mode. */
|
||||
if (input != ERR && !have_shortcut) {
|
||||
if (input != ERR && !have_shortcut) {
|
||||
if (ISSET(VIEW_MODE))
|
||||
print_view_warning();
|
||||
else {
|
||||
@@ -1896,8 +1894,6 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int optchr;
|
||||
ssize_t startline = 0, startcol = 0;
|
||||
/* Target line and column when specified on the command line. */
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
bool fill_used = FALSE;
|
||||
/* Was the fill option used on the command line? */
|
||||
@@ -1907,16 +1903,16 @@ int main(int argc, char **argv)
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
bool old_multibuffer;
|
||||
/* The old value of the multibuffer option, restored after we
|
||||
* load all files on the command line. */
|
||||
bool is_multibuffer;
|
||||
/* The actual value of the multibuffer option, restored after
|
||||
* we've loaded all files given on the command line. */
|
||||
#endif
|
||||
const struct option long_options[] = {
|
||||
{"boldtext", 0, NULL, 'D'},
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
{"multibuffer", 0, NULL, 'F'},
|
||||
#endif
|
||||
#ifndef DISABLE_NANORC
|
||||
#ifdef ENABLE_NANORC
|
||||
{"ignorercfiles", 0, NULL, 'I'},
|
||||
#endif
|
||||
{"rebindkeypad", 0, NULL, 'K'},
|
||||
@@ -1934,7 +1930,7 @@ int main(int argc, char **argv)
|
||||
#endif
|
||||
{"constantshow", 0, NULL, 'c'},
|
||||
{"rebinddelete", 0, NULL, 'd'},
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
{"showcursor", 0, NULL, 'g'},
|
||||
#endif
|
||||
{"help", 0, NULL, 'h'},
|
||||
@@ -2006,13 +2002,13 @@ int main(int argc, char **argv)
|
||||
textdomain(PACKAGE);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
#if defined(ENABLE_UTF8) && !defined(NANO_TINY)
|
||||
if (MB_CUR_MAX > MAXCHARLEN)
|
||||
fprintf(stderr, "Unexpected large character size: %i bytes"
|
||||
" -- please report a bug\n", (int)MB_CUR_MAX);
|
||||
#endif
|
||||
|
||||
#if defined(DISABLE_NANORC) && defined(DISABLE_ROOTWRAPPING)
|
||||
#if !defined(ENABLE_NANORC) && defined(DISABLE_ROOTWRAPPING)
|
||||
/* If we don't have rcfile support, --disable-wrapping-as-root is
|
||||
* used, and we're root, turn wrapping off. */
|
||||
if (geteuid() == NANO_ROOT_UID)
|
||||
@@ -2069,7 +2065,7 @@ int main(int argc, char **argv)
|
||||
SET(HISTORYLOG);
|
||||
break;
|
||||
#endif
|
||||
#ifndef DISABLE_NANORC
|
||||
#ifdef ENABLE_NANORC
|
||||
case 'I':
|
||||
no_rcfiles = TRUE;
|
||||
break;
|
||||
@@ -2165,7 +2161,7 @@ int main(int argc, char **argv)
|
||||
case 'p':
|
||||
SET(PRESERVE);
|
||||
break;
|
||||
#ifndef DISABLE_NANORC
|
||||
#ifdef ENABLE_NANORC
|
||||
case 'q':
|
||||
SET(QUIET);
|
||||
break;
|
||||
@@ -2238,7 +2234,7 @@ int main(int argc, char **argv)
|
||||
if (ISSET(RESTRICTED)) {
|
||||
UNSET(SUSPEND);
|
||||
UNSET(BACKUP_FILE);
|
||||
#ifndef DISABLE_NANORC
|
||||
#ifdef ENABLE_NANORC
|
||||
no_rcfiles = TRUE;
|
||||
UNSET(HISTORYLOG);
|
||||
UNSET(POS_HISTORY);
|
||||
@@ -2249,11 +2245,9 @@ int main(int argc, char **argv)
|
||||
* before reading the rcfile, to be able to rebind/unbind keys. */
|
||||
shortcut_init();
|
||||
|
||||
/* We've read through the command line options. Now back up the flags
|
||||
* and values that are set, and read the rcfile(s). If the values
|
||||
* haven't changed afterward, restore the backed-up values. */
|
||||
#ifndef DISABLE_NANORC
|
||||
#ifdef ENABLE_NANORC
|
||||
if (!no_rcfiles) {
|
||||
/* Back up the command-line options, then read the rcfile(s). */
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
char *operating_dir_cpy = operating_dir;
|
||||
#endif
|
||||
@@ -2297,6 +2291,7 @@ int main(int argc, char **argv)
|
||||
print_sclist();
|
||||
#endif
|
||||
|
||||
/* If the backed-up command-line options have a value, restore them. */
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
if (operating_dir_cpy != NULL) {
|
||||
free(operating_dir);
|
||||
@@ -2332,6 +2327,7 @@ int main(int argc, char **argv)
|
||||
if (tabsize_cpy != -1)
|
||||
tabsize = tabsize_cpy;
|
||||
|
||||
/* Simply OR the boolean flags from rcfile and command line. */
|
||||
for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++)
|
||||
flags[i] |= flags_cpy[i];
|
||||
}
|
||||
@@ -2341,7 +2337,7 @@ int main(int argc, char **argv)
|
||||
else if (geteuid() == NANO_ROOT_UID)
|
||||
SET(NO_WRAP);
|
||||
#endif
|
||||
#endif /* !DISABLE_NANORC */
|
||||
#endif /* ENABLE_NANORC */
|
||||
|
||||
#ifndef DISABLE_WRAPPING
|
||||
/* Override a "set nowrap" in an rcfile (or a --disable-wrapping-as-root)
|
||||
@@ -2432,13 +2428,12 @@ int main(int argc, char **argv)
|
||||
if (matchbrackets == NULL)
|
||||
matchbrackets = mallocstrcpy(NULL, "(<[{)>]}");
|
||||
|
||||
/* If whitespace wasn't specified, set its default value. If we're
|
||||
* using UTF-8, it's Unicode 00BB (Right-Pointing Double Angle
|
||||
* Quotation Mark) and Unicode 00B7 (Middle Dot). Otherwise, it's
|
||||
* ">" and ".". */
|
||||
/* If the whitespace option wasn't specified, set its default value. */
|
||||
if (whitespace == NULL) {
|
||||
#ifdef ENABLE_UTF8
|
||||
if (using_utf8()) {
|
||||
/* A tab is shown as a Right-Pointing Double Angle Quotation Mark
|
||||
* (U+00BB), and a space as a Middle Dot (U+00B7). */
|
||||
whitespace = mallocstrcpy(NULL, "\xC2\xBB\xC2\xB7");
|
||||
whitespace_len[0] = 2;
|
||||
whitespace_len[1] = 2;
|
||||
@@ -2475,8 +2470,7 @@ int main(int argc, char **argv)
|
||||
fprintf(stderr, "Main: set up windows\n");
|
||||
#endif
|
||||
|
||||
/* Initialize all the windows based on the current screen
|
||||
* dimensions. */
|
||||
/* Create the three subwindows, based on the current screen dimensions. */
|
||||
window_init();
|
||||
|
||||
editwincols = COLS;
|
||||
@@ -2532,90 +2526,58 @@ int main(int argc, char **argv)
|
||||
fprintf(stderr, "Main: open file\n");
|
||||
#endif
|
||||
|
||||
/* If there's a +LINE or +LINE,COLUMN flag here, it is the first
|
||||
* non-option argument, and it is followed by at least one other
|
||||
* argument, the filename it applies to. */
|
||||
if (0 < optind && optind < argc - 1 && argv[optind][0] == '+') {
|
||||
if (!parse_line_column(&argv[optind][1], &startline, &startcol))
|
||||
statusline(ALERT, _("Invalid line or column number"));
|
||||
optind++;
|
||||
}
|
||||
|
||||
/* If one of the arguments is a dash, read text from standard input. */
|
||||
if (optind < argc && !strcmp(argv[optind], "-")) {
|
||||
stdin_pager();
|
||||
set_modified();
|
||||
optind++;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
old_multibuffer = ISSET(MULTIBUFFER);
|
||||
is_multibuffer = ISSET(MULTIBUFFER);
|
||||
SET(MULTIBUFFER);
|
||||
|
||||
/* Read all the files after the first one on the command line into
|
||||
* new buffers. */
|
||||
{
|
||||
int i = optind + 1;
|
||||
ssize_t iline = 0, icol = 0;
|
||||
|
||||
for (; i < argc; i++) {
|
||||
/* If there's a +LINE or +LINE,COLUMN flag here, it is followed
|
||||
* by at least one other argument: the filename it applies to. */
|
||||
if (i < argc - 1 && argv[i][0] == '+') {
|
||||
if (!parse_line_column(&argv[i][1], &iline, &icol))
|
||||
statusline(ALERT, _("Invalid line or column number"));
|
||||
} else {
|
||||
/* If opening fails, don't try to position the cursor. */
|
||||
if (!open_buffer(argv[i], FALSE))
|
||||
continue;
|
||||
|
||||
/* If a position was given on the command line, go there. */
|
||||
if (iline > 0 || icol > 0) {
|
||||
do_gotolinecolumn(iline, icol, FALSE, FALSE);
|
||||
iline = 0;
|
||||
icol = 0;
|
||||
}
|
||||
#ifndef DISABLE_HISTORIES
|
||||
else if (ISSET(POS_HISTORY)) {
|
||||
ssize_t savedposline, savedposcol;
|
||||
/* If edited before, restore the last cursor position. */
|
||||
if (has_old_position(argv[i], &savedposline, &savedposcol))
|
||||
do_gotolinecolumn(savedposline, savedposcol,
|
||||
FALSE, FALSE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Read the files mentioned on the command line into new buffers. */
|
||||
while (optind < argc && (!openfile || ISSET(MULTIBUFFER))) {
|
||||
ssize_t givenline = 0, givencol = 0;
|
||||
bool dash = FALSE;
|
||||
|
||||
/* If there's a +LINE[,COLUMN] argument here, eat it up. */
|
||||
if (optind < argc - 1 && argv[optind][0] == '+') {
|
||||
if (!parse_line_column(&argv[optind++][1], &givenline, &givencol))
|
||||
statusline(ALERT, _("Invalid line or column number"));
|
||||
}
|
||||
|
||||
/* If the filename is a dash, read from standard input; otherwise,
|
||||
* open the file; skip positioning the cursor if either failed. */
|
||||
if (strcmp(argv[optind], "-") == 0) {
|
||||
if (!scoop_stdin())
|
||||
continue;
|
||||
dash = TRUE;
|
||||
optind++;
|
||||
} else if (!open_buffer(argv[optind++], FALSE))
|
||||
continue;
|
||||
|
||||
/* If a position was given on the command line, go there. */
|
||||
if (givenline != 0 || givencol != 0)
|
||||
do_gotolinecolumn(givenline, givencol, FALSE, FALSE);
|
||||
#ifndef DISABLE_HISTORIES
|
||||
else if (ISSET(POS_HISTORY) && !dash) {
|
||||
ssize_t savedline, savedcol;
|
||||
/* If edited before, restore the last cursor position. */
|
||||
if (has_old_position(argv[optind - 1], &savedline, &savedcol))
|
||||
do_gotolinecolumn(savedline, savedcol, FALSE, FALSE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif /* ENABLE_MULTIBUFFER */
|
||||
|
||||
/* Now read the first file on the command line into a new buffer. */
|
||||
if (optind < argc)
|
||||
open_buffer(argv[optind], FALSE);
|
||||
|
||||
/* If all the command-line arguments were invalid files like directories,
|
||||
* or if there were no filenames given, we didn't open any file. In this
|
||||
* case, load a blank buffer. Also, unset view mode to allow editing. */
|
||||
/* If no filenames were given, or all of them were invalid things like
|
||||
* directories, then open a blank buffer and allow editing. Otherwise,
|
||||
* switch from the last opened file to the next, that is: the first. */
|
||||
if (openfile == NULL) {
|
||||
open_buffer("", FALSE);
|
||||
UNSET(VIEW_MODE);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (!old_multibuffer)
|
||||
UNSET(MULTIBUFFER);
|
||||
#endif
|
||||
else
|
||||
openfile = openfile->next;
|
||||
|
||||
/* If a starting position was given on the command line, go there. */
|
||||
if (startline > 0 || startcol > 0)
|
||||
do_gotolinecolumn(startline, startcol, FALSE, FALSE);
|
||||
#ifndef DISABLE_HISTORIES
|
||||
else if (ISSET(POS_HISTORY)) {
|
||||
ssize_t savedposline, savedposcol;
|
||||
/* If the file was edited before, restore the last cursor position. */
|
||||
if (has_old_position(argv[optind], &savedposline, &savedposcol))
|
||||
do_gotolinecolumn(savedposline, savedposcol, FALSE, FALSE);
|
||||
}
|
||||
if (!is_multibuffer)
|
||||
UNSET(MULTIBUFFER);
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
@@ -2628,7 +2590,7 @@ int main(int argc, char **argv)
|
||||
#ifdef ENABLE_LINENUMBERS
|
||||
int needed_margin = digits(openfile->filebot->lineno) + 1;
|
||||
|
||||
/* Only enable line numbers when there is enough room for them. */
|
||||
/* Suppress line numbers when there is not enough room for them. */
|
||||
if (!ISSET(LINE_NUMBERS) || needed_margin > COLS - 4)
|
||||
needed_margin = 0;
|
||||
|
||||
@@ -2636,9 +2598,10 @@ int main(int argc, char **argv)
|
||||
margin = needed_margin;
|
||||
editwincols = COLS - margin;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Ensure that firstcolumn is the starting column of its chunk. */
|
||||
ensure_firstcolumn_is_aligned();
|
||||
|
||||
#endif
|
||||
/* The margin has changed -- schedule a full refresh. */
|
||||
refresh_needed = TRUE;
|
||||
}
|
||||
@@ -2657,7 +2620,7 @@ int main(int argc, char **argv)
|
||||
|
||||
/* Refresh just the cursor position or the entire edit window. */
|
||||
if (!refresh_needed) {
|
||||
place_the_cursor();
|
||||
place_the_cursor(TRUE);
|
||||
wnoutrefresh(edit);
|
||||
} else
|
||||
edit_refresh();
|
||||
|
||||
@@ -404,7 +404,7 @@ typedef struct openfilestruct {
|
||||
/* The preceding open file, if any. */
|
||||
} openfilestruct;
|
||||
|
||||
#ifndef DISABLE_NANORC
|
||||
#ifdef ENABLE_NANORC
|
||||
typedef struct rcoption {
|
||||
const char *name;
|
||||
/* The name of the rcfile option. */
|
||||
@@ -542,6 +542,11 @@ enum
|
||||
/* This is an abbreviation for all menus except Help and YesNo. */
|
||||
#define MMOST (MMAIN|MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE|MWRITEFILE|MINSERTFILE|\
|
||||
MEXTCMD|MBROWSER|MWHEREISFILE|MGOTODIR|MFINDINHELP|MSPELL|MLINTER)
|
||||
#ifndef NANO_TINY
|
||||
#define MSOME MMOST
|
||||
#else
|
||||
#define MSOME MMAIN|MBROWSER
|
||||
#endif
|
||||
|
||||
/* Basic control codes. */
|
||||
#define TAB_CODE 0x09
|
||||
|
||||
17
src/prompt.c
17
src/prompt.c
@@ -95,7 +95,7 @@ int do_statusbar_input(bool *ran_func, bool *finished)
|
||||
kbinput = (int *)nrealloc(kbinput, kbinput_len * sizeof(int));
|
||||
kbinput[kbinput_len - 1] = input;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If we got a shortcut, or if there aren't any other keystrokes waiting
|
||||
* after the one we read in, we need to insert all the characters in the
|
||||
@@ -411,8 +411,7 @@ void update_the_statusbar(void)
|
||||
|
||||
/* Work around a cursor-misplacement bug in VTEs. */
|
||||
wmove(bottomwin, 0, 0);
|
||||
wnoutrefresh(bottomwin);
|
||||
doupdate();
|
||||
wrefresh(bottomwin);
|
||||
|
||||
/* Place the cursor at statusbar_x in the answer. */
|
||||
column = base + statusbar_xplustabs();
|
||||
@@ -431,7 +430,7 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
|
||||
int kbinput = ERR;
|
||||
bool ran_func, finished;
|
||||
functionptrtype func;
|
||||
#ifndef DISABLE_TABCOMP
|
||||
#ifdef ENABLE_TABCOMP
|
||||
bool tabbed = FALSE;
|
||||
/* Whether we've pressed Tab. */
|
||||
#endif
|
||||
@@ -441,7 +440,7 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
|
||||
char *magichistory = NULL;
|
||||
/* The temporary string typed at the bottom of the history, if
|
||||
* any. */
|
||||
#ifndef DISABLE_TABCOMP
|
||||
#ifdef ENABLE_TABCOMP
|
||||
int last_kbinput = ERR;
|
||||
/* The key we pressed before the current key. */
|
||||
size_t complete_len = 0;
|
||||
@@ -482,7 +481,7 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
|
||||
if (func == do_cancel || func == do_enter)
|
||||
break;
|
||||
|
||||
#ifndef DISABLE_TABCOMP
|
||||
#ifdef ENABLE_TABCOMP
|
||||
if (func != do_tab)
|
||||
tabbed = FALSE;
|
||||
|
||||
@@ -503,7 +502,7 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
|
||||
answer = input_tab(answer, allow_files, &statusbar_x,
|
||||
&tabbed, refresh_func, listed);
|
||||
} else
|
||||
#endif /* !DISABLE_TABCOMP */
|
||||
#endif /* ENABLE_TABCOMP */
|
||||
#ifndef DISABLE_HISTORIES
|
||||
if (func == get_history_older_void) {
|
||||
if (history_list != NULL) {
|
||||
@@ -567,7 +566,7 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
|
||||
|
||||
update_the_statusbar();
|
||||
|
||||
#if !defined(DISABLE_HISTORIES) && !defined(DISABLE_TABCOMP)
|
||||
#if !defined(DISABLE_HISTORIES) && defined(ENABLE_TABCOMP)
|
||||
last_kbinput = kbinput;
|
||||
#endif
|
||||
}
|
||||
@@ -658,7 +657,7 @@ int do_prompt(bool allow_tabs, bool allow_files,
|
||||
fprintf(stderr, "answer = \"%s\"\n", answer);
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_TABCOMP
|
||||
#ifdef ENABLE_TABCOMP
|
||||
/* If we've done tab completion, there might still be a list of
|
||||
* filename matches on the edit window. Clear them off. */
|
||||
if (listed)
|
||||
|
||||
46
src/proto.h
46
src/proto.h
@@ -47,6 +47,8 @@ extern int editwincols;
|
||||
extern bool have_palette;
|
||||
#endif
|
||||
|
||||
extern bool suppress_cursorpos;
|
||||
|
||||
extern message_type lastmessage;
|
||||
|
||||
extern filestruct *pletion_line;
|
||||
@@ -119,8 +121,6 @@ extern char *quoteerr;
|
||||
|
||||
extern char *word_chars;
|
||||
|
||||
extern bool nodelay_mode;
|
||||
|
||||
extern char *answer;
|
||||
|
||||
extern ssize_t tabsize;
|
||||
@@ -176,7 +176,7 @@ extern char *homedir;
|
||||
typedef void (*functionptrtype)(void);
|
||||
|
||||
/* Most functions in browser.c. */
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
char *do_browse_from(const char *inpath);
|
||||
void read_the_list(const char *path, DIR *dir);
|
||||
functionptrtype parse_browser_input(int *kbinput);
|
||||
@@ -225,13 +225,13 @@ char *mbstrpbrk(const char *s, const char *accept);
|
||||
char *revstrpbrk(const char *head, const char *accept, const char *index);
|
||||
char *mbrevstrpbrk(const char *head, const char *accept, const char *index);
|
||||
#endif
|
||||
#if !defined(DISABLE_NANORC) && (!defined(NANO_TINY) || !defined(DISABLE_JUSTIFY))
|
||||
#if defined(ENABLE_NANORC) && (!defined(NANO_TINY) || !defined(DISABLE_JUSTIFY))
|
||||
bool has_blank_mbchars(const char *s);
|
||||
#endif
|
||||
#ifdef ENABLE_UTF8
|
||||
bool is_valid_unicode(wchar_t wc);
|
||||
#endif
|
||||
#ifndef DISABLE_NANORC
|
||||
#ifdef ENABLE_NANORC
|
||||
bool is_valid_mbstring(const char *s);
|
||||
#endif
|
||||
|
||||
@@ -304,11 +304,11 @@ void do_writeout_void(void);
|
||||
void do_savefile(void);
|
||||
#endif
|
||||
char *real_dir_from_tilde(const char *buf);
|
||||
#if !defined(DISABLE_TABCOMP) || !defined(DISABLE_BROWSER)
|
||||
#if defined(ENABLE_TABCOMP) || defined(ENABLE_BROWSER)
|
||||
int diralphasort(const void *va, const void *vb);
|
||||
void free_chararray(char **array, size_t len);
|
||||
#endif
|
||||
#ifndef DISABLE_TABCOMP
|
||||
#ifdef ENABLE_TABCOMP
|
||||
char *input_tab(char *buf, bool allow_files, size_t *place,
|
||||
bool *lastwastab, void (*refresh_func)(void), bool *listed);
|
||||
#endif
|
||||
@@ -466,14 +466,14 @@ int do_prompt(bool allow_tabs, bool allow_files,
|
||||
int do_yesno_prompt(bool all, const char *msg);
|
||||
|
||||
/* Most functions in rcfile.c. */
|
||||
#ifndef DISABLE_NANORC
|
||||
#ifdef ENABLE_NANORC
|
||||
#ifndef DISABLE_COLOR
|
||||
bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright);
|
||||
void grab_and_store(const char *kind, char *ptr, regexlisttype **storage);
|
||||
#endif
|
||||
void parse_rcfile(FILE *rcstream, bool syntax_only);
|
||||
void do_rcfiles(void);
|
||||
#endif /* !DISABLE_NANORC */
|
||||
#endif /* ENABLE_NANORC */
|
||||
|
||||
/* Most functions in search.c. */
|
||||
void not_found_msg(const char *str);
|
||||
@@ -496,7 +496,7 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
void do_gotolinecolumn_void(void);
|
||||
#ifndef NANO_TINY
|
||||
void do_find_bracket(void);
|
||||
#ifndef DISABLE_TABCOMP
|
||||
#ifdef ENABLE_TABCOMP
|
||||
char *get_history_completion(filestruct **h, char *s, size_t len);
|
||||
#endif
|
||||
#endif
|
||||
@@ -650,7 +650,7 @@ void warn_and_shortly_pause(const char *msg);
|
||||
void statusline(message_type importance, const char *msg, ...);
|
||||
void bottombars(int menu);
|
||||
void onekey(const char *keystroke, const char *desc, int length);
|
||||
void place_the_cursor(void);
|
||||
void place_the_cursor(bool forreal);
|
||||
void edit_draw(filestruct *fileptr, const char *converted,
|
||||
int line, size_t from_col);
|
||||
int update_line(filestruct *fileptr, size_t index);
|
||||
@@ -662,7 +662,9 @@ int go_back_chunks(int nrows, filestruct **line, size_t *leftedge);
|
||||
int go_forward_chunks(int nrows, filestruct **line, size_t *leftedge);
|
||||
bool less_than_a_screenful(size_t was_lineno, size_t was_leftedge);
|
||||
void edit_scroll(scroll_dir direction, int nrows);
|
||||
#ifndef NANO_TINY
|
||||
void ensure_firstcolumn_is_aligned(void);
|
||||
#endif
|
||||
void edit_redraw(filestruct *old_current);
|
||||
void edit_refresh(void);
|
||||
void adjust_viewport(update_type location);
|
||||
@@ -675,28 +677,34 @@ void spotlight(bool active, const char *word);
|
||||
void xon_complaint(void);
|
||||
void xoff_complaint(void);
|
||||
void do_suspend_void(void);
|
||||
void enable_nodelay(void);
|
||||
void disable_nodelay(void);
|
||||
void disable_waiting(void);
|
||||
void enable_waiting(void);
|
||||
#ifndef DISABLE_EXTRA
|
||||
void do_credits(void);
|
||||
#endif
|
||||
|
||||
/* May as well throw these here, since they are just placeholders. */
|
||||
/* These are just name definitions. */
|
||||
void do_cancel(void);
|
||||
void case_sens_void(void);
|
||||
void regexp_void(void);
|
||||
void backwards_void(void);
|
||||
void flip_replace(void);
|
||||
void gototext_void(void);
|
||||
#ifdef ENABLE_BROWSER
|
||||
void to_files_void(void);
|
||||
void goto_dir_void(void);
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
void dos_format_void(void);
|
||||
void mac_format_void(void);
|
||||
void append_void(void);
|
||||
void prepend_void(void);
|
||||
void backup_file_void(void);
|
||||
void flip_execute(void);
|
||||
#endif
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
void flip_newbuffer(void);
|
||||
#endif
|
||||
void discard_buffer(void);
|
||||
void new_buffer_void(void);
|
||||
void backwards_void(void);
|
||||
void goto_dir_void(void);
|
||||
void flip_replace_void(void);
|
||||
void flip_execute_void(void);
|
||||
|
||||
#endif /* !PROTO_H */
|
||||
|
||||
14
src/rcfile.c
14
src/rcfile.c
@@ -30,7 +30,7 @@
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifndef DISABLE_NANORC
|
||||
#ifdef ENABLE_NANORC
|
||||
|
||||
#ifndef RCFILE_NAME
|
||||
#define RCFILE_NAME ".nanorc"
|
||||
@@ -159,9 +159,9 @@ void rcfile_error(const char *msg, ...)
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
#endif /* !DISABLE_NANORC */
|
||||
#endif /* ENABLE_NANORC */
|
||||
|
||||
#if !defined(DISABLE_NANORC) || !defined(DISABLE_HISTORIES)
|
||||
#if defined(ENABLE_NANORC) || !defined(DISABLE_HISTORIES)
|
||||
/* Parse the next word from the string, null-terminate it, and return
|
||||
* a pointer to the first character after the null terminator. The
|
||||
* returned pointer will point to '\0' if we hit the end of the line. */
|
||||
@@ -181,9 +181,9 @@ char *parse_next_word(char *ptr)
|
||||
|
||||
return ptr;
|
||||
}
|
||||
#endif /* !DISABLE_NANORC || !DISABLE_HISTORIES */
|
||||
#endif /* ENABLE_NANORC || !DISABLE_HISTORIES */
|
||||
|
||||
#ifndef DISABLE_NANORC
|
||||
#ifdef ENABLE_NANORC
|
||||
/* Parse an argument, with optional quotes, after a keyword that takes
|
||||
* one. If the next word starts with a ", we say that it ends with the
|
||||
* last " of the line. Otherwise, we interpret it as usual, so that the
|
||||
@@ -350,7 +350,9 @@ bool is_universal(void (*func))
|
||||
{
|
||||
if (func == do_left || func == do_right ||
|
||||
func == do_home_void || func == do_end_void ||
|
||||
#ifndef NANO_TINY
|
||||
func == do_prev_word_void || func == do_next_word_void ||
|
||||
#endif
|
||||
func == do_verbatim_input || func == do_cut_text_void ||
|
||||
func == do_delete || func == do_backspace ||
|
||||
func == do_tab || func == do_enter)
|
||||
@@ -1300,4 +1302,4 @@ void do_rcfiles(void)
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !DISABLE_NANORC */
|
||||
#endif /* ENABLE_NANORC */
|
||||
|
||||
36
src/search.c
36
src/search.c
@@ -202,7 +202,7 @@ int search_init(bool replacing, bool use_answer)
|
||||
TOGGLE(USE_REGEXP);
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return 1;
|
||||
} else if (func == do_replace || func == flip_replace_void) {
|
||||
} else if (func == flip_replace) {
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return -2; /* Call the opposite search function. */
|
||||
} else if (func == do_gotolinecolumn_void) {
|
||||
@@ -234,8 +234,10 @@ int findnextstr(const char *needle, bool whole_word_only, bool have_region,
|
||||
size_t found_x;
|
||||
/* The x coordinate of a found occurrence. */
|
||||
time_t lastkbcheck = time(NULL);
|
||||
/* The time we last looked at the keyboard. */
|
||||
|
||||
enable_nodelay();
|
||||
/* Set non-blocking input so that we can just peek for a Cancel. */
|
||||
disable_waiting();
|
||||
|
||||
if (begin == NULL)
|
||||
came_full_circle = FALSE;
|
||||
@@ -252,7 +254,7 @@ int findnextstr(const char *needle, bool whole_word_only, bool have_region,
|
||||
while (input) {
|
||||
if (func_from_key(&input) == do_cancel) {
|
||||
statusbar(_("Cancelled"));
|
||||
disable_nodelay();
|
||||
enable_waiting();
|
||||
return -2;
|
||||
}
|
||||
input = parse_kbinput(NULL);
|
||||
@@ -303,7 +305,7 @@ int findnextstr(const char *needle, bool whole_word_only, bool have_region,
|
||||
/* If we're back at the beginning, then there is no needle. */
|
||||
if (came_full_circle) {
|
||||
not_found_msg(needle);
|
||||
disable_nodelay();
|
||||
enable_waiting();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -317,7 +319,7 @@ int findnextstr(const char *needle, bool whole_word_only, bool have_region,
|
||||
* but stop when spell-checking or replacing in a region. */
|
||||
if (line == NULL) {
|
||||
if (whole_word_only || have_region) {
|
||||
disable_nodelay();
|
||||
enable_waiting();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -343,16 +345,15 @@ int findnextstr(const char *needle, bool whole_word_only, bool have_region,
|
||||
|
||||
found_x = found - line->data;
|
||||
|
||||
enable_waiting();
|
||||
|
||||
/* Ensure that the found occurrence is not beyond the starting x. */
|
||||
if (came_full_circle && ((!ISSET(BACKWARDS_SEARCH) && found_x > begin_x) ||
|
||||
(ISSET(BACKWARDS_SEARCH) && found_x < begin_x))) {
|
||||
not_found_msg(needle);
|
||||
disable_nodelay();
|
||||
return 0;
|
||||
}
|
||||
|
||||
disable_nodelay();
|
||||
|
||||
/* Set the current position to point at what we found. */
|
||||
openfile->current = line;
|
||||
openfile->current_x = found_x;
|
||||
@@ -361,8 +362,11 @@ int findnextstr(const char *needle, bool whole_word_only, bool have_region,
|
||||
if (match_len != NULL)
|
||||
*match_len = found_len;
|
||||
|
||||
if (feedback > 0)
|
||||
/* Wipe the "Searching..." message and unset the suppression flag. */
|
||||
if (feedback > 0) {
|
||||
blank_statusbar();
|
||||
suppress_cursorpos = FALSE;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -855,10 +859,10 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (line < 1)
|
||||
if (line == 0)
|
||||
line = openfile->current->lineno;
|
||||
|
||||
if (column < 1)
|
||||
if (column == 0)
|
||||
column = openfile->placewewant + 1;
|
||||
}
|
||||
|
||||
@@ -883,6 +887,12 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
openfile->current_x = actual_x(openfile->current->data, column - 1);
|
||||
openfile->placewewant = column - 1;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(SOFTWRAP) && openfile->placewewant / editwincols >
|
||||
strlenpt(openfile->current->data) / editwincols)
|
||||
openfile->placewewant = strlenpt(openfile->current->data);
|
||||
#endif
|
||||
|
||||
/* When the position was manually given, center the target line. */
|
||||
if (interactive) {
|
||||
adjust_viewport(CENTERING);
|
||||
@@ -1224,7 +1234,7 @@ void get_history_older_void(void)
|
||||
;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_TABCOMP
|
||||
#ifdef ENABLE_TABCOMP
|
||||
/* Move h to the next string that's a tab completion of the string s,
|
||||
* looking at only the first len characters of s, and return that
|
||||
* string. If there isn't one, or if len is 0, don't move h and return
|
||||
@@ -1277,5 +1287,5 @@ char *get_history_completion(filestruct **h, char *s, size_t len)
|
||||
* match, or len is 0. Return s. */
|
||||
return (char *)s;
|
||||
}
|
||||
#endif /* !DISABLE_TABCOMP */
|
||||
#endif /* ENSABLE_TABCOMP */
|
||||
#endif /* !DISABLE_HISTORIES */
|
||||
|
||||
16
src/text.c
16
src/text.c
@@ -1140,7 +1140,9 @@ bool execute_command(const char *command)
|
||||
void discard_until(const undo *thisitem, openfilestruct *thefile)
|
||||
{
|
||||
undo *dropit = thefile->undotop;
|
||||
#ifdef ENABLE_COMMENT
|
||||
undo_group *group;
|
||||
#endif
|
||||
|
||||
while (dropit != NULL && dropit != thisitem) {
|
||||
thefile->undotop = dropit->next;
|
||||
@@ -2439,17 +2441,15 @@ void do_justify(bool full_justify)
|
||||
do {
|
||||
#endif
|
||||
statusbar(_("Can now UnJustify!"));
|
||||
place_the_cursor();
|
||||
place_the_cursor(TRUE);
|
||||
curs_set(1);
|
||||
kbinput = do_input(FALSE);
|
||||
#ifndef NANO_TINY
|
||||
} while (kbinput == KEY_WINCH);
|
||||
#endif
|
||||
|
||||
/* If needed, unset the cursor-position suppression flag, so the cursor
|
||||
* position /will/ be displayed upon a return to the main loop. */
|
||||
if (ISSET(CONSTANT_SHOW))
|
||||
do_cursorpos(FALSE);
|
||||
/* Unset the suppression flag after showing the Unjustify message. */
|
||||
suppress_cursorpos = FALSE;
|
||||
|
||||
func = func_from_key(&kbinput);
|
||||
|
||||
@@ -3311,7 +3311,7 @@ void do_linter(void)
|
||||
}
|
||||
|
||||
/* Place and show the cursor to indicate the affected line. */
|
||||
place_the_cursor();
|
||||
place_the_cursor(TRUE);
|
||||
wnoutrefresh(edit);
|
||||
curs_set(1);
|
||||
|
||||
@@ -3558,7 +3558,7 @@ void do_verbatim_input(void)
|
||||
/* TRANSLATORS: This is displayed when the next keystroke will be
|
||||
* inserted verbatim. */
|
||||
statusbar(_("Verbatim Input"));
|
||||
place_the_cursor();
|
||||
place_the_cursor(TRUE);
|
||||
curs_set(1);
|
||||
|
||||
/* Read in all the verbatim characters. */
|
||||
@@ -3566,7 +3566,7 @@ void do_verbatim_input(void)
|
||||
|
||||
/* Unsuppress cursor-position display or blank the statusbar. */
|
||||
if (ISSET(CONSTANT_SHOW))
|
||||
do_cursorpos(FALSE);
|
||||
suppress_cursorpos = FALSE;
|
||||
else {
|
||||
blank_statusbar();
|
||||
wnoutrefresh(bottomwin);
|
||||
|
||||
56
src/utils.c
56
src/utils.c
@@ -60,30 +60,29 @@ void get_homedir(void)
|
||||
int digits(ssize_t n)
|
||||
{
|
||||
if (n < 100000) {
|
||||
if (n < 1000) {
|
||||
if (n < 100)
|
||||
return 2;
|
||||
else
|
||||
return 3;
|
||||
} else {
|
||||
if (n < 10000)
|
||||
return 4;
|
||||
else
|
||||
return 5;
|
||||
}
|
||||
if (n < 1000) {
|
||||
if (n < 100)
|
||||
return 2;
|
||||
else
|
||||
return 3;
|
||||
} else {
|
||||
if (n < 10000)
|
||||
return 4;
|
||||
else
|
||||
return 5;
|
||||
}
|
||||
} else {
|
||||
if (n < 10000000) {
|
||||
if (n < 1000000)
|
||||
return 6;
|
||||
else
|
||||
return 7;
|
||||
}
|
||||
else {
|
||||
if (n < 100000000)
|
||||
return 8;
|
||||
else
|
||||
return 9;
|
||||
}
|
||||
if (n < 10000000) {
|
||||
if (n < 1000000)
|
||||
return 6;
|
||||
else
|
||||
return 7;
|
||||
} else {
|
||||
if (n < 100000000)
|
||||
return 8;
|
||||
else
|
||||
return 9;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -117,7 +116,7 @@ bool parse_line_column(const char *str, ssize_t *line, ssize_t *column)
|
||||
const char *comma;
|
||||
|
||||
while (*str == ' ')
|
||||
str++;
|
||||
str++;
|
||||
|
||||
comma = strpbrk(str, "m,. /;");
|
||||
|
||||
@@ -237,9 +236,12 @@ bool is_separate_word(size_t position, size_t length, const char *buf)
|
||||
const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
const char *start)
|
||||
{
|
||||
/* Just in case we search for an empty needle. :/ */
|
||||
if (*needle == '\0')
|
||||
if (*needle == '\0') {
|
||||
#ifndef NANO_TINY
|
||||
statusline(ALERT, "Searching for nothing -- please report a bug");
|
||||
#endif
|
||||
return (char *)start;
|
||||
}
|
||||
|
||||
if (ISSET(USE_REGEXP)) {
|
||||
if (ISSET(BACKWARDS_SEARCH)) {
|
||||
@@ -279,7 +281,7 @@ const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
regmatches[0].rm_eo = far_end;
|
||||
if (regexec(&search_regexp, haystack, 10, regmatches,
|
||||
REG_STARTEND) != 0)
|
||||
statusline(ALERT, "BAD: failed to refind the match!");
|
||||
return NULL;
|
||||
|
||||
return haystack + regmatches[0].rm_so;
|
||||
}
|
||||
|
||||
85
src/winio.c
85
src/winio.c
@@ -45,10 +45,10 @@ static size_t key_buffer_len = 0;
|
||||
/* The length of the keystroke buffer. */
|
||||
static bool solitary = FALSE;
|
||||
/* Whether an Esc arrived by itself -- not as leader of a sequence. */
|
||||
static bool waiting_mode = TRUE;
|
||||
/* Whether getting a character will wait for a key to be pressed. */
|
||||
static int statusblank = 0;
|
||||
/* The number of keystrokes left before we blank the statusbar. */
|
||||
static bool suppress_cursorpos = FALSE;
|
||||
/* Should we skip constant position display for one keystroke? */
|
||||
#ifdef USING_OLD_NCURSES
|
||||
static bool seen_wide = FALSE;
|
||||
/* Whether we've seen a multicolumn character in the current line. */
|
||||
@@ -135,7 +135,7 @@ void get_key_buffer(WINDOW *win)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (input == ERR && nodelay_mode)
|
||||
if (input == ERR && !waiting_mode)
|
||||
return;
|
||||
|
||||
while (input == ERR) {
|
||||
@@ -144,7 +144,7 @@ void get_key_buffer(WINDOW *win)
|
||||
* check if errno is set to EIO ("Input/output error") and die in
|
||||
* that case, but it's not always set properly. Argh. */
|
||||
if (++errcount == MAX_BUF_SIZE)
|
||||
handle_hupterm(0);
|
||||
die(_("Too many errors from stdin"));
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (the_window_resized) {
|
||||
@@ -188,7 +188,7 @@ void get_key_buffer(WINDOW *win)
|
||||
}
|
||||
|
||||
/* Restore waiting mode if it was on. */
|
||||
if (!nodelay_mode)
|
||||
if (waiting_mode)
|
||||
nodelay(win, FALSE);
|
||||
|
||||
#ifdef DEBUG
|
||||
@@ -327,7 +327,7 @@ int parse_kbinput(WINDOW *win)
|
||||
/* Read in a character. */
|
||||
kbinput = get_input(win, 1);
|
||||
|
||||
if (kbinput == NULL && nodelay_mode)
|
||||
if (kbinput == NULL && !waiting_mode)
|
||||
return 0;
|
||||
|
||||
while (kbinput == NULL)
|
||||
@@ -703,8 +703,9 @@ int parse_kbinput(WINDOW *win)
|
||||
#ifdef KEY_RESIZE
|
||||
/* Slang and SunOS 5.7-5.9 don't support KEY_RESIZE. */
|
||||
case KEY_RESIZE:
|
||||
return ERR;
|
||||
#endif
|
||||
case KEY_F0:
|
||||
return ERR;
|
||||
}
|
||||
|
||||
return retval;
|
||||
@@ -1235,7 +1236,7 @@ int parse_escape_sequence(WINDOW *win, int kbinput)
|
||||
suppress_cursorpos = FALSE;
|
||||
lastmessage = HUSH;
|
||||
if (currmenu == MMAIN) {
|
||||
place_the_cursor();
|
||||
place_the_cursor(TRUE);
|
||||
curs_set(1);
|
||||
}
|
||||
}
|
||||
@@ -1989,7 +1990,7 @@ void titlebar(const char *path)
|
||||
/* Figure out the path, prefix and state strings. */
|
||||
if (inhelp)
|
||||
branding = "";
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
else if (path != NULL)
|
||||
prefix = _("DIR:");
|
||||
#endif
|
||||
@@ -2014,7 +2015,7 @@ void titlebar(const char *path)
|
||||
prefixlen = strlenpt(prefix);
|
||||
if (prefixlen > 0)
|
||||
prefixlen++;
|
||||
pathlen= strlenpt(path);
|
||||
pathlen = strlenpt(path);
|
||||
statelen = strlenpt(state) + 2;
|
||||
if (statelen > 2) {
|
||||
pathlen++;
|
||||
@@ -2070,8 +2071,7 @@ void titlebar(const char *path)
|
||||
|
||||
wattroff(topwin, interface_color_pair[TITLE_BAR]);
|
||||
|
||||
wnoutrefresh(topwin);
|
||||
doupdate();
|
||||
wrefresh(topwin);
|
||||
}
|
||||
|
||||
/* Display a normal message on the statusbar, quietly. */
|
||||
@@ -2163,8 +2163,7 @@ void statusline(message_type importance, const char *msg, ...)
|
||||
wattroff(bottomwin, interface_color_pair[STATUS_BAR]);
|
||||
|
||||
/* Push the message to the screen straightaway. */
|
||||
wnoutrefresh(bottomwin);
|
||||
doupdate();
|
||||
wrefresh(bottomwin);
|
||||
|
||||
suppress_cursorpos = TRUE;
|
||||
|
||||
@@ -2242,8 +2241,7 @@ void bottombars(int menu)
|
||||
|
||||
/* Defeat a VTE bug by moving the cursor and forcing a screen update. */
|
||||
wmove(bottomwin, 0, 0);
|
||||
wnoutrefresh(bottomwin);
|
||||
doupdate();
|
||||
wrefresh(bottomwin);
|
||||
}
|
||||
|
||||
/* Write a shortcut key to the help area at the bottom of the window.
|
||||
@@ -2271,7 +2269,7 @@ void onekey(const char *keystroke, const char *desc, int length)
|
||||
|
||||
/* Redetermine current_y from the position of current relative to edittop,
|
||||
* and put the cursor in the edit window at (current_y, "current_x"). */
|
||||
void place_the_cursor(void)
|
||||
void place_the_cursor(bool forreal)
|
||||
{
|
||||
ssize_t row = 0;
|
||||
size_t col, xpt = xplustabs();
|
||||
@@ -2293,7 +2291,7 @@ void place_the_cursor(void)
|
||||
col = xpt % editwincols;
|
||||
|
||||
/* If the cursor ought to be in column zero, nudge it there. */
|
||||
if (openfile->placewewant % editwincols == 0 && col != 0) {
|
||||
if (forreal && openfile->placewewant % editwincols == 0 && col != 0) {
|
||||
row++;
|
||||
col = 0;
|
||||
}
|
||||
@@ -2307,7 +2305,8 @@ void place_the_cursor(void)
|
||||
if (row < editwinrows)
|
||||
wmove(edit, row, margin + col);
|
||||
|
||||
openfile->current_y = row;
|
||||
if (forreal)
|
||||
openfile->current_y = row;
|
||||
}
|
||||
|
||||
/* edit_draw() takes care of the job of actually painting a line into
|
||||
@@ -2686,8 +2685,10 @@ int update_line(filestruct *fileptr, size_t index)
|
||||
|
||||
/* If the line is offscreen, don't even try to display it. */
|
||||
if (row < 0 || row >= editwinrows) {
|
||||
#ifndef NANO_TINY
|
||||
statusline(ALERT, "Badness: tried to display a line on row %i"
|
||||
" -- please report a bug", row);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2902,12 +2903,16 @@ void edit_scroll(scroll_dir direction, int nrows)
|
||||
|
||||
/* Don't bother scrolling zero rows, nor more than the window can hold. */
|
||||
if (nrows == 0) {
|
||||
#ifndef NANO_TINY
|
||||
statusline(ALERT, "Underscrolling -- please report a bug");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
if (nrows >= editwinrows) {
|
||||
#ifndef NANO_TINY
|
||||
if (editwinrows > 1)
|
||||
statusline(ALERT, "Overscrolling -- please report a bug");
|
||||
#endif
|
||||
refresh_needed = TRUE;
|
||||
return;
|
||||
}
|
||||
@@ -2951,16 +2956,19 @@ void edit_scroll(scroll_dir direction, int nrows)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Ensure that firstcolumn is at the starting column of the softwrapped chunk
|
||||
* it's on. We need to do this when the number of columns of the edit window
|
||||
* has changed, because then the width of softwrapped chunks has changed. */
|
||||
void ensure_firstcolumn_is_aligned(void)
|
||||
{
|
||||
#ifndef NANO_TINY
|
||||
if (openfile->firstcolumn % editwincols != 0)
|
||||
openfile->firstcolumn -= (openfile->firstcolumn % editwincols);
|
||||
#endif
|
||||
|
||||
/* If smooth scrolling is on, make sure the viewport doesn't center. */
|
||||
focusing = FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Return TRUE if current[current_x] is above the top of the screen, and FALSE
|
||||
* otherwise. */
|
||||
@@ -3086,7 +3094,7 @@ void edit_refresh(void)
|
||||
while (row < editwinrows)
|
||||
blank_row(edit, row++, 0, COLS);
|
||||
|
||||
place_the_cursor();
|
||||
place_the_cursor(TRUE);
|
||||
wnoutrefresh(edit);
|
||||
|
||||
refresh_needed = FALSE;
|
||||
@@ -3135,17 +3143,19 @@ void total_redraw(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Unconditionally redraw the entire screen, and then refresh it using
|
||||
* the current file. */
|
||||
/* Redraw the entire screen, then refresh the title bar and the content of
|
||||
* the edit window (when not in the file browser), and the bottom bars. */
|
||||
void total_refresh(void)
|
||||
{
|
||||
total_redraw();
|
||||
titlebar(title);
|
||||
if (currmenu != MBROWSER && currmenu != MWHEREISFILE && currmenu != MGOTODIR)
|
||||
titlebar(title);
|
||||
#ifdef ENABLE_HELP
|
||||
if (inhelp)
|
||||
wrap_the_help_text(TRUE);
|
||||
else
|
||||
#endif
|
||||
if (currmenu != MBROWSER && currmenu != MWHEREISFILE && currmenu != MGOTODIR)
|
||||
edit_refresh();
|
||||
bottombars(currmenu);
|
||||
}
|
||||
@@ -3175,7 +3185,14 @@ void do_cursorpos(bool force)
|
||||
size_t cur_lenpt = strlenpt(openfile->current->data) + 1;
|
||||
int linepct, colpct, charpct;
|
||||
|
||||
assert(openfile->fileage != NULL && openfile->current != NULL);
|
||||
/* If the showing needs to be suppressed, don't suppress it next time. */
|
||||
if (suppress_cursorpos && !force) {
|
||||
suppress_cursorpos = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Hide the cursor while we are calculating. */
|
||||
curs_set(0);
|
||||
|
||||
/* Determine the size of the file up to the cursor. */
|
||||
saved_byte = openfile->current->data[openfile->current_x];
|
||||
@@ -3189,12 +3206,6 @@ void do_cursorpos(bool force)
|
||||
if (openfile->current != openfile->filebot)
|
||||
sum--;
|
||||
|
||||
/* If the showing needs to be suppressed, don't suppress it next time. */
|
||||
if (suppress_cursorpos && !force) {
|
||||
suppress_cursorpos = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Display the current cursor position on the statusbar. */
|
||||
linepct = 100 * openfile->current->lineno / openfile->filebot->lineno;
|
||||
colpct = 100 * cur_xpt / cur_lenpt;
|
||||
@@ -3217,15 +3228,15 @@ void do_cursorpos_void(void)
|
||||
do_cursorpos(TRUE);
|
||||
}
|
||||
|
||||
void enable_nodelay(void)
|
||||
void disable_waiting(void)
|
||||
{
|
||||
nodelay_mode = TRUE;
|
||||
waiting_mode = FALSE;
|
||||
nodelay(edit, TRUE);
|
||||
}
|
||||
|
||||
void disable_nodelay(void)
|
||||
void enable_waiting(void)
|
||||
{
|
||||
nodelay_mode = FALSE;
|
||||
waiting_mode = TRUE;
|
||||
nodelay(edit, FALSE);
|
||||
}
|
||||
|
||||
@@ -3245,7 +3256,7 @@ void spotlight(bool active, const char *word)
|
||||
room--;
|
||||
}
|
||||
|
||||
place_the_cursor();
|
||||
place_the_cursor(FALSE);
|
||||
|
||||
if (active)
|
||||
wattron(edit, hilite_attribute);
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
## A default syntax, which is used
|
||||
## for files that do not match any other syntax.
|
||||
## An example of a default syntax. The default syntax is used for
|
||||
## files that do not match any other syntax.
|
||||
|
||||
syntax "default"
|
||||
comment "#"
|
||||
|
||||
# Comments.
|
||||
color cyan "^[[:space:]]*#.*"
|
||||
|
||||
# Spaces in front of tabs.
|
||||
color ,red " + +"
|
||||
|
||||
# Nano's name, including version.
|
||||
color brightred "(GNU )?nano [1-9]\.[0-9]\.[^[:space:][:punct:]]+"
|
||||
|
||||
# Email addresses.
|
||||
color yellow "<[[:alnum:].%_+-]+@[[:alnum:].-]+\.[[:alpha:]]{2,}>"
|
||||
|
||||
@@ -7,7 +7,7 @@ color red "[:=]"
|
||||
color magenta "\<(if|ifeq|else|endif)\>"
|
||||
color blue "\$+[{(][a-zA-Z0-9_-]+[})]"
|
||||
color brightblue "^[^ ]+:"
|
||||
color green "#.*$"
|
||||
color green "(^|[[:space:]]+)#.*"
|
||||
|
||||
## Trailing whitespace.
|
||||
color ,green "[[:space:]]+$"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
syntax "nanohelp"
|
||||
|
||||
# Key combos:
|
||||
color cyan "\^([]A-Z^\_←→↑↓]|Home|End)" "[←→↑↓]"
|
||||
color cyan "\^([]4-8A-Z^\_←→↑↓]|Home|End)" "[←→↑↓]"
|
||||
color cyan "\<(Tab|Enter|Home|End|Ins|Del|Bsp|PgUp|PgDn)\>"
|
||||
color cyan "\<M-." "\<F1?[0-9]" "(\^|M-)Space"
|
||||
|
||||
|
||||
@@ -1,32 +1,35 @@
|
||||
## Here is an example for PHP.
|
||||
|
||||
syntax "php" "\.php[2345s~]?$"
|
||||
syntax "php" "\.ph(p[23457s~]?|tml)$"
|
||||
magic "PHP script text"
|
||||
comment "//"
|
||||
|
||||
# PHP markings.
|
||||
color brightgreen "(<\?(php)?|\?>)"
|
||||
|
||||
# Functions.
|
||||
# Function names.
|
||||
color white "\<[a-z_]*\("
|
||||
# Variable names.
|
||||
color cyan "\$[a-z_]+"
|
||||
|
||||
# Types.
|
||||
color green "\<(var|float|global|double|bool|char|int|enum|const)\>"
|
||||
color green "\<(array|bool|callable|const|float|global|int|object|string|var)\>"
|
||||
|
||||
# Structure.
|
||||
color brightyellow "\<(class|new|private|public|function|for|foreach|if|while|do|else|elseif|case|default|switch)\>"
|
||||
# Directives and structure.
|
||||
color brightyellow "\<(abstract|as|class|clone|(end)?declare|extends|function|implements|include(_once)?|inst(ance|ead)of|interface|namespace|new|private|protected|public|require(_once)?|static|trait|use|yield)\>"
|
||||
color brightyellow "\<(case|catch|default|do|echo|else(if)?|end(for(each)?|if|switch|while)|final(ly)?|for(each)?|if|print|switch|throw|try|while)\>"
|
||||
# Operators.
|
||||
color brightyellow "\<(and|or|xor)\>"
|
||||
|
||||
# Control flow.
|
||||
color magenta "\<(goto|continue|break|return)\>"
|
||||
color magenta "\<(break|continue|goto|return)\>"
|
||||
|
||||
# Strings.
|
||||
color brightyellow "<[^= ]*>" ""(\.|[^"])*""
|
||||
color brightyellow ""(\.|[^"])*"" "'(\.|[^'])*'"
|
||||
|
||||
# Comments.
|
||||
color brightblue "//.*"
|
||||
color brightblue "(^|[[:space:]]+)//.*"
|
||||
color brightblue start="/\*" end="\*/"
|
||||
##color blue start="<" end=">"
|
||||
##color red "&[^;[:space:]]*;"
|
||||
|
||||
# Trailing whitespace.
|
||||
color ,green "[[:space:]]+$"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
## Here is an example for XML files.
|
||||
|
||||
syntax "xml" "\.([jrsx]html?|jnlp|mml|pom|rng|sgml?|svg|w[as]dl|wsdd|xjb|xml|xs(d|lt?)|xul)$"
|
||||
header "<\?xml.*version=.*\?>"
|
||||
magic "(XML|SGML) (sub)?document text"
|
||||
comment "<!--|-->"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user