Compare commits
68 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
361267cf25 | ||
|
|
ed493bb99b | ||
|
|
ae7366616f | ||
|
|
58ed3a8152 | ||
|
|
e11021a7a5 | ||
|
|
83c264939b | ||
|
|
d48f3e5e7b | ||
|
|
b18e76d4d8 | ||
|
|
f5c87a7fee | ||
|
|
90ebff00ca | ||
|
|
cdc9a29598 | ||
|
|
ddc1de1939 | ||
|
|
18bf2af9c1 | ||
|
|
452008c81d | ||
|
|
97cbbb0cc8 | ||
|
|
7b9bd65362 | ||
|
|
f72fecee9b | ||
|
|
97a8a62128 | ||
|
|
f095e20a86 | ||
|
|
fa7e9b11df | ||
|
|
838b175d4f | ||
|
|
ba1f990582 | ||
|
|
6795d079b1 | ||
|
|
e739448cd0 | ||
|
|
8e328e43c2 | ||
|
|
cb56a575fd | ||
|
|
a429dc4a76 | ||
|
|
91073be49c | ||
|
|
d5f9be7dc8 | ||
|
|
4ad0490ce4 | ||
|
|
d85098abda | ||
|
|
13f8ddcaf2 | ||
|
|
37e9ada964 | ||
|
|
a99158c7c0 | ||
|
|
3981217e5a | ||
|
|
96b47f2877 | ||
|
|
7da391beb7 | ||
|
|
90cf4838d2 | ||
|
|
4c7ec18a55 | ||
|
|
704a7d7b4f | ||
|
|
64366d9992 | ||
|
|
bd97ae7255 | ||
|
|
2ff398c685 | ||
|
|
4b24ce1c11 | ||
|
|
00c1105c1b | ||
|
|
6a4d88cb4c | ||
|
|
898c4c6fbb | ||
|
|
c1bb6485de | ||
|
|
4bcce96a4f | ||
|
|
caeed6821c | ||
|
|
eb1bf8f927 | ||
|
|
2c8b99d5e9 | ||
|
|
091dd71f08 | ||
|
|
837475519b | ||
|
|
31540e3e7e | ||
|
|
ae3b8579fa | ||
|
|
e1199cd94d | ||
|
|
45d2458b47 | ||
|
|
4c505e5127 | ||
|
|
e3b13ae124 | ||
|
|
e5440b390e | ||
|
|
2a17527381 | ||
|
|
8067efa6cc | ||
|
|
0bb6c0234f | ||
|
|
7947d9d2a5 | ||
|
|
c9ccb39752 | ||
|
|
ada78dc89d | ||
|
|
c6f367268b |
74
ChangeLog
74
ChangeLog
@@ -1,3 +1,77 @@
|
||||
Changes between v2.9.2 and v2.9.3:
|
||||
----------------------------------
|
||||
|
||||
Benno Schulenberg (65):
|
||||
build: fix compilation when configured with --enable(tiny,color,nanorc}
|
||||
build: fix compilation with --enable-tiny --enable-justify
|
||||
build: let ./configure fail (not just warn) when curses.h is missing
|
||||
bump version numbers and add a news item for the 2.9.3 release
|
||||
copyright: update the years for the FSF
|
||||
display: wipe the status bar when doing a total refresh
|
||||
docs: remove the note about needing a recent ncurses for macros to work
|
||||
docs: update the FAQ for the changed default location of history files
|
||||
docs: update the TODO file to the current state of affairs
|
||||
gnulib: update to its current upstream state
|
||||
help: don't get stuck when there is an unwrappable piece of text
|
||||
input: consume only the actual length of an escape sequence
|
||||
input: fully reset state when a three-digit character code is cut short
|
||||
input: make <Shift+Tab> do an unindent also on a Manjaro console
|
||||
input: recognize escape sequences for <Shift+PageUp> and <Shift+PageDown>
|
||||
input: recognize more escape sequences for <Shift+Home> and <Shift+End>
|
||||
input: recognize the deviant keycode for <Ctrl+End> in urxvt
|
||||
options: recognize -M and --trimblanks on the command line
|
||||
painting: look for an end match only after a start match, if any
|
||||
prompt: show whitespace only in the filename, not in the whole line
|
||||
replacing: don't skip the first character of a backwards-marked region
|
||||
search: suppress the occurrence at the cursor only when replacing
|
||||
startup: allow a named pipe as file argument when --noread is used
|
||||
startup: make an error message succinct and to the point
|
||||
startup: move the initialization of colors, so any error gets printed
|
||||
syntax: go: colorize only valid octal numbers
|
||||
syntax: lua: do not color debug.setinfo as it doesn't exist
|
||||
syntax: nanohelp: color also the Sh-Tab key combo
|
||||
tweaks: change a 'do' to a 'while', and return early to elide an 'if'
|
||||
tweaks: check for the type of terminal far earlier
|
||||
tweaks: condense a condition and a comment, and reshuffle a line
|
||||
tweaks: condense and rewrap some comments, and reindent two lines
|
||||
tweaks: condense the conditional compilation of shortcut reassignments
|
||||
tweaks: don't bother freeing the key buffer, just reallocate it
|
||||
tweaks: don't bother to reallocate when the keybuffer size decreases
|
||||
tweaks: drop a superfluous parameter, as it is always 1
|
||||
tweaks: drop a useless assert, and don't abort over an unhandled option
|
||||
tweaks: drop two unneeded initializations, and trim a comment
|
||||
tweaks: elide a tiny intermediate buffer, and rename two variables
|
||||
tweaks: exclude --trimblanks when no wrapping or justifying is configured
|
||||
tweaks: fully include Savefile and Wherewas in the tiny version
|
||||
tweaks: indenting text files with tabs is not a good idea
|
||||
tweaks: mark the two blocks that have a deviant indentation
|
||||
tweaks: move a bunch of comments to the lines that they refer to
|
||||
tweaks: move two functions to their proper place, orderingwise
|
||||
tweaks: remove a fragment of dead code
|
||||
tweaks: remove a handful of redundant (because always true) asserts
|
||||
tweaks: remove a superfluous case -- there can never be four digits
|
||||
tweaks: remove a superfluous check, as we insert always one code
|
||||
tweaks: rename a function, for aptness, and drop a superfluous check
|
||||
tweaks: rename a function, to be more distinct
|
||||
tweaks: rename a variable, and further condense some comments
|
||||
tweaks: rename a variable, for more contrast
|
||||
tweaks: rename a variable, to better fit its usage
|
||||
tweaks: rename two variables, and swap their declaration order
|
||||
tweaks: rename two variables, for preciseness and shortness
|
||||
tweaks: reshuffle a couple of lines
|
||||
tweaks: reshuffle a couple of lines, to make a bit more sense
|
||||
tweaks: reshuffle some stuff, and avoid a memory leak
|
||||
tweaks: reshuffle two condition series, to look better
|
||||
tweaks: rewrap a bunch of lines in the NEWS file
|
||||
tweaks: set a modifier in a single place, for conciseness
|
||||
tweaks: swap the row and col parameters to a more consistent order
|
||||
tweaks: transform a parameter, from a pointer to the value itself
|
||||
wrapping: don't trim a blank character that the user just typed
|
||||
|
||||
Brand Huntsman (1):
|
||||
startup: parse interface colors when they are read, not when initialized
|
||||
|
||||
|
||||
Changes between v2.9.1 and v2.9.2:
|
||||
----------------------------------
|
||||
|
||||
|
||||
92
README
92
README
@@ -1,76 +1,76 @@
|
||||
|
||||
GNU nano -- an enhanced clone of the Pico text editor
|
||||
GNU nano -- an enhanced clone of the Pico text editor
|
||||
|
||||
Overview
|
||||
|
||||
The nano project was started because of a few "problems" with the
|
||||
wonderfully easy-to-use and friendly Pico text editor.
|
||||
The nano project was started because of a few "problems" with the
|
||||
wonderfully easy-to-use and friendly Pico text editor.
|
||||
|
||||
First and foremost was its license: the Pine suite does not use
|
||||
the GPL or a GPL-friendly license, and has unclear restrictions on
|
||||
redistribution. Because of this, Pine and Pico are not included
|
||||
with many GNU/Linux distributions. Also, other features (like
|
||||
go-to-line-number or search-and-replace) were unavailable until
|
||||
recently or require a command-line flag. Yuck.
|
||||
First and foremost was its license: the Pine suite does not use
|
||||
the GPL or a GPL-friendly license, and has unclear restrictions on
|
||||
redistribution. Because of this, Pine and Pico are not included
|
||||
with many GNU/Linux distributions. Also, other features (like
|
||||
go-to-line-number or search-and-replace) were unavailable until
|
||||
recently or require a command-line flag. Yuck.
|
||||
|
||||
nano aims to solve these problems by emulating the functionality of
|
||||
Pico as closely as possible while addressing the problems above and
|
||||
providing other extra functionality.
|
||||
nano aims to solve these problems by emulating the functionality of
|
||||
Pico as closely as possible while addressing the problems above and
|
||||
providing other extra functionality.
|
||||
|
||||
The nano editor is an official GNU package. For more information on
|
||||
GNU and the Free Software Foundation, please see http://www.gnu.org/.
|
||||
The nano editor is an official GNU package. For more information on
|
||||
GNU and the Free Software Foundation, please see http://www.gnu.org/.
|
||||
|
||||
How to compile and install nano
|
||||
|
||||
Download the nano source code, then:
|
||||
Download the nano source code, then:
|
||||
|
||||
tar xvzf nano-x.y.z.tar.gz
|
||||
cd nano-x.y.z
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
tar xvzf nano-x.y.z.tar.gz
|
||||
cd nano-x.y.z
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
|
||||
It's that simple. Use --prefix with configure to override the
|
||||
default installation directory of /usr/local.
|
||||
It's that simple. Use --prefix with configure to override the
|
||||
default installation directory of /usr/local.
|
||||
|
||||
If you haven't configured with the --disable-nanorc option, after
|
||||
installation you may want to copy the doc/sample.nanorc file to
|
||||
your home directory, rename it to ".nanorc", and then edit it
|
||||
according to your taste.
|
||||
If you haven't configured with the --disable-nanorc option, after
|
||||
installation you may want to copy the doc/sample.nanorc file to
|
||||
your home directory, rename it to ".nanorc", and then edit it
|
||||
according to your taste.
|
||||
|
||||
Web Page
|
||||
|
||||
https://nano-editor.org/
|
||||
https://nano-editor.org/
|
||||
|
||||
Mailing Lists
|
||||
|
||||
There are three nano-related mailing-lists.
|
||||
There are three nano-related mailing-lists.
|
||||
|
||||
+ info-nano@gnu.org is a very low traffic list used to announce
|
||||
new nano versions or other important info about the project.
|
||||
+ help-nano@gnu.org is for those seeking to get help without
|
||||
wanting to hear about the technical details of its development.
|
||||
+ nano-devel@gnu.org is the list used by the people that make nano
|
||||
and a general development discussion list, with moderate traffic.
|
||||
+ info-nano@gnu.org is a very low traffic list used to announce
|
||||
new nano versions or other important info about the project.
|
||||
+ help-nano@gnu.org is for those seeking to get help without
|
||||
wanting to hear about the technical details of its development.
|
||||
+ nano-devel@gnu.org is the list used by the people that make nano
|
||||
and a general development discussion list, with moderate traffic.
|
||||
|
||||
To subscribe, send email to <name>-request@gnu.org with a subject
|
||||
of "subscribe", where <name> is the list you want to subscribe to.
|
||||
To subscribe, send email to <name>-request@gnu.org with a subject
|
||||
of "subscribe", where <name> is the list you want to subscribe to.
|
||||
|
||||
Bug Reports
|
||||
|
||||
To report a bug, please file a description of the problem on nano's
|
||||
bug tracker (https://savannah.gnu.org/bugs/?group=nano -- hover on
|
||||
"Bugs", then click "Submit new"). The issue may have already been
|
||||
reported, so please look first.
|
||||
To report a bug, please file a description of the problem on nano's
|
||||
bug tracker (https://savannah.gnu.org/bugs/?group=nano -- hover on
|
||||
"Bugs", then click "Submit new"). The issue may have already been
|
||||
reported, so please look first.
|
||||
|
||||
Current Status
|
||||
|
||||
Since version 2.5.0, GNU nano has abandoned the distinction between
|
||||
a stable and a development branch: it is now on a "rolling" release
|
||||
-- fixing bugs and adding new features go hand in hand.
|
||||
Since version 2.5.0, GNU nano has abandoned the distinction between
|
||||
a stable and a development branch: it is now on a "rolling" release
|
||||
-- fixing bugs and adding new features go hand in hand.
|
||||
|
||||
Copyright Years
|
||||
|
||||
When in any file of this package a copyright notice mentions a
|
||||
year range (such as 1999-2011), it is a shorthand for a list of
|
||||
all the years in that interval.
|
||||
When in any file of this package a copyright notice mentions a
|
||||
year range (such as 1999-2011), it is a shorthand for a list of
|
||||
all the years in that interval.
|
||||
|
||||
16
TODO
16
TODO
@@ -2,11 +2,9 @@ A list of desired features
|
||||
--------------------------
|
||||
|
||||
Somewhat urgent:
|
||||
- Make undo/redo work also for justifying and indenting.
|
||||
- Make undo/redo work also for justifying.
|
||||
- Detect when text is being pasted, so that we can handle it faster.
|
||||
See https://savannah.gnu.org/bugs/?40060.
|
||||
- Allow to define and execute a macro: a stored sequence of keystrokes.
|
||||
See https://savannah.gnu.org/bugs/?50314.
|
||||
- Allow color syntaxes to apply to more than just color, so that we can
|
||||
e.g. specify a different alternate spell checker depending on which
|
||||
file type we have open.
|
||||
@@ -15,15 +13,16 @@ Somewhat urgent:
|
||||
See also https://savannah.gnu.org/bugs/?28993.
|
||||
|
||||
Vague musings:
|
||||
- FriBidi support?
|
||||
- Add support for right-to-left text (RTL), through FriBidi?
|
||||
- Allow setting marks (saved positions, not to be confused with the
|
||||
mark set via Ctrl-^) at various lines and/or columns in the buffer,
|
||||
and allow movement between them with a single keystroke?
|
||||
- Make matching bracket searches sophisticated enough to skip over
|
||||
brackets inside comments?
|
||||
- Allow indentation of marked text by spaces as well as tabs?
|
||||
- Allow indentation to add just enough columns to reach the nearest
|
||||
multiple of tabsize, rather than always adding tabsize columns?
|
||||
|
||||
For version 2.9:
|
||||
- Make undo/redo work also for indenting. [DONE]
|
||||
- Allow to record and replay a macro: a stored series of keystrokes. [DONE]
|
||||
|
||||
For version 2.8:
|
||||
- Allow text searches in the help viewer. [DONE]
|
||||
@@ -41,8 +40,7 @@ For version 2.2:
|
||||
- Undo/Redo keys (M-U and M-E)? [DONE]
|
||||
- Fix problems with color syntaxes highlighting lines too aggressively. [DONE]
|
||||
- Allow nano to work like a pager (reading from stdin). [DONE]
|
||||
- Allow color syntaxes to be selected based on more than just filename
|
||||
extension. [DONE]
|
||||
- Select a color syntax based on more than just the filename extension. [DONE]
|
||||
- Allow soft wrapping as well as hard wrapping? [DONE]
|
||||
|
||||
For version 2.0:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Generate configure & friends for GIT users.
|
||||
|
||||
gnulib_url="git://git.sv.gnu.org/gnulib.git"
|
||||
gnulib_hash="44100f563482fe469a33abecda5797da04fc3c61"
|
||||
gnulib_hash="4a236f16ce0ef97094ff2f6538d4dba90e72a523"
|
||||
|
||||
modules="
|
||||
futimens
|
||||
|
||||
10
configure.ac
10
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.9.2], [nano-devel@gnu.org], [nano])
|
||||
AC_INIT([GNU nano], [2.9.3], [nano-devel@gnu.org], [nano])
|
||||
AC_CONFIG_SRCDIR([src/nano.c])
|
||||
AC_CANONICAL_HOST
|
||||
AM_INIT_AUTOMAKE([1.14])
|
||||
@@ -565,10 +565,10 @@ if eval "test x$CURSES_LIB_NAME = x"; then
|
||||
fi
|
||||
|
||||
if eval "test x$CURSES_LIB_NAME = x"; then
|
||||
AC_MSG_WARN([
|
||||
*** No curses lib available. Consider getting the official ncurses
|
||||
*** distribution from ftp://ftp.gnu.org/pub/gnu/ncurses if you get
|
||||
*** errors compiling nano.])
|
||||
AC_MSG_ERROR([
|
||||
*** No curses lib was found. Please install the curses header files
|
||||
*** from libncursesw5-dev (Debian), ncurses-devel (Fedora), or similar.
|
||||
*** (Or install ncurses from https://ftp.gnu.org/gnu/ncurses/.)])
|
||||
else
|
||||
AC_MSG_RESULT([Using $CURSES_LIB_NAME as the curses library])
|
||||
fi
|
||||
|
||||
10
doc/faq.html
10
doc/faq.html
@@ -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.9.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.9.3</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%">
|
||||
@@ -217,18 +217,18 @@
|
||||
<h2><a name="4.12"></a>4.12. On startup I get a message that says "Detected a legacy nano history file". Now older nano versions can't find my search history!</h2>
|
||||
<blockquote><p>In nano 2.3.0, cursor-position history was introduced, and both history files now reside in a .nano subdirectory in your home directory. A newer nano will move an existing search-history file to this new location so it can continue to be used. This means that if you then try and use an earlier version of nano, it will be unable to see your current search history. To fix this, run the following command:</p>
|
||||
<p><b>ln -sf ~/.nano/search_history ~/.nano_history</b></p>
|
||||
<p>The "migration service" (moving the search-history file to its new location) will be deleted from nano in early 2018.</p></blockquote>
|
||||
<p>The "migration service" (moving the search-history file to its new location) has been deleted from nano in late 2017, since version 2.9.0. The search-history and position-history files will now be looked for first in ~/.nano/ and, when not found there, then in ~/.local/share/nano/.</p></blockquote>
|
||||
<hr width="100%">
|
||||
|
||||
<h1><a name="5"></a>5. Internationalization</h1>
|
||||
<h2><a name="5.1"></a>5.1. There's no translation for my language!</h2>
|
||||
<blockquote><p>In June 2001, GNU nano entered the <a href="http://translationproject.org/html/welcome.html">Translation Project</a> and since then, translations should be managed from there.</p>
|
||||
<p>If there isn't a translation for your language, you could ask <a href="http://translationproject.org/team/">your language team</a> to translate nano, or better still, join that team and do it yourself. Joining a team is easy. You just need to ask the team leader to add you, and then send a <a href="http://translationproject.org/disclaim.txt">translation disclaimer to the FSF</a> (this is necessary as nano is an official GNU package, but it does <b>not</b> mean that you transfer the rights of your work to the FSF, it's just so the FSF can legally manage them).</p>
|
||||
<p>In any case, translating nano is very easy. Just grab the latest <b>nano.pot</b> file listed on <a href="http://translationproject.org/domain/nano.html">nano's page</a> at the TP, and translate each <b>msgid</b> line into your native language on the <b>msgstr</b> line. When you're done, you should send it to the TP's central po repository.</p></blockquote>
|
||||
<p>In any case, translating nano is easy. Just grab the latest <b>nano.pot</b> file listed on <a href="http://translationproject.org/domain/nano.html">nano's page</a> at the TP, and translate each <b>msgid</b> line into your native language on the <b>msgstr</b> line. When you're done, you should send it to the TP's central PO-file repository.</p></blockquote>
|
||||
<h2><a name="5.2"></a>5.2. I don't like the translation for <x> in my language. How can I fix it?</h2>
|
||||
<blockquote><p>The best way would probably be to send an e-mail to the team's mailing listed mentione in the <code>Language-Team:</code> field in the <b><your_language>.po</b> file with your suggested corrections, and then they can make the changes reach the nano-devel list.</p></blockquote>
|
||||
<blockquote><p>The best way is to send an e-mail with your suggested corrections to the team's mailing list. The address is mentioned in the <code>Language-Team:</code> field in the relevant PO file. The team leader or the assigned translator can then make the changes reach the nano-devel list.</p></blockquote>
|
||||
<h2><a name="5.3"></a>5.3. What is the status of Unicode support?</h2>
|
||||
<blockquote><p>Since versions 1.3.12, Unicode should be usable. With your terminal, locale (LC_ALL and similar environment variables), and encoding configured to properly support UTF-8, you should be able to enter and save Unicode text.</p></blockquote>
|
||||
<blockquote><p>Unicode should be fully usable nowadays. When the encoding of your terminal is set to UTF-8, and your locale (mainly the LANG environment variable) is UTF-8 too, then you should be able to read, enter and save Unicode text.</p></blockquote>
|
||||
<hr width="100%">
|
||||
|
||||
<h1><a name="6"></a>6. Advocacy and Licensing</h1>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH NANO 1 "version 2.9.2" "January 2018"
|
||||
.TH NANO 1 "version 2.9.3" "January 2018"
|
||||
|
||||
.SH NAME
|
||||
nano \- Nano's ANOther editor, an enhanced free Pico clone
|
||||
@@ -108,6 +108,10 @@ won't work properly with this option enabled.
|
||||
.BR \-L ", " \-\-nonewlines
|
||||
Don't add newlines to the ends of files.
|
||||
.TP
|
||||
.BR \-M ", " \-\-trimblanks
|
||||
Snip trailing whitespace from the wrapped line when automatic
|
||||
hard-wrapping occurs or when text is justified.
|
||||
.TP
|
||||
.BR \-N ", " \-\-noconvert
|
||||
Disable automatic conversion of files from DOS/Mac format.
|
||||
.TP
|
||||
@@ -301,7 +305,7 @@ saving.
|
||||
.sp
|
||||
The recording and playback of keyboard macros works correctly only on a
|
||||
terminal emulator, not on a Linux console (VT), because the latter is a
|
||||
deficient terminal. And it works only with recent versions of ncurses.
|
||||
deficient terminal.
|
||||
.sp
|
||||
Please report any other bugs that you encounter via:
|
||||
.br
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
@smallbook
|
||||
@set EDITION 0.5
|
||||
@set VERSION 2.9.2
|
||||
@set VERSION 2.9.3
|
||||
@set UPDATED January 2018
|
||||
|
||||
@dircategory Editors
|
||||
@@ -23,7 +23,7 @@
|
||||
@titlepage
|
||||
@title GNU @command{nano}
|
||||
@subtitle a small and friendly text editor
|
||||
@subtitle version 2.9.2
|
||||
@subtitle version 2.9.3
|
||||
|
||||
@author Chris Allegretta
|
||||
@page
|
||||
@@ -63,7 +63,7 @@ e-mail: @email{chrisa@@asty.org}@*
|
||||
@node Top
|
||||
@top
|
||||
|
||||
This manual documents the GNU @command{nano} editor, version 2.9.2.
|
||||
This manual documents the GNU @command{nano} editor, version 2.9.3.
|
||||
|
||||
@menu
|
||||
* Introduction::
|
||||
@@ -200,6 +200,11 @@ won't work properly with this option enabled.
|
||||
@itemx --nonewlines
|
||||
Don't add newlines to the ends of files.
|
||||
|
||||
@item -M
|
||||
@itemx --trimblanks
|
||||
Snip trailing whitespace from the wrapped line when automatic
|
||||
hard-wrapping occurs or when text is justified.
|
||||
|
||||
@item -N
|
||||
@itemx --noconvert
|
||||
Disable automatic conversion of files from DOS/Mac format.
|
||||
@@ -563,7 +568,7 @@ saving.
|
||||
|
||||
The recording and playback of keyboard macros works correctly only on a
|
||||
terminal emulator, not on a Linux console (VT), because the latter is a
|
||||
deficient terminal. And it works only with recent versions of ncurses.
|
||||
deficient terminal.
|
||||
|
||||
@node Built-in Help
|
||||
@chapter Built-in Help
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH NANORC 5 "version 2.9.2" "January 2018"
|
||||
.TH NANORC 5 "version 2.9.3" "January 2018"
|
||||
|
||||
.SH NAME
|
||||
nanorc \- GNU nano's configuration file
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH RNANO 1 "version 2.9.2" "January 2018"
|
||||
.TH RNANO 1 "version 2.9.3" "January 2018"
|
||||
|
||||
.SH NAME
|
||||
rnano \- a restricted nano
|
||||
|
||||
@@ -10,7 +10,7 @@ Summary : a user-friendly editor, a Pico clone with enhancements
|
||||
License : GPLv3+
|
||||
Group : Applications/Editors
|
||||
URL : https://nano-editor.org/
|
||||
Source : https://nano-editor.org/dist/v2.6/%{name}-%{version}.tar.gz
|
||||
Source : https://nano-editor.org/dist/latest/%{name}-%{version}.tar.gz
|
||||
|
||||
BuildRoot : %{_tmppath}/%{name}-%{version}-root
|
||||
BuildRequires : autoconf, automake, gettext-devel, ncurses-devel, texinfo
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
# List of available languages.
|
||||
bg ca cs da de eo es eu fi fr ga gl hr hu id it ja ms nb nl nn pl pt_BR ro ru sl sr sv tr uk vi zh_CN zh_TW
|
||||
bg ca cs da de eo es eu fi fr ga gl hr hu id it ja ms nb nl nn pl pt pt_BR ro ru sl sr sv tr uk vi zh_CN zh_TW
|
||||
|
||||
917
po/nano.pot
917
po/nano.pot
File diff suppressed because it is too large
Load Diff
913
po/pt_BR.po
913
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
923
po/zh_CN.po
923
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
923
po/zh_TW.po
923
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
/**************************************************************************
|
||||
* browser.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 2001-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2001-2011, 2013-2018 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2015-2016 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -121,7 +121,7 @@ char *do_browser(char *path)
|
||||
int mouse_x, mouse_y;
|
||||
|
||||
/* We can click on the edit window to select a filename. */
|
||||
if (get_mouseinput(&mouse_x, &mouse_y, TRUE) == 0 &&
|
||||
if (get_mouseinput(&mouse_y, &mouse_x, TRUE) == 0 &&
|
||||
wmouse_trafo(edit, &mouse_y, &mouse_x, FALSE)) {
|
||||
/* longest is the width of each column. There
|
||||
* are two spaces between each column. */
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**************************************************************************
|
||||
* chars.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 2001-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2001-2011, 2013-2018 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2016-2017 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
|
||||
28
src/color.c
28
src/color.c
@@ -1,7 +1,7 @@
|
||||
/**************************************************************************
|
||||
* color.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 2001-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2001-2011, 2013-2018 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2014-2017 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -45,7 +45,6 @@ void set_colorpairs(void)
|
||||
{
|
||||
const syntaxtype *sint;
|
||||
bool using_defaults = FALSE;
|
||||
short foreground, background;
|
||||
size_t i;
|
||||
|
||||
/* Tell ncurses to enable colors. */
|
||||
@@ -58,18 +57,16 @@ void set_colorpairs(void)
|
||||
|
||||
/* Initialize the color pairs for nano's interface elements. */
|
||||
for (i = 0; i < NUMBER_OF_ELEMENTS; i++) {
|
||||
bool bright = FALSE;
|
||||
colortype *combo = color_combo[i];
|
||||
|
||||
if (specified_color_combo[i] != NULL &&
|
||||
parse_color_names(specified_color_combo[i],
|
||||
&foreground, &background, &bright)) {
|
||||
if (foreground == -1 && !using_defaults)
|
||||
foreground = COLOR_WHITE;
|
||||
if (background == -1 && !using_defaults)
|
||||
background = COLOR_BLACK;
|
||||
init_pair(i + 1, foreground, background);
|
||||
if (combo != NULL) {
|
||||
if (combo->fg == -1 && !using_defaults)
|
||||
combo->fg = COLOR_WHITE;
|
||||
if (combo->bg == -1 && !using_defaults)
|
||||
combo->bg = COLOR_BLACK;
|
||||
init_pair(i + 1, combo->fg, combo->bg);
|
||||
interface_color_pair[i] = COLOR_PAIR(i + 1) | A_BANDAID |
|
||||
(bright ? A_BOLD : A_NORMAL);
|
||||
(combo->bright ? A_BOLD : A_NORMAL);
|
||||
} else {
|
||||
if (i != FUNCTION_TAG)
|
||||
interface_color_pair[i] = hilite_attribute;
|
||||
@@ -77,8 +74,7 @@ void set_colorpairs(void)
|
||||
interface_color_pair[i] = A_NORMAL;
|
||||
}
|
||||
|
||||
free(specified_color_combo[i]);
|
||||
specified_color_combo[i] = NULL;
|
||||
free(color_combo[i]);
|
||||
}
|
||||
|
||||
/* For each syntax, go through its list of colors and assign each
|
||||
@@ -293,6 +289,7 @@ void check_the_multis(filestruct *line)
|
||||
const colortype *ink;
|
||||
bool astart, anend;
|
||||
regmatch_t startmatch, endmatch;
|
||||
char *afterstart;
|
||||
|
||||
/* If there is no syntax or no multiline regex, there is nothing to do. */
|
||||
if (openfile->syntax == NULL || openfile->syntax->nmultis == 0)
|
||||
@@ -306,7 +303,8 @@ void check_the_multis(filestruct *line)
|
||||
alloc_multidata_if_needed(line);
|
||||
|
||||
astart = (regexec(ink->start, line->data, 1, &startmatch, 0) == 0);
|
||||
anend = (regexec(ink->end, line->data, 1, &endmatch, 0) == 0);
|
||||
afterstart = line->data + (astart ? startmatch.rm_eo : 0);
|
||||
anend = (regexec(ink->end, afterstart, 1, &endmatch, 0) == 0);
|
||||
|
||||
/* Check whether the multidata still matches the current situation. */
|
||||
if (line->multidata[ink->id] == CNONE ||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**************************************************************************
|
||||
* cut.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2018 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2014 Mark Majeres *
|
||||
* Copyright (C) 2016 Benno Schulenberg *
|
||||
* *
|
||||
|
||||
19
src/files.c
19
src/files.c
@@ -1,7 +1,7 @@
|
||||
/**************************************************************************
|
||||
* files.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2018 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2015-2017 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -345,6 +345,9 @@ int do_lockfile(const char *filename)
|
||||
pidstring = charalloc(11);
|
||||
sprintf (pidstring, "%u", (unsigned int)lockpid);
|
||||
|
||||
/* Display newlines in filenames as ^J. */
|
||||
as_an_at = FALSE;
|
||||
|
||||
/* TRANSLATORS: The second %s is the name of the user, the third that of the editor. */
|
||||
question = _("File %s is being edited (by %s with %s, PID %s); continue?");
|
||||
room = COLS - strlenpt(question) + 7 - strlenpt(lockuser) -
|
||||
@@ -359,7 +362,7 @@ int do_lockfile(const char *filename)
|
||||
strcat(postedname, fragment);
|
||||
free(fragment);
|
||||
} else
|
||||
postedname = mallocstrcpy(NULL, filename);
|
||||
postedname = display_string(filename, 0, room, FALSE);
|
||||
|
||||
/* Allow extra space for username (14), program name (8), PID (8),
|
||||
* and terminating \0 (1), minus the %s (2) for the file name. */
|
||||
@@ -435,7 +438,8 @@ bool open_buffer(const char *filename, bool undoable)
|
||||
if (strcmp(filename, "") != 0) {
|
||||
struct stat fileinfo;
|
||||
|
||||
if (stat(realname, &fileinfo) == 0 && !S_ISREG(fileinfo.st_mode)) {
|
||||
if (stat(realname, &fileinfo) == 0 && !(S_ISREG(fileinfo.st_mode) ||
|
||||
(ISSET(NOREAD_MODE) && S_ISFIFO(fileinfo.st_mode)))) {
|
||||
if (S_ISDIR(fileinfo.st_mode))
|
||||
statusline(ALERT, _("\"%s\" is a directory"), realname);
|
||||
else
|
||||
@@ -2192,12 +2196,17 @@ int do_writeout(bool exiting, bool withprompt)
|
||||
|
||||
if (name_exists) {
|
||||
char *question = _("File \"%s\" exists; OVERWRITE? ");
|
||||
char *name = display_string(answer, 0,
|
||||
COLS - strlenpt(question) + 1, FALSE);
|
||||
char *message = charalloc(strlen(question) +
|
||||
strlen(answer) + 1);
|
||||
sprintf(message, question, answer);
|
||||
strlen(name) + 1);
|
||||
|
||||
sprintf(message, question, name);
|
||||
|
||||
i = do_yesno_prompt(FALSE, message);
|
||||
|
||||
free(message);
|
||||
free(name);
|
||||
|
||||
if (i < 1)
|
||||
continue;
|
||||
|
||||
39
src/global.c
39
src/global.c
@@ -1,7 +1,7 @@
|
||||
/**************************************************************************
|
||||
* global.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2018 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2014-2017 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -233,8 +233,8 @@ regmatch_t regmatches[10];
|
||||
int hilite_attribute = A_REVERSE;
|
||||
/* The curses attribute we use to highlight something. */
|
||||
#ifdef ENABLE_COLOR
|
||||
char* specified_color_combo[] = {NULL};
|
||||
/* The color combinations as specified in the rcfile. */
|
||||
colortype* color_combo[] = {NULL};
|
||||
/* The color combinations for interface elements given in the rcfile. */
|
||||
#endif
|
||||
int interface_color_pair[] = {0};
|
||||
/* The processed color pairs for the interface elements. */
|
||||
@@ -379,16 +379,6 @@ void add_to_sclist(int menus, const char *scstring, const int keycode,
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Assign one function's shortcuts to another function. */
|
||||
void replace_scs_for(void (*oldfunc)(void), void (*newfunc)(void))
|
||||
{
|
||||
sc *s;
|
||||
|
||||
for (s = sclist; s != NULL; s = s->next)
|
||||
if (s->scfunc == oldfunc)
|
||||
s->scfunc = newfunc;
|
||||
}
|
||||
|
||||
/* Return the first shortcut in the list of shortcuts that
|
||||
* matches the given func in the given menu. */
|
||||
const sc *first_sc_for(int menu, void (*func)(void))
|
||||
@@ -633,8 +623,8 @@ void shortcut_init(void)
|
||||
const char *comment_gist =
|
||||
N_("Comment/uncomment the current line (or marked lines)");
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
const char *savefile_gist = N_("Save file without prompting");
|
||||
#ifndef NANO_TINY
|
||||
const char *findprev_gist = N_("Search next occurrence backward");
|
||||
const char *findnext_gist = N_("Search next occurrence forward");
|
||||
const char *recordmacro_gist = N_("Start/stop recording a macro");
|
||||
@@ -985,14 +975,13 @@ void shortcut_init(void)
|
||||
N_("Record"), WITHORSANS(recordmacro_gist), TOGETHER, VIEW);
|
||||
add_to_funcs(run_macro, MMAIN,
|
||||
N_("Run Macro"), WITHORSANS(runmacro_gist), BLANKAFTER, VIEW);
|
||||
|
||||
#endif
|
||||
add_to_funcs(do_search_backward, MMAIN,
|
||||
/* TRANSLATORS: This starts a backward search. */
|
||||
N_("Where Was"), WITHORSANS(wherewas_gist), BLANKAFTER, VIEW);
|
||||
|
||||
add_to_funcs(do_savefile, MMAIN,
|
||||
N_("Save"), WITHORSANS(savefile_gist), BLANKAFTER, NOVIEW);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_HISTORIES
|
||||
add_to_funcs(get_history_older_void, MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE,
|
||||
@@ -1364,10 +1353,17 @@ void shortcut_init(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
#if defined(ENABLE_COLOR) && defined(ENABLE_SPELLER)
|
||||
/* Assign one function's shortcuts to another function. */
|
||||
void replace_scs_for(void (*oldfunc)(void), void (*newfunc)(void))
|
||||
{
|
||||
for (sc *s = sclist; s != NULL; s = s->next)
|
||||
if (s->scfunc == oldfunc)
|
||||
s->scfunc = newfunc;
|
||||
}
|
||||
|
||||
void set_lint_or_format_shortcuts(void)
|
||||
{
|
||||
#ifdef ENABLE_SPELLER
|
||||
if (openfile->syntax->formatter) {
|
||||
replace_scs_for(do_spell, do_formatter);
|
||||
replace_scs_for(do_linter, do_formatter);
|
||||
@@ -1375,17 +1371,14 @@ void set_lint_or_format_shortcuts(void)
|
||||
replace_scs_for(do_spell, do_linter);
|
||||
replace_scs_for(do_formatter, do_linter);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void set_spell_shortcuts(void)
|
||||
{
|
||||
#ifdef ENABLE_SPELLER
|
||||
replace_scs_for(do_formatter, do_spell);
|
||||
replace_scs_for(do_linter, do_spell);
|
||||
#endif
|
||||
}
|
||||
#endif /* ENABLE_COLOR */
|
||||
#endif /* ENABLE_COLOR && ENABLE_SPELLER */
|
||||
|
||||
const subnfunc *sctofunc(const sc *s)
|
||||
{
|
||||
@@ -1471,10 +1464,8 @@ sc *strtosc(const char *input)
|
||||
s->scfunc = discard_buffer;
|
||||
else if (!strcasecmp(input, "writeout"))
|
||||
s->scfunc = do_writeout_void;
|
||||
#ifndef NANO_TINY
|
||||
else if (!strcasecmp(input, "savefile"))
|
||||
s->scfunc = do_savefile;
|
||||
#endif
|
||||
else if (!strcasecmp(input, "insert"))
|
||||
s->scfunc = do_insertfile_void;
|
||||
else if (!strcasecmp(input, "whereis"))
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**************************************************************************
|
||||
* help.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 2000-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2000-2011, 2013-2018 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2017 Rishabh Dave *
|
||||
* Copyright (C) 2014-2017 Benno Schulenberg *
|
||||
* *
|
||||
@@ -220,8 +220,8 @@ void do_help(void)
|
||||
#endif
|
||||
#ifdef ENABLE_MOUSE
|
||||
} else if (kbinput == KEY_MOUSE) {
|
||||
int dummy_x, dummy_y;
|
||||
get_mouseinput(&dummy_x, &dummy_y, TRUE);
|
||||
int dummy_row, dummy_col;
|
||||
get_mouseinput(&dummy_row, &dummy_col, TRUE);
|
||||
#endif
|
||||
} else if (func == do_exit) {
|
||||
/* Exit from the help viewer. */
|
||||
@@ -620,7 +620,7 @@ size_t help_line_len(const char *ptr)
|
||||
else if (wrap_location > 0)
|
||||
return wrap_location;
|
||||
else
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif /* ENABLE_HELP */
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**************************************************************************
|
||||
* history.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 2003-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2003-2011, 2013-2018 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2016-2017 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**************************************************************************
|
||||
* move.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2018 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2014-2017 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
|
||||
164
src/nano.c
164
src/nano.c
@@ -1,7 +1,7 @@
|
||||
/**************************************************************************
|
||||
* nano.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2018 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2014-2017 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -818,6 +818,10 @@ void usage(void)
|
||||
N_("Fix numeric keypad key confusion problem"));
|
||||
print_opt("-L", "--nonewlines",
|
||||
N_("Don't add newlines to the ends of files"));
|
||||
#ifdef ENABLED_WRAPORJUSTIFY
|
||||
print_opt("-M", "--trimblanks",
|
||||
N_("Trim tail spaces when hard-wrapping"));
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
print_opt("-N", "--noconvert",
|
||||
N_("Don't convert files from DOS/Mac format"));
|
||||
@@ -913,8 +917,8 @@ void version(void)
|
||||
#else
|
||||
printf(_(" GNU nano, version %s\n"), VERSION);
|
||||
#endif
|
||||
printf(" (C) 1999-2011, 2013-2017 Free Software Foundation, Inc.\n");
|
||||
printf(_(" (C) 2014-%s the contributors to nano\n"), "2017");
|
||||
printf(" (C) 1999-2011, 2013-2018 Free Software Foundation, Inc.\n");
|
||||
printf(_(" (C) 2014-%s the contributors to nano\n"), "2018");
|
||||
printf(_(" Email: nano@nano-editor.org Web: https://nano-editor.org/"));
|
||||
printf(_("\n Compiled options:"));
|
||||
|
||||
@@ -1556,6 +1560,60 @@ void unbound_key(int code)
|
||||
statusline(ALERT, _("Unbound key: %c"), code);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_MOUSE
|
||||
/* Handle a mouse click on the edit window or the shortcut list. */
|
||||
int do_mouse(void)
|
||||
{
|
||||
int click_row, click_col;
|
||||
int retval = get_mouseinput(&click_row, &click_col, TRUE);
|
||||
|
||||
/* If the click is wrong or already handled, we're done. */
|
||||
if (retval != 0)
|
||||
return retval;
|
||||
|
||||
/* If the click was in the edit window, put the cursor in that spot. */
|
||||
if (wmouse_trafo(edit, &click_row, &click_col, FALSE)) {
|
||||
filestruct *current_save = openfile->current;
|
||||
ssize_t row_count = click_row - openfile->current_y;
|
||||
size_t leftedge;
|
||||
#ifndef NANO_TINY
|
||||
size_t current_x_save = openfile->current_x;
|
||||
bool sameline = (click_row == openfile->current_y);
|
||||
/* Whether the click was on the row where the cursor is. */
|
||||
|
||||
if (ISSET(SOFTWRAP))
|
||||
leftedge = leftedge_for(xplustabs(), openfile->current);
|
||||
else
|
||||
#endif
|
||||
leftedge = get_page_start(xplustabs());
|
||||
|
||||
/* Move current up or down to the row that was clicked on. */
|
||||
if (row_count < 0)
|
||||
go_back_chunks(-row_count, &openfile->current, &leftedge);
|
||||
else
|
||||
go_forward_chunks(row_count, &openfile->current, &leftedge);
|
||||
|
||||
openfile->current_x = actual_x(openfile->current->data,
|
||||
actual_last_column(leftedge, click_col));
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Clicking where the cursor is toggles the mark, as does clicking
|
||||
* beyond the line length with the cursor at the end of the line. */
|
||||
if (sameline && openfile->current_x == current_x_save)
|
||||
do_mark();
|
||||
else
|
||||
#endif
|
||||
/* The cursor moved; clean the cutbuffer on the next cut. */
|
||||
cutbuffer_reset();
|
||||
|
||||
edit_redraw(current_save, CENTERING);
|
||||
}
|
||||
|
||||
/* No more handling is needed. */
|
||||
return 2;
|
||||
}
|
||||
#endif /* ENABLE_MOUSE */
|
||||
|
||||
/* Read in a keystroke. Act on the keystroke if it is a shortcut or a toggle;
|
||||
* otherwise, insert it into the edit buffer. If allow_funcs is FALSE, don't
|
||||
* do anything with the keystroke -- just return it. */
|
||||
@@ -1731,60 +1789,6 @@ int do_input(bool allow_funcs)
|
||||
return input;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_MOUSE
|
||||
/* Handle a mouse click on the edit window or the shortcut list. */
|
||||
int do_mouse(void)
|
||||
{
|
||||
int mouse_col, mouse_row;
|
||||
int retval = get_mouseinput(&mouse_col, &mouse_row, TRUE);
|
||||
|
||||
/* If the click is wrong or already handled, we're done. */
|
||||
if (retval != 0)
|
||||
return retval;
|
||||
|
||||
/* If the click was in the edit window, put the cursor in that spot. */
|
||||
if (wmouse_trafo(edit, &mouse_row, &mouse_col, FALSE)) {
|
||||
filestruct *current_save = openfile->current;
|
||||
ssize_t row_count = mouse_row - openfile->current_y;
|
||||
size_t leftedge;
|
||||
#ifndef NANO_TINY
|
||||
size_t current_x_save = openfile->current_x;
|
||||
bool sameline = (mouse_row == openfile->current_y);
|
||||
/* Whether the click was on the row where the cursor is. */
|
||||
|
||||
if (ISSET(SOFTWRAP))
|
||||
leftedge = leftedge_for(xplustabs(), openfile->current);
|
||||
else
|
||||
#endif
|
||||
leftedge = get_page_start(xplustabs());
|
||||
|
||||
/* Move current up or down to the row corresponding to mouse_row. */
|
||||
if (row_count < 0)
|
||||
go_back_chunks(-row_count, &openfile->current, &leftedge);
|
||||
else
|
||||
go_forward_chunks(row_count, &openfile->current, &leftedge);
|
||||
|
||||
openfile->current_x = actual_x(openfile->current->data,
|
||||
actual_last_column(leftedge, mouse_col));
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Clicking where the cursor is toggles the mark, as does clicking
|
||||
* beyond the line length with the cursor at the end of the line. */
|
||||
if (sameline && openfile->current_x == current_x_save)
|
||||
do_mark();
|
||||
else
|
||||
#endif
|
||||
/* The cursor moved; clean the cutbuffer on the next cut. */
|
||||
cutbuffer_reset();
|
||||
|
||||
edit_redraw(current_save, CENTERING);
|
||||
}
|
||||
|
||||
/* No more handling is needed. */
|
||||
return 2;
|
||||
}
|
||||
#endif /* ENABLE_MOUSE */
|
||||
|
||||
/* The user typed output_len multibyte characters. Add them to the edit
|
||||
* buffer, filtering out all ASCII control characters if allow_cntrls is
|
||||
* TRUE. */
|
||||
@@ -1916,6 +1920,9 @@ int main(int argc, char **argv)
|
||||
#endif
|
||||
{"rebindkeypad", 0, NULL, 'K'},
|
||||
{"nonewlines", 0, NULL, 'L'},
|
||||
#ifdef ENABLED_WRAPORJUSTIFY
|
||||
{"trimblanks", 0, NULL, 'M'},
|
||||
#endif
|
||||
{"morespace", 0, NULL, 'O'},
|
||||
#ifdef ENABLE_JUSTIFY
|
||||
{"quotestr", 1, NULL, 'Q'},
|
||||
@@ -1980,6 +1987,11 @@ int main(int argc, char **argv)
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
#ifdef __linux__
|
||||
/* Check whether we're running on a Linux console. */
|
||||
console = (getenv("DISPLAY") == NULL);
|
||||
#endif
|
||||
|
||||
/* Back up the terminal settings so that they can be restored. */
|
||||
tcgetattr(0, &oldterm);
|
||||
|
||||
@@ -2026,7 +2038,7 @@ int main(int argc, char **argv)
|
||||
|
||||
while ((optchr =
|
||||
getopt_long(argc, argv,
|
||||
"ABC:DEFGHIKLNOPQ:RST:UVWX:Y:abcdefghijklmno:pqr:s:tuvwxz$",
|
||||
"ABC:DEFGHIKLMNOPQ:RST:UVWX:Y:abcdefghijklmno:pqr:s:tuvwxz$",
|
||||
long_options, NULL)) != -1) {
|
||||
switch (optchr) {
|
||||
case 'b':
|
||||
@@ -2080,6 +2092,11 @@ int main(int argc, char **argv)
|
||||
case 'L':
|
||||
SET(NO_NEWLINES);
|
||||
break;
|
||||
#ifdef ENABLED_WRAPORJUSTIFY
|
||||
case 'M':
|
||||
SET(TRIM_BLANKS);
|
||||
break;
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
case 'N':
|
||||
SET(NO_CONVERT);
|
||||
@@ -2468,14 +2485,20 @@ int main(int argc, char **argv)
|
||||
if (initscr() == NULL)
|
||||
exit(1);
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
set_colorpairs();
|
||||
#else
|
||||
interface_color_pair[TITLE_BAR] = hilite_attribute;
|
||||
interface_color_pair[LINE_NUMBER] = hilite_attribute;
|
||||
interface_color_pair[SELECTED_TEXT] = hilite_attribute;
|
||||
interface_color_pair[STATUS_BAR] = hilite_attribute;
|
||||
interface_color_pair[KEY_COMBO] = hilite_attribute;
|
||||
interface_color_pair[FUNCTION_TAG] = A_NORMAL;
|
||||
#endif
|
||||
|
||||
/* Set up the terminal state. */
|
||||
terminal_init();
|
||||
|
||||
#ifdef __linux__
|
||||
/* Check whether we're running on a Linux console. */
|
||||
console = (getenv("DISPLAY") == NULL);
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Main: set up windows\n");
|
||||
#endif
|
||||
@@ -2494,17 +2517,6 @@ int main(int argc, char **argv)
|
||||
mouse_init();
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
set_colorpairs();
|
||||
#else
|
||||
interface_color_pair[TITLE_BAR] = hilite_attribute;
|
||||
interface_color_pair[LINE_NUMBER] = hilite_attribute;
|
||||
interface_color_pair[SELECTED_TEXT] = hilite_attribute;
|
||||
interface_color_pair[STATUS_BAR] = hilite_attribute;
|
||||
interface_color_pair[KEY_COMBO] = hilite_attribute;
|
||||
interface_color_pair[FUNCTION_TAG] = A_NORMAL;
|
||||
#endif
|
||||
|
||||
/* Ask ncurses for the key codes for Control+Left/Right/Up/Down. */
|
||||
controlleft = get_keycode("kLFT5", CONTROL_LEFT);
|
||||
controlright = get_keycode("kRIT5", CONTROL_RIGHT);
|
||||
@@ -2624,7 +2636,6 @@ int main(int argc, char **argv)
|
||||
refresh_needed = TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (currmenu != MMAIN)
|
||||
display_main_list();
|
||||
|
||||
@@ -2651,7 +2662,4 @@ int main(int argc, char **argv)
|
||||
/* Read in and interpret keystrokes. */
|
||||
do_input(TRUE);
|
||||
}
|
||||
|
||||
/* We should never get here. */
|
||||
assert(FALSE);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**************************************************************************
|
||||
* nano.h -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2018 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2014-2017 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
|
||||
57
src/prompt.c
57
src/prompt.c
@@ -1,7 +1,7 @@
|
||||
/**************************************************************************
|
||||
* prompt.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2018 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2016 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -28,6 +28,30 @@ static char *prompt = NULL;
|
||||
static size_t statusbar_x = HIGHEST_POSITIVE;
|
||||
/* The cursor position in answer. */
|
||||
|
||||
#ifdef ENABLE_MOUSE
|
||||
/* Handle a mouse click on the statusbar prompt or the shortcut list. */
|
||||
int do_statusbar_mouse(void)
|
||||
{
|
||||
int click_row, click_col;
|
||||
int retval = get_mouseinput(&click_row, &click_col, TRUE);
|
||||
|
||||
/* We can click on the statusbar window text to move the cursor. */
|
||||
if (retval == 0 && wmouse_trafo(bottomwin, &click_row, &click_col, FALSE)) {
|
||||
size_t start_col = strlenpt(prompt) + 2;
|
||||
|
||||
/* Move to where the click occurred. */
|
||||
if (click_row == 0 && click_col >= start_col) {
|
||||
statusbar_x = actual_x(answer,
|
||||
get_statusbar_page_start(start_col, start_col +
|
||||
statusbar_xplustabs()) + click_col - start_col);
|
||||
update_the_statusbar();
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Read in a keystroke, interpret it if it is a shortcut or toggle, and
|
||||
* return it. Set ran_func to TRUE if we ran a function associated with
|
||||
* a shortcut key, and set finished to TRUE if we're done after running
|
||||
@@ -165,32 +189,6 @@ int do_statusbar_input(bool *ran_func, bool *finished)
|
||||
return input;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_MOUSE
|
||||
/* Handle a mouse click on the statusbar prompt or the shortcut list. */
|
||||
int do_statusbar_mouse(void)
|
||||
{
|
||||
int mouse_x, mouse_y;
|
||||
int retval = get_mouseinput(&mouse_x, &mouse_y, TRUE);
|
||||
|
||||
/* We can click on the statusbar window text to move the cursor. */
|
||||
if (retval == 0 && wmouse_trafo(bottomwin, &mouse_y, &mouse_x, FALSE)) {
|
||||
size_t start_col;
|
||||
|
||||
start_col = strlenpt(prompt) + 2;
|
||||
|
||||
/* Move to where the click occurred. */
|
||||
if (mouse_x >= start_col && mouse_y == 0) {
|
||||
statusbar_x = actual_x(answer,
|
||||
get_statusbar_page_start(start_col, start_col +
|
||||
statusbar_xplustabs()) + mouse_x - start_col);
|
||||
update_the_statusbar();
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* The user typed input_len multibyte characters. Add them to the answer,
|
||||
* filtering out ASCII control characters if filtering is TRUE. */
|
||||
void do_statusbar_output(int *the_input, size_t input_len,
|
||||
@@ -669,7 +667,6 @@ int do_prompt(bool allow_tabs, bool allow_files,
|
||||
int do_yesno_prompt(bool all, const char *msg)
|
||||
{
|
||||
int response = -2, width = 16;
|
||||
char *message = display_string(msg, 0, COLS, FALSE);
|
||||
|
||||
/* TRANSLATORS: For the next three strings, if possible, specify
|
||||
* the single-byte letters for both your language and English.
|
||||
@@ -717,7 +714,7 @@ int do_yesno_prompt(bool all, const char *msg)
|
||||
/* Color the statusbar over its full width and display the question. */
|
||||
wattron(bottomwin, interface_color_pair[TITLE_BAR]);
|
||||
blank_statusbar();
|
||||
mvwaddnstr(bottomwin, 0, 0, message, actual_x(message, COLS - 1));
|
||||
mvwaddnstr(bottomwin, 0, 0, msg, actual_x(msg, COLS - 1));
|
||||
wattroff(bottomwin, interface_color_pair[TITLE_BAR]);
|
||||
wnoutrefresh(bottomwin);
|
||||
|
||||
@@ -755,7 +752,5 @@ int do_yesno_prompt(bool all, const char *msg)
|
||||
#endif /* ENABLE_MOUSE */
|
||||
}
|
||||
|
||||
free(message);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
13
src/proto.h
13
src/proto.h
@@ -1,7 +1,7 @@
|
||||
/**************************************************************************
|
||||
* proto.h -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2018 Free Software Foundation, Inc. *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published *
|
||||
@@ -172,7 +172,7 @@ extern regmatch_t regmatches[10];
|
||||
|
||||
extern int hilite_attribute;
|
||||
#ifdef ENABLE_COLOR
|
||||
extern char* specified_color_combo[NUMBER_OF_ELEMENTS];
|
||||
extern colortype *color_combo[NUMBER_OF_ELEMENTS];
|
||||
#endif
|
||||
extern int interface_color_pair[NUMBER_OF_ELEMENTS];
|
||||
|
||||
@@ -442,15 +442,9 @@ void enable_flow_control(void);
|
||||
void terminal_init(void);
|
||||
void unbound_key(int code);
|
||||
int do_input(bool allow_funcs);
|
||||
#ifdef ENABLE_MOUSE
|
||||
int do_mouse(void);
|
||||
#endif
|
||||
void do_output(char *output, size_t output_len, bool allow_cntrls);
|
||||
|
||||
/* Most functions in prompt.c. */
|
||||
#ifdef ENABLE_MOUSE
|
||||
int do_statusbar_mouse(void);
|
||||
#endif
|
||||
void do_statusbar_output(int *the_input, size_t input_len, bool filtering);
|
||||
void do_statusbar_home(void);
|
||||
void do_statusbar_end(void);
|
||||
@@ -624,7 +618,6 @@ void dump_filestruct(const filestruct *inptr);
|
||||
/* Most functions in winio.c. */
|
||||
void record_macro(void);
|
||||
void run_macro(void);
|
||||
void get_key_buffer(WINDOW *win);
|
||||
size_t get_key_buffer_len(void);
|
||||
void unget_kbinput(int kbinput, bool metakey);
|
||||
int get_kbinput(WINDOW *win, bool showcursor);
|
||||
@@ -636,7 +629,7 @@ int get_control_kbinput(int kbinput);
|
||||
int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
|
||||
int *parse_verbatim_kbinput(WINDOW *win, size_t *count);
|
||||
#ifdef ENABLE_MOUSE
|
||||
int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts);
|
||||
int get_mouseinput(int *mouse_row, int *mouse_col, bool allow_shortcuts);
|
||||
#endif
|
||||
const sc *get_shortcut(int *kbinput);
|
||||
void blank_row(WINDOW *win, int y, int x, int n);
|
||||
|
||||
105
src/rcfile.c
105
src/rcfile.c
@@ -1,7 +1,7 @@
|
||||
/**************************************************************************
|
||||
* rcfile.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 2001-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2001-2011, 2013-2018 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2014 Mike Frysinger *
|
||||
* Copyright (C) 2014-2017 Benno Schulenberg *
|
||||
* *
|
||||
@@ -188,30 +188,25 @@ char *parse_argument(char *ptr)
|
||||
const char *ptr_save = ptr;
|
||||
char *last_quote = NULL;
|
||||
|
||||
assert(ptr != NULL);
|
||||
|
||||
if (*ptr != '"')
|
||||
return parse_next_word(ptr);
|
||||
|
||||
do {
|
||||
ptr++;
|
||||
if (*ptr == '"')
|
||||
while (*ptr != '\0') {
|
||||
if (*++ptr == '"')
|
||||
last_quote = ptr;
|
||||
} while (*ptr != '\0');
|
||||
}
|
||||
|
||||
if (last_quote == NULL) {
|
||||
if (*ptr == '\0')
|
||||
ptr = NULL;
|
||||
else
|
||||
*ptr++ = '\0';
|
||||
rcfile_error(N_("Argument '%s' has an unterminated \""), ptr_save);
|
||||
} else {
|
||||
*last_quote = '\0';
|
||||
ptr = last_quote + 1;
|
||||
return NULL;
|
||||
}
|
||||
if (ptr != NULL)
|
||||
while (isblank((unsigned char)*ptr))
|
||||
ptr++;
|
||||
|
||||
*last_quote = '\0';
|
||||
ptr = last_quote + 1;
|
||||
|
||||
while (isblank((unsigned char)*ptr))
|
||||
ptr++;
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@@ -220,19 +215,14 @@ char *parse_argument(char *ptr)
|
||||
* null-terminate it, and return a pointer to the /next/ word. */
|
||||
char *parse_next_regex(char *ptr)
|
||||
{
|
||||
assert(ptr != NULL);
|
||||
|
||||
/* Continue until the end of line, or until a " followed by a
|
||||
* blank character or the end of line. */
|
||||
while (*ptr != '\0' && (*ptr != '"' ||
|
||||
(*(ptr + 1) != '\0' && !isblank((unsigned char)ptr[1]))))
|
||||
ptr++;
|
||||
|
||||
assert(*ptr == '"' || *ptr == '\0');
|
||||
|
||||
if (*ptr == '\0') {
|
||||
rcfile_error(
|
||||
N_("Regex strings must begin and end with a \" character"));
|
||||
rcfile_error(N_("Regex strings must begin and end with a \" character"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -275,8 +265,6 @@ void parse_syntax(char *ptr)
|
||||
|
||||
opensyntax = FALSE;
|
||||
|
||||
assert(ptr != NULL);
|
||||
|
||||
/* Check that the syntax name is not empty. */
|
||||
if (*ptr == '\0' || (*ptr == '"' &&
|
||||
(*(ptr + 1) == '\0' || *(ptr + 1) == '"'))) {
|
||||
@@ -329,8 +317,7 @@ void parse_syntax(char *ptr)
|
||||
|
||||
/* The default syntax should have no associated extensions. */
|
||||
if (strcmp(live_syntax->name, "default") == 0 && *ptr != '\0') {
|
||||
rcfile_error(
|
||||
N_("The \"default\" syntax does not accept extensions"));
|
||||
rcfile_error(N_("The \"default\" syntax does not accept extensions"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -365,8 +352,6 @@ void parse_binding(char *ptr, bool dobind)
|
||||
sc *s, *newsc = NULL;
|
||||
int menu;
|
||||
|
||||
assert(ptr != NULL);
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Starting the rebinding code...\n");
|
||||
#endif
|
||||
@@ -591,7 +576,8 @@ short color_to_short(const char *colorname, bool *bright)
|
||||
if (strncasecmp(colorname, "bright", 6) == 0) {
|
||||
*bright = TRUE;
|
||||
colorname += 6;
|
||||
}
|
||||
} else
|
||||
*bright = FALSE;
|
||||
|
||||
if (strcasecmp(colorname, "green") == 0)
|
||||
return COLOR_GREEN;
|
||||
@@ -610,11 +596,7 @@ short color_to_short(const char *colorname, bool *bright)
|
||||
else if (strcasecmp(colorname, "black") == 0)
|
||||
return COLOR_BLACK;
|
||||
|
||||
rcfile_error(N_("Color \"%s\" not understood.\n"
|
||||
"Valid colors are \"green\", \"red\", \"blue\",\n"
|
||||
"\"white\", \"yellow\", \"cyan\", \"magenta\" and\n"
|
||||
"\"black\", with the optional prefix \"bright\"\n"
|
||||
"for foreground colors."), colorname);
|
||||
rcfile_error(N_("Color \"%s\" not understood"), colorname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -624,13 +606,12 @@ short color_to_short(const char *colorname, bool *bright)
|
||||
void parse_colors(char *ptr, int rex_flags)
|
||||
{
|
||||
short fg, bg;
|
||||
bool bright = FALSE;
|
||||
bool bright;
|
||||
char *item;
|
||||
|
||||
if (!opensyntax) {
|
||||
rcfile_error(
|
||||
N_("A '%s' command requires a preceding 'syntax' command"),
|
||||
"color");
|
||||
rcfile_error(N_("A '%s' command requires a preceding 'syntax' command"),
|
||||
"color");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -665,8 +646,7 @@ void parse_colors(char *ptr, int rex_flags)
|
||||
}
|
||||
|
||||
if (*ptr != '"') {
|
||||
rcfile_error(
|
||||
N_("Regex strings must begin and end with a \" character"));
|
||||
rcfile_error(N_("Regex strings must begin and end with a \" character"));
|
||||
ptr = parse_next_regex(ptr);
|
||||
continue;
|
||||
}
|
||||
@@ -774,6 +754,21 @@ bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Parse the argument of an interface color option. */
|
||||
colortype *parse_interface_color(char *combostr)
|
||||
{
|
||||
colortype *trio = nmalloc(sizeof(colortype));
|
||||
|
||||
if (parse_color_names(combostr, &trio->fg, &trio->bg, &trio->bright)) {
|
||||
free(combostr);
|
||||
return trio;
|
||||
} else {
|
||||
free(combostr);
|
||||
free(trio);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Read regex strings enclosed in double quotes from the line pointed at
|
||||
* by ptr, and store them quoteless in the passed storage place. */
|
||||
void grab_and_store(const char *kind, char *ptr, regexlisttype **storage)
|
||||
@@ -810,8 +805,7 @@ void grab_and_store(const char *kind, char *ptr, regexlisttype **storage)
|
||||
regexlisttype *newthing;
|
||||
|
||||
if (*ptr != '"') {
|
||||
rcfile_error(
|
||||
N_("Regex strings must begin and end with a \" character"));
|
||||
rcfile_error(N_("Regex strings must begin and end with a \" character"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -841,8 +835,6 @@ void grab_and_store(const char *kind, char *ptr, regexlisttype **storage)
|
||||
/* Gather and store the string after a comment/linter/formatter command. */
|
||||
void pick_up_name(const char *kind, char *ptr, char **storage)
|
||||
{
|
||||
assert(ptr != NULL);
|
||||
|
||||
if (!opensyntax) {
|
||||
rcfile_error(
|
||||
N_("A '%s' command requires a preceding 'syntax' command"), kind);
|
||||
@@ -856,17 +848,17 @@ void pick_up_name(const char *kind, char *ptr, char **storage)
|
||||
|
||||
/* If the argument starts with a quote, find the terminating quote. */
|
||||
if (*ptr == '"') {
|
||||
char *look = ++ptr;
|
||||
|
||||
look += strlen(ptr);
|
||||
char *look = ptr + strlen(ptr);
|
||||
|
||||
while (*look != '"') {
|
||||
if (--look < ptr) {
|
||||
if (--look == ptr) {
|
||||
rcfile_error(N_("Argument of '%s' lacks closing \""), kind);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
*look = '\0';
|
||||
ptr++;
|
||||
}
|
||||
|
||||
*storage = mallocstrcpy(*storage, ptr);
|
||||
@@ -1086,17 +1078,17 @@ void parse_rcfile(FILE *rcstream, bool syntax_only)
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
if (strcasecmp(rcopts[i].name, "titlecolor") == 0)
|
||||
specified_color_combo[TITLE_BAR] = option;
|
||||
color_combo[TITLE_BAR] = parse_interface_color(option);
|
||||
else if (strcasecmp(rcopts[i].name, "numbercolor") == 0)
|
||||
specified_color_combo[LINE_NUMBER] = option;
|
||||
color_combo[LINE_NUMBER] = parse_interface_color(option);
|
||||
else if (strcasecmp(rcopts[i].name, "selectedcolor") == 0)
|
||||
specified_color_combo[SELECTED_TEXT] = option;
|
||||
color_combo[SELECTED_TEXT] = parse_interface_color(option);
|
||||
else if (strcasecmp(rcopts[i].name, "statuscolor") == 0)
|
||||
specified_color_combo[STATUS_BAR] = option;
|
||||
color_combo[STATUS_BAR] = parse_interface_color(option);
|
||||
else if (strcasecmp(rcopts[i].name, "keycolor") == 0)
|
||||
specified_color_combo[KEY_COMBO] = option;
|
||||
color_combo[KEY_COMBO] = parse_interface_color(option);
|
||||
else if (strcasecmp(rcopts[i].name, "functioncolor") == 0)
|
||||
specified_color_combo[FUNCTION_TAG] = option;
|
||||
color_combo[FUNCTION_TAG] = parse_interface_color(option);
|
||||
else
|
||||
#endif
|
||||
#ifdef ENABLE_OPERATINGDIR
|
||||
@@ -1175,8 +1167,7 @@ void parse_rcfile(FILE *rcstream, bool syntax_only)
|
||||
tabsize = -1;
|
||||
}
|
||||
free(option);
|
||||
} else
|
||||
assert(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
|
||||
28
src/search.c
28
src/search.c
@@ -1,7 +1,7 @@
|
||||
/**************************************************************************
|
||||
* search.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2018 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2015-2017 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -250,24 +250,19 @@ int findnextstr(const char *needle, bool whole_word_only, int modus,
|
||||
statusbar(_("Searching..."));
|
||||
}
|
||||
|
||||
/* Search for the needle in the current line. */
|
||||
if (!skipone)
|
||||
found = strstrwrapper(line->data, needle, from);
|
||||
|
||||
/* Ignore the initial match at the starting position: continue
|
||||
* searching from the next character, or invalidate the match. */
|
||||
if (skipone || (!whole_word_only && !came_full_circle &&
|
||||
found == begin->data + begin_x)) {
|
||||
/* When starting a new search, skip the first character, then
|
||||
* (in either case) search for the needle in the current line. */
|
||||
if (skipone) {
|
||||
skipone = FALSE;
|
||||
if (ISSET(BACKWARDS_SEARCH) && from != line->data) {
|
||||
from = line->data + move_mbleft(line->data, from - line->data);
|
||||
continue;
|
||||
found = strstrwrapper(line->data, needle, from);
|
||||
} else if (!ISSET(BACKWARDS_SEARCH) && *from != '\0') {
|
||||
from += move_mbright(from, 0);
|
||||
continue;
|
||||
found = strstrwrapper(line->data, needle, from);
|
||||
}
|
||||
found = NULL;
|
||||
}
|
||||
} else
|
||||
found = strstrwrapper(line->data, needle, from);
|
||||
|
||||
if (found != NULL) {
|
||||
/* When doing a regex search, compute the length of the match. */
|
||||
@@ -333,7 +328,8 @@ int findnextstr(const char *needle, bool whole_word_only, int modus,
|
||||
enable_waiting();
|
||||
|
||||
/* Ensure that the found occurrence is not beyond the starting x. */
|
||||
if (came_full_circle && ((!ISSET(BACKWARDS_SEARCH) && found_x > begin_x) ||
|
||||
if (came_full_circle && ((!ISSET(BACKWARDS_SEARCH) && (found_x > begin_x ||
|
||||
(modus == REPLACING && found_x == begin_x))) ||
|
||||
(ISSET(BACKWARDS_SEARCH) && found_x < begin_x)))
|
||||
return 0;
|
||||
|
||||
@@ -436,7 +432,7 @@ void go_looking(void)
|
||||
|
||||
came_full_circle = FALSE;
|
||||
|
||||
didfind = findnextstr(last_search, FALSE, JUSTFIND, NULL, FALSE,
|
||||
didfind = findnextstr(last_search, FALSE, JUSTFIND, NULL, TRUE,
|
||||
openfile->current, openfile->current_x);
|
||||
|
||||
/* If we found something, and we're back at the exact same spot
|
||||
@@ -546,7 +542,7 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
|
||||
ssize_t numreplaced = -1;
|
||||
size_t match_len;
|
||||
bool replaceall = FALSE;
|
||||
bool skipone = FALSE;
|
||||
bool skipone = ISSET(BACKWARDS_SEARCH);
|
||||
int modus = REPLACING;
|
||||
#ifndef NANO_TINY
|
||||
filestruct *was_mark = openfile->mark;
|
||||
|
||||
15
src/text.c
15
src/text.c
@@ -1,7 +1,7 @@
|
||||
/**************************************************************************
|
||||
* text.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2018 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2014-2015 Mark Majeres *
|
||||
* Copyright (C) 2016 Mike Scalora *
|
||||
* Copyright (C) 2016 Sumedh Pendurkar *
|
||||
@@ -1618,12 +1618,13 @@ bool do_wrap(filestruct *line)
|
||||
|
||||
/* When requested, snip trailing blanks off the wrapped line. */
|
||||
if (ISSET(TRIM_BLANKS)) {
|
||||
size_t cur_x = move_mbleft(line->data, wrap_loc);
|
||||
size_t tail_x = move_mbleft(line->data, wrap_loc);
|
||||
size_t typed_x = move_mbleft(line->data, old_x);
|
||||
|
||||
while (is_blank_mbchar(line->data + cur_x)) {
|
||||
openfile->current_x = cur_x;
|
||||
while (tail_x != typed_x && is_blank_mbchar(line->data + tail_x)) {
|
||||
openfile->current_x = tail_x;
|
||||
do_delete();
|
||||
cur_x = move_mbleft(line->data, cur_x);
|
||||
tail_x = move_mbleft(line->data, tail_x);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2422,9 +2423,11 @@ void do_justify(bool full_justify)
|
||||
if (first_par_line != NULL)
|
||||
last_par_line = openfile->current;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Let a justification cancel a soft mark. */
|
||||
if (openfile->mark && openfile->kind_of_mark == SOFTMARK)
|
||||
openfile->mark = NULL;
|
||||
#endif
|
||||
|
||||
edit_refresh();
|
||||
|
||||
@@ -3035,7 +3038,9 @@ void do_linter(void)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
openfile->mark = NULL;
|
||||
#endif
|
||||
edit_refresh();
|
||||
|
||||
if (openfile->modified) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**************************************************************************
|
||||
* utils.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2018 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2016-2017 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
|
||||
380
src/winio.c
380
src/winio.c
@@ -1,8 +1,8 @@
|
||||
/**************************************************************************
|
||||
* winio.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2014-2017 Benno Schulenberg *
|
||||
* Copyright (C) 1999-2011, 2013-2018 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2014-2018 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published *
|
||||
@@ -35,12 +35,13 @@
|
||||
#endif
|
||||
|
||||
static int *key_buffer = NULL;
|
||||
/* The keystroke buffer, containing all the keystrokes we
|
||||
* haven't handled yet at a given point. */
|
||||
/* A buffer for the keystrokes that haven't been handled yet. */
|
||||
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 int digit_count = 0;
|
||||
/* How many digits of a three-digit character code we've eaten. */
|
||||
static bool waiting_mode = TRUE;
|
||||
/* Whether getting a character will wait for a key to be pressed. */
|
||||
static int statusblank = 0;
|
||||
@@ -106,8 +107,7 @@ void run_macro(void)
|
||||
return;
|
||||
}
|
||||
|
||||
free(key_buffer);
|
||||
key_buffer = (int *)nmalloc(macro_length * sizeof(int));
|
||||
key_buffer = (int *)nrealloc(key_buffer, macro_length * sizeof(int));
|
||||
key_buffer_len = macro_length;
|
||||
|
||||
for (i = 0; i < macro_length; i++)
|
||||
@@ -169,15 +169,11 @@ void run_macro(void)
|
||||
|
||||
/* Read in a sequence of keystrokes from the given window and save them
|
||||
* in the keystroke buffer. */
|
||||
void get_key_buffer(WINDOW *win)
|
||||
void read_keys_from(WINDOW *win)
|
||||
{
|
||||
int input = ERR;
|
||||
size_t errcount = 0;
|
||||
|
||||
/* If the keystroke buffer isn't empty, get out. */
|
||||
if (key_buffer != NULL)
|
||||
return;
|
||||
|
||||
/* Before reading the first keycode, display any pending screen updates. */
|
||||
doupdate();
|
||||
|
||||
@@ -214,9 +210,9 @@ void get_key_buffer(WINDOW *win)
|
||||
curs_set(0);
|
||||
|
||||
/* Initiate the keystroke buffer, and save the keycode in it. */
|
||||
key_buffer_len++;
|
||||
key_buffer = (int *)nmalloc(sizeof(int));
|
||||
key_buffer = (int *)nrealloc(key_buffer, sizeof(int));
|
||||
key_buffer[0] = input;
|
||||
key_buffer_len = 1;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* If we got a SIGWINCH, get out as the win argument is no longer valid. */
|
||||
@@ -262,42 +258,32 @@ size_t get_key_buffer_len(void)
|
||||
return key_buffer_len;
|
||||
}
|
||||
|
||||
/* Add the keycodes in input to the keystroke buffer. */
|
||||
void unget_input(int *input, size_t input_len)
|
||||
/* Add the given keycode to the front of the keystroke buffer. */
|
||||
void put_back(int keycode)
|
||||
{
|
||||
/* If input is empty, get out. */
|
||||
if (input_len == 0)
|
||||
/* If the keystroke buffer is at maximum capacity, don't add anything. */
|
||||
if (key_buffer_len + 1 < key_buffer_len)
|
||||
return;
|
||||
|
||||
/* If adding input would put the keystroke buffer beyond maximum capacity,
|
||||
* only add enough of input to put it at maximum capacity. */
|
||||
if (key_buffer_len + input_len < key_buffer_len)
|
||||
input_len = (size_t)-1 - key_buffer_len;
|
||||
/* Extend the keystroke buffer to make room for the extra keycode. */
|
||||
key_buffer = (int *)nrealloc(key_buffer, ++key_buffer_len * sizeof(int));
|
||||
|
||||
/* Extend the keystroke buffer to make room for the extra keycodes. */
|
||||
key_buffer_len += input_len;
|
||||
key_buffer = (int *)nrealloc(key_buffer, key_buffer_len * sizeof(int));
|
||||
/* If the keystroke buffer wasn't empty before, move all the
|
||||
* existing content one step further away. */
|
||||
if (key_buffer_len > 1)
|
||||
memmove(key_buffer + 1, key_buffer, (key_buffer_len - 1) * sizeof(int));
|
||||
|
||||
/* If the keystroke buffer wasn't empty before, move its beginning
|
||||
* forward far enough so that we can add input to its beginning. */
|
||||
if (key_buffer_len > input_len)
|
||||
memmove(key_buffer + input_len, key_buffer,
|
||||
(key_buffer_len - input_len) * sizeof(int));
|
||||
|
||||
/* Copy input to the beginning of the keystroke buffer. */
|
||||
memcpy(key_buffer, input, input_len * sizeof(int));
|
||||
*key_buffer = keycode;
|
||||
}
|
||||
|
||||
/* Put the character given in kbinput back into the input stream. If it
|
||||
* is a Meta key, also insert an Escape character in front of it. */
|
||||
void unget_kbinput(int kbinput, bool metakey)
|
||||
{
|
||||
unget_input(&kbinput, 1);
|
||||
put_back(kbinput);
|
||||
|
||||
if (metakey) {
|
||||
kbinput = ESC_CODE;
|
||||
unget_input(&kbinput, 1);
|
||||
}
|
||||
if (metakey)
|
||||
put_back(ESC_CODE);
|
||||
}
|
||||
|
||||
/* Try to read input_len codes from the keystroke buffer. If the
|
||||
@@ -309,7 +295,7 @@ int *get_input(WINDOW *win, size_t input_len)
|
||||
int *input;
|
||||
|
||||
if (key_buffer_len == 0 && win != NULL)
|
||||
get_key_buffer(win);
|
||||
read_keys_from(win);
|
||||
|
||||
if (key_buffer_len == 0)
|
||||
return NULL;
|
||||
@@ -323,17 +309,10 @@ int *get_input(WINDOW *win, size_t input_len)
|
||||
memcpy(input, key_buffer, input_len * sizeof(int));
|
||||
key_buffer_len -= input_len;
|
||||
|
||||
/* If the keystroke buffer is now empty, mark it as such. */
|
||||
if (key_buffer_len == 0) {
|
||||
free(key_buffer);
|
||||
key_buffer = NULL;
|
||||
} else {
|
||||
/* Trim from the buffer the codes that were copied. */
|
||||
/* If the buffer still contains keystrokes, move them to the front. */
|
||||
if (key_buffer_len > 0)
|
||||
memmove(key_buffer, key_buffer + input_len, key_buffer_len *
|
||||
sizeof(int));
|
||||
key_buffer = (int *)nrealloc(key_buffer, key_buffer_len *
|
||||
sizeof(int));
|
||||
}
|
||||
|
||||
return input;
|
||||
}
|
||||
@@ -364,7 +343,7 @@ int get_kbinput(WINDOW *win, bool showcursor)
|
||||
* the function keys (F1-F16), and the numeric keypad with NumLock off. */
|
||||
int parse_kbinput(WINDOW *win)
|
||||
{
|
||||
static int escapes = 0, byte_digits = 0;
|
||||
static int escapes = 0;
|
||||
static bool double_esc = FALSE;
|
||||
int *kbinput, keycode, retval = ERR;
|
||||
|
||||
@@ -384,8 +363,8 @@ int parse_kbinput(WINDOW *win)
|
||||
free(kbinput);
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "before parsing: keycode = %d, escapes = %d, byte_digits = %d\n",
|
||||
keycode, escapes, byte_digits);
|
||||
fprintf(stderr, "before parsing: keycode = %d, escapes = %d, digit_count = %d\n",
|
||||
keycode, escapes, digit_count);
|
||||
#endif
|
||||
|
||||
if (keycode == ERR)
|
||||
@@ -409,6 +388,8 @@ int parse_kbinput(WINDOW *win)
|
||||
case 1:
|
||||
if (keycode >= 0x80)
|
||||
retval = keycode;
|
||||
else if (keycode == TAB_CODE)
|
||||
retval = SHIFT_TAB;
|
||||
else if ((keycode != 'O' && keycode != 'o' && keycode != '[') ||
|
||||
key_buffer_len == 0 || *key_buffer == ESC_CODE) {
|
||||
/* One escape followed by a single non-escape:
|
||||
@@ -457,45 +438,35 @@ int parse_kbinput(WINDOW *win)
|
||||
double_esc = FALSE;
|
||||
escapes = 0;
|
||||
} else if (key_buffer_len == 0) {
|
||||
if (('0' <= keycode && keycode <= '2' &&
|
||||
byte_digits == 0) || ('0' <= keycode &&
|
||||
keycode <= '9' && byte_digits > 0)) {
|
||||
if ('0' <= keycode && ((keycode <= '2' && digit_count == 0) ||
|
||||
(keycode <= '9' && digit_count > 0))) {
|
||||
/* Two escapes followed by one or more decimal
|
||||
* digits, and there aren't any other codes
|
||||
* waiting: byte sequence mode. If the range
|
||||
* of the byte sequence is limited to 2XX (the
|
||||
* first digit is between '0' and '2' and the
|
||||
* others between '0' and '9', interpret it. */
|
||||
int byte;
|
||||
|
||||
byte_digits++;
|
||||
byte = get_byte_kbinput(keycode);
|
||||
* waiting: byte sequence mode. If the range of the
|
||||
* byte sequence is limited to 2XX, interpret it. */
|
||||
int byte = get_byte_kbinput(keycode);
|
||||
|
||||
/* If the decimal byte value is complete, convert it and
|
||||
* put the obtained byte(s) back into the input buffer. */
|
||||
if (byte != ERR) {
|
||||
char *byte_mb;
|
||||
int byte_mb_len, *seq, i;
|
||||
char *multibyte;
|
||||
int count, onebyte, i;
|
||||
|
||||
/* Convert the decimal code to one or two bytes. */
|
||||
byte_mb = make_mbchar((long)byte, &byte_mb_len);
|
||||
|
||||
seq = (int *)nmalloc(byte_mb_len * sizeof(int));
|
||||
|
||||
for (i = 0; i < byte_mb_len; i++)
|
||||
seq[i] = (unsigned char)byte_mb[i];
|
||||
multibyte = make_mbchar((long)byte, &count);
|
||||
|
||||
/* Insert the byte(s) into the input buffer. */
|
||||
unget_input(seq, byte_mb_len);
|
||||
for (i = count; i > 0 ; i--) {
|
||||
onebyte = (unsigned char)multibyte[i - 1];
|
||||
put_back(onebyte);
|
||||
}
|
||||
|
||||
free(byte_mb);
|
||||
free(seq);
|
||||
free(multibyte);
|
||||
|
||||
byte_digits = 0;
|
||||
escapes = 0;
|
||||
}
|
||||
} else {
|
||||
if (byte_digits == 0)
|
||||
if (digit_count == 0)
|
||||
/* Two escapes followed by a non-decimal
|
||||
* digit (or a decimal digit that would
|
||||
* create a byte sequence greater than 2XX)
|
||||
@@ -506,7 +477,7 @@ int parse_kbinput(WINDOW *win)
|
||||
/* An invalid digit in the middle of a byte
|
||||
* sequence: reset the byte sequence counter
|
||||
* and save the code we got as the result. */
|
||||
byte_digits = 0;
|
||||
digit_count = 0;
|
||||
retval = keycode;
|
||||
}
|
||||
escapes = 0;
|
||||
@@ -654,21 +625,18 @@ int parse_kbinput(WINDOW *win)
|
||||
#endif
|
||||
|
||||
switch (retval) {
|
||||
#ifdef KEY_SLEFT
|
||||
/* Slang doesn't support KEY_SLEFT. */
|
||||
#ifdef KEY_SLEFT /* Slang doesn't support KEY_SLEFT. */
|
||||
case KEY_SLEFT:
|
||||
shift_held = TRUE;
|
||||
return KEY_LEFT;
|
||||
#endif
|
||||
#ifdef KEY_SRIGHT
|
||||
/* Slang doesn't support KEY_SRIGHT. */
|
||||
#ifdef KEY_SRIGHT /* Slang doesn't support KEY_SRIGHT. */
|
||||
case KEY_SRIGHT:
|
||||
shift_held = TRUE;
|
||||
return KEY_RIGHT;
|
||||
#endif
|
||||
#ifdef KEY_SR
|
||||
#ifdef KEY_SUP
|
||||
/* ncurses and Slang don't support KEY_SUP. */
|
||||
#ifdef KEY_SUP /* ncurses and Slang don't support KEY_SUP. */
|
||||
case KEY_SUP:
|
||||
#endif
|
||||
case KEY_SR: /* Scroll backward, on Xfce4-terminal. */
|
||||
@@ -676,30 +644,31 @@ int parse_kbinput(WINDOW *win)
|
||||
return KEY_UP;
|
||||
#endif
|
||||
#ifdef KEY_SF
|
||||
#ifdef KEY_SDOWN
|
||||
/* ncurses and Slang don't support KEY_SDOWN. */
|
||||
#ifdef KEY_SDOWN /* ncurses and Slang don't support KEY_SDOWN. */
|
||||
case KEY_SDOWN:
|
||||
#endif
|
||||
case KEY_SF: /* Scroll forward, on Xfce4-terminal. */
|
||||
shift_held = TRUE;
|
||||
return KEY_DOWN;
|
||||
#endif
|
||||
#ifdef KEY_SHOME
|
||||
/* HP-UX 10-11 and Slang don't support KEY_SHOME. */
|
||||
#ifdef KEY_SHOME /* HP-UX 10-11 and Slang don't support KEY_SHOME. */
|
||||
case KEY_SHOME:
|
||||
#endif
|
||||
case SHIFT_HOME:
|
||||
shift_held = TRUE;
|
||||
case KEY_A1: /* Home (7) on keypad with NumLock off. */
|
||||
return KEY_HOME;
|
||||
#ifdef KEY_SEND
|
||||
/* HP-UX 10-11 and Slang don't support KEY_SEND. */
|
||||
#ifdef KEY_SEND /* HP-UX 10-11 and Slang don't support KEY_SEND. */
|
||||
case KEY_SEND:
|
||||
#endif
|
||||
case SHIFT_END:
|
||||
shift_held = TRUE;
|
||||
case KEY_C1: /* End (1) on keypad with NumLock off. */
|
||||
return KEY_END;
|
||||
#ifdef KEY_EOL
|
||||
case KEY_EOL: /* Ctrl+End on rxvt-unicode. */
|
||||
return CONTROL_END;
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
#ifdef KEY_SPREVIOUS
|
||||
case KEY_SPREVIOUS:
|
||||
@@ -718,8 +687,7 @@ int parse_kbinput(WINDOW *win)
|
||||
#endif
|
||||
case KEY_C3: /* PageDown (3) on keypad with NumLock off. */
|
||||
return KEY_NPAGE;
|
||||
#ifdef KEY_SDC
|
||||
/* Slang doesn't support KEY_SDC. */
|
||||
#ifdef KEY_SDC /* Slang doesn't support KEY_SDC. */
|
||||
case KEY_SDC:
|
||||
#endif
|
||||
case DEL_CODE:
|
||||
@@ -727,41 +695,33 @@ int parse_kbinput(WINDOW *win)
|
||||
return the_code_for(do_delete, KEY_DC);
|
||||
else
|
||||
return KEY_BACKSPACE;
|
||||
#ifdef KEY_SIC
|
||||
/* Slang doesn't support KEY_SIC. */
|
||||
#ifdef KEY_SIC /* Slang doesn't support KEY_SIC. */
|
||||
case KEY_SIC:
|
||||
return the_code_for(do_insertfile_void, KEY_IC);
|
||||
#endif
|
||||
#ifdef KEY_SBEG
|
||||
/* Slang doesn't support KEY_SBEG. */
|
||||
#ifdef KEY_SBEG /* Slang doesn't support KEY_SBEG. */
|
||||
case KEY_SBEG:
|
||||
#endif
|
||||
#ifdef KEY_BEG
|
||||
/* Slang doesn't support KEY_BEG. */
|
||||
#ifdef KEY_BEG /* Slang doesn't support KEY_BEG. */
|
||||
case KEY_BEG:
|
||||
#endif
|
||||
case KEY_B2: /* Center (5) on keypad with NumLock off. */
|
||||
return ERR;
|
||||
#ifdef KEY_CANCEL
|
||||
#ifdef KEY_SCANCEL
|
||||
/* Slang doesn't support KEY_SCANCEL. */
|
||||
#ifdef KEY_CANCEL /* Slang doesn't support KEY_CANCEL. */
|
||||
#ifdef KEY_SCANCEL /* Slang doesn't support KEY_SCANCEL. */
|
||||
case KEY_SCANCEL:
|
||||
#endif
|
||||
/* Slang doesn't support KEY_CANCEL. */
|
||||
case KEY_CANCEL:
|
||||
return the_code_for(do_cancel, 0x03);
|
||||
#endif
|
||||
#ifdef KEY_SUSPEND
|
||||
#ifdef KEY_SSUSPEND
|
||||
/* Slang doesn't support KEY_SSUSPEND. */
|
||||
#ifdef KEY_SUSPEND /* Slang doesn't support KEY_SUSPEND. */
|
||||
#ifdef KEY_SSUSPEND /* Slang doesn't support KEY_SSUSPEND. */
|
||||
case KEY_SSUSPEND:
|
||||
#endif
|
||||
/* Slang doesn't support KEY_SUSPEND. */
|
||||
case KEY_SUSPEND:
|
||||
return the_code_for(do_suspend_void, KEY_SUSPEND);
|
||||
#endif
|
||||
#ifdef KEY_BTAB
|
||||
/* Slang doesn't support KEY_BTAB. */
|
||||
#ifdef KEY_BTAB /* Slang doesn't support KEY_BTAB. */
|
||||
case KEY_BTAB:
|
||||
return SHIFT_TAB;
|
||||
#endif
|
||||
@@ -774,8 +734,7 @@ int parse_kbinput(WINDOW *win)
|
||||
case KEY_ALT_R:
|
||||
return ERR;
|
||||
#endif
|
||||
#ifdef KEY_RESIZE
|
||||
/* Slang and SunOS 5.7-5.9 don't support KEY_RESIZE. */
|
||||
#ifdef KEY_RESIZE /* Slang and SunOS 5.7-5.9 don't support KEY_RESIZE. */
|
||||
case KEY_RESIZE:
|
||||
#endif
|
||||
#if defined(USE_SLANG) && defined(ENABLE_UTF8)
|
||||
@@ -792,15 +751,17 @@ int parse_kbinput(WINDOW *win)
|
||||
* keypad values, into their corresponding key values. These sequences
|
||||
* are generated when the keypad doesn't support the needed keys.
|
||||
* Assume that Escape has already been read in. */
|
||||
int convert_sequence(const int *seq, size_t seq_len)
|
||||
int convert_sequence(const int *seq, size_t length, int *consumed)
|
||||
{
|
||||
if (seq_len > 1) {
|
||||
if (length > 1) {
|
||||
*consumed = 2;
|
||||
switch (seq[0]) {
|
||||
case 'O':
|
||||
switch (seq[1]) {
|
||||
case '1':
|
||||
if (seq_len > 4 && seq[2] == ';') {
|
||||
|
||||
if (length > 4 && seq[2] == ';') {
|
||||
/* <-<-<-<-<-<-<- */
|
||||
*consumed = 5;
|
||||
switch (seq[3]) {
|
||||
case '2':
|
||||
switch (seq[4]) {
|
||||
@@ -833,11 +794,12 @@ int convert_sequence(const int *seq, size_t seq_len)
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* ->->->->->->-> */
|
||||
}
|
||||
break;
|
||||
case '2':
|
||||
if (seq_len >= 3) {
|
||||
if (length > 2) {
|
||||
*consumed = 3;
|
||||
switch (seq[2]) {
|
||||
case 'P': /* Esc O 2 P == F13 on xterm. */
|
||||
return KEY_F(13);
|
||||
@@ -851,7 +813,8 @@ int convert_sequence(const int *seq, size_t seq_len)
|
||||
}
|
||||
break;
|
||||
case '5':
|
||||
if (seq_len >= 3) {
|
||||
if (length > 2) {
|
||||
*consumed = 3;
|
||||
switch (seq[2]) {
|
||||
case 'A': /* Esc O 5 A == Ctrl-Up on Haiku. */
|
||||
return CONTROL_UP;
|
||||
@@ -863,6 +826,7 @@ int convert_sequence(const int *seq, size_t seq_len)
|
||||
return CONTROL_LEFT;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'A': /* Esc O A == Up on VT100/VT320/xterm. */
|
||||
case 'B': /* Esc O B == Down on VT100/VT320/xterm. */
|
||||
case 'C': /* Esc O C == Right on VT100/VT320/xterm. */
|
||||
@@ -962,9 +926,15 @@ int convert_sequence(const int *seq, size_t seq_len)
|
||||
}
|
||||
break;
|
||||
case '[':
|
||||
if (seq[1] < '9')
|
||||
*consumed = 3;
|
||||
switch (seq[1]) {
|
||||
case '1':
|
||||
if (seq_len > 3 && seq[3] == '~') {
|
||||
if (length > 2 && seq[2] == '~')
|
||||
/* Esc [ 1 ~ == Home on VT320/Linux console. */
|
||||
return KEY_HOME;
|
||||
else if (length > 3 && seq[3] == '~') {
|
||||
*consumed = 4;
|
||||
switch (seq[2]) {
|
||||
case '1': /* Esc [ 1 1 ~ == F1 on rxvt/Eterm. */
|
||||
return KEY_F(1);
|
||||
@@ -984,8 +954,9 @@ int convert_sequence(const int *seq, size_t seq_len)
|
||||
case '9': /* Esc [ 1 9 ~ == F8 on the same. */
|
||||
return KEY_F(8);
|
||||
}
|
||||
} else if (seq_len > 4 && seq[2] == ';') {
|
||||
|
||||
} else if (length > 4 && seq[2] == ';') {
|
||||
/* <-<-<-<-<-<-<- */
|
||||
*consumed = 5;
|
||||
switch (seq[3]) {
|
||||
case '2':
|
||||
switch (seq[4]) {
|
||||
@@ -995,6 +966,12 @@ int convert_sequence(const int *seq, size_t seq_len)
|
||||
case 'D': /* Esc [ 1 ; 2 D == Shift-Left on xterm. */
|
||||
shift_held = TRUE;
|
||||
return arrow_from_abcd(seq[4]);
|
||||
#ifndef NANO_TINY
|
||||
case 'F': /* Esc [ 1 ; 2 F == Shift-End on xterm. */
|
||||
return SHIFT_END;
|
||||
case 'H': /* Esc [ 1 ; 2 H == Shift-Home on xterm. */
|
||||
return SHIFT_HOME;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
#ifndef NANO_TINY
|
||||
@@ -1061,13 +1038,12 @@ int convert_sequence(const int *seq, size_t seq_len)
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
} else if (seq_len > 2 && seq[2] == '~')
|
||||
/* Esc [ 1 ~ == Home on VT320/Linux console. */
|
||||
return KEY_HOME;
|
||||
/* ->->->->->->-> */
|
||||
}
|
||||
break;
|
||||
case '2':
|
||||
if (seq_len > 3 && seq[3] == '~') {
|
||||
if (length > 3 && seq[3] == '~') {
|
||||
*consumed = 4;
|
||||
switch (seq[2]) {
|
||||
case '0': /* Esc [ 2 0 ~ == F9 on VT220/VT320/
|
||||
* Linux console/xterm/rxvt/Eterm. */
|
||||
@@ -1088,45 +1064,59 @@ int convert_sequence(const int *seq, size_t seq_len)
|
||||
case '9': /* Esc [ 2 9 ~ == F16 on the same. */
|
||||
return KEY_F(16);
|
||||
}
|
||||
} else if (seq_len > 2 && seq[2] == '~')
|
||||
} else if (length > 2 && seq[2] == '~')
|
||||
/* Esc [ 2 ~ == Insert on VT220/VT320/
|
||||
* Linux console/xterm/Terminal. */
|
||||
return KEY_IC;
|
||||
break;
|
||||
case '3': /* Esc [ 3 ~ == Delete on VT220/VT320/
|
||||
* Linux console/xterm/Terminal. */
|
||||
if (seq_len > 2 && seq[2] == '~')
|
||||
if (length > 2 && seq[2] == '~')
|
||||
return KEY_DC;
|
||||
break;
|
||||
case '4': /* Esc [ 4 ~ == End on VT220/VT320/
|
||||
* Linux console/xterm. */
|
||||
if (seq_len > 2 && seq[2] == '~')
|
||||
if (length > 2 && seq[2] == '~')
|
||||
return KEY_END;
|
||||
break;
|
||||
case '5': /* Esc [ 5 ~ == PageUp on VT220/VT320/
|
||||
* Linux console/xterm/Terminal;
|
||||
* Esc [ 5 ^ == PageUp on Eterm. */
|
||||
if (seq_len > 2 && (seq[2] == '~' || seq[2] == '^'))
|
||||
if (length > 2 && (seq[2] == '~' || seq[2] == '^'))
|
||||
return KEY_PPAGE;
|
||||
#ifndef NANO_TINY
|
||||
else if (length > 4 && seq[2] == ';' &&
|
||||
seq[3] == '2' && seq[4] == '~') {
|
||||
*consumed = 5;
|
||||
return shiftaltup;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case '6': /* Esc [ 6 ~ == PageDown on VT220/VT320/
|
||||
* Linux console/xterm/Terminal;
|
||||
* Esc [ 6 ^ == PageDown on Eterm. */
|
||||
if (seq_len > 2 && (seq[2] == '~' || seq[2] == '^'))
|
||||
if (length > 2 && (seq[2] == '~' || seq[2] == '^'))
|
||||
return KEY_NPAGE;
|
||||
#ifndef NANO_TINY
|
||||
else if (length > 4 && seq[2] == ';' &&
|
||||
seq[3] == '2' && seq[4] == '~') {
|
||||
*consumed = 5;
|
||||
return shiftaltdown;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case '7': /* Esc [ 7 ~ == Home on Eterm/rxvt;
|
||||
* Esc [ 7 $ == Shift-Home on Eterm/rxvt;
|
||||
* Esc [ 7 ^ == Control-Home on Eterm/rxvt;
|
||||
* Esc [ 7 @ == Shift-Control-Home on same. */
|
||||
if (seq_len > 2 && seq[2] == '~')
|
||||
if (length > 2 && seq[2] == '~')
|
||||
return KEY_HOME;
|
||||
else if (seq_len > 2 && seq[2] == '$')
|
||||
else if (length > 2 && seq[2] == '$')
|
||||
return SHIFT_HOME;
|
||||
else if (seq_len > 2 && seq[2] == '^')
|
||||
else if (length > 2 && seq[2] == '^')
|
||||
return CONTROL_HOME;
|
||||
#ifndef NANO_TINY
|
||||
else if (seq_len > 2 && seq[2] == '@')
|
||||
else if (length > 2 && seq[2] == '@')
|
||||
return shiftcontrolhome;
|
||||
#endif
|
||||
break;
|
||||
@@ -1134,14 +1124,14 @@ int convert_sequence(const int *seq, size_t seq_len)
|
||||
* Esc [ 8 $ == Shift-End on Eterm/rxvt;
|
||||
* Esc [ 8 ^ == Control-End on Eterm/rxvt;
|
||||
* Esc [ 8 @ == Shift-Control-End on same. */
|
||||
if (seq_len > 2 && seq[2] == '~')
|
||||
if (length > 2 && seq[2] == '~')
|
||||
return KEY_END;
|
||||
else if (seq_len > 2 && seq[2] == '$')
|
||||
else if (length > 2 && seq[2] == '$')
|
||||
return SHIFT_END;
|
||||
else if (seq_len > 2 && seq[2] == '^')
|
||||
else if (length > 2 && seq[2] == '^')
|
||||
return CONTROL_END;
|
||||
#ifndef NANO_TINY
|
||||
else if (seq_len > 2 && seq[2] == '@')
|
||||
else if (length > 2 && seq[2] == '@')
|
||||
return shiftcontrolend;
|
||||
#endif
|
||||
break;
|
||||
@@ -1174,7 +1164,8 @@ int convert_sequence(const int *seq, size_t seq_len)
|
||||
case 'N': /* Esc [ N == F2 on FreeBSD console. */
|
||||
return KEY_F(2);
|
||||
case 'O':
|
||||
if (seq_len > 2) {
|
||||
if (length > 2) {
|
||||
*consumed = 3;
|
||||
switch (seq[2]) {
|
||||
case 'P': /* Esc [ O P == F1 on xterm. */
|
||||
return KEY_F(1);
|
||||
@@ -1219,7 +1210,8 @@ int convert_sequence(const int *seq, size_t seq_len)
|
||||
shift_held = TRUE;
|
||||
return arrow_from_abcd(seq[1]);
|
||||
case '[':
|
||||
if (seq_len > 2 ) {
|
||||
if (length > 2) {
|
||||
*consumed = 3;
|
||||
switch (seq[2]) {
|
||||
case 'A': /* Esc [ [ A == F1 on Linux console. */
|
||||
return KEY_F(1);
|
||||
@@ -1265,15 +1257,20 @@ int arrow_from_abcd(int kbinput)
|
||||
* isn't empty, and that the initial escape has already been read in. */
|
||||
int parse_escape_sequence(WINDOW *win, int kbinput)
|
||||
{
|
||||
int retval, *sequence, length;
|
||||
int retval, *sequence, length, consumed;
|
||||
|
||||
/* Put back the non-escape character, get the complete escape
|
||||
* sequence, translate the sequence into its corresponding key
|
||||
* value, and save that as the result. */
|
||||
unget_input(&kbinput, 1);
|
||||
length = key_buffer_len;
|
||||
/* Put back the non-escape code, then grab at most five integers
|
||||
* (the longest possible escape sequence) from the keybuffer and
|
||||
* translate the sequence into its corresponding keycode. */
|
||||
put_back(kbinput);
|
||||
length = (key_buffer_len < 5 ? key_buffer_len : 5);
|
||||
sequence = get_input(NULL, length);
|
||||
retval = convert_sequence(sequence, length);
|
||||
retval = convert_sequence(sequence, length, &consumed);
|
||||
|
||||
/* If not all grabbed integers were consumed, put the leftovers back. */
|
||||
for (int i = length - 1; i >= consumed; i--)
|
||||
put_back(sequence[i]);
|
||||
|
||||
free(sequence);
|
||||
|
||||
/* If we got an unrecognized escape sequence, notify the user. */
|
||||
@@ -1292,74 +1289,52 @@ int parse_escape_sequence(WINDOW *win, int kbinput)
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* Translate a byte sequence: turn a three-digit decimal number (from
|
||||
* 000 to 255) into its corresponding byte value. */
|
||||
/* Turn a three-digit decimal number (from 000 to 255) into its corresponding
|
||||
* byte value. */
|
||||
int get_byte_kbinput(int kbinput)
|
||||
{
|
||||
static int byte_digits = 0, byte = 0;
|
||||
static int byte = 0;
|
||||
int retval = ERR;
|
||||
|
||||
/* Increment the byte digit counter. */
|
||||
byte_digits++;
|
||||
|
||||
switch (byte_digits) {
|
||||
/* Check that the given digit is within the allowed range for its position.
|
||||
* If yes, store it. If no, return the digit (or character) itself. */
|
||||
switch (++digit_count) {
|
||||
case 1:
|
||||
/* First digit: This must be from zero to two. Put it in
|
||||
* the 100's position of the byte sequence holder. */
|
||||
/* The first digit (the 100's position) must be from zero to two. */
|
||||
if ('0' <= kbinput && kbinput <= '2')
|
||||
byte = (kbinput - '0') * 100;
|
||||
else
|
||||
/* This isn't the start of a byte sequence. Return this
|
||||
* character as the result. */
|
||||
retval = kbinput;
|
||||
break;
|
||||
case 2:
|
||||
/* Second digit: This must be from zero to five if the first
|
||||
* was two, and may be any decimal value if the first was
|
||||
* zero or one. Put it in the 10's position of the byte
|
||||
* sequence holder. */
|
||||
if (('0' <= kbinput && kbinput <= '5') || (byte < 200 &&
|
||||
'6' <= kbinput && kbinput <= '9'))
|
||||
/* The second digit (the 10's position) must be from zero to five
|
||||
* if the first was two, and may be any decimal value otherwise. */
|
||||
if ((byte < 200 && '0' <= kbinput && kbinput <= '9') ||
|
||||
('0' <= kbinput && kbinput <= '5'))
|
||||
byte += (kbinput - '0') * 10;
|
||||
else
|
||||
/* This isn't the second digit of a byte sequence.
|
||||
* Return this character as the result. */
|
||||
retval = kbinput;
|
||||
break;
|
||||
case 3:
|
||||
/* Third digit: This must be from zero to five if the first
|
||||
* was two and the second was five, and may be any decimal
|
||||
* value otherwise. Put it in the 1's position of the byte
|
||||
* sequence holder. */
|
||||
if (('0' <= kbinput && kbinput <= '5') || (byte < 250 &&
|
||||
'6' <= kbinput && kbinput <= '9')) {
|
||||
/* The third digit (the 1's position) must be from zero to five
|
||||
* if the first was two and the second was five, and may be any
|
||||
* decimal value otherwise. */
|
||||
if ((byte < 250 && '0' <= kbinput && kbinput <= '9') ||
|
||||
('0' <= kbinput && kbinput <= '5')) {
|
||||
byte += kbinput - '0';
|
||||
/* The byte sequence is complete. */
|
||||
retval = byte;
|
||||
} else
|
||||
/* This isn't the third digit of a byte sequence.
|
||||
* Return this character as the result. */
|
||||
retval = kbinput;
|
||||
break;
|
||||
default:
|
||||
/* If there are more than three digits, return this
|
||||
* character as the result. (Maybe we should produce an
|
||||
* error instead?) */
|
||||
retval = kbinput;
|
||||
break;
|
||||
}
|
||||
|
||||
/* If we have a result, reset the byte digit counter and the byte
|
||||
* sequence holder. */
|
||||
/* If we have a result, reset the counter and the byte holder. */
|
||||
if (retval != ERR) {
|
||||
byte_digits = 0;
|
||||
digit_count = 0;
|
||||
byte = 0;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "get_byte_kbinput(): kbinput = %d, byte_digits = %d, byte = %d, retval = %d\n", kbinput, byte_digits, byte, retval);
|
||||
#endif
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -1553,7 +1528,7 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *count)
|
||||
|
||||
/* If the first code isn't the digit 0 nor 1, put it back. */
|
||||
if (unicode != ERR)
|
||||
unget_input(kbinput, 1);
|
||||
put_back(*kbinput);
|
||||
/* Otherwise, continue reading in digits until we have a complete
|
||||
* Unicode value, and put back the corresponding byte(s). */
|
||||
else {
|
||||
@@ -1575,7 +1550,7 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *count)
|
||||
/* Insert the multibyte sequence into the input buffer. */
|
||||
for (i = *count; i > 0 ; i--) {
|
||||
onebyte = (unsigned char)multibyte[i - 1];
|
||||
unget_input(&onebyte, 1);
|
||||
put_back(onebyte);
|
||||
}
|
||||
|
||||
free(multibyte);
|
||||
@@ -1583,7 +1558,7 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *count)
|
||||
} else
|
||||
#endif /* ENABLE_UTF8 */
|
||||
/* Put back the first code. */
|
||||
unget_input(kbinput, 1);
|
||||
put_back(*kbinput);
|
||||
|
||||
free(kbinput);
|
||||
|
||||
@@ -1599,26 +1574,20 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *count)
|
||||
/* Handle any mouse event that may have occurred. We currently handle
|
||||
* releases/clicks of the first mouse button. If allow_shortcuts is
|
||||
* TRUE, releasing/clicking on a visible shortcut will put back the
|
||||
* keystroke associated with that shortcut. If NCURSES_MOUSE_VERSION is
|
||||
* at least 2, we also currently handle presses of the fourth mouse
|
||||
* button (upward rolls of the mouse wheel) by putting back the
|
||||
* keystrokes to move up, and presses of the fifth mouse button
|
||||
* (downward rolls of the mouse wheel) by putting back the keystrokes to
|
||||
* move down. We also store the coordinates of a mouse event that needs
|
||||
* to be handled in mouse_x and mouse_y, relative to the entire screen.
|
||||
* Return -1 on error, 0 if the mouse event needs to be handled, 1 if
|
||||
* it's been handled by putting back keystrokes that need to be handled.
|
||||
* or 2 if it's been ignored. Assume that KEY_MOUSE has already been
|
||||
* read in. */
|
||||
int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts)
|
||||
* keystroke associated with that shortcut. If ncurses supports them,
|
||||
* we also handle presses of the fourth mouse button (upward rolls of
|
||||
* the mouse wheel) by putting back keystrokes to move up, and presses
|
||||
* of the fifth mouse button (downward rolls of the mouse wheel) by
|
||||
* putting back keystrokes to move down. We also store the coordinates
|
||||
* of a mouse event that needs further handling in mouse_x and mouse_y.
|
||||
* Return -1 on error, 0 if the mouse event needs to be handled, 1 if it's
|
||||
* been handled by putting back keystrokes, or 2 if it's been ignored. */
|
||||
int get_mouseinput(int *mouse_y, int *mouse_x, bool allow_shortcuts)
|
||||
{
|
||||
MEVENT mevent;
|
||||
bool in_bottomwin;
|
||||
subnfunc *f;
|
||||
|
||||
*mouse_x = -1;
|
||||
*mouse_y = -1;
|
||||
|
||||
/* First, get the actual mouse event. */
|
||||
if (getmouse(&mevent) == ERR)
|
||||
return -1;
|
||||
@@ -1631,7 +1600,7 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts)
|
||||
|
||||
/* Handle releases/clicks of the first mouse button. */
|
||||
if (mevent.bstate & (BUTTON1_RELEASED | BUTTON1_CLICKED)) {
|
||||
/* If we're allowing shortcuts, the current shortcut list is
|
||||
/* If we're allowing shortcuts, and the current shortcut list is
|
||||
* being displayed on the last two lines of the screen, and the
|
||||
* first mouse button was released on/clicked inside it, we need
|
||||
* to figure out which shortcut was released on/clicked and put
|
||||
@@ -3332,6 +3301,7 @@ void total_refresh(void)
|
||||
#endif
|
||||
if (currmenu != MBROWSER && currmenu != MWHEREISFILE && currmenu != MGOTODIR)
|
||||
edit_refresh();
|
||||
wipe_statusbar();
|
||||
bottombars(currmenu);
|
||||
}
|
||||
|
||||
@@ -3339,7 +3309,7 @@ void total_refresh(void)
|
||||
* portion of the window. */
|
||||
void display_main_list(void)
|
||||
{
|
||||
#ifdef ENABLE_COLOR
|
||||
#if defined(ENABLE_COLOR) && defined(ENABLE_SPELLER)
|
||||
if (openfile->syntax &&
|
||||
(openfile->syntax->formatter || openfile->syntax->linter))
|
||||
set_lint_or_format_shortcuts();
|
||||
@@ -3572,7 +3542,7 @@ void do_credits(void)
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"(C) 2017",
|
||||
"(C) 2018",
|
||||
"Free Software Foundation, Inc.",
|
||||
"",
|
||||
"",
|
||||
|
||||
@@ -24,9 +24,9 @@ color brightcyan "\<(package|import)\>"
|
||||
color brightcyan "//[[:space:]]*\+build[[:space:]]+(([a-zA-Z_0-9]+[[:space:]]*)+,[[:space:]]*)*[a-zA-Z_0-9]+"
|
||||
|
||||
# Literals.
|
||||
color red "\<[0-9]+(\.[0-9]*)?([Ee][+-]?[0-9]+)?i?\>"
|
||||
color red "\B\.[0-9]+([Ee][+-]?[0-9]+)?i?\>"
|
||||
color red "\<(0[0-7]*|[1-9][0-9]*|0[xX][0-9a-fA-F]+)\>"
|
||||
color red "\<0([0-7]*|[xX][0-9a-fA-F]+)\>"
|
||||
color red "(\<0+|\B)\.[0-9]+([Ee][+-]?[0-9]+)?i?\>"
|
||||
color red "\<[1-9][0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?i?\>"
|
||||
|
||||
# Strings and characters; slightly fuzzy.
|
||||
color red "\<(true|false|nil|iota|_)\>"
|
||||
|
||||
@@ -20,7 +20,7 @@ color brightyellow "\<(_G|_VERSION|assert|collectgarbage|dofile|error|getfenv|ge
|
||||
|
||||
# Standard library
|
||||
color brightyellow "\<coroutine\.(create|isyieldable|resume|running|status|wrap|yield)\>"
|
||||
color brightyellow "\<debug\.(debug|(get|set)(fenv|hook|info|local|metatable|(up|user)value)|getregistry|traceback|upvalue(id|join))\>"
|
||||
color brightyellow "\<debug\.(debug|(get|set)(fenv|hook|local|metatable|(up|user)value)|getinfo|getregistry|traceback|upvalue(id|join))\>"
|
||||
color brightyellow "\<io\.(close|flush|input|lines|output|p?open|read|tmpfile|type|write|std(in|out|err))\>"
|
||||
color brightyellow "\<math\.(abs|acos|asin|atan2?|ceil|cosh?|deg|exp|floor|fmod|frexp|huge|ldexp|log10|log)\>"
|
||||
color brightyellow "\<math\.((max|min)(integer)?|modf?|pi|pow|rad|random(seed)?|sinh?|sqrt|tan|tointeger|type|ult)\>"
|
||||
|
||||
@@ -5,7 +5,7 @@ syntax "nanohelp"
|
||||
|
||||
# Key combos:
|
||||
color cyan "\^[]4-8A-Z^\_◀▶▲▼]" "[◀▶▲▼]" "(\^|M-)Space" "\<M-." "\<F1?[0-9]"
|
||||
color cyan "\<(Tab|Enter|Ins|Del|Bsp|Up|Down|Left|Right|Home|End|PgUp|PgDn)\>"
|
||||
color cyan "\<(Tab|Sh-Tab|Enter|Ins|Del|Bsp|Up|Down|Left|Right|Home|End|PgUp|PgDn)\>"
|
||||
|
||||
# Quoted indicators:
|
||||
color brightred "'(\^|M-)'"
|
||||
|
||||
Reference in New Issue
Block a user