Compare commits

..

64 Commits
v4.4 ... v4.5

Author SHA1 Message Date
Benno Schulenberg
72b13adeff po: update translations and regenerate POT file and PO files 2019-10-04 12:11:14 +02:00
Benno Schulenberg
481178428b oops: fix typo in Changelog 2019-10-04 12:00:09 +02:00
Benno Schulenberg
9a2ef3a542 bump version numbers and add a news item for the 4.5 release 2019-10-04 11:31:29 +02:00
Benno Schulenberg
b480e7fc9c tweaks: remove some timing code that has served its purpose 2019-10-03 19:00:50 +02:00
Benno Schulenberg
3e33d1eba6 tweaks: rewrap a line, reshuffle a declaration, and improve some comments 2019-10-03 17:22:55 +02:00
Benno Schulenberg
cdb9b04980 docs: add two examples of the 'tabgives' command to the sample nanorc 2019-10-03 16:41:10 +02:00
Benno Schulenberg
31ff7ead73 tweaks: move a function to before its callers and next to its kind
Also, improve the indentation of two random lines.
2019-10-03 11:24:01 +02:00
Benno Schulenberg
5398d986ef tweaks: speed up determining the width of plain ASCII characters 2019-10-03 11:09:21 +02:00
Benno Schulenberg
b02dccc51f tweaks: elide a function from a non-UTF8 build
In a non-UTF8 build, mbwidth() returns always 1, so it is pointless
to call that function and compare its result to zero then.

Also, don't bother special-casing the function for a non-UTF8 locale.
2019-10-03 10:48:10 +02:00
Benno Schulenberg
3158133edd tweaks: rename three variables, for contrast and more sense 2019-10-03 10:12:30 +02:00
Benno Schulenberg
acf50ae26d tweaks: improve a handful of comments, and reduce the needed padding
Reshuffle a few struct elements so they will require less padding.
2019-10-02 19:33:03 +02:00
Benno Schulenberg
01b840890d tweaks: rename another type, again to better fit the general pattern 2019-10-02 19:32:41 +02:00
Benno Schulenberg
9bd60e7d5d tweaks: frob a few comments 2019-10-02 17:46:20 +02:00
Benno Schulenberg
c5e46101b1 tweaks: reshuffle some lines, to elide an unneeded assignment 2019-10-02 17:39:45 +02:00
Benno Schulenberg
53b77cb4c6 tweaks: rename another type, to also better fit the general pattern 2019-10-02 17:18:51 +02:00
Benno Schulenberg
cc4ce8d83b tweaks: rename a type, to better fit the general pattern 2019-10-02 17:09:22 +02:00
Benno Schulenberg
23c8ef70aa tweaks: reshuffle some lines, to have the same order as elsewhere 2019-10-02 15:20:49 +02:00
Benno Schulenberg
2a4d338d97 tweaks: reshuffle a fragment, to group some toggles together 2019-10-02 15:07:04 +02:00
Benno Schulenberg
9c202198a3 tweaks: simplify a calculation, as done elsewhere 2019-10-01 15:03:40 +02:00
Benno Schulenberg
c8dc67717b tweaks: mark as 'const' a parameter that takes fixed strings [coverity] 2019-10-01 15:02:08 +02:00
Benno Schulenberg
4df2f81295 tweaks: avoid recomputing a maximum value every time round the loop 2019-10-01 13:28:50 +02:00
Benno Schulenberg
78def852d1 mouse: make the clickable width of menu items more consistent
When there are fewer than four menu items, act as if there are four:
make their clickable width half the width of the screen.

Until now, when there were two menu items, their clickable width would
be the full width of the screen, which was overwide.  But when there
was just one menu item, its clickable width would suddenly be as small
as when the menu had the maximum number of items (12 for an 80-column
screen).  This was odd.

Also, slightly simplify another computation.
2019-10-01 12:46:31 +02:00
Benno Schulenberg
a4933873c9 tweaks: avoid leaking memory when finding an invalid string [coverity] 2019-09-30 19:42:27 +02:00
Benno Schulenberg
1861052234 tweaks: avoid a comparison between signed and unsigned [coverity] 2019-09-30 19:30:54 +02:00
Benno Schulenberg
2307b31887 tweaks: use 'void' in prototypes of parameterless functions [coverity] 2019-09-30 19:06:25 +02:00
Benno Schulenberg
108a3b0b41 tweaks: sort two keywords strictly alphabetically 2019-09-29 15:11:15 +02:00
Benno Schulenberg
e0d9b7a8af tweaks: add a translator hint, and correct two others 2019-09-29 15:08:57 +02:00
Benno Schulenberg
b3ace4d8f6 tweaks: don't burden all menus with something meant for the WriteOut menu
The first_sc_for() function is somewhat costly, so avoid calling it
when it is not necessary.

Most menus have either so many entries that unbinding some keys does
not reduce the number of shown entries, or they have so few entries
that each entry already has space enough and will not profit from
having more room available.  But the WriteOut menu is an edge case.
Most translators don't use --tempfile and translate the key tags for
the WriteOut menu making use of all 17 positions that are available
for each of them.  This makes that when --tempfile is used, some of
those tags get truncated.  This is not so bad, because --tempfile is
normally not used.  But when it isn't used (when the discardbuffer
function isn't bound), the WriteOut menu should make full use of the
available width to avoid truncating any translated tags.
2019-09-29 13:27:03 +02:00
Dirkjan Ochtman
e9d6ceab0b syntax: rust: add the words reserved in 2018, and remove unreserved ones
See https://doc.rust-lang.org/reference/keywords.html,
and https://rust-lang.github.io/rfcs/2421-unreservations-2018.html.

Signed-off-by: Dirkjan Ochtman <dirkjan@ochtman.nl>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2019-09-28 13:29:23 +02:00
Benno Schulenberg
5103bfe6b8 bindings: add a dedicated keycode for <Tab> for when a region is marked
In this way the keycode cannot be unbound from the 'indent' function,
so pressing <Tab> on a marked region will always indent the region.

This fixes https://savannah.gnu.org/bugs/?56960.

Bug existed since the "tabbing" of a marked region was introduced,
in version 2.9.2, commit 09958ebd.
2019-09-28 12:39:42 +02:00
Benno Schulenberg
cfd17f5722 tweaks: speed up the counting of the menu entries to be shown
Instead of first counting all available entries and then capping it
at MAIN_VISIBLE, simply stop counting when MAIN_VISIBLE is reached.
2019-09-28 12:03:02 +02:00
Benno Schulenberg
43235c2f16 tweaks: rename a function, to be a bit more fitting 2019-09-27 19:07:25 +02:00
Benno Schulenberg
b14ad451a9 tweaks: rename two variables, away from single letters 2019-09-27 18:53:44 +02:00
Benno Schulenberg
cd00d0975e tweaks: move a fragment of common code into the appropriate function 2019-09-27 18:49:39 +02:00
Benno Schulenberg
40f6dbc34e tweaks: move two functions to after the ones that they call 2019-09-27 18:41:22 +02:00
Benno Schulenberg
a9fb56a8c9 tweaks: move a function to a better file, to be amongst its kind 2019-09-27 17:43:28 +02:00
Benno Schulenberg
07c0d29276 gnulib: update to its current upstream state 2019-09-27 11:17:35 +02:00
Benno Schulenberg
310c971d50 docs: describe the new syntax-specific 'tabgives' command 2019-09-25 19:42:16 +02:00
Benno Schulenberg
3644d51b97 new feature: a 'tabgives' command to define what the Tab key produces
The 'tabgives' command is syntax-specific and should be followed by a
string containing the character(s) that a single press of the <Tab> key
should produce -- most likely a single TAB or a small bunch of spaces,
but any string is allowed.  This overrides the 'tabstospaces' option.

When one wants to make sure <Tab> inserts always four spaces and never
a TAB when editing a Python file, one could add to one's nanorc:

  extendsyntax python tabgives "    "

where there are four spaces between the quotes.  And when one wants
to ensure, when editing a Makefile, that <Tab> always inserts a TAB
and never spaces, independent of what tabstospaces is set to, one
could add to one's nanorc:

  extendsyntax makefile tabgives "	"

where there is a literal TAB character between the quotes.

This fulfills https://savannah.gnu.org/bugs/?53661,
Requested-by: Andrew Pennebaker <andrew.pennebaker@gmail.com>
And addresses https://savannah.gnu.org/bugs/?54760.
Requested-by: Henry van Megen <hvanmegen@gmail.com>
And addresses part of https://savannah.gnu.org/bugs/?54775.
Requested-by: Dirkjan Ochtman <dirkjan@ochtman.nl>
2019-09-25 19:35:07 +02:00
Benno Schulenberg
591d3170aa tweaks: add some translator hints, be more precise on permissible length 2019-09-24 17:15:42 +02:00
Benno Schulenberg
752dde1130 docs: mention that gcc must be at least version 5.0
This is needed to get '-std=c11' by default.

Reported-by: Ansuel Smith <ansuelsmth@gmail.com>
in https://lists.gnu.org/archive/html/nano-devel/2019-09/msg00004.html
2019-09-23 13:50:51 +02:00
Benno Schulenberg
b5eda7f812 tweaks: reshuffle two fragments, to group things better 2019-09-23 13:03:52 +02:00
Benno Schulenberg
4d44b03fc8 tweaks: rename a variable, to be more compact 2019-09-22 17:38:22 +02:00
Benno Schulenberg
2d16c27820 tweaks: add two hints for translators, to try and help avoid mistakes 2019-09-22 17:31:27 +02:00
Benno Schulenberg
ad65b79ac7 usage: mark the -J/--guidestripe option plus argument as translatable
This fixes https://savannah.gnu.org/bugs/?56930.

Bug existed since the vertical guiding bar was introduced,
in version 4.0, commit 66c6eb51.
2019-09-21 19:50:55 +02:00
Benno Schulenberg
fe5bd8cdef usage: properly align --help output also when it has accented characters
As printf() is not UTF8-aware, we have to determine ourselves how many
columns each short and long flag take up and add the required number of
spaces (not tabs, because their size is not fixed) to fill things up.

This fixes https://savannah.gnu.org/bugs/?56928.

Bug existed since version 4.3, commit 2f169107.
2019-09-21 19:31:48 +02:00
Benno Schulenberg
c848ec3d53 tweaks: elide two multiplications with something that is always 1 2019-09-18 15:25:42 +02:00
Benno Schulenberg
ab6390cad0 tweaks: remove two superfluous macros, as sizeof(char) is always 1 2019-09-18 15:20:08 +02:00
Benno Schulenberg
48124fdba4 tweaks: use a more effecient way to skip storing an empty file name
Position history refers only to actual files, so when the filename
is blank...  there is nothing that needs to be remembered.
2019-09-18 14:18:48 +02:00
Benno Schulenberg
ebd9eb346d tweaks: improve a bunch of comments, and reshuffle some declarations 2019-09-17 17:38:42 +02:00
Benno Schulenberg
413116e1b5 tweaks: rename another variable, for a better fit 2019-09-17 16:46:11 +02:00
Benno Schulenberg
69a3d39bc4 tweaks: rename three variables, for more contrast 2019-09-17 16:42:53 +02:00
Benno Schulenberg
f081fa3047 tweaks: rename two variables, to better describe what they contain
The 'tilded' variable is used for two purposes: a user's home directory,
and an intermediate user name.
2019-09-17 14:26:09 +02:00
Benno Schulenberg
4383b01b9b tweaks: adjust indentation after previous change, reshuffle declarations 2019-09-17 14:11:45 +02:00
Benno Schulenberg
b901a20a06 tweaks: use an early return when there is no tilde
Also improve a comment, and use a 'while' instead of a 'for'.
2019-09-17 14:09:40 +02:00
Benno Schulenberg
d6e05d8376 tweaks: simplify the determination of a canonical path
Suggested-by: Brand Huntsman <alpha@qzx.com>
2019-09-17 13:32:15 +02:00
Benno Schulenberg
21e307e820 tweaks: rename a variable, normalize a comment, and reshuffle a free() 2019-09-16 17:25:47 +02:00
Benno Schulenberg
dbcf4f0cbe color: don't concatenate an absolute path with the working directory
When the user specified an absolute path... it is NOT relative to the
current working directory.

This fixes https://savannah.gnu.org/bugs/?56902.
Reported-by: Brand Huntsman <alpha@qzx.com>

Bug existed since version 2.4.2, commit ec8d51be.
2019-09-16 17:12:25 +02:00
Benno Schulenberg
7b88557ef5 tweaks: meld two calls of free() into a single one, to elide an 'else' 2019-09-16 16:55:03 +02:00
Benno Schulenberg
75a6abe6d2 docs: mark the undoing of justifications as done in the TODO list 2019-09-11 17:25:35 +02:00
Benno Schulenberg
ba5b85baf0 tweaks: rename three variables, to better indicate what they hold
They hold not a terminal but flags, settings, state.
2019-09-06 19:40:38 +02:00
Benno Schulenberg
9f95fa9ce5 tweaks: reshuffle a line, to group things better 2019-09-06 19:25:43 +02:00
Brand Huntsman
8853bc448d search: accept a match at start of file when searching from command line
For a forward search from the command line, pass FALSE to 'skipone'
so that an occurrence at the head of the file is not skipped over.

This fixes https://savannah.gnu.org/bugs/?56845.
Reported-by: Derek Wolfe <dwwolfe1@gmail.com>

Signed-off-by: Brand Huntsman <alpha@qzx.com>
2019-09-02 09:05:50 +02:00
Benno Schulenberg
15148a5e6d search: after search-at-startup, store the column (for vertical movement)
This fixes https://savannah.gnu.org/bugs/?56846.
2019-09-01 16:15:15 +02:00
69 changed files with 18045 additions and 17449 deletions

View File

@@ -1,3 +1,75 @@
Changes between v4.4 and v4.5:
------------------------------
Benno Schulenberg (60):
bindings: add a dedicated keycode for <Tab> for when a region is marked
bump version numbers and add a news item for the 4.5 release
color: don't concatenate an absolute path with the working directory
docs: add two examples of the 'tabgives' command to the sample nanorc
docs: describe the new syntax-specific 'tabgives' command
docs: mark the undoing of justifications as done in the TODO list
docs: mention that gcc must be at least version 5.0
gnulib: update to its current upstream state
mouse: make the clickable width of menu items more consistent
new feature: a 'tabgives' command to define what the Tab key produces
search: after search-at-startup, store the column (for vertical movement)
tweaks: add a translator hint, and correct two others
tweaks: add some translator hints, be more precise on permissible length
tweaks: add two hints for translators, to try and help avoid mistakes
tweaks: adjust indentation after previous change, reshuffle declarations
tweaks: avoid a comparison between signed and unsigned [coverity]
tweaks: avoid leaking memory when finding an invalid string [coverity]
tweaks: avoid recomputing a maximum value every time round the loop
tweaks: don't burden all menus with something meant for the WriteOut menu
tweaks: elide a function from a non-UTF8 build
tweaks: elide two multiplications with something that is always 1
tweaks: frob a few comments
tweaks: improve a bunch of comments, and reshuffle some declarations
tweaks: improve a handful of comments, and reduce the needed padding
tweaks: mark as 'const' a parameter that takes fixed strings [coverity]
tweaks: meld two calls of free() into a single one, to elide an 'else'
tweaks: move a fragment of common code into the appropriate function
tweaks: move a function to a better file, to be amongst its kind
tweaks: move a function to before its callers and next to its kind
tweaks: move two functions to after the ones that they call
tweaks: remove some timing code that has served its purpose
tweaks: remove two superfluous macros, as sizeof(char) is always 1
tweaks: rename a function, to be a bit more fitting
tweaks: rename another type, again to better fit the general pattern
tweaks: rename another type, to also better fit the general pattern
tweaks: rename another variable, for a better fit
tweaks: rename a type, to better fit the general pattern
tweaks: rename a variable, normalize a comment, and reshuffle a free()
tweaks: rename a variable, to be more compact
tweaks: rename three variables, for contrast and more sense
tweaks: rename three variables, for more contrast
tweaks: rename three variables, to better indicate what they hold
tweaks: rename two variables, away from single letters
tweaks: rename two variables, to better describe what they contain
tweaks: reshuffle a fragment, to group some toggles together
tweaks: reshuffle a line, to group things better
tweaks: reshuffle some lines, to elide an unneeded assignment
tweaks: reshuffle some lines, to have the same order as elsewhere
tweaks: reshuffle two fragments, to group things better
tweaks: rewrap a line, reshuffle a declaration, and improve some comments
tweaks: simplify a calculation, as done elsewhere
tweaks: simplify the determination of a canonical path
tweaks: sort two keywords strictly alphabetically
tweaks: speed up determining the width of plain ASCII characters
tweaks: speed up the counting of the menu entries to be shown
tweaks: use a more effecient way to skip storing an empty file name
tweaks: use an early return when there is no tilde
tweaks: use 'void' in prototypes of parameterless functions [coverity]
usage: mark the -J/--guidestripe option plus argument as translatable
usage: properly align --help output also when it has accented characters
Brand Huntsman (1):
search: accept a match at start of file when searching from command line
Dirkjan Ochtman (1):
syntax: rust: add the words reserved in 2018, and remove unreserved ones
Changes between v4.3 and v4.4:
------------------------------

View File

@@ -2,6 +2,7 @@ Improvements in GNU nano
========================
Since 4.0:
- What the <Tab> key produces can be specified per syntax with 'tabgives'.
- The ability to perform a search at startup with +/string or +?string.
- Comment characters are copied when automatic hard-wrapping occurs.
- The ability to both read from and write to a FIFO.

6
NEWS
View File

@@ -1,3 +1,9 @@
2019.10.04 - GNU nano 4.5 "Košice"
• The new 'tabgives' command allows you to specify per syntax what
the <Tab> key should produce: some spaces, a hard TAB, ...
• The output of --help is properly aligned again for all languages.
• <Tab> will indent a marked region also when M-} has been rebound.
2019.08.25 - GNU nano 4.4 "Hagelslag"
• At startup, the cursor can be put on the first or last occurrence
of a string by preceding the filename with +/string or +?string.

View File

@@ -14,13 +14,13 @@ packages:
- autoconf (version >= 2.69)
- automake (version >= 1.14)
- autopoint (version >= 0.18.3)
- gcc (version >= 5.0)
- gettext (version >= 0.18.3)
- git (version >= 2.7.4)
- groff (version >= 1.12)
- make (any version)
- pkg-config (version >= 0.22)
- texinfo (version >= 4.0)
- gcc (any version)
- make (any version)
If you want UTF-8 support, you will also need libncursesw5-dev installed
(version >= 5.7), or libslang2-dev (version >= 2.0) if you use --with-slang.

4
TODO
View File

@@ -2,7 +2,6 @@ A list of desired features
--------------------------
Somewhat urgent:
- 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 color syntaxes to apply to more than just color, so that we can
@@ -17,6 +16,9 @@ Vague musings:
- Make matching bracket searches sophisticated enough to skip over
brackets inside comments?
For version 4.0:
- Make undo/redo work also for justifying. [DONE]
For version 2.9:
- Allow piping (marked) text to an external command and replacing it with
the command's output. That is: implement filtering. [DONE]

View File

@@ -2,7 +2,7 @@
# Generate configure & friends for GIT users.
gnulib_url="git://git.sv.gnu.org/gnulib.git"
gnulib_hash="b3cde21d1fb6391686e4fa68506131fb65ca256f"
gnulib_hash="ab02af9d47248a1d8b4ade4e8ab2c927d0543ea1"
modules="
futimens

View File

@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see https://www.gnu.org/licenses/.
AC_INIT([GNU nano], [4.4], [nano-devel@gnu.org], [nano])
AC_INIT([GNU nano], [4.5], [nano-devel@gnu.org], [nano])
AC_CONFIG_SRCDIR([src/nano.c])
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE([1.14])

View File

@@ -85,7 +85,7 @@
<h3><a name="1.3"></a>1.3. Why the name change from TIP?</h3>
<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 &quot;establishes a full duplex terminal connection to a remote host&quot;, 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>
<h3><a name="1.4"></a>1.4. What is the current version of nano?</h3>
<blockquote><p>The current version of nano <i>should</i> be <b>4.4</b>. Of course, you should always check the <a href="https://nano-editor.org/">nano homepage</a> to see what the latest and greatest version is.</p></blockquote>
<blockquote><p>The current version of nano <i>should</i> be <b>4.5</b>. Of course, you should always check the <a href="https://nano-editor.org/">nano homepage</a> to see what the latest and greatest version is.</p></blockquote>
<h3><a name="1.5"></a>1.5. I want to read the man page without having to download the program!</h3>
<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%">

View File

@@ -16,7 +16,7 @@
.\" Documentation License along with this program. If not, see
.\" <https://www.gnu.org/licenses/>.
.\"
.TH NANO 1 "version 4.4" "August 2019"
.TH NANO 1 "version 4.5" "October 2019"
.SH NAME
nano \- Nano's ANOther editor, inspired by Pico

View File

@@ -8,8 +8,8 @@
@smallbook
@set EDITION 0.5
@set VERSION 4.4
@set UPDATED August 2019
@set VERSION 4.5
@set UPDATED October 2019
@dircategory Editors
@direntry
@@ -23,7 +23,7 @@
@titlepage
@title GNU @command{nano}
@subtitle a small and friendly text editor
@subtitle version 4.4
@subtitle version 4.5
@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 4.4.
This manual documents the GNU @command{nano} editor, version 4.5.
@menu
* Introduction::
@@ -1060,6 +1060,11 @@ Python files. If empty double quotes are specified, the comment/uncomment
functions are disabled; for example, @t{""} for JSON.
The default value is @t{"#"}.
@item tabgives "@var{string}"
Make the <Tab> key produce the given @var{string}. Useful for languages like
Python that want to see only spaces for indentation.
This overrides the setting of the @code{tabstospaces} option.
@item color @var{fgcolor},@var{bgcolor} "@var{regex}" @dots{}
Paint all pieces of text that match the extended regular expression "regex"
with the given foreground and background colors, at least one of which must

View File

@@ -16,7 +16,7 @@
.\" Documentation License along with this program. If not, see
.\" <https://www.gnu.org/licenses/>.
.\"
.TH NANORC 5 "version 4.4" "August 2019"
.TH NANORC 5 "version 4.5" "October 2019"
.SH NAME
nanorc \- GNU nano's configuration file
@@ -396,6 +396,11 @@ for Python files. If empty double quotes are specified, the comment/uncomment
function is disabled; for example, "" for JSON.
The default value is "\fB#\fP".
.TP
.BI "tabgives """ string """
Make the <Tab> key produce the given \fIstring\fR. Useful for languages like
Python that want to see only spaces for indentation.
This overrides the setting of the \fBtabstospaces\fR option.
.TP
.BI "color " fgcolor , bgcolor " """ regex """ " \fR...
Paint all pieces of text that match the extended regular expression
\fIregex\fP with the given foreground and background colors, at least

View File

@@ -16,7 +16,7 @@
.\" Documentation License along with this program. If not, see
.\" <https://www.gnu.org/licenses/>.
.\"
.TH RNANO 1 "version 4.4" "August 2019"
.TH RNANO 1 "version 4.5" "October 2019"
.SH NAME
rnano \- a restricted nano

View File

@@ -261,6 +261,14 @@
# include "@PKGDATADIR@/*.nanorc"
## If <Tab> should always produce four spaces when editing a Python file,
## independent of the settings of 'tabsize' and 'tabstospaces':
# extendsyntax python tabgives " "
#
## If <Tab> should always produce an actual TAB when editing a Makefile:
# extendsyntax makefile tabgives " "
## Key bindings.
## See nanorc(5) (section REBINDING KEYS) for more details on this.

940
po/bg.po

File diff suppressed because it is too large Load Diff

957
po/ca.po

File diff suppressed because it is too large Load Diff

1142
po/cs.po

File diff suppressed because it is too large Load Diff

942
po/da.po

File diff suppressed because it is too large Load Diff

948
po/de.po

File diff suppressed because it is too large Load Diff

944
po/eo.po

File diff suppressed because it is too large Load Diff

946
po/es.po

File diff suppressed because it is too large Load Diff

940
po/eu.po

File diff suppressed because it is too large Load Diff

942
po/fi.po

File diff suppressed because it is too large Load Diff

962
po/fr.po

File diff suppressed because it is too large Load Diff

940
po/ga.po

File diff suppressed because it is too large Load Diff

940
po/gl.po

File diff suppressed because it is too large Load Diff

951
po/hr.po

File diff suppressed because it is too large Load Diff

940
po/hu.po

File diff suppressed because it is too large Load Diff

940
po/id.po

File diff suppressed because it is too large Load Diff

940
po/it.po

File diff suppressed because it is too large Load Diff

978
po/ja.po

File diff suppressed because it is too large Load Diff

940
po/ko.po

File diff suppressed because it is too large Load Diff

940
po/ms.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

944
po/nb.po

File diff suppressed because it is too large Load Diff

944
po/nl.po

File diff suppressed because it is too large Load Diff

938
po/nn.po

File diff suppressed because it is too large Load Diff

940
po/pl.po

File diff suppressed because it is too large Load Diff

1206
po/pt.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

956
po/ro.po

File diff suppressed because it is too large Load Diff

940
po/ru.po

File diff suppressed because it is too large Load Diff

940
po/sl.po

File diff suppressed because it is too large Load Diff

940
po/sr.po

File diff suppressed because it is too large Load Diff

940
po/sv.po

File diff suppressed because it is too large Load Diff

940
po/tr.po

File diff suppressed because it is too large Load Diff

946
po/uk.po

File diff suppressed because it is too large Load Diff

940
po/vi.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
#!/bin/bash
VERSION="4.4"
VERSION="4.5"
./configure -C --enable-tiny && make && ./configure -C &&

View File

@@ -458,21 +458,6 @@ functionptrtype parse_browser_input(int *kbinput)
return do_page_up;
case ' ':
return do_page_down;
case '?':
return do_help_void;
case 'E':
case 'e':
case 'Q':
case 'q':
case 'X':
case 'x':
return do_exit;
case 'G':
case 'g':
return goto_dir_void;
case 'S':
case 's':
return do_enter;
case 'W':
case 'w':
case '/':
@@ -481,6 +466,21 @@ functionptrtype parse_browser_input(int *kbinput)
return do_findprevious;
case 'n':
return do_findnext;
case 'G':
case 'g':
return goto_dir_void;
case '?':
return do_help_void;
case 'S':
case 's':
return do_enter;
case 'E':
case 'e':
case 'Q':
case 'q':
case 'X':
case 'x':
return do_exit;
}
}
return func_from_key(kbinput);
@@ -670,6 +670,7 @@ int filesearch_init(bool forwards)
/* Now ask what to search for. */
response = do_prompt(FALSE, FALSE, MWHEREISFILE, NULL, &search_history,
browser_refresh, "%s%s%s", _("Search"),
/* TRANSLATORS: A modifier of the Search prompt. */
!forwards ? _(" [Backwards]") : "", thedefault);
free(thedefault);

View File

@@ -200,11 +200,12 @@ char control_mbrep(const char *c, bool isdata)
return control_rep(*c);
}
/* This function is equivalent to wcwidth() for multibyte characters. */
#ifdef ENABLE_UTF8
/* Return the width in columns of the given (multibyte) character. */
int mbwidth(const char *c)
{
#ifdef ENABLE_UTF8
if (use_utf8) {
/* Ask for the width only when the character isn't plain ASCII. */
if ((signed char)*c <= 0) {
wchar_t wc;
int width;
@@ -213,41 +214,41 @@ int mbwidth(const char *c)
width = wcwidth(wc);
if (width == -1)
if (width < 0)
return 1;
return width;
} else
#endif
return 1;
}
#endif
/* Convert the Unicode value in chr to a multibyte character, if possible.
/* Convert the Unicode value in code to a multibyte character, if possible.
* If the conversion succeeds, return the (dynamically allocated) multibyte
* character and its length. Otherwise, return an undefined (dynamically
* allocated) multibyte character and a length of zero. */
char *make_mbchar(long chr, int *chr_mb_len)
char *make_mbchar(long code, int *length)
{
char *chr_mb;
char *mb_char;
#ifdef ENABLE_UTF8
if (use_utf8) {
chr_mb = charalloc(MAXCHARLEN);
*chr_mb_len = wctomb(chr_mb, (wchar_t)chr);
mb_char = charalloc(MAXCHARLEN);
*length = wctomb(mb_char, (wchar_t)code);
/* Reject invalid Unicode characters. */
if (*chr_mb_len < 0 || !is_valid_unicode((wchar_t)chr)) {
if (*length < 0 || !is_valid_unicode((wchar_t)code)) {
IGNORE_CALL_RESULT(wctomb(NULL, 0));
*chr_mb_len = 0;
*length = 0;
}
} else
#endif
{
*chr_mb_len = 1;
chr_mb = mallocstrncpy(NULL, (char *)&chr, 1);
mb_char = mallocstrncpy(NULL, (char *)&code, 1);
*length = 1;
}
return chr_mb;
return mb_char;
}
/* Return the length (in bytes) of the character located at *pointer. */
@@ -264,6 +265,27 @@ int char_length(const char *pointer)
return 1;
}
/* Return the number of (multibyte) characters in the given string. */
size_t mbstrlen(const char *pointer)
{
size_t count = 0;
while (*pointer != '\0') {
#ifdef ENABLE_UTF8
if ((signed char)*pointer < 0) {
int length = mblen(pointer, MAXCHARLEN);
pointer += (length < 0 ? 1 : length);
} else
#endif
pointer++;
count++;
}
return count;
}
/* Parse a multibyte character from buf. Return the number of bytes
* used. If chr isn't NULL, store the multibyte character in it. If
* col isn't NULL, add the character's width (in columns) to it. */
@@ -346,7 +368,7 @@ size_t step_left(const char *buf, size_t pos)
return before - charlen;
} else
#endif
return (pos == 0 ? 0 : pos - 1);
return (pos == 0 ? 0 : pos - 1);
}
/* Return the index in buf of the beginning of the multibyte character
@@ -487,27 +509,6 @@ char *mbrevstrcasestr(const char *haystack, const char *needle,
return revstrcasestr(haystack, needle, pointer);
}
/* Count the number of (multibyte) characters in the given string. */
size_t mbstrlen(const char *pointer)
{
size_t count = 0;
while (*pointer != '\0') {
#ifdef ENABLE_UTF8
if ((signed char)*pointer < 0) {
int length = mblen(pointer, MAXCHARLEN);
pointer += (length < 0 ? 1 : length);
} else
#endif
pointer++;
count++;
}
return count;
}
#if !defined(NANO_TINY) || defined(ENABLE_JUSTIFY)
/* This function is equivalent to strchr() for multibyte strings. */
char *mbstrchr(const char *string, const char *chr)

View File

@@ -26,7 +26,6 @@
#include <magic.h>
#endif
#include <string.h>
#include <unistd.h>
#ifdef ENABLE_COLOR
@@ -192,20 +191,7 @@ void color_update(void)
/* If no syntax-override string was specified, or it didn't match,
* try finding a syntax based on the filename (extension). */
if (sint == NULL && !inhelp) {
char *reserved = charalloc(PATH_MAX + 1);
char *currentdir = getcwd(reserved, PATH_MAX + 1);
char *joinednames = charalloc(PATH_MAX + 1);
char *fullname = NULL;
if (currentdir == NULL)
free(reserved);
else {
/* Concatenate the current working directory with the
* specified filename, and canonicalize the result. */
sprintf(joinednames, "%s/%s", currentdir, openfile->filename);
fullname = get_full_path(joinednames);
free(currentdir);
}
char *fullname = get_full_path(openfile->filename);
if (fullname == NULL)
fullname = mallocstrcpy(fullname, openfile->filename);
@@ -215,7 +201,6 @@ void color_update(void)
break;
}
free(joinednames);
free(fullname);
}

View File

@@ -50,7 +50,7 @@ void do_deletion(undo_type action)
old_amount = number_of_chunks_in(openfile->current);
#endif
/* Move the remainder of the line "in", over the current character. */
charmove(&openfile->current->data[openfile->current_x],
memmove(&openfile->current->data[openfile->current_x],
&openfile->current->data[openfile->current_x + charlen],
line_len - charlen + 1);
#ifndef NANO_TINY

View File

@@ -1029,7 +1029,7 @@ void do_insertfile(void)
char *given = mallocstrcpy(NULL, "");
/* The last answer the user typed at the statusbar prompt. */
#ifndef NANO_TINY
file_format original_fmt = openfile->fmt;
format_type was_fmt = openfile->fmt;
bool execute = FALSE;
#endif
@@ -1115,6 +1115,11 @@ void do_insertfile(void)
execute = !execute;
continue;
}
if (func == flip_pipe) {
add_or_remove_pipe_symbol_from_answer();
given = mallocstrcpy(given, answer);
continue;
}
#endif
#ifdef ENABLE_BROWSER
if (func == to_files_void) {
@@ -1128,13 +1133,6 @@ void do_insertfile(void)
answer = chosen;
response = 0;
}
#endif
#ifndef NANO_TINY
if (func == flip_pipe) {
add_or_remove_pipe_symbol_from_answer();
given = mallocstrcpy(given, answer);
continue;
}
#endif
/* If we don't have a file yet, go back to the prompt. */
if (response != 0 && (!ISSET(MULTIBUFFER) || response != -2))
@@ -1199,7 +1197,7 @@ void do_insertfile(void)
set_modified();
#ifndef NANO_TINY
/* Ensure that the buffer retains the format that it had. */
openfile->fmt = original_fmt;
openfile->fmt = was_fmt;
#endif
refresh_needed = TRUE;
}
@@ -1220,134 +1218,112 @@ void do_insertfile_void(void)
do_insertfile();
}
/* When passed "[relative path]" or "[relative path][filename]" in
* origpath, return "[full path]" or "[full path][filename]" on success,
* or NULL on error. Do this if the file doesn't exist but the relative
* path does, since the file could exist in memory but not yet on disk).
* Don't do this if the relative path doesn't exist, since we won't be
* able to go there. */
/* For the given bare path (or path plus filename), return the canonical,
* absolute path (plus filename) when the path exists, and NULL when not. */
char *get_full_path(const char *origpath)
{
char *allocation, *here, *target, *last_slash;
char *just_filename = NULL;
int attempts = 0;
/* How often we've tried climbing back up the tree. */
struct stat fileinfo;
char *currentdir, *d_here, *d_there, *d_there_file = NULL;
char *last_slash;
bool path_only;
if (origpath == NULL)
return NULL;
/* Get the current directory. If it doesn't exist, back up and try
* again until we get a directory that does, and use that as the
* current directory. */
currentdir = charalloc(PATH_MAX + 1);
d_here = getcwd(currentdir, PATH_MAX + 1);
allocation = charalloc(PATH_MAX + 1);
here = getcwd(allocation, PATH_MAX + 1);
while (d_here == NULL && attempts < 20) {
/* If getting the current directory failed, go up one level and try again,
* until we find an existing directory, and use that as the current one. */
while (here == NULL && attempts < 20) {
IGNORE_CALL_RESULT(chdir(".."));
d_here = getcwd(currentdir, PATH_MAX + 1);
here = getcwd(allocation, PATH_MAX + 1);
attempts++;
}
/* If we succeeded, canonicalize it in d_here. */
if (d_here != NULL) {
/* If the current directory isn't "/", tack a slash onto the end
* of it. */
if (strcmp(d_here, "/") != 0) {
d_here = charealloc(d_here, strlen(d_here) + 2);
strcat(d_here, "/");
/* If we found a directory, make sure its path ends in a slash. */
if (here != NULL) {
if (strcmp(here, "/") != 0) {
here = charealloc(here, strlen(here) + 2);
strcat(here, "/");
}
/* Otherwise, set d_here to "". */
} else {
d_here = mallocstrcpy(NULL, "");
free(currentdir);
here = mallocstrcpy(NULL, "");
free(allocation);
}
d_there = real_dir_from_tilde(origpath);
target = real_dir_from_tilde(origpath);
/* If stat()ing d_there fails, assume that d_there refers to a new
* file that hasn't been saved to disk yet. Set path_only to TRUE
* if d_there refers to a directory, and FALSE otherwise. */
path_only = (stat(d_there, &fileinfo) != -1 && S_ISDIR(fileinfo.st_mode));
/* Determine whether the target path refers to a directory. If stat()ing
* target fails, however, assume that it refers to a new, unsaved file. */
path_only = (stat(target, &fileinfo) != -1 && S_ISDIR(fileinfo.st_mode));
/* If path_only is TRUE, make sure d_there ends in a slash. */
/* If the target is a directory, make sure its path ends in a slash. */
if (path_only) {
size_t d_there_len = strlen(d_there);
size_t length = strlen(target);
if (d_there[d_there_len - 1] != '/') {
d_there = charealloc(d_there, d_there_len + 2);
strcat(d_there, "/");
if (target[length - 1] != '/') {
target = charealloc(target, length + 2);
strcat(target, "/");
}
}
/* Search for the last slash in d_there. */
last_slash = strrchr(d_there, '/');
last_slash = strrchr(target, '/');
/* If we didn't find one, then make sure the answer is in the format
* "d_here/d_there". */
/* If the target path does not contain a slash, then it is a bare filename
* and must therefore be located in the working directory. */
if (last_slash == NULL) {
d_there_file = d_there;
d_there = d_here;
just_filename = target;
target = here;
} else {
/* If path_only is FALSE, then save the filename portion of the
* answer (everything after the last slash) in d_there_file. */
if (!path_only)
d_there_file = mallocstrcpy(NULL, last_slash + 1);
/* If target contains a filename, separate the two. */
if (!path_only) {
just_filename = mallocstrcpy(NULL, last_slash + 1);
*(last_slash + 1) = '\0';
}
/* Remove the filename portion of the answer from d_there. */
*(last_slash + 1) = '\0';
/* Go to the path specified in d_there. */
if (chdir(d_there) == -1) {
free(d_there);
d_there = NULL;
/* If we can't change to the target directory, give up. Otherwise,
* get the canonical path to this target directory. */
if (chdir(target) == -1) {
free(target);
target = NULL;
} else {
free(d_there);
free(target);
/* Get the full path. */
currentdir = charalloc(PATH_MAX + 1);
d_there = getcwd(currentdir, PATH_MAX + 1);
allocation = charalloc(PATH_MAX + 1);
target = getcwd(allocation, PATH_MAX + 1);
/* If we succeeded, canonicalize it in d_there. */
if (d_there != NULL) {
/* If the current directory isn't "/", tack a slash onto
* the end of it. */
if (strcmp(d_there, "/") != 0) {
d_there = charealloc(d_there, strlen(d_there) + 2);
strcat(d_there, "/");
/* If we got a result, make sure it ends in a slash.
* Otherwise, ensure that we return NULL. */
if (target != NULL) {
if (strcmp(target, "/") != 0) {
target = charealloc(target, strlen(target) + 2);
strcat(target, "/");
}
/* Otherwise, make sure that we return NULL. */
} else {
path_only = TRUE;
free(currentdir);
free(allocation);
}
/* Finally, go back to the path specified in d_here,
* where we were before. We don't check for a chdir()
* error, since we can do nothing if we get one. */
IGNORE_CALL_RESULT(chdir(d_here));
/* Finally, go back to where we were before. We don't check
* for an error, since we can't do anything if we get one. */
IGNORE_CALL_RESULT(chdir(here));
}
/* Free d_here, since we're done using it. */
free(d_here);
free(here);
}
/* At this point, if path_only is FALSE and d_there isn't NULL,
* d_there contains the path portion of the answer and d_there_file
* contains the filename portion of the answer. If this is the
* case, tack the latter onto the end of the former. d_there will
* then contain the complete answer. */
if (!path_only && d_there != NULL) {
d_there = charealloc(d_there, strlen(d_there) +
strlen(d_there_file) + 1);
strcat(d_there, d_there_file);
/* If we were given more than a bare path, concatenate the target path
* with the filename portion to get the full, absolute file path. */
if (!path_only && target != NULL) {
target = charealloc(target, strlen(target) + strlen(just_filename) + 1);
strcat(target, just_filename);
}
/* Free d_there_file, since we're done using it. */
free(d_there_file);
free(just_filename);
return d_there;
return target;
}
/* Return the full version of path, as returned by get_full_path(). On
@@ -2303,49 +2279,46 @@ void do_savefile(void)
close_and_go();
}
/* Return a malloc()ed string containing the actual directory, used to
* convert ~user/ and ~/ notation. */
char *real_dir_from_tilde(const char *buf)
/* Convert the tilde notation when the given path begins with ~/ or ~user/.
* Return an allocated string containing the expanded path. */
char *real_dir_from_tilde(const char *path)
{
char *retval;
char *tilded, *retval;
size_t i = 1;
if (*buf == '~') {
size_t i = 1;
char *tilde_dir;
if (*path != '~')
return mallocstrcpy(NULL, path);
/* Figure out how much of the string we need to compare. */
for (; buf[i] != '/' && buf[i] != '\0'; i++)
;
/* Figure out how much of the string we need to compare. */
while (path[i] != '/' && path[i] != '\0')
i++;
/* Get the home directory. */
if (i == 1) {
get_homedir();
tilde_dir = mallocstrcpy(NULL, homedir);
} else {
if (i == 1) {
get_homedir();
tilded = mallocstrcpy(NULL, homedir);
} else {
#ifdef HAVE_PWD_H
const struct passwd *userdata;
const struct passwd *userdata;
tilde_dir = mallocstrncpy(NULL, buf, i + 1);
tilde_dir[i] = '\0';
tilded = mallocstrncpy(NULL, path, i + 1);
tilded[i] = '\0';
do {
userdata = getpwent();
} while (userdata != NULL &&
strcmp(userdata->pw_name, tilde_dir + 1) != 0);
endpwent();
if (userdata != NULL)
tilde_dir = mallocstrcpy(tilde_dir, userdata->pw_dir);
do {
userdata = getpwent();
} while (userdata && strcmp(userdata->pw_name, tilded + 1) != 0);
endpwent();
if (userdata != NULL)
tilded = mallocstrcpy(tilded, userdata->pw_dir);
#else
tilde_dir = strdup("");
tilded = strdup("");
#endif
}
}
retval = charalloc(strlen(tilde_dir) + strlen(buf + i) + 1);
sprintf(retval, "%s%s", tilde_dir, buf + i);
retval = charalloc(strlen(tilded) + strlen(path + i) + 1);
sprintf(retval, "%s%s", tilded, path + i);
free(tilde_dir);
} else
retval = mallocstrcpy(NULL, buf);
free(tilded);
return retval;
}
@@ -2609,7 +2582,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place,
/* If the matches have something in common, show that part. */
if (common_len != *place) {
buf = charealloc(buf, common_len + buf_len - *place + 1);
charmove(buf + common_len, buf + *place, buf_len - *place + 1);
memmove(buf + common_len, buf + *place, buf_len - *place + 1);
strncpy(buf, mzero, common_len);
*place = common_len;
}

View File

@@ -89,7 +89,7 @@ int shiftaltleft, shiftaltright, shiftaltup, shiftaltdown;
#ifdef ENABLED_WRAPORJUSTIFY
ssize_t fill = -COLUMNS_FROM_EOL;
/* The relative column where we will wrap lines. */
ssize_t wrap_at = 0;
size_t wrap_at = 0;
/* The actual column where we will wrap lines, based on fill. */
#endif
@@ -272,19 +272,6 @@ size_t light_from_col = 0;
size_t light_to_col = 0;
/* Where the spotlighted text ends. */
/* Return the number of entries in the shortcut list for a given menu. */
size_t length_of_list(int menu)
{
funcstruct *f;
size_t i = 0;
for (f = allfuncs; f != NULL; f = f->next)
if ((f->menus & menu) && first_sc_for(menu, f->func) != NULL)
i++;
return i;
}
/* To make the functions and shortcuts lists clearer. */
#define VIEW TRUE /* Is allowed in view mode. */
#define NOVIEW FALSE
@@ -361,9 +348,9 @@ void do_cancel(void)
{
}
/* Add a function to the function list. */
void add_to_funcs(void (*func)(void), int menus, const char *desc, const char *help,
bool blank_after, bool viewok)
/* Add a function to the linked list of functions. */
void add_to_funcs(void (*func)(void), int menus, const char *desc,
const char *help, bool blank_after, bool viewok)
{
funcstruct *f = nmalloc(sizeof(funcstruct));
@@ -384,7 +371,7 @@ void add_to_funcs(void (*func)(void), int menus, const char *desc, const char *h
#endif
}
/* Add a key combo to the shortcut list. */
/* Add a key combo to the linked list of shortcuts. */
void add_to_sclist(int menus, const char *scstring, const int keycode,
void (*func)(void), int toggle)
{
@@ -441,6 +428,46 @@ int the_code_for(void (*func)(void), int defaultval)
return s->keycode;
}
/* Return the number of entries that can be shown in the given menu. */
size_t shown_entries_for(int menu)
{
funcstruct *item = allfuncs;
size_t maximum = ((COLS + 40) / 20) * 2;
size_t count = 0;
while (count < maximum && item != NULL) {
if (item->menus & menu)
count++;
item = item->next;
}
/* When --tempfile is not used, widen the grid of the WriteOut menu. */
if (menu == MWRITEFILE && first_sc_for(menu, discard_buffer) == NULL)
count--;
return count;
}
/* Return the shortcut that corresponds to the values of kbinput (the
* key itself) and meta_key (whether the key is a meta sequence). The
* returned shortcut will be the first in the list that corresponds to
* the given sequence. */
const keystruct *get_shortcut(int *kbinput)
{
/* Plain characters cannot be shortcuts, so just skip those. */
if (!meta_key && ((*kbinput >= 0x20 && *kbinput < 0x7F) ||
(*kbinput >= 0xA0 && *kbinput <= 0xFF)))
return NULL;
for (keystruct *s = sclist; s != NULL; s = s->next) {
if ((s->menus & currmenu) && *kbinput == s->keycode &&
meta_key == s->meta)
return s;
}
return NULL;
}
/* Return a pointer to the function that is bound to the given key. */
functionptrtype func_from_key(int *kbinput)
{
@@ -452,18 +479,6 @@ functionptrtype func_from_key(int *kbinput)
return NULL;
}
/* Set the string and its corresponding keycode for the given shortcut s. */
void assign_keyinfo(keystruct *s, const char *keystring, const int keycode)
{
s->keystr = keystring;
s->meta = (keystring[0] == 'M' && keycode == 0);
if (keycode)
s->keycode = keycode;
else
s->keycode = keycode_from_string(keystring);
}
/* Parse the given keystring and return the corresponding keycode,
* or return -1 when the string is invalid. */
int keycode_from_string(const char *keystring)
@@ -499,6 +514,18 @@ int keycode_from_string(const char *keystring)
return -1;
}
/* Set the string and its corresponding keycode for the given shortcut s. */
void assign_keyinfo(keystruct *s, const char *keystring, const int keycode)
{
s->keystr = keystring;
s->meta = (keystring[0] == 'M' && keycode == 0);
if (keycode)
s->keycode = keycode;
else
s->keycode = keycode_from_string(keystring);
}
/* These two tags are used elsewhere too, so they are global. */
/* TRANSLATORS: Try to keep the next two strings at most 10 characters. */
const char *exit_tag = N_("Exit");
@@ -678,8 +705,7 @@ void shortcut_init(void)
/* Start populating the different menus with functions. */
add_to_funcs(do_help_void, (MMOST | MBROWSER) & ~MFINDINHELP,
/* TRANSLATORS: Try to keep the next ninety strings or so at most 10
* characters. Some strings may be longer -- run nano and see. */
/* TRANSLATORS: Try to keep the next eleven strings at most 10 characters. */
N_("Get Help"), WITHORSANS(help_gist), TOGETHER, VIEW);
add_to_funcs(do_cancel, ((MMOST & ~MMAIN) | MYESNO),
@@ -727,14 +753,6 @@ void shortcut_init(void)
add_to_funcs(do_replace, MMAIN,
N_("Replace"), WITHORSANS(replace_gist), TOGETHER, NOVIEW);
#ifdef ENABLE_BROWSER
add_to_funcs(goto_dir_void, MBROWSER,
N_("Go To Dir"), WITHORSANS(gotodir_gist), TOGETHER, VIEW);
add_to_funcs(total_refresh, MBROWSER,
N_("Refresh"), WITHORSANS(browserrefresh_gist), BLANKAFTER, VIEW);
#endif
add_to_funcs(cut_text, MMAIN,
N_("Cut Text"), WITHORSANS(cut_gist), TOGETHER, NOVIEW);
@@ -753,6 +771,7 @@ void shortcut_init(void)
}
add_to_funcs(do_cursorpos_void, MMAIN,
/* TRANSLATORS: Try to keep the next thirteen strings at most 12 characters. */
N_("Cur Pos"), WITHORSANS(cursorpos_gist), TOGETHER, VIEW);
#if (defined(ENABLE_JUSTIFY) && (defined(ENABLE_SPELLER) || defined(ENABLE_COLOR)) || \
@@ -803,12 +822,14 @@ void shortcut_init(void)
N_("FullJstify"), WITHORSANS(fulljustify_gist), BLANKAFTER, NOVIEW);
#endif
#ifndef NANO_TINY
add_to_funcs(do_find_bracket, MMAIN,
N_("To Bracket"), WITHORSANS(bracket_gist), BLANKAFTER, VIEW);
#endif
#ifdef ENABLE_BROWSER
add_to_funcs(goto_dir_void, MBROWSER,
/* TRANSLATORS: Try to keep the next seven strings at most 10 characters. */
N_("Go To Dir"), WITHORSANS(gotodir_gist), TOGETHER, VIEW);
add_to_funcs(total_refresh, MBROWSER,
N_("Refresh"), WITHORSANS(browserrefresh_gist), BLANKAFTER, VIEW);
add_to_funcs(do_search_forward, MBROWSER,
N_("Where Is"), WITHORSANS(browserwhereis_gist), TOGETHER, VIEW);
add_to_funcs(do_search_backward, MBROWSER,
@@ -816,6 +837,9 @@ void shortcut_init(void)
#endif
#ifndef NANO_TINY
add_to_funcs(do_find_bracket, MMAIN,
N_("To Bracket"), WITHORSANS(bracket_gist), BLANKAFTER, VIEW);
add_to_funcs(do_search_backward, MMAIN|MHELP,
/* TRANSLATORS: This starts a backward search. */
N_("Where Was"), WITHORSANS(wherewas_gist), TOGETHER, VIEW);
@@ -850,6 +874,7 @@ void shortcut_init(void)
#endif
add_to_funcs(do_prev_word_void, MMAIN,
/* TRANSLATORS: Try to keep the next eighteen strings at most 12 characters. */
N_("Prev Word"), WITHORSANS(prevword_gist), TOGETHER, VIEW);
add_to_funcs(do_next_word_void, MMAIN,
N_("Next Word"), WITHORSANS(nextword_gist), TOGETHER, VIEW);
@@ -1061,7 +1086,7 @@ void shortcut_init(void)
#ifdef ENABLE_COLOR
add_to_funcs(do_page_up, MLINTER,
/* TRANSLATORS: Try to keep the next two strings at most 20 characters. */
/* TRANSLATORS: The next two strings may be up to 37 characters each. */
N_("Prev Lint Msg"), WITHORSANS(prevlint_gist), TOGETHER, VIEW);
add_to_funcs(do_page_down, MLINTER,
N_("Next Lint Msg"), WITHORSANS(nextlint_gist), TOGETHER, VIEW);
@@ -1124,7 +1149,7 @@ void shortcut_init(void)
add_to_sclist(MMAIN, "M-6", 0, copy_text, 0);
add_to_sclist(MMAIN, "M-^", 0, copy_text, 0);
add_to_sclist(MMAIN, "M-}", 0, do_indent, 0);
add_to_sclist(MMAIN, "Tab", TAB_CODE, do_indent, 0);
add_to_sclist(MMAIN, "Tab", INDENT_KEY, do_indent, 0);
add_to_sclist(MMAIN, "M-{", 0, do_unindent, 0);
add_to_sclist(MMAIN, "Sh-Tab", SHIFT_TAB, do_unindent, 0);
add_to_sclist(MMAIN, "M-:", 0, record_macro, 0);
@@ -1384,7 +1409,7 @@ const char *flagtostr(int flag)
{
switch (flag) {
case NO_HELP:
/* TRANSLATORS: The next fourteen strings are toggle descriptions;
/* TRANSLATORS: The next thirteen strings are toggle descriptions;
* they are best kept shorter than 40 characters, but may be longer. */
return N_("Help mode");
case CONSTANT_SHOW:

View File

@@ -40,7 +40,7 @@ static size_t location;
/* The offset (in bytes) of the topleft of the shown help text. */
/* Hard-wrap the concatenated help text, and write it into a new buffer. */
void wrap_help_text_into_buffer()
void wrap_help_text_into_buffer(void)
{
size_t sum = 0;
const char *ptr = start_of_body;

View File

@@ -528,7 +528,7 @@ void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos)
poshiststruct *posptr, *theone, *posprev = NULL;
char *fullpath = get_full_path(filename);
if (fullpath == NULL || fullpath[strlen(fullpath) - 1] == '/') {
if (fullpath == NULL || *filename == '\0') {
free(fullpath);
return;
}

View File

@@ -109,7 +109,7 @@ void set_proper_index_and_pww(size_t *leftedge, size_t target, bool forward)
openfile->placewewant = *leftedge + target;
}
/* Move up nearly one screenful. */
/* Move up almost one screenful. */
void do_page_up(void)
{
int mustmove = (editwinrows < 3) ? 1 : editwinrows - 2;
@@ -139,7 +139,7 @@ void do_page_up(void)
refresh_needed = TRUE;
}
/* Move down nearly one screenful. */
/* Move down almost one screenful. */
void do_page_down(void)
{
int mustmove = (editwinrows < 3) ? 1 : editwinrows - 2;
@@ -534,7 +534,7 @@ void do_down(void)
}
#if !defined(NANO_TINY) || defined(ENABLE_HELP)
/* Scroll up one line or chunk without scrolling the cursor. */
/* Scroll up one line or chunk without moving the cursor textwise. */
void do_scroll_up(void)
{
/* When the top of the file is onscreen, we can't scroll. */
@@ -548,7 +548,7 @@ void do_scroll_up(void)
edit_scroll(BACKWARD);
}
/* Scroll down one line or chunk without scrolling the cursor. */
/* Scroll down one line or chunk without moving the cursor textwise. */
void do_scroll_down(void)
{
if (openfile->current_y == 0)

View File

@@ -53,8 +53,8 @@ static int oldinterval = -1;
/* Used to store the user's original mouse click interval. */
#endif
#ifdef HAVE_TERMIOS_H
static struct termios oldterm;
/* The user's original terminal settings. */
static struct termios original_state;
/* The original settings of the user's terminal. */
#else
# define tcsetattr(...)
# define tcgetattr(...)
@@ -239,11 +239,11 @@ void partition_buffer(linestruct *top, size_t top_x,
bot->data[bot_x] = '\0';
/* At the beginning of the partition, remove all text before top_x. */
charmove(top->data, top->data + top_x, strlen(top->data) - top_x + 1);
memmove(top->data, top->data + top_x, strlen(top->data) - top_x + 1);
}
/* Unpartition the current buffer so that it is complete again. */
void unpartition_buffer()
void unpartition_buffer(void)
{
/* Reattach the line that was above the top of the partition. */
openfile->filetop->prev = foreline;
@@ -253,7 +253,7 @@ void unpartition_buffer()
/* Restore the text that was on the first partition line before its start. */
openfile->filetop->data = charealloc(openfile->filetop->data,
strlen(antedata) + strlen(openfile->filetop->data) + 1);
charmove(openfile->filetop->data + strlen(antedata),
memmove(openfile->filetop->data + strlen(antedata),
openfile->filetop->data, strlen(openfile->filetop->data) + 1);
strncpy(openfile->filetop->data, antedata, strlen(antedata));
free(antedata);
@@ -498,7 +498,7 @@ void finish(void)
endwin();
/* Restore the old terminal settings. */
tcsetattr(0, TCSANOW, &oldterm);
tcsetattr(0, TCSANOW, &original_state);
#ifdef ENABLE_NANORC
display_rcfile_errors();
@@ -529,7 +529,7 @@ void die(const char *msg, ...)
endwin();
/* Restore the old terminal settings. */
tcsetattr(0, TCSANOW, &oldterm);
tcsetattr(0, TCSANOW, &original_state);
#ifdef ENABLE_NANORC
display_rcfile_errors();
@@ -649,11 +649,12 @@ void window_init(void)
#ifdef ENABLED_WRAPORJUSTIFY
/* Set up the wrapping point, accounting for screen width when negative. */
wrap_at = fill;
if (wrap_at <= 0)
wrap_at += COLS;
if (wrap_at < 0)
if (COLS + fill < 0)
wrap_at = 0;
else if (fill <= 0)
wrap_at = COLS + fill;
else
wrap_at = fill;
#endif
}
@@ -683,7 +684,18 @@ void mouse_init(void)
/* Print the usage line for the given option to the screen. */
void print_opt(const char *shortflag, const char *longflag, const char *desc)
{
printf(" %-14s %-23s %s\n", shortflag, longflag, _(desc));
int firstwidth = breadth(shortflag);
int secondwidth = breadth(longflag);
printf(" %s", shortflag);
if (firstwidth < 14)
printf("%*s", 14 - firstwidth, " ");
printf(" %s", longflag);
if (secondwidth < 24)
printf("%*s", 24 - secondwidth, " ");
printf("%s\n", _(desc));
}
/* Explain how to properly use nano and its command-line options. */
@@ -696,7 +708,7 @@ void usage(void)
"a '+' before the filename. The column number can be added after a comma.\n"));
printf(_("When a filename is '-', nano reads data from standard input.\n\n"));
/* TRANSLATORS: The next three are column headers of the --help output. */
printf("%-16s%-26s%s\n", _("Option"), _("Long option"), _("Meaning"));
print_opt(_("Option"), _("Long option"), N_("Meaning"));
#ifndef NANO_TINY
/* TRANSLATORS: The next forty or so strings are option descriptions
* for the --help output. Try to keep them at most 40 characters. */
@@ -728,7 +740,7 @@ void usage(void)
print_opt("-I", "--ignorercfiles", N_("Don't look at nanorc files"));
#endif
#ifndef NANO_TINY
print_opt("-J <number>", "--guidestripe=<number>",
print_opt(_("-J <number>"), _("--guidestripe=<number>"),
N_("Show a guiding bar at this column"));
#endif
print_opt("-K", "--rawsequences",
@@ -752,7 +764,9 @@ void usage(void)
#endif
#ifdef ENABLE_JUSTIFY
print_opt(_("-Q <regex>"), _("--quotestr=<regex>"),
N_("Regular expression to match quoting"));
/* TRANSLATORS: This refers to email quoting,
* like the > in: > quoted text. */
N_("Regular expression to match quoting"));
#endif
if (!ISSET(RESTRICTED))
print_opt("-R", "--restricted", N_("Restricted mode"));
@@ -1068,7 +1082,7 @@ void reconnect_and_store_state(void)
/* If input was not cut short, store the current state of the terminal. */
if (!control_C_was_pressed)
tcgetattr(0, &oldterm);
tcgetattr(0, &original_state);
}
/* Read whatever comes from standard input into a new buffer. */
@@ -1078,7 +1092,7 @@ bool scoop_stdin(void)
/* Exit from curses mode and put the terminal into its original state. */
endwin();
tcsetattr(0, TCSANOW, &oldterm);
tcsetattr(0, TCSANOW, &original_state);
/* When input comes from a terminal, show a helpful message. */
if (isatty(STANDARD_INPUT))
@@ -1203,7 +1217,7 @@ RETSIGTYPE do_suspend(int signal)
fflush(stdout);
/* Restore the old terminal settings. */
tcsetattr(0, TCSANOW, &oldterm);
tcsetattr(0, TCSANOW, &original_state);
/* The suspend keystroke must not elicit cursor-position display. */
suppress_cursorpos=TRUE;
@@ -1378,12 +1392,12 @@ void do_toggle(int flag)
void disable_extended_io(void)
{
#ifdef HAVE_TERMIOS_H
struct termios term = {0};
struct termios settings = {0};
tcgetattr(0, &term);
term.c_lflag &= ~IEXTEN;
term.c_oflag &= ~OPOST;
tcsetattr(0, TCSANOW, &term);
tcgetattr(0, &settings);
settings.c_lflag &= ~IEXTEN;
settings.c_oflag &= ~OPOST;
tcsetattr(0, TCSANOW, &settings);
#endif
}
@@ -1391,11 +1405,11 @@ void disable_extended_io(void)
void disable_kb_interrupt(void)
{
#ifdef HAVE_TERMIOS_H
struct termios term = {0};
struct termios settings = {0};
tcgetattr(0, &term);
term.c_lflag &= ~ISIG;
tcsetattr(0, TCSANOW, &term);
tcgetattr(0, &settings);
settings.c_lflag &= ~ISIG;
tcsetattr(0, TCSANOW, &settings);
#endif
}
@@ -1403,11 +1417,11 @@ void disable_kb_interrupt(void)
void enable_kb_interrupt(void)
{
#ifdef HAVE_TERMIOS_H
struct termios term = {0};
struct termios settings = {0};
tcgetattr(0, &term);
term.c_lflag |= ISIG;
tcsetattr(0, TCSANOW, &term);
tcgetattr(0, &settings);
settings.c_lflag |= ISIG;
tcsetattr(0, TCSANOW, &settings);
#endif
}
@@ -1415,11 +1429,11 @@ void enable_kb_interrupt(void)
void disable_flow_control(void)
{
#ifdef HAVE_TERMIOS_H
struct termios term;
struct termios settings;
tcgetattr(0, &term);
term.c_iflag &= ~IXON;
tcsetattr(0, TCSANOW, &term);
tcgetattr(0, &settings);
settings.c_iflag &= ~IXON;
tcsetattr(0, TCSANOW, &settings);
#endif
}
@@ -1427,11 +1441,11 @@ void disable_flow_control(void)
void enable_flow_control(void)
{
#ifdef HAVE_TERMIOS_H
struct termios term;
struct termios settings;
tcgetattr(0, &term);
term.c_iflag |= IXON;
tcsetattr(0, TCSANOW, &term);
tcgetattr(0, &settings);
settings.c_iflag |= IXON;
tcsetattr(0, TCSANOW, &settings);
#endif
}
@@ -1452,27 +1466,27 @@ void terminal_init(void)
* disable the special control keys and interpretation of the flow
* control characters using termios, save the terminal state after
* the first call, and restore it on subsequent calls. */
static struct termios newterm;
static bool newterm_set = FALSE;
static struct termios desired_state;
static bool have_new_state = FALSE;
if (!newterm_set) {
if (!have_new_state) {
#endif
raw();
nonl();
noecho();
disable_extended_io();
disable_kb_interrupt();
if (ISSET(PRESERVE))
enable_flow_control();
disable_kb_interrupt();
#ifdef USE_SLANG
if (!ISSET(PRESERVE))
else
disable_flow_control();
tcgetattr(0, &newterm);
newterm_set = TRUE;
tcgetattr(0, &desired_state);
have_new_state = TRUE;
} else
tcsetattr(0, TCSANOW, &newterm);
tcsetattr(0, TCSANOW, &desired_state);
#endif
}
@@ -1808,7 +1822,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
/* Make room for the new character and copy it into the line. */
openfile->current->data = charealloc(openfile->current->data,
current_len + charlen + 1);
charmove(openfile->current->data + openfile->current_x + charlen,
memmove(openfile->current->data + openfile->current_x + charlen,
openfile->current->data + openfile->current_x,
current_len - openfile->current_x + 1);
strncpy(openfile->current->data + openfile->current_x, onechar,
@@ -1991,7 +2005,7 @@ int main(int argc, char **argv)
#endif
/* Back up the terminal settings so that they can be restored. */
tcgetattr(0, &oldterm);
tcgetattr(0, &original_state);
/* Get the state of standard input and ensure it uses blocking mode. */
stdin_flags = fcntl(0, F_GETFL, 0);
@@ -2315,18 +2329,8 @@ int main(int argc, char **argv)
#ifdef ENABLE_SPELLER
alt_speller = NULL;
#endif
//#define TIMEIT 12
#ifdef TIMEIT
#include <time.h>
clock_t start = clock();
#endif
/* Now process the system's and the user's nanorc file, if any. */
do_rcfiles();
#ifdef TIMEIT
fprintf(stderr, "Took: %.3f\n",
(double)(clock() - start) / CLOCKS_PER_SEC);
#endif
/* If the backed-up command-line options have a value, restore them. */
#ifdef ENABLED_WRAPORJUSTIFY
@@ -2631,11 +2635,12 @@ int main(int argc, char **argv)
else if (searchstring != NULL) {
if (ISSET(USE_REGEXP))
regexp_init(searchstring);
if (!findnextstr(searchstring, FALSE, JUSTFIND, NULL, TRUE,
openfile->filetop, 0))
if (!findnextstr(searchstring, FALSE, JUSTFIND, NULL,
ISSET(BACKWARDS_SEARCH), openfile->filetop, 0))
not_found_msg(searchstring);
else if (lastmessage == HUSH)
wipe_statusbar();
openfile->placewewant = xplustabs();
if (ISSET(USE_REGEXP))
tidy_up_after_search();
free(last_search);

View File

@@ -59,11 +59,9 @@
#define ISSET(flag) ((FLAGS(flag) & FLAGMASK(flag)) != 0)
#define TOGGLE(flag) FLAGS(flag) ^= FLAGMASK(flag)
/* Macros for character allocation and more. */
#define charalloc(howmuch) (char *)nmalloc((howmuch) * sizeof(char))
#define charealloc(ptr, howmuch) (char *)nrealloc(ptr, (howmuch) * sizeof(char))
#define charmove(dest, src, n) memmove(dest, src, (n) * sizeof(char))
#define charset(dest, src, n) memset(dest, src, (n) * sizeof(char))
/* Macros for allocation of character strings. */
#define charalloc(howmuch) (char *)nmalloc(howmuch)
#define charealloc(ptr, howmuch) (char *)nrealloc(ptr, howmuch)
/* In UTF-8 a character is at most six bytes long. */
#ifdef ENABLE_UTF8
@@ -149,7 +147,7 @@
/* Enumeration types. */
typedef enum {
NIX_FILE, DOS_FILE, MAC_FILE
} file_format;
} format_type;
typedef enum {
HUSH, NOTICE, MILD, ALERT
@@ -236,6 +234,8 @@ typedef struct syntaxtype {
/* The list of libmagic results that this syntax applies to. */
char *linter;
/* The command with which to lint this type of file. */
char *tab;
/* What the Tab key should produce; NULL for default behavior. */
#ifdef ENABLE_COMMENT
char *comment;
/* The line comment prefix (and postfix) for this type of file. */
@@ -295,41 +295,43 @@ typedef struct linestruct {
} linestruct;
#ifndef NANO_TINY
typedef struct undo_group {
typedef struct groupstruct {
ssize_t top_line;
/* First line of group. */
ssize_t bottom_line;
/* Last line of group. */
char **indentations;
/* String data used to restore the affected lines; one per line. */
struct undo_group *next;
} undo_group;
struct groupstruct *next;
/* The next group, if any. */
} groupstruct;
typedef struct undo {
ssize_t lineno;
typedef struct undostruct {
undo_type type;
/* What type of undo this was. */
/* The operation type that this undo item is for. */
int xflags;
/* Some flag data to mark certain corner cases. */
ssize_t lineno;
/* The line number where the operation began or ended. */
size_t begin;
/* Where did this action begin or end. */
/* The x position where the operation began or ended. */
char *strdata;
/* String type data we will use for copying the affected line back. */
/* String data to help restore the affected line. */
size_t wassize;
/* The file size before the action. */
size_t newsize;
/* The file size after the action. */
int xflags;
/* Some flag data we need. */
undo_group *grouping;
groupstruct *grouping;
/* Undo info specific to groups of lines. */
linestruct *cutbuffer;
/* Copy of the cutbuffer. */
/* A copy of the cutbuffer. */
ssize_t mark_begin_lineno;
/* Mostly the line number of the current line; sometimes something else. */
size_t mark_begin_x;
/* The x position corresponding to the above line number. */
struct undo *next;
struct undostruct *next;
/* A pointer to the undo item of the preceding action. */
} undo;
} undostruct;
#endif /* !NANO_TINY */
#ifdef ENABLE_HISTORIES
@@ -339,8 +341,9 @@ typedef struct poshiststruct {
ssize_t lineno;
/* Line number we left off on. */
ssize_t xno;
/* x position in the file we left off on. */
/* The x position in the file we left off on. */
struct poshiststruct *next;
/* The next item of position history. */
} poshiststruct;
#endif
@@ -366,8 +369,6 @@ typedef struct openfilestruct {
/* The file's x position we would like. */
ssize_t current_y;
/* The file's y-coordinate position. */
bool modified;
/* Whether the file has been modified. */
struct stat *current_stat;
/* The file's current stat information. */
#ifdef ENABLE_WRAPPING
@@ -381,19 +382,21 @@ typedef struct openfilestruct {
/* The mark's x position in the above line. */
mark_type kind_of_mark;
/* Whether it is a soft (with Shift) or a hard mark. */
file_format fmt;
format_type fmt;
/* The file's format -- Unix or DOS or Mac or mixed. */
undo *undotop;
char *lock_filename;
/* The path of the lockfile, if we created one. */
undostruct *undotop;
/* The top of the undo list. */
undo *current_undo;
undostruct *current_undo;
/* The current (i.e. next) level of undo. */
undo *last_saved;
undostruct *last_saved;
/* The undo item at which the file was last saved. */
undo_type last_action;
/* The type of the last action the user performed. */
char *lock_filename;
/* The path of the lockfile, if we created one. */
#endif
bool modified;
/* Whether the file has been modified. */
#ifdef ENABLE_COLOR
syntaxtype *syntax;
/* The syntax struct for this file, if any. */
@@ -605,6 +608,9 @@ enum
#define SHIFT_DELETE 0x45D
#define SHIFT_TAB 0x45F
/* A special keycode for when <Tab> is pressed while the mark is on. */
#define INDENT_KEY 0x4F1
#ifdef USE_SLANG
#ifdef ENABLE_UTF8
#define KEY_BAD 0xFF /* Clipped error code. */
@@ -626,9 +632,6 @@ enum
#define WAS_MARKED_FORWARD (1<<5)
#endif /* !NANO_TINY */
/* The maximum number of entries displayed in the main shortcut list. */
#define MAIN_VISIBLE (((COLS + 40) / 20) * 2)
/* The default number of columns from end of line where wrapping occurs. */
#define COLUMNS_FROM_EOL 8

View File

@@ -213,7 +213,7 @@ void do_statusbar_output(int *the_input, size_t input_len,
/* Insert the typed character into the existing answer string. */
answer = charealloc(answer, strlen(answer) + charlen + 1);
charmove(answer + typing_x + charlen, answer + typing_x,
memmove(answer + typing_x + charlen, answer + typing_x,
strlen(answer) - typing_x + 1);
strncpy(answer + typing_x, onechar, charlen);
@@ -255,7 +255,7 @@ void do_statusbar_delete(void)
if (answer[typing_x] != '\0') {
int charlen = char_length(answer + typing_x);
charmove(answer + typing_x, answer + typing_x + charlen,
memmove(answer + typing_x, answer + typing_x + charlen,
strlen(answer) - typing_x - charlen + 1);
}
}
@@ -424,12 +424,12 @@ void draw_the_promptbar(void)
void add_or_remove_pipe_symbol_from_answer(void)
{
if (answer[0] == '|') {
charmove(answer, answer + 1, strlen(answer) + 1);
memmove(answer, answer + 1, strlen(answer) + 1);
if (typing_x > 0)
typing_x--;
} else {
answer = charealloc(answer, strlen(answer) + 2);
charmove(answer + 1, answer, strlen(answer) + 1);
memmove(answer + 1, answer, strlen(answer) + 1);
answer[0] = '|';
typing_x++;
}

View File

@@ -77,7 +77,8 @@ extern int shiftaltup, shiftaltdown;
#endif
#ifdef ENABLED_WRAPORJUSTIFY
extern ssize_t fill, wrap_at;
extern ssize_t fill;
extern size_t wrap_at;
#endif
extern char *last_search;
@@ -212,9 +213,12 @@ bool is_ascii_cntrl_char(int c);
bool is_cntrl_mbchar(const char *c);
bool is_word_mbchar(const char *c, bool allow_punct);
char control_mbrep(const char *c, bool isdata);
#ifdef ENABLE_UTF8
int mbwidth(const char *c);
#endif
char *make_mbchar(long chr, int *chr_mb_len);
int char_length(const char *pointer);
size_t mbstrlen(const char *s);
int parse_mbchar(const char *buf, char *chr, size_t *col);
size_t step_left(const char *buf, size_t pos);
size_t step_right(const char *buf, size_t pos);
@@ -223,7 +227,6 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n);
char *mbstrcasestr(const char *haystack, const char *needle);
char *revstrstr(const char *haystack, const char *needle, const char *index);
char *mbrevstrcasestr(const char *haystack, const char *needle, const char *index);
size_t mbstrlen(const char *s);
#if !defined(NANO_TINY) || defined(ENABLE_JUSTIFY)
char *mbstrchr(const char *s, const char *c);
#endif
@@ -317,9 +320,10 @@ char *input_tab(char *buf, bool allow_files, size_t *place,
#endif
/* Some functions in global.c. */
size_t length_of_list(int menu);
const keystruct *first_sc_for(int menu, void (*func)(void));
int the_code_for(void (*func)(void), int defaultval);
size_t shown_entries_for(int menu);
const keystruct *get_shortcut(int *kbinput);
functionptrtype func_from_key(int *kbinput);
int keycode_from_string(const char *keystring);
void assign_keyinfo(keystruct *s, const char *keystring, const int keycode);
@@ -333,7 +337,7 @@ char *menu_to_name(int menu);
/* All functions in help.c. */
#ifdef ENABLE_HELP
void wrap_help_text_into_buffer();
void wrap_help_text_into_buffer(void);
void do_help(void);
void help_init(void);
functionptrtype parse_help_input(int *kbinput);
@@ -399,7 +403,7 @@ void free_lines(linestruct *src);
void renumber_from(linestruct *line);
void partition_buffer(linestruct *top, size_t top_x,
linestruct *bot, size_t bot_x);
void unpartition_buffer();
void unpartition_buffer(void);
void extract(linestruct *top, size_t top_x, linestruct *bot, size_t bot_x);
void ingraft_buffer(linestruct *somebuffer);
void copy_from_buffer(linestruct *somebuffer);
@@ -468,7 +472,7 @@ int do_yesno_prompt(bool all, const char *msg);
/* Most functions in rcfile.c. */
#ifdef ENABLE_NANORC
void display_rcfile_errors();
void display_rcfile_errors(void);
#ifdef ENABLE_COLOR
void parse_one_include(char *file, syntaxtype *syntax);
void grab_and_store(const char *kind, char *ptr, regexlisttype **storage);
@@ -520,7 +524,7 @@ void do_enter(void);
#ifndef NANO_TINY
RETSIGTYPE cancel_command(int signal);
bool execute_command(const char *command);
void discard_until(const undo *thisitem, openfilestruct *thefile, bool keep);
void discard_until(const undostruct *thisitem, openfilestruct *thefile, bool keep);
void add_undo(undo_type action);
void update_multiline_undo(ssize_t lineno, char *indentation);
void update_undo(undo_type action);
@@ -617,7 +621,6 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *count);
#ifdef ENABLE_MOUSE
int get_mouseinput(int *mouse_row, int *mouse_col, bool allow_shortcuts);
#endif
const keystruct *get_shortcut(int *kbinput);
void blank_edit(void);
void blank_statusbar(void);
void wipe_statusbar(void);

View File

@@ -152,7 +152,7 @@ static linestruct *errors_tail = NULL;
/* Beginning and end of a list of errors in rcfiles, if any. */
/* Send the gathered error messages (if any) to the terminal. */
void display_rcfile_errors()
void display_rcfile_errors(void)
{
for (linestruct *error = errors_head; error != NULL; error = error->next)
fprintf(stderr, "%s\n", error->data);
@@ -333,6 +333,7 @@ void begin_new_syntax(char *ptr)
live_syntax->headers = NULL;
live_syntax->magics = NULL;
live_syntax->linter = NULL;
live_syntax->tab = NULL;
#ifdef ENABLE_COMMENT
live_syntax->comment = mallocstrcpy(NULL, GENERAL_COMMENT_CHARACTER);
#endif
@@ -947,6 +948,10 @@ bool parse_syntax_commands(char *keyword, char *ptr)
else if (strcasecmp(keyword, "comment") == 0) {
#ifdef ENABLE_COMMENT
pick_up_name("comment", ptr, &live_syntax->comment);
#endif
} else if (strcasecmp(keyword, "tabgives") == 0) {
#ifdef ENABLE_COLOR
pick_up_name("tabgives", ptr, &live_syntax->tab);
#endif
} else if (strcasecmp(keyword, "linter") == 0)
pick_up_name("linter", ptr, &live_syntax->linter);
@@ -1090,6 +1095,7 @@ void parse_rcfile(FILE *rcstream, bool just_syntax, bool intros_only)
} else if (intros_only && (strcasecmp(keyword, "color") == 0 ||
strcasecmp(keyword, "icolor") == 0 ||
strcasecmp(keyword, "comment") == 0 ||
strcasecmp(keyword, "tabgives") == 0 ||
strcasecmp(keyword, "linter") == 0)) {
if (!opensyntax)
jot_error(N_("A '%s' command requires a preceding "
@@ -1163,8 +1169,6 @@ void parse_rcfile(FILE *rcstream, bool just_syntax, bool intros_only)
option++;
ptr = parse_argument(ptr);
option = mallocstrcpy(NULL, option);
#ifdef ENABLE_UTF8
/* When in a UTF-8 locale, ignore arguments with invalid sequences. */
if (using_utf8() && mbstowcs(NULL, option, 0) == (size_t)-1) {
@@ -1172,6 +1176,8 @@ void parse_rcfile(FILE *rcstream, bool just_syntax, bool intros_only)
continue;
}
#endif
option = mallocstrcpy(NULL, option);
#ifdef ENABLE_COLOR
if (strcasecmp(rcopts[i].name, "titlecolor") == 0)
color_combo[TITLE_BAR] = parse_interface_color(option);
@@ -1294,7 +1300,7 @@ void parse_one_nanorc(void)
jot_error(N_("Error reading %s: %s"), nanorc, strerror(errno));
}
bool have_nanorc(const char *path, char *name)
bool have_nanorc(const char *path, const char *name)
{
if (path == NULL)
return FALSE;

View File

@@ -98,7 +98,7 @@ void search_init(bool replacing, bool keep_the_answer)
answer, &search_history, edit_refresh,
/* TRANSLATORS: This is the main search prompt. */
"%s%s%s%s%s%s", _("Search"),
/* TRANSLATORS: The next five modify the search prompt. */
/* TRANSLATORS: The next four modify the search prompt. */
ISSET(CASE_SENSITIVE) ? _(" [Case Sensitive]") : "",
ISSET(USE_REGEXP) ? _(" [Regexp]") : "",
ISSET(BACKWARDS_SEARCH) ? _(" [Backwards]") : "",

View File

@@ -76,12 +76,17 @@ const char *invocation_error(const char *name)
* of spaces that a tab would normally take up. */
void do_tab(void)
{
#ifdef ENABLE_COLOR
if (openfile->syntax && openfile->syntax->tab)
do_output(openfile->syntax->tab, strlen(openfile->syntax->tab), TRUE);
else
#endif
#ifndef NANO_TINY
if (ISSET(TABS_TO_SPACES)) {
char *spaces = charalloc(tabsize + 1);
size_t length = tabsize - (xplustabs() % tabsize);
charset(spaces, ' ', length);
memset(spaces, ' ', length);
spaces[length] = '\0';
do_output(spaces, length, TRUE);
@@ -105,7 +110,7 @@ void indent_a_line(linestruct *line, char *indentation)
/* Add the fabricated indentation to the beginning of the line. */
line->data = charealloc(line->data, length + indent_len + 1);
charmove(line->data + indent_len, line->data, length + 1);
memmove(line->data + indent_len, line->data, length + 1);
strncpy(line->data, indentation, indent_len);
openfile->totsize += indent_len;
@@ -141,8 +146,13 @@ void do_indent(void)
indentation = charalloc(tabsize + 1);
/* Set the indentation to either a bunch of spaces or a single tab. */
#ifdef ENABLE_COLOR
if (openfile->syntax && openfile->syntax->tab)
indentation = mallocstrcpy(indentation, openfile->syntax->tab);
else
#endif
if (ISSET(TABS_TO_SPACES)) {
charset(indentation, ' ', tabsize);
memset(indentation, ' ', tabsize);
indentation[tabsize] = '\0';
} else {
indentation[0] = '\t';
@@ -172,16 +182,28 @@ void do_indent(void)
* but at most a tab's worth. */
size_t length_of_white(const char *text)
{
size_t bytes_of_white = 0;
size_t white_count = 0;
#ifdef ENABLE_COLOR
if (openfile->syntax && openfile->syntax->tab) {
size_t thelength = strlen(openfile->syntax->tab);
while (text[white_count] == openfile->syntax->tab[white_count])
if (++white_count == thelength)
return thelength;
white_count = 0;
}
#endif
while (TRUE) {
if (*text == '\t')
return ++bytes_of_white;
return ++white_count;
if (*text != ' ')
return bytes_of_white;
return white_count;
if (++bytes_of_white == tabsize)
if (++white_count == tabsize)
return tabsize;
text++;
@@ -217,7 +239,7 @@ void unindent_a_line(linestruct *line, size_t indent_len)
return;
/* Remove the first tab's worth of whitespace from this line. */
charmove(line->data, line->data + indent_len, length - indent_len + 1);
memmove(line->data, line->data + indent_len, length - indent_len + 1);
openfile->totsize -= indent_len;
@@ -265,9 +287,9 @@ void do_unindent(void)
}
/* Perform an undo or redo for an indent or unindent action. */
void handle_indent_action(undo *u, bool undoing, bool add_indent)
void handle_indent_action(undostruct *u, bool undoing, bool add_indent)
{
undo_group *group = u->grouping;
groupstruct *group = u->grouping;
linestruct *line = line_from_number(group->top_line);
if (group->next != NULL)
@@ -319,10 +341,10 @@ bool comment_line(undo_type action, linestruct *line, const char *comment_seq)
/* Make room for the comment sequence(s), move the text right and
* copy them in. */
line->data = charealloc(line->data, line_len + pre_len + post_len + 1);
charmove(line->data + pre_len, line->data, line_len + 1);
charmove(line->data, comment_seq, pre_len);
memmove(line->data + pre_len, line->data, line_len + 1);
memmove(line->data, comment_seq, pre_len);
if (post_len > 0)
charmove(line->data + pre_len + line_len, post_seq, post_len + 1);
memmove(line->data + pre_len + line_len, post_seq, post_len + 1);
openfile->totsize += pre_len + post_len;
@@ -345,7 +367,7 @@ bool comment_line(undo_type action, linestruct *line, const char *comment_seq)
return TRUE;
/* Erase the comment prefix by moving the non-comment part. */
charmove(line->data, line->data + pre_len, line_len - pre_len);
memmove(line->data, line->data + pre_len, line_len - pre_len);
/* Truncate the postfix if there was one. */
line->data[line_len - pre_len - post_len] = '\0';
@@ -422,9 +444,9 @@ void do_comment(void)
}
/* Perform an undo or redo for a comment or uncomment action. */
void handle_comment_action(undo *u, bool undoing, bool add_comment)
void handle_comment_action(undostruct *u, bool undoing, bool add_comment)
{
undo_group *group = u->grouping;
groupstruct *group = u->grouping;
/* When redoing, reposition the cursor and let the commenter adjust it. */
if (!undoing)
@@ -454,10 +476,9 @@ void handle_comment_action(undo *u, bool undoing, bool add_comment)
#define redo_paste undo_cut
#define undo_paste redo_cut
/* Undo a cut, or redo an uncut. */
void undo_cut(undo *u)
/* Undo a cut, or redo a paste. */
void undo_cut(undostruct *u)
{
/* Get to where we need to uncut from. */
if (u->xflags & WAS_WHOLE_LINE)
goto_line_posx(u->mark_begin_lineno, 0);
else
@@ -478,8 +499,8 @@ void undo_cut(undo *u)
goto_line_posx(u->mark_begin_lineno, u->mark_begin_x);
}
/* Redo a cut, or undo an uncut. */
void redo_cut(undo *u)
/* Redo a cut, or undo a paste. */
void redo_cut(undostruct *u)
{
linestruct *oldcutbuffer = cutbuffer;
@@ -503,7 +524,7 @@ void redo_cut(undo *u)
/* Undo the last thing(s) we did. */
void do_undo(void)
{
undo *u = openfile->current_undo;
undostruct *u = openfile->current_undo;
linestruct *f = NULL, *t = NULL;
linestruct *oldcutbuffer;
char *data, *undidmsg = NULL;
@@ -518,6 +539,7 @@ void do_undo(void)
f = line_from_number(u->mark_begin_lineno);
openfile->current_x = u->begin;
switch (u->type) {
case ADD:
/* TRANSLATORS: The next thirteen strings describe actions
@@ -672,7 +694,7 @@ void do_redo(void)
{
linestruct *f = NULL, *shoveline;
char *data, *redidmsg = NULL;
undo *u = openfile->undotop;
undostruct *u = openfile->undotop;
if (u == NULL || u == openfile->current_undo) {
statusbar(_("Nothing to redo"));
@@ -1062,10 +1084,10 @@ bool execute_command(const char *command)
/* Discard undo items that are newer than the given one, or all if NULL.
* When keep is TRUE, do not touch the last_saved pointer. */
void discard_until(const undo *thisitem, openfilestruct *thefile, bool keep)
void discard_until(const undostruct *thisitem, openfilestruct *thefile, bool keep)
{
undo *dropit = thefile->undotop;
undo_group *group;
undostruct *dropit = thefile->undotop;
groupstruct *group;
while (dropit != NULL && dropit != thisitem) {
thefile->undotop = dropit->next;
@@ -1073,7 +1095,7 @@ void discard_until(const undo *thisitem, openfilestruct *thefile, bool keep)
free_lines(dropit->cutbuffer);
group = dropit->grouping;
while (group != NULL) {
undo_group *next = group->next;
groupstruct *next = group->next;
free_chararray(group->indentations,
group->bottom_line - group->top_line);
free(group);
@@ -1084,7 +1106,7 @@ void discard_until(const undo *thisitem, openfilestruct *thefile, bool keep)
}
/* Adjust the pointer to the top of the undo stack. */
thefile->current_undo = (undo *)thisitem;
thefile->current_undo = (undostruct *)thisitem;
/* Prevent a chain of editing actions from continuing. */
thefile->last_action = OTHER;
@@ -1092,20 +1114,15 @@ void discard_until(const undo *thisitem, openfilestruct *thefile, bool keep)
/* When requested, record that the undo stack was chopped, and
* that thus there is no point at which the file was last saved. */
if (!keep)
thefile->last_saved = (undo *)0xbeeb;
thefile->last_saved = (undostruct *)0xbeeb;
}
/* Add a new undo item of the given type to the top of the current pile. */
void add_undo(undo_type action)
{
undo *u = openfile->current_undo;
/* The thing we did previously. */
undostruct *u = nmalloc(sizeof(undostruct));
/* Blow away newer undo items if we add somewhere in the middle. */
discard_until(u, openfile, TRUE);
/* Allocate and initialize a new undo item. */
u = (undo *) nmalloc(sizeof(undo));
/* Initialize the newly allocated undo item. */
u->type = action;
u->strdata = NULL;
u->cutbuffer = NULL;
@@ -1115,8 +1132,11 @@ void add_undo(undo_type action)
u->mark_begin_x = openfile->current_x;
u->wassize = openfile->totsize;
u->newsize = openfile->totsize;
u->xflags = 0;
u->grouping = NULL;
u->xflags = 0;
/* Blow away any undone items. */
discard_until(openfile->current_undo, openfile, TRUE);
#ifdef ENABLE_WRAPPING
/* If some action caused automatic long-line wrapping, insert the
@@ -1228,7 +1248,7 @@ void add_undo(undo_type action)
* added or removed is saved separately for each line in the undo item. */
void update_multiline_undo(ssize_t lineno, char *indentation)
{
undo *u = openfile->current_undo;
undostruct *u = openfile->current_undo;
/* If there already is a group and the current line is contiguous with it,
* extend the group; otherwise, create a new group. */
@@ -1243,7 +1263,7 @@ void update_multiline_undo(ssize_t lineno, char *indentation)
u->grouping->indentations[number_of_lines - 1] = mallocstrcpy(NULL,
indentation);
} else {
undo_group *born = (undo_group *)nmalloc(sizeof(undo_group));
groupstruct *born = nmalloc(sizeof(groupstruct));
born->next = u->grouping;
u->grouping = born;
@@ -1262,7 +1282,7 @@ void update_multiline_undo(ssize_t lineno, char *indentation)
* cursor position after the given action. */
void update_undo(undo_type action)
{
undo *u = openfile->undotop;
undostruct *u = openfile->undotop;
char *char_buf;
int charlen;
@@ -1496,7 +1516,7 @@ bool do_wrap(void)
line_len = strlen(line->data);
line->data = charealloc(line->data, lead_len + line_len + 1);
charmove(line->data + lead_len, line->data, line_len + 1);
memmove(line->data + lead_len, line->data, line_len + 1);
strncpy(line->data, line->prev->data, lead_len);
openfile->current_x += lead_len;
@@ -2047,7 +2067,7 @@ void do_justify(bool full_justify)
if (needed_top_extra > 0) {
cutbuffer->data = charealloc(cutbuffer->data,
line_len + needed_top_extra + 1);
charmove(cutbuffer->data + needed_top_extra, cutbuffer->data,
memmove(cutbuffer->data + needed_top_extra, cutbuffer->data,
line_len + 1);
strncpy(cutbuffer->data, the_lead, needed_top_extra);
line_len += needed_top_extra;
@@ -2061,7 +2081,7 @@ void do_justify(bool full_justify)
/* Remove extra whitespace after the leading part. */
if (indent_len > 0)
charmove(cutbuffer->data + lead_len,
memmove(cutbuffer->data + lead_len,
cutbuffer->data + lead_len + indent_len,
line_len - indent_len + 1);
@@ -2088,7 +2108,7 @@ void do_justify(bool full_justify)
* remove the (now-redundant) addition we made earlier. */
if (top_x > 0) {
if (needed_top_extra > 0)
charmove(cutbuffer->data, cutbuffer->data + needed_top_extra,
memmove(cutbuffer->data, cutbuffer->data + needed_top_extra,
strlen(cutbuffer->data) - needed_top_extra + 1);
else {
cutbuffer->prev = make_new_node(NULL);
@@ -3182,6 +3202,7 @@ void complete_a_word(void)
/* If there is no word fragment before the cursor, do nothing. */
if (start_of_shard == openfile->current_x) {
/* TRANSLATORS: Shown when no text is directly left of the cursor. */
statusbar(_("No word fragment"));
pletion_line = NULL;
return;

View File

@@ -658,12 +658,8 @@ int parse_kbinput(WINDOW *win)
#ifndef NANO_TINY
/* When <Tab> is pressed while the mark is on, do an indent. */
if (retval == TAB_CODE && openfile->mark && currmenu == MMAIN) {
const keystruct *command = first_sc_for(MMAIN, do_indent);
meta_key = command->meta;
return command->keycode;
}
if (retval == TAB_CODE && openfile->mark && currmenu == MMAIN)
return INDENT_KEY;
#endif
switch (retval) {
@@ -1695,17 +1691,14 @@ int get_mouseinput(int *mouse_y, int *mouse_x, bool allow_shortcuts)
return 0;
}
/* Determine how many shortcuts will be shown. */
number = length_of_list(currmenu);
if (number > MAIN_VISIBLE)
number = MAIN_VISIBLE;
/* Determine how many shortcuts are being shown. */
number = shown_entries_for(currmenu);
/* Calculate the width of each non-rightmost shortcut item;
* the rightmost ones will "absorb" any remaining slack. */
if (number < 2)
width = COLS / (MAIN_VISIBLE / 2);
/* Calculate the clickable width of each menu item. */
if (number < 5)
width = COLS / 2;
else
width = COLS / ((number / 2) + (number % 2));
width = COLS / ((number + 1) / 2);
/* Calculate the one-based index in the shortcut list. */
index = (*mouse_x / width) * 2 + *mouse_y;
@@ -1768,28 +1761,6 @@ int get_mouseinput(int *mouse_y, int *mouse_x, bool allow_shortcuts)
}
#endif /* ENABLE_MOUSE */
/* Return the shortcut that corresponds to the values of kbinput (the
* key itself) and meta_key (whether the key is a meta sequence). The
* returned shortcut will be the first in the list that corresponds to
* the given sequence. */
const keystruct *get_shortcut(int *kbinput)
{
keystruct *s;
/* Plain characters cannot be shortcuts, so just skip those. */
if (!meta_key && ((*kbinput >= 0x20 && *kbinput < 0x7F) ||
(*kbinput >= 0xA0 && *kbinput <= 0xFF)))
return NULL;
for (s = sclist; s != NULL; s = s->next) {
if ((s->menus & currmenu) && *kbinput == s->keycode &&
meta_key == s->meta)
return s;
}
return NULL;
}
/* Move (in the given window) to the given row and wipe it clean. */
void blank_row(WINDOW *window, int row)
{
@@ -1919,11 +1890,13 @@ char *display_string(const char *buf, size_t column, size_t span,
#ifdef ENABLE_UTF8
#define ISO8859_CHAR FALSE
#define ZEROWIDTH_CHAR (mbwidth(buf) == 0)
#else
#define ISO8859_CHAR ((unsigned char)*buf > 0x9F)
#define ZEROWIDTH_CHAR FALSE
#endif
while (*buf != '\0' && (column < beyond || mbwidth(buf) == 0)) {
while (*buf != '\0' && (column < beyond || ZEROWIDTH_CHAR)) {
/* A plain printable ASCII character is one byte, one column. */
if (((signed char)*buf > 0x20 && *buf != DEL_CODE) || ISO8859_CHAR) {
converted[index++] = *(buf++);
@@ -2011,15 +1984,17 @@ char *display_string(const char *buf, size_t column, size_t span,
/* If there is more text than can be shown, make room for the ">". */
if (column > beyond || (*buf != '\0' && (isprompt ||
(isdata && !ISSET(SOFTWRAP))))) {
(isdata && !ISSET(SOFTWRAP))))) {
#ifdef ENABLE_UTF8
do {
index = step_left(converted, index);
} while (mbwidth(converted + index) == 0);
#ifdef ENABLE_UTF8
/* Display the left half of a two-column character as '['. */
if (mbwidth(converted + index) == 2)
converted[index++] = '[';
#else
index--;
#endif
}
@@ -2316,14 +2291,11 @@ void bottombars(int menu)
if (ISSET(NO_HELP) || LINES < 5)
return;
/* Determine how many shortcuts there are to show. */
number = length_of_list(menu);
if (number > MAIN_VISIBLE)
number = MAIN_VISIBLE;
/* Determine how many shortcuts must be shown. */
number = shown_entries_for(menu);
/* Compute the width of each keyname-plus-explanation pair. */
itemwidth = COLS / ((number / 2) + (number % 2));
itemwidth = COLS / ((number + 1) / 2);
/* If there is no room, don't print anything. */
if (itemwidth == 0)

View File

@@ -4,7 +4,7 @@ syntax nanorc "\.?nanorc$"
comment "#"
# Possible errors and parameters
icolor brightred "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|comment|linter|i?color|extendsyntax).*"
icolor brightred "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|comment|linter|tabgives|i?color|extendsyntax).*"
# Keywords
icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(afterends|allow_insecure_backup|atblanks|autoindent|backup|backwards|boldtext|breaklonglines|casesensitive|constantshow|cutfromcursor|emptyline|finalnewline|historylog|jumpyscrolling|linenumbers|locking|morespace|mouse|multibuffer|noconvert|nohelp|nopauses|nonewlines|nowrap|positionlog|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|showcursor|smarthome|smooth|softwrap|suspend|tabstospaces|tempfile|trimblanks|unix|view|wordbounds|zap)\>"
@@ -13,9 +13,9 @@ icolor brightgreen "^[[:space:]]*set[[:space:]]+(backupdir|brackets|errorcolor|f
icolor brightgreen "^[[:space:]]*set[[:space:]]+(fill[[:space:]]+-?[[:digit:]]+|(guidestripe|tabsize)[[:space:]]+[1-9][0-9]*)\>"
icolor brightgreen "^[[:space:]]*bind[[:space:]]+((\^([[:alpha:]]|[]@\^_]|Space)|M-([[:alpha:]]|[]!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+([[:alpha:]]+|".*")[[:space:]]+(all|main|search|replace(with)?|yesno|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)"
icolor brightgreen "^[[:space:]]*unbind[[:space:]]+((\^([[:alpha:]]|[]@\^_]|Space)|M-([[:alpha:]]|[]!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+(all|main|search|replace(with)?|yesno|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)"
icolor brightgreen "^[[:space:]]*extendsyntax[[:space:]]+[[:alpha:]]+[[:space:]]+(i?color|header|magic|comment|linter)[[:space:]]+.*"
icolor brightgreen "^[[:space:]]*extendsyntax[[:space:]]+[[:alpha:]]+[[:space:]]+(i?color|header|magic|comment|linter|tabgives)[[:space:]]+.*"
icolor brightgreen "^[[:space:]]*(syntax|linter)[[:space:]]+[^[:blank:]]+"
icolor green "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|comment|linter|extendsyntax)\>"
icolor green "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|comment|linter|tabgives|extendsyntax)\>"
# Strings
color brightmagenta "([[:space:]]|(start|end)=)".+"([[:space:]]|$)"

View File

@@ -11,7 +11,7 @@ comment "//"
color magenta "fn [a-z_0-9]+"
# Reserved words
color yellow "\<(abstract|alignof|as|become|box|break|const|continue|crate|do|else|enum|extern|false|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|offsetof|override|priv|pub|pure|ref|return|sizeof|static|self|struct|super|true|trait|type|typeof|unsafe|unsized|use|virtual|where|while|yield)\>"
color yellow "\<(abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|false|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|true|try|type|typeof|unsafe|unsized|use|virtual|where|while|yield)\>"
# Macros
color red "[a-z_]+!"