Compare commits

...

89 Commits
v4.0 ... v4.1

Author SHA1 Message Date
Benno Schulenberg
576c20c4e4 po: update translations and regenerate POT file and PO files 2019-04-15 09:57:12 +02:00
Benno Schulenberg
3a0a6b5db8 bump version numbers and add a news item for the 4.1 release 2019-04-15 09:33:07 +02:00
Benno Schulenberg
c039aaad9d tweaks: remove several unneeded bad-state checks and their messages
No one ever reported seeing any of them, and each of these checks
has been there for at least a year.
2019-04-14 19:38:04 +02:00
Benno Schulenberg
145bb6e01a build: don't do fuzzy matching when merging PO files against the POT file
Fuzzy strings don't contribute anything to the translations that the
users get to see.  They are useful only for translators, but translators
fetch or receive their PO files from the TP.  For nano, fuzzy strings
just bloat the distribution tarball.
2019-04-14 10:47:41 +02:00
Benno Schulenberg
9cc70d2069 tweaks: shorten a comment to its essence 2019-04-14 10:10:03 +02:00
Benno Schulenberg
3604ad2950 build: remove obsolete translations from the PO files after merging
These obsolete strings contribute nothing to the translations that the
users get to see.  They are somewhat useful only for translators.  But
as nano is registered at the Translation Project, translators fetch or
receive their PO file from there (or they keep their own archive), so
these obsolete strings are not getting lost.  But for nano, they just
burden the distribution tarball.
2019-04-14 09:55:23 +02:00
Benno Schulenberg
1fe3e2ed69 docs: mention that -b is the opposite of -w also in the latter's item 2019-04-14 08:49:25 +02:00
Benno Schulenberg
baca8bb19e indenting, commenting: ensure a partial line stays displayed properly
Do the same as in the previous commit: re-evaluate the start of the
viewport when lines that are located above this viewport may have
changed.  This is relevant when softwrap is on.
2019-04-13 11:51:14 +02:00
Benno Schulenberg
1c707d4f99 unindent: ensure that a partial line gets displayed properly afterwards
When only the trailing chunk of a line is displayed on the top row of
the screen, and the unindenting of this line leads to a reduction in
the number of chunks, then the starting point of the viewport needs
to be re-evaluated.  For simplicity, do this always when something is
unindented.

This fixes https://savannah.gnu.org/bugs/?56102.
Reported-by: Devin Hussey <husseydevin@gmail.com>

Bug existed since around version 2.9.2.
2019-04-13 11:36:53 +02:00
Benno Schulenberg
c0e3779453 display: report and catch a bad state, to prevent a possible hang 2019-04-12 19:18:21 +02:00
Benno Schulenberg
bf6bcde078 tweaks: initialize a boolean before it is referenced [valgrind]
Found because of a report by Devin Hussey <husseydevin@gmail.com>.
2019-04-12 13:37:54 +02:00
Benno Schulenberg
167a8e5c09 options: make --nowrap override again a contrary nanorc setting
All other options are off by default and can only be switched *on*
(either by a command-line option or a nanorc setting) -- there are
no command-line options to switch them off again.  Except for the
--breaklonglines/--nowrap pair.  So these need special handling.

This fixes https://savannah.gnu.org/bugs/?56119.
Reported-by: Sébastien Desreux <seb@h-k.fr>

Bug existed since version 4.0, commit 4d40bea5.
2019-04-12 10:35:20 +02:00
Benno Schulenberg
90cbdbbe75 docs: mention that M-S now toggles softwrap and M-N line numbers 2019-04-11 17:46:19 +02:00
Benno Schulenberg
d83a8eb359 justify: correctly compute the number of lines to take, to avoid a crash
When the file starts with one or more blank lines, the first paragraph
doesn't start on line 1.

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

Bug existed since version 4.0, commit ac8bd2a2.
2019-04-11 16:11:49 +02:00
Benno Schulenberg
98cc39e8e5 tweaks: reshuffle some lines, to elide an 'if' 2019-04-11 15:12:04 +02:00
Benno Schulenberg
b20fadd604 tweaks: free the copy of a linter message in all cases [valgrind] 2019-04-11 14:17:32 +02:00
Benno Schulenberg
cdf0f8e68a tweaks: drop two 'const' qualifiers, to silence the compiler 2019-04-11 12:31:50 +02:00
Benno Schulenberg
f645009a5e tweaks: free the result string from an invocation error [coverity] 2019-04-11 10:05:39 +02:00
Benno Schulenberg
2b2736d41a tweaks: free some memory before a possible error exit [coverity] 2019-04-11 09:55:18 +02:00
Benno Schulenberg
5a6029a938 tweaks: rename some variables, for more contrast and to match others 2019-04-11 09:38:06 +02:00
Benno Schulenberg
8d272db4e6 tweaks: rename two variables, for more contrast 2019-04-11 09:14:30 +02:00
Benno Schulenberg
70885d0f9a tweaks: use a signed type for a result that could be negative [coverity] 2019-04-11 09:11:53 +02:00
Benno Schulenberg
f1e5da6cdd help: don't doubly list toggles that have two keys assigned to them 2019-04-09 19:48:41 +02:00
Benno Schulenberg
d79b9823ae bindings: add easier keystrokes for the linenumber and softwrap toggles
For most people, M-N and M-S are simpler to type than M-# and M-$,
and more mnemonic.
2019-04-09 17:48:26 +02:00
Benno Schulenberg
82f1ce8ebf bindings: remove the jumpy-scrolling toggle entirely
It is still possible to use --jumpyscrolling on the command line or
'set jumpyscrolling' in a nanorc file, but a user will have to restart
nano when they decide they want chunky instead of smooth scrolling,
a decision that should be rather rare.

This frees up the M-S keystroke to be reused for toggling softwrap.
2019-04-09 17:46:21 +02:00
Benno Schulenberg
50ee655f9d gnulib: update to its current upstream state 2019-04-09 14:44:51 +02:00
Benno Schulenberg
5459f56f6d build: add gnulib modules to the list of files with translatable strings
The error messages from gnulib need to be included into nano's POT file
so that those messages get translated when nano is built on a platform
where the modules that contain the messages get used.

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

Bug existed since gnulib support was added in version 2.8.0.
The relevant modules were added by commits 3deec435 and 272345cc.
2019-04-09 13:49:36 +02:00
Benno Schulenberg
209531a761 docs: remove all mention of --finalnewline, and undefault --nonewlines 2019-04-07 10:02:22 +02:00
Benno Schulenberg
2552307064 options: remove -f (--finalnewline); go back to auto-adding this newline
For relatively inexperienced users (as most users of nano probably are)
it is far better that nano produces POSIX text files by default, where
each line ends with a newline character.  This means that these files
will "print" properly (not gluing the next prompt at the end of the
last line), tools will see and process each line of them, and, while
editing, adding text at the end is easier.

This addresses https://savannah.gnu.org/bugs/?55997.
Reported-by: Ralph Corderoy <ralph@inputplus.co.uk>
2019-04-07 10:02:05 +02:00
Benno Schulenberg
5601b9a66b tweaks: switch back from checking FINAL_NEWLINE to checking NO_NEWLINES
This effectively reverts commit b6a76223 from a good two months ago.
2019-04-07 08:50:35 +02:00
Benno Schulenberg
81dcb13783 tweaks: remove an unpaired closing parenthesis from the NEWS file 2019-04-06 21:21:38 +02:00
Benno Schulenberg
580fd13424 tweaks: do a check up front instead of every time round the loop
Instead of doing a check every time round the loop when it is useful
only the first time, duplicate a bit a code and do the check and its
related action beforehand.

Also, improve some comments.
2019-04-06 21:07:20 +02:00
Benno Schulenberg
790ce3791a tweaks: reshuffle some lines, condense a comment and drop another
Also, find_bracket_match() is only called when there is a bracket under
the cursor, so stepping forward will never go beyond the end-of-line,
so the central loop does not need to check for that.
2019-04-06 20:37:22 +02:00
Benno Schulenberg
97cd62a8fb tweaks: rename two variables, to make more sense 2019-04-06 20:29:04 +02:00
Benno Schulenberg
2f68bbb5e8 tweaks: reword a comment, and drop an unneeded assert 2019-04-06 20:08:39 +02:00
Benno Schulenberg
55952c0984 tweaks: adjust the indentation after the previous change
Also, improve a comment and shorten another, change a 'for' to a 'while'
(as the end point is not known), and rename a parameter from a single
letter to a word.
2019-04-06 19:45:45 +02:00
Benno Schulenberg
d9cfdd364b tweaks: don't bother special-casing non-UTF8 when seeking a character
This code is seldom used (only when searching for a matching bracket),
so speed is not a priority.
2019-04-06 19:34:09 +02:00
Liu Hao
c9605e7308 syntax: c: change the highlighting of preprocessor directives
Some of these directives are now colored in their entirety, while for
a few others it's still just the keyword itself that is colored.

Signed-off-by: Liu Hao <lh_mouse@126.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2019-04-06 17:51:07 +02:00
Benno Schulenberg
c3f97bc9b7 rcfile: read the syntax files in alphabetical order when globbing
The reading order must be predictable, otherwise things might get
colored differently from system to system.

This fixes https://savannah.gnu.org/bugs/?56012.
2019-04-06 17:50:55 +02:00
Benno Schulenberg
4399b734db bindings: disallow executing an external command when in view mode
Otherwise the user could do something like

  ^R^X  sed -i 's/a/surprise!/g' name-of-current-file  <Enter>

and the file being viewed would be modified anyway.
2019-04-06 17:41:44 +02:00
Benno Schulenberg
b9581bd50a tweaks: rename two variables, to match others
Also, initialize them straightaway.
2019-04-06 11:54:32 +02:00
Benno Schulenberg
408f15954e feedback: replace an assert with a check plus error message at startup 2019-04-06 10:03:52 +02:00
Benno Schulenberg
f585403b36 build: add src/cut.c to the list of files with translatable strings
(Also, adjust the style of one of the messages.)

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

Bug existed since version 4.0, commit 50e8f8aa.
2019-04-06 09:40:53 +02:00
Benno Schulenberg
601973ddc2 tweaks: rename another variable, to be more descriptive 2019-04-05 11:01:07 +02:00
Benno Schulenberg
25a5fb8231 tweaks: rename a variable, to get out of the way for another rename 2019-04-05 10:50:15 +02:00
Benno Schulenberg
897e557ce3 tweaks: rename a variable, to be more distinct and more descriptive 2019-04-05 10:45:22 +02:00
Benno Schulenberg
81bee1f5fd tweaks: shorten and improve some comments, and reshuffle a few lines 2019-04-05 10:35:48 +02:00
Benno Schulenberg
691eb1145c tweaks: remove a function that is now unused 2019-04-04 14:53:53 +02:00
Benno Schulenberg
fb04dff6d7 tweaks: don't bother reallocating the data when a line gets hard-wrapped
This will waste some memory, but... if the user keeps editing, she is
likely to revisit the line and the data will get reallocated soon enough.
2019-04-04 14:44:44 +02:00
Benno Schulenberg
c224ea3ce7 tweaks: reshuffle two lines, and reword a comment 2019-04-04 14:23:07 +02:00
Benno Schulenberg
2a2fe7208a tweaks: condense a bit of copying code 2019-04-04 14:11:52 +02:00
Benno Schulenberg
3f9d8011b9 tweaks: don't bother copying the NUL byte -- it is set nine lines down 2019-04-04 13:59:00 +02:00
Benno Schulenberg
4788c5f97d tweaks: don't bother reallocating the squeezed string, just terminate it
The string will be rewrapped right after, within microseconds.
2019-04-04 13:56:41 +02:00
Benno Schulenberg
a5869ba450 tweaks: rename another variable, to be more fitting 2019-04-04 13:52:27 +02:00
Benno Schulenberg
7bc324f276 tweaks: rename two variables, to be more distinct and more fitting 2019-04-04 13:48:34 +02:00
Benno Schulenberg
8d40b568fa tweaks: rename a variable, to be more distinct and more apt 2019-04-04 13:39:11 +02:00
Benno Schulenberg
0c0afb0039 tweaks: simplify a message, and normalize the spelling of another one
The word "buffer" in relation to undo has been confusing to translators.

Also, drop the exclamation mark, as there is nothing important or urgent
about these messages.
2019-04-04 12:55:58 +02:00
Benno Schulenberg
2281ec9a31 tweaks: remove an unneeded check for NULL [coverity] 2019-04-04 12:47:20 +02:00
Benno Schulenberg
cd0917fe10 tweaks: remove an unneeded check for NULL and its associated message
The message (or its equivalent) has been there for years
and no one ever reported seeing it.
2019-04-04 12:40:03 +02:00
Benno Schulenberg
1a1519b6cd tweaks: drop an assignment whose value is never used [scan-build]
This useless assignment has been there for ages, since before 2.0.0.
2019-04-03 19:10:21 +02:00
Benno Schulenberg
947ccbb597 rcfile: don't break a chain of 'else if' [scan-build]
The mistake was made when 'guidestripe' was added, in commit 66c6eb51.
2019-04-03 19:06:04 +02:00
Benno Schulenberg
671db5e1e3 tweaks: rename an overshort type to something that makes some sense 2019-04-03 17:34:05 +02:00
Benno Schulenberg
acfee2538e tweaks: rename a cryptic type to something that makes a little sense 2019-04-03 17:11:24 +02:00
Brand Huntsman
32431cddf8 files: block the resizing signal while reading from an external command
A SIGWINCH somehow causes the input stream to see EOT, with the result
that any remaining output of an external program would be lost.

This fixes https://savannah.gnu.org/bugs/?56038,
and fixes https://savannah.gnu.org/bugs/?56033.

Signed-off-by: Brand Huntsman <alpha@qzx.com>
2019-04-03 15:14:33 +02:00
Benno Schulenberg
8e302738e8 bindings: recognize the ^W^Y and ^W^V legacy keystrokes again
The keystrokes are recognized and acted upon, but they are not visible
in the menu nor in the help text, and they cannot be rebound.  They are
there just to avoid frustrating the muscle memory of long-time users.

This fixes https://savannah.gnu.org/bugs/?56002.
Reported-by: Peter Zwegat <peterzwegat@yopmail.com>
2019-04-03 15:13:47 +02:00
Benno Schulenberg
aa2568858e tweaks: remove a superfluous check for NULL plus the associated message
The message has been there for a year and no one ever reported seeing it.
2019-04-03 15:11:18 +02:00
Benno Schulenberg
5375403b9d syntax: nanorc: colorize also strings preceded by 'start=' or 'end=' 2019-04-02 12:01:56 +02:00
Benno Schulenberg
b0c9809a2e speller: block the resizing signal also during an integrated spell check
Because somehow something goes wrong when SIGWINCHes are handled while
reading from a pipe.

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

Bug existed since version 2.4.2, commit 75d64e67.
2019-04-01 20:21:23 +02:00
Benno Schulenberg
19c82e6a43 feedback: spare the user a superfluous scaring when trying to exit
Also, a simple question is easier to answer than an annotated one.
2019-04-01 19:56:10 +02:00
Benno Schulenberg
84d21b0972 tweaks: consistently use .sp instead of .PP to insert a blank line
And use plain .P to start a new paragraph.
2019-04-01 17:31:35 +02:00
Benno Schulenberg
f8e0320722 syntax: nanorc: require whitespace both before and after a quoted string
This ensures that the keyname M-" is not miscolored.
2019-04-01 17:24:19 +02:00
Benno Schulenberg
e5a8c35104 feedback: show a message while executing an external command
Some commands can take a little while to execute; showing just the prompt
during that time could give the impression that nothing is happening.

This addresses https://savannah.gnu.org/bugs/?56041.
2019-03-31 18:04:52 +02:00
Devin Hussey
7ad232d714 files: initialize a variable before referencing it
The lack of initialization caused a nasty bug on some targets (such as
ARMv7) which would make it so that ^S would just say "Cancelled".

While x86 (both 64 and 32 bits) seems to initialize 'response' to zero or
a positive number, ARM does not, and there is usually a negative value in
its place, which triggers the 'if (response < 0)' check and, as a result,
the code says "Cancelled".

This fixes https://savannah.gnu.org/bugs/?56023.
Reported-by: Devin Hussey <husseydevin@gmail.com>

Bug existed since version 4.0, commit 0f9d60a3.

Signed-off-by: Devin Hussey <husseydevin@gmail.com>
2019-03-31 12:57:27 +02:00
Benno Schulenberg
85804ec70d syntax: man: require the dot to be at start of line, not the comment 2019-03-31 12:42:53 +02:00
Benno Schulenberg
e473ba5e6c syntax: man: anchor macros at start of line, as only then they are valid 2019-03-30 20:54:31 +01:00
Benno Schulenberg
9120a62cdd syntax: man: add comments, and color all the safe lowercase macros 2019-03-30 20:47:45 +01:00
Benno Schulenberg
53ecb3225f syntax: default: color in red also versions 4.x of nano 2019-03-30 19:54:58 +01:00
Benno Schulenberg
3f695b8fb7 speller: resizing can happen also when configured with --enable-tiny
When nano was configured with --enable-tiny --enable-speller, the
block_sigwinch() function should be available, to mask SIGWINCHes
during a spell check.
2019-03-30 19:23:15 +01:00
Benno Schulenberg
55699dc171 tweaks: rename some variables, to be less repititious
The repeated 'read_buff_' made everything look the same.
2019-03-30 19:10:44 +01:00
Benno Schulenberg
fa48d523b2 tweaks: stop doing tandem assignments (one passing through the other) 2019-03-30 18:52:45 +01:00
Benno Schulenberg
92cbc7c426 syntax: c: color as a type any lowercase word that ends with "_t" 2019-03-30 17:48:34 +01:00
Benno Schulenberg
6f07f2b444 tweaks: rename a function plus parameter, to stay closer to what it does 2019-03-27 19:46:37 +01:00
Benno Schulenberg
f58869d072 tweaks: put the unblocking of SIGWINCHes in a better place
The blocking is needed only during the wait(), so unblock SIGWINCH
again right after the wait() -- also to have the unblocking before
a possible error exit.
2019-03-27 19:10:24 +01:00
Benno Schulenberg
978c121de1 speller: block the resizing signal again during an external spell check
Somehow a SIGWINCH pushes nano past the wait() in do_alt_speller(),
even though the external spelling program hasn't finished.

This fixes https://savannah.gnu.org/bugs/?56010
by reverting commit 1f39f60b.

Bug existed since version 3.2.
2019-03-27 17:43:43 +01:00
Benno Schulenberg
f6a7983a8a docs: for two of the toggles, mention the new instead of the old option 2019-03-26 17:08:31 +01:00
Benno Schulenberg
a1375474d9 docs: remove the AUTHOR section, per advice from 'man man-pages'
Also because most of nano has meanwhile been written by other people
than Chris.  And because authorship is meta-information, irrelevant
for knowing how to operate nano.
2019-03-25 15:55:34 +01:00
Benno Schulenberg
d0cc75f197 docs: put paths and filenames in italics, per 'man man-pages'
Plus a few other text and formatting tweaks.
2019-03-25 15:31:47 +01:00
Benno Schulenberg
0fccfc0373 docs: re-title the temporary section about the changed defaults
To avoid having both a NOTE and a NOTES section.
2019-03-25 15:22:30 +01:00
Benno Schulenberg
d0a7e6e6a6 docs: give the FILES section in the man page its canonical title
Suggested-by: Michael Siegel <msi@malbolge.net>
2019-03-25 14:59:28 +01:00
68 changed files with 24644 additions and 31724 deletions

100
ChangeLog
View File

@@ -1,3 +1,103 @@
Changes between v4.0 and v4.1:
------------------------------
Benno Schulenberg (85):
bindings: add easier keystrokes for the linenumber and softwrap toggles
bindings: disallow executing an external command when in view mode
bindings: recognize the ^W^Y and ^W^V legacy keystrokes again
bindings: remove the jumpy-scrolling toggle entirely
build: add gnulib modules to the list of files with translatable strings
build: add src/cut.c to the list of files with translatable strings
build: don't do fuzzy matching when merging PO files against the POT file
build: remove obsolete translations from the PO files after merging
bump version numbers and add a news item for the 4.1 release
display: report and catch a bad state, to prevent a possible hang
docs: for two of the toggles, mention the new instead of the old option
docs: give the FILES section in the man page its canonical title
docs: mention that -b is the opposite of -w also in the latter's item
docs: mention that M-S now toggles softwrap and M-N line numbers
docs: put paths and filenames in italics, per 'man man-pages'
docs: remove all mention of --finalnewline, and undefault --nonewlines
docs: remove the AUTHOR section, per advice from 'man man-pages'
docs: re-title the temporary section about the changed defaults
feedback: replace an assert with a check plus error message at startup
feedback: show a message while executing an external command
feedback: spare the user a superfluous scaring when trying to exit
gnulib: update to its current upstream state
help: don't doubly list toggles that have two keys assigned to them
indenting, commenting: ensure a partial line stays displayed properly
justify: correctly compute the number of lines to take, to avoid a crash
options: make --nowrap override again a contrary nanorc setting
options: remove -f (--finalnewline); go back to auto-adding this newline
rcfile: don't break a chain of 'else if' [scan-build]
rcfile: read the syntax files in alphabetical order when globbing
speller: block the resizing signal again during an external spell check
speller: block the resizing signal also during an integrated spell check
speller: resizing can happen also when configured with --enable-tiny
syntax: c: color as a type any lowercase word that ends with "_t"
syntax: default: color in red also versions 4.x of nano
syntax: man: add comments, and color all the safe lowercase macros
syntax: man: anchor macros at start of line, as only then they are valid
syntax: man: require the dot to be at start of line, not the comment
syntax: nanorc: colorize also strings preceded by 'start=' or 'end='
syntax: nanorc: require whitespace both before and after a quoted string
tweaks: adjust the indentation after the previous change
tweaks: condense a bit of copying code
tweaks: consistently use .sp instead of .PP to insert a blank line
tweaks: do a check up front instead of every time round the loop
tweaks: don't bother copying the NUL byte -- it is set nine lines down
tweaks: don't bother reallocating the data when a line gets hard-wrapped
tweaks: don't bother reallocating the squeezed string, just terminate it
tweaks: don't bother special-casing non-UTF8 when seeking a character
tweaks: drop an assignment whose value is never used [scan-build]
tweaks: drop two 'const' qualifiers, to silence the compiler
tweaks: free some memory before a possible error exit [coverity]
tweaks: free the copy of a linter message in all cases [valgrind]
tweaks: free the result string from an invocation error [coverity]
tweaks: initialize a boolean before it is referenced [valgrind]
tweaks: put the unblocking of SIGWINCHes in a better place
tweaks: remove a function that is now unused
tweaks: remove an unneeded check for NULL and its associated message
tweaks: remove an unneeded check for NULL [coverity]
tweaks: remove an unpaired closing parenthesis from the NEWS file
tweaks: remove a superfluous check for NULL plus the associated message
tweaks: remove several unneeded bad-state checks and their messages
tweaks: rename a cryptic type to something that makes a little sense
tweaks: rename a function plus parameter, to stay closer to what it does
tweaks: rename another variable, to be more descriptive
tweaks: rename another variable, to be more fitting
tweaks: rename an overshort type to something that makes some sense
tweaks: rename a variable, to be more distinct and more apt
tweaks: rename a variable, to be more distinct and more descriptive
tweaks: rename a variable, to get out of the way for another rename
tweaks: rename some variables, for more contrast and to match others
tweaks: rename some variables, to be less repititious
tweaks: rename two variables, for more contrast
tweaks: rename two variables, to be more distinct and more fitting
tweaks: rename two variables, to make more sense
tweaks: rename two variables, to match others
tweaks: reshuffle some lines, condense a comment and drop another
tweaks: reshuffle some lines, to elide an 'if'
tweaks: reshuffle two lines, and reword a comment
tweaks: reword a comment, and drop an unneeded assert
tweaks: shorten a comment to its essence
tweaks: shorten and improve some comments, and reshuffle a few lines
tweaks: simplify a message, and normalize the spelling of another one
tweaks: stop doing tandem assignments (one passing through the other)
tweaks: switch back from checking FINAL_NEWLINE to checking NO_NEWLINES
tweaks: use a signed type for a result that could be negative [coverity]
unindent: ensure that a partial line gets displayed properly afterwards
Brand Huntsman (1):
files: block the resizing signal while reading from an external command
Devin Hussey (1):
files: initialize a variable before referencing it
Liu Hao (1):
syntax: c: change the highlighting of preprocessor directives
Changes between v3.2 and v4.0:
------------------------------

18
NEWS
View File

@@ -1,3 +1,17 @@
2019.04.15 - GNU nano 4.1 "Qué corchos será eso?"
• By default, a newline character is again automatically added at the
end of a buffer, to produce valid POSIX text files by default, but
also to get back the easy adding of text at the bottom.
• The now unneeded option --finalnewline (-f) has been removed.
• Syntax files are read in alphabetical order when globbing, so that
the precedence of syntaxes becomes predictable.
• In the C syntax, preprocessor directives are highlighted differently.
• M-S now toggles soft wrapping, and M-N toggles line numbers.
• The jumpy-scrolling toggle has been removed.
• The legacy keystrokes ^W^Y and ^W^V are recognized again.
• Executing an external command is disallowed when in view mode.
• Problems with resizing during external or speller commands were fixed.
2019.03.24 - GNU nano 4.0 "Thy Rope of Sands"
• An overlong line is no longer automatically hard-wrapped.
• Smooth scrolling (one line at a time) has become the default.
@@ -670,8 +684,8 @@
without the usual truncation and a '$' symbol at the end
of the line. It can be enabled via Meta-$ inside the
editor, via the -$ or --softwrap command-line flags,
or "set softwrap" in your .nanorc). As always, please
report any bugs to the nano Savannah project page
or via "set softwrap" in your .nanorc. As always,
please report any bugs to the nano Savannah project page
(http://savannah.gnu.org/bugs/?func=additem&group=nano)
Remember: data loss happens, back up your files.

View File

@@ -2,7 +2,7 @@
# Generate configure & friends for GIT users.
gnulib_url="git://git.sv.gnu.org/gnulib.git"
gnulib_hash="69c4509f33c6a6ac159f3429d4150bf119ac4d76"
gnulib_hash="91584ed612fa26a505c8fc4c7f6fb19f7413795d"
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.0], [nano-devel@gnu.org], [nano])
AC_INIT([GNU nano], [4.1], [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.0</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.1</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.0" "March 2019"
.TH NANO 1 "version 4.1" "April 2019"
.SH NAME
nano \- Nano's ANOther editor, inspired by Pico
@@ -25,15 +25,13 @@ nano \- Nano's ANOther editor, inspired by Pico
.B nano
.RI [ options "] [[+" line [, column "]]\ " file "]..."
.SH NOTE
.SH NOTICE
Starting with version 4.0, \fBnano\fR no longer hard-wraps an overlong
line by default, and no longer automatically adds a newline at the end
of the text if one is missing. Furthermore, it uses smooth scrolling
by default and makes use of the line below the title bar.
line by default, uses smooth scrolling by default, and by default makes
use of the line below the title bar.
.sp
If you want the old, Pico behavior back, you can use \fB\-\-breaklonglines\fR,
\fB\-\-finalnewline\fR, \fB\-\-jumpyscrolling\fR, and \fB\-\-emptyline\fR
(or \fB\-bfje\fR for short).
\fB\-\-jumpyscrolling\fR, and \fB\-\-emptyline\fR (or \fB\-bje\fR for short).
.SH DESCRIPTION
\fBnano\fP is a small and friendly editor. It copies the look and feel
@@ -57,18 +55,18 @@ Consecutive \fB^K\fRs will put all deleted lines together in the cutbuffer.
Any cursor movement or executing any other command will cause the next
\fB^K\fR to overwrite the cutbuffer. A \fB^U\fR will paste the current
contents of the cutbuffer at the current cursor position.
.PP
.sp
When a more precise piece of text needs to be cut or copied, one can mark
its start with \fB^6\fR, move the cursor to its end (the marked text will be
highlighted), and then use \fB^K\fR to cut it, or \fBM\-6\fR to copy it to the
cutbuffer. One can also save the marked text to a file with \fB^O\fR, or
spell check it with \fB^T\fR.
.PP
.sp
On some terminals, text can be selected also by holding down Shift while
using the arrow keys. Holding down the Ctrl or Alt key too will increase
the stride.
Any cursor movement without Shift being held will cancel such a selection.
.PP
.sp
The two lines at the bottom of the screen show some important commands;
the built-in help (\fB^G\fR) lists all the available ones.
The default key bindings can be changed via a \fInanorc\fR file -- see
@@ -124,7 +122,6 @@ mouse support.
.TP
.BR \-L ", " \-\-nonewlines
Don't automatically add a newline when a file does not end with one.
(This is the default.)
.TP
.BR \-M ", " \-\-trimblanks
Snip trailing whitespace from the wrapped line when automatic
@@ -213,11 +210,6 @@ system either Backspace acts like Delete or Delete acts like Backspace.
.BR \-e ", " \-\-emptyline
Do not use the line below the title bar, leaving it entirely blank.
.TP
.BR \-f ", " \-\-finalnewline
If the buffer is not empty, ensure that it ends with a newline character.
(This option is the opposite of \fB\-L\fR (\fB\-\-nonewlines\fR) --
the last one given takes effect.)
.TP
.BR \-g ", " \-\-showcursor
Make the cursor visible in the file browser (putting it on the
highlighted item) and in the help viewer. Useful for braille users
@@ -288,7 +280,9 @@ unless \fB\-\-restricted\fR is given too.
.TP
.BR \-w ", " \-\-nowrap
Do not automatically hard-wrap the current line when it becomes overlong.
(This is the default.)
This is the default. (This option is the opposite of \fB\-b\fR
(\fB\-\-breaklonglines\fR) -- the last one given takes effect.)
.TP
.BR \-x ", " \-\-nohelp
Don't show the two help lines at the bottom of the screen.
@@ -310,16 +304,16 @@ separately (e.g.\& 'nano \-wS \-$').
.SH TOGGLES
Several of the above options can be switched on and off also while
\fBnano\fR is running. For example, \fBM\-L\fR toggles the
hard-wrapping of long lines, \fBM\-$\fR toggles soft-wrapping,
\fBM\-#\fR toggles line numbers, \fBM\-M\fR toggles the mouse,
hard-wrapping of long lines, \fBM\-S\fR toggles soft-wrapping,
\fBM\-N\fR toggles line numbers, \fBM\-M\fR toggles the mouse,
\fBM\-I\fR auto-indentation, and \fBM\-X\fR the help lines.
See at the end of the \fB^G\fR help text for a complete list.
.SH INITIALIZATION FILE
.SH FILES
\fBnano\fR will read two configuration files: first the system's
\fInanorc\fR (if it exists), and then the user's \fInanorc\fR (if it
exists), either \fB~/.nanorc\fR or \fI$XDG_CONFIG_HOME\fB/nano/nanorc\fR
or \fB~/.config/nano/nanorc\fR, whichever is encountered first. See
exists), either \fI~/.nanorc\fR or \fI$XDG_CONFIG_HOME/nano/nanorc\fR
or \fI~/.config/nano/nanorc\fR, whichever is encountered first. See
.BR nanorc (5)
for more information on the possible contents of those files.
@@ -345,21 +339,16 @@ not by default distinguish modified from unmodified arrow keys.
.sp
Please report any other bugs that you encounter via:
.br
\fIhttps://savannah.gnu.org/bugs/?group=nano\fR.
.IR https://savannah.gnu.org/bugs/?group=nano .
.sp
When nano crashes, it will save any modified buffers to emergency .save files.
If you are able to reproduce the crash and you want to get a backtrace, define
the environment variable \fBNANO_NOCATCH\fR.
.SH HOMEPAGE
\fIhttps://nano\-editor.org/\fR
.I https://nano\-editor.org/
.SH SEE ALSO
.BR nanorc (5)
.PP
.sp
\fI/usr/share/doc/nano/\fP (or equivalent on your system)
.SH AUTHOR
Chris Allegretta and others (see the files \fIAUTHORS\fR and
\fITHANKS\fP for details). This manual page was originally written by
Jordi Mallach for the Debian system (but may be used by others).

View File

@@ -8,8 +8,8 @@
@smallbook
@set EDITION 0.5
@set VERSION 4.0
@set UPDATED March 2019
@set VERSION 4.1
@set UPDATED April 2019
@dircategory Editors
@direntry
@@ -23,7 +23,7 @@
@titlepage
@title GNU @command{nano}
@subtitle a small and friendly text editor
@subtitle version 4.0
@subtitle version 4.1
@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.0.
This manual documents the GNU @command{nano} editor, version 4.1.
@menu
* Introduction::
@@ -97,14 +97,13 @@ as is reasonable while offering a superset of Pico's functionality.
Pico differ.
Starting with version 4.0, @command{nano} no longer hard-wraps an overlong
line by default, and no longer automatically adds a newline at the end
of the text if one is missing. Furthermore, it uses smooth scrolling
by default and makes use of the line below the title bar.
line by default, uses smooth scrolling by default, and by default makes
use of the line below the title bar.
If you want the old, Pico behavior back, you can use the
following options: @option{--breaklonglines}, @option{--finalnewline},
following options: @option{--breaklonglines},
@option{--jumpyscrolling}, and @option{--emptyline}
(or @option{-bfje} for short).
(or @option{-bje} for short).
Please report bugs via @url{https://savannah.gnu.org/bugs/?group=nano}.
@@ -216,7 +215,6 @@ mouse support.
@item -L
@itemx --nonewlines
Don't automatically add a newline when a file does not end with one.
(This is the default.)
@item -M
@itemx --trimblanks
@@ -325,12 +323,6 @@ system either Backspace acts like Delete or Delete acts like Backspace.
@itemx --emptyline
Do not use the line below the title bar, leaving it entirely blank.
@item -f
@itemx --finalnewline
If the buffer is not empty, ensure that it ends with a newline character.
(This option is the opposite of @option{-L} (@option{--nonewlines}) ---
the last one given takes effect.)
@item -g
@itemx --showcursor
Make the cursor visible in the file browser (putting it on the
@@ -426,7 +418,9 @@ file permissions to implement a read-only file.)
@item -w
@itemx --nowrap
Do not automatically hard-wrap the current line when it becomes overlong.
(This is the default.)
This is the default. (This option is the opposite of @option{-b}
(@option{--breaklonglines}) --- the last one given takes effect.)
@anchor{Expert Mode}
@item -x
@@ -643,19 +637,22 @@ The following global toggles are available:
@kbd{Meta-K} toggles the @option{-k} (@option{--cutfromcursor}) command-line option.
@item Long-Line Wrapping
@kbd{Meta-L} toggles the @option{-w} (@option{--nowrap}) command-line option.
@kbd{Meta-L} toggles the @option{-b} (@option{--breaklonglines}) command-line option.
@item Mouse Support
@kbd{Meta-M} toggles the @option{-m} (@option{--mouse}) command-line option.
@item Line Numbers
@kbd{Meta-N} toggles the @option{-l} (@option{--linenumbers}) command-line option.
@item Tabs To Spaces
@kbd{Meta-O} toggles the @option{-E} (@option{--tabstospaces}) command-line option.
@item Whitespace Display
@kbd{Meta-P} toggles the displaying of whitespace (@pxref{Whitespace}).
@item Smooth Scrolling
@kbd{Meta-S} toggles the @option{-S} (@option{--smooth}) command-line option.
@item Soft Wrapping
@kbd{Meta-S} toggles the @option{-$} (@option{--softwrap}) command-line option.
@item Expert/No Help
@kbd{Meta-X} toggles the @option{-x} (@option{--nohelp}) command-line option.
@@ -667,12 +664,6 @@ The following global toggles are available:
@item Suspension
@kbd{Meta-Z} toggles the @option{-z} (@option{--suspend}) command-line option.
@item Line Numbers
@kbd{Meta-#} toggles the @option{-l} (@option{--linenumbers}) command-line option.
@item Soft Wrapping
@kbd{Meta-$} toggles the @option{-$} (@option{--softwrap}) command-line option.
@end table
@@ -776,9 +767,6 @@ Do not use the line below the title bar, leaving it entirely blank.
Use this color combination for the status bar when an error message is displayed.
@xref{@code{set functioncolor}} for valid color names.
@item set finalnewline
If the buffer is not empty, ensure that it ends with a newline character.
@item set fill @var{number}
Set the target width for justifying and automatic hard-wrapping at this
@var{number} of columns. If the value is 0 or less, wrapping will occur
@@ -843,8 +831,7 @@ Don't convert files from DOS/Mac format.
Don't display the help lists at the bottom of the screen.
@item set nonewlines
Deprecated option since it has become the default setting.
When needed, use @code{unset finalnewline} instead.
Don't automatically add a newline when a file does not end with one.
@item set nopauses
Don't pause between warnings at startup. This means that only
@@ -1442,9 +1429,6 @@ Toggles the presence of the two-line list of key bindings at the bottom of the s
@item constantshow
Toggles the constant display of the current line, column, and character positions.
@item smoothscroll
Toggles smooth scrolling (when moving around with the arrow keys).
@item softwrap
Toggles the displaying of overlong lines on multiple screen lines.
@@ -1576,12 +1560,6 @@ switched on with the @option{--breaklonglines} option. With that option,
whereas Pico does it at screen width minus six columns. You can make
@command{nano} do as Pico by using @option{--fill=-6}.
@item Magic Newline
Pico ensures that any text always ends with a newline character.
Nano does not do this by default: the user is left in full control
of the formatting. You can get the automatic newline by using the
@option{--finalnewline} option.
@item Scrolling
By default, @command{nano} will scroll just one line (instead of half
a screen) when the cursor is moved to a line that is just out of view.

View File

@@ -16,28 +16,27 @@
.\" Documentation License along with this program. If not, see
.\" <https://www.gnu.org/licenses/>.
.\"
.TH NANORC 5 "version 4.0" "March 2019"
.TH NANORC 5 "version 4.1" "April 2019"
.SH NAME
nanorc \- GNU nano's configuration file
.SH NOTE
.SH NOTICE
Starting with version 4.0, \fBnano\fR no longer hard-wraps an overlong
line by default, and no longer automatically adds a newline at the end
of the text if one is missing. Furthermore, it uses smooth scrolling
by default and makes use of the line below the title bar.
line by default, uses smooth scrolling by default, and by default makes
use of the line below the title bar.
.sp
If you want the old, Pico behavior back, you can use \fBset breaklonglines\fR,
\fBset finalnewline\fR, \fBset jumpyscrolling\fR, and \fBset emptyline\fR.
\fBset jumpyscrolling\fR, and \fBset emptyline\fR.
.SH DESCRIPTION
The \fInanorc\fP file contains the default settings for \fBnano\fP, a
small and friendly editor. The file should be in Unix format, not in
DOS or Mac format. During startup, \fBnano\fP will first read the
system-wide settings, from \fB/etc/nanorc\fP (the exact path might be
system-wide settings, from \fI/etc/nanorc\fP (the exact path might be
different on your system), and then the user-specific settings, either
from \fB~/.nanorc\fR or from \fI$XDG_CONFIG_HOME\fB/nano/nanorc\fR
or from \fB~/.config/nano/nanorc\fR, whichever is encountered first.
from \fI~/.nanorc\fR or from \fI$XDG_CONFIG_HOME/nano/nanorc\fR
or from \fI~/.config/nano/nanorc\fR, whichever is encountered first.
.SH OPTIONS
The configuration file accepts a series of \fBset\fP and \fBunset\fP
@@ -45,20 +44,20 @@ commands, which can be used to configure nano on startup without using
command-line options. Additionally, there are some commands to define
syntax highlighting and to rebind keys -- see the two separate sections
on those. \fBnano\fP reads one command per line.
.PP
.sp
Options in \fInanorc\fP files take precedence over nano's defaults, and
command-line options override \fInanorc\fP settings. Also, options that
do not take an argument are unset by default. So using the \fBunset\fR
command is only needed when wanting to override a setting of the system's
\fInanorc\fR file in your own \fInanorc\fR. Options that take an
argument cannot be unset.
.PP
.sp
Below, the \fIstring\fR parameters need to be enclosed in double quotes.
Quotes inside these string parameters don't have to be escaped with
backslashes. The last double quote in the string will be treated as its
end. For example, for the \fBbrackets\fP option, "\fB"')>]}\fP" will
match \fB"\fP, \fB'\fP, \fB)\fP, \fB>\fP, \fB]\fP, and \fB}\fP.
.PP
.sp
The supported commands and arguments are:
.TP 3
@@ -121,9 +120,6 @@ Do not use the line below the title bar, leaving it entirely blank.
Use this color combination for the status bar when an error message is displayed.
See \fBset titlecolor\fR for valid color names.
.TP
.B set finalnewline
If the buffer is not empty, ensure that it ends with a newline character.
.TP
.B set fill \fInumber\fR
Set the target width for justifying and automatic hard-wrapping at this
\fInumber\fR of columns. If the value is 0 or less, wrapping will occur
@@ -185,8 +181,7 @@ Don't convert files from DOS/Mac format.
Don't display the two help lines at the bottom of the screen.
.TP
.B set nonewlines
Deprecated option since it has become the default setting.
When needed, use \fBunset finalnewline\fR instead.
Don't automatically add a newline when a file does not end with one.
.TP
.B set nopauses
Don't pause between warnings at startup. This means that only
@@ -434,14 +429,14 @@ a more general mechanism: the filtering of buffer or marked text through
an external command. Such filtering is done by typing \fB^R^X\fR and then
preceding your formatter command with the pipe symbol (\fB|\fR). It has
the added advantage that the operation can be undone.
.PP
.sp
If you use such a formatting command regularly, you could assign the relevant
series of keystrokes to a single key in your nanorc:
.PP
.sp
.RS
.B "bind M\-F \(dq^R^X|yourformatcommand^M\(dq main"
.RE
.PP
.sp
(Note that the \fB^R\fR, \fB^X\fR, and \fB^M\fR are each a single, literal
control character. You can enter them by preceding each with \fBM\-V\fR.)
@@ -776,9 +771,6 @@ Toggles the presence of the two-line list of key bindings at the bottom of the s
.B constantshow
Toggles the constant display of the current line, column, and character positions.
.TP
.B smoothscroll
Toggles smooth scrolling (when moving around with the arrow keys).
.TP
.B softwrap
Toggles the displaying of overlong lines on multiple screen lines.
.TP
@@ -873,16 +865,11 @@ for \fBunbind\fR it means all menus where the specified \fIkey\fR exists.
.SH FILES
.TP
.B /etc/nanorc
.I /etc/nanorc
System-wide configuration file.
.TP
.BR ~/.nanorc " or " \fI$XDG_CONFIG_HOME\fB/nano/nanorc " or " ~/.config/nano/nanorc
.IR ~/.nanorc " or " $XDG_CONFIG_HOME/nano/nanorc " or " ~/.config/nano/nanorc
Per-user configuration file.
.SH SEE ALSO
.BR nano (1)
.SH AUTHOR
Chris Allegretta and others (see the files \fIAUTHORS\fP and
\fITHANKS\fP for details). This manual page was originally written by
Jordi Mallach for the Debian system (but may be used by others).

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.0" "March 2019"
.TH RNANO 1 "version 4.1" "April 2019"
.SH NAME
rnano \- a restricted nano
@@ -29,7 +29,7 @@ rnano \- a restricted nano
\fBrnano\fR runs the \fBnano\fR editor in restricted mode. This allows
editing only the specified file or files, and doesn't allow the user
access to the filesystem nor to a command shell.
.PP
.sp
In restricted mode, \fBnano\fR will:
.IP \[bu] 2
not allow suspending;
@@ -45,20 +45,16 @@ not make backup files nor do spell checking.
.SH OPTIONS
.TP
.BR \-h ", " \-\-help
Show a summary of command-line options and exit.
.PP
See the \fBnano\fP(1) manpage for all available options.
Show the available command-line options and exit.
.P
For all existing options, see the \fBnano\fR(1) man page.
.SH BUGS
Please report bugs via \fIhttps://savannah.gnu.org/bugs/?group=nano\fR.
Please report bugs via
.IR https://savannah.gnu.org/bugs/?group=nano .
.SH HOMEPAGE
https://nano-editor.org/
.I https://nano-editor.org/
.SH SEE ALSO
.BR nano (1)
.SH AUTHOR
Chris Allegretta and others (see the files \fIAUTHORS\fR and \fITHANKS\fR
for details). This manual page was originally written by Thijs Kinkhorst
for the Debian system (but may be used by others).

View File

@@ -61,9 +61,6 @@
## less, the wrapping point will be the screen width minus this number.
# set fill -8
## Ensure that a non-empty buffer ends with a newline character.
# set finalnewline
## Remember the used search/replace strings for the next session.
# set historylog
@@ -99,6 +96,9 @@
## Don't display the helpful shortcut lists at the bottom of the screen.
# set nohelp
## Don't automatically add a newline when a file does not end with one.
# set nonewlines
## Don't pause between warnings at startup. Which means that only the
## last one will be readable (when there are multiple ones).
# set nopauses

View File

@@ -11,15 +11,12 @@ top_builddir = ..
XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ --keyword=P_:1,2
# This is the copyright holder that gets inserted into the header of the
# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
# package. (Note that the msgstr strings, extracted from the package's
# sources, belong to the copyright holder of the package.) Translators are
# expected to transfer the copyright for their translations to this person
# or entity, or to disclaim their copyright. The empty string stands for
# the public domain; in this case the translators are expected to disclaim
# their copyright.
# $(DOMAIN).pot file. Translators are expected to disclaim their copyright.
COPYRIGHT_HOLDER = Free Software Foundation, Inc.
# This is the list of locale categories, beyond LC_MESSAGES, for which the
# message catalogs shall be used. It is usually empty.
EXTRA_LOCALE_CATEGORIES =
# Don't do fuzzy matching when merging the PO files against the POT file.
MSGMERGE_OPTIONS = --no-fuzzy-matching

View File

@@ -2,6 +2,7 @@
src/browser.c
src/color.c
src/cut.c
src/files.c
src/global.c
src/help.c
@@ -13,3 +14,6 @@ src/search.c
src/text.c
src/utils.c
src/winio.c
lib/getopt.c
lib/regcomp.c

1887
po/bg.po

File diff suppressed because it is too large Load Diff

1660
po/ca.po

File diff suppressed because it is too large Load Diff

1466
po/cs.po

File diff suppressed because it is too large Load Diff

1699
po/da.po

File diff suppressed because it is too large Load Diff

1086
po/de.po

File diff suppressed because it is too large Load Diff

1325
po/eo.po

File diff suppressed because it is too large Load Diff

1380
po/es.po

File diff suppressed because it is too large Load Diff

2175
po/eu.po

File diff suppressed because it is too large Load Diff

1672
po/fi.po

File diff suppressed because it is too large Load Diff

1098
po/fr.po

File diff suppressed because it is too large Load Diff

1631
po/ga.po

File diff suppressed because it is too large Load Diff

1557
po/gl.po

File diff suppressed because it is too large Load Diff

1515
po/hr.po

File diff suppressed because it is too large Load Diff

1352
po/hu.po

File diff suppressed because it is too large Load Diff

2228
po/id.po

File diff suppressed because it is too large Load Diff

1175
po/it.po

File diff suppressed because it is too large Load Diff

1447
po/ja.po

File diff suppressed because it is too large Load Diff

1084
po/ko.po

File diff suppressed because it is too large Load Diff

2113
po/ms.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1547
po/nb.po

File diff suppressed because it is too large Load Diff

1332
po/nl.po

File diff suppressed because it is too large Load Diff

2213
po/nn.po

File diff suppressed because it is too large Load Diff

1195
po/pl.po

File diff suppressed because it is too large Load Diff

1172
po/pt.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1319
po/ro.po

File diff suppressed because it is too large Load Diff

1851
po/ru.po

File diff suppressed because it is too large Load Diff

1968
po/sl.po

File diff suppressed because it is too large Load Diff

1565
po/sr.po

File diff suppressed because it is too large Load Diff

1851
po/sv.po

File diff suppressed because it is too large Load Diff

1532
po/tr.po

File diff suppressed because it is too large Load Diff

1353
po/uk.po

File diff suppressed because it is too large Load Diff

View File

@@ -21,8 +21,11 @@ fi
echo "Regenerating POT file and remerging and recompiling PO files..."
make update-po
# Ensure that the PO files are newer than the POT.
touch *.po
echo "Removing the dead weight of obsolete and fuzzy translations..."
for pofile in *.po; do
msgattrib --no-obsolete --no-fuzzy $pofile >trimmed.po || exit 4
mv trimmed.po $pofile || exit 4
done
# If needed, fix a problem in the Makefile template.
grep -q '^datarootdir' Makefile.in.in || \

1507
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.0"
VERSION="4.1"
./configure -C --enable-tiny && make && ./configure -C &&

View File

@@ -572,66 +572,40 @@ char *mbstrchr(const char *s, const char *c)
#endif /* !NANO_TINY || ENABLE_JUSTIFY */
#ifndef NANO_TINY
/* This function is equivalent to strpbrk() for multibyte strings. */
char *mbstrpbrk(const char *s, const char *accept)
/* Locate, in the given string, the first occurrence of any of
* the characters in accept, searching forward. */
char *mbstrpbrk(const char *string, const char *accept)
{
#ifdef ENABLE_UTF8
if (use_utf8) {
for (; *s != '\0'; s += move_mbright(s, 0)) {
if (mbstrchr(accept, s) != NULL)
return (char *)s;
}
while (*string != '\0') {
if (mbstrchr(accept, string) != NULL)
return (char *)string;
return NULL;
} else
#endif
return (char *) strpbrk(s, accept);
}
/* Locate, in the string that starts at head, the first occurrence of any of
* the characters in the string accept, starting from pointer and searching
* backwards. */
char *revstrpbrk(const char *head, const char *accept, const char *pointer)
{
if (*pointer == '\0') {
if (pointer == head)
return NULL;
pointer--;
}
while (pointer >= head) {
if (strchr(accept, *pointer) != NULL)
return (char *)pointer;
pointer--;
string += move_mbright(string, 0);
}
return NULL;
}
/* The same as the preceding function but then for multibyte strings. */
/* Locate, in the string that starts at head, the first occurrence of any of
* the characters in accept, starting from pointer and searching backwards. */
char *mbrevstrpbrk(const char *head, const char *accept, const char *pointer)
{
#ifdef ENABLE_UTF8
if (use_utf8) {
if (*pointer == '\0') {
if (pointer == head)
return NULL;
pointer = head + move_mbleft(head, pointer - head);
}
if (*pointer == '\0') {
if (pointer == head)
return NULL;
pointer = head + move_mbleft(head, pointer - head);
}
while (TRUE) {
if (mbstrchr(accept, pointer) != NULL)
return (char *)pointer;
while (TRUE) {
if (mbstrchr(accept, pointer) != NULL)
return (char *)pointer;
/* If we've reached the head of the string, we found nothing. */
if (pointer == head)
return NULL;
/* If we've reached the head of the string, we found nothing. */
if (pointer == head)
return NULL;
pointer = head + move_mbleft(head, pointer - head);
}
} else
#endif
return revstrpbrk(head, accept, pointer);
pointer = head + move_mbleft(head, pointer - head);
}
}
#endif /* !NANO_TINY */

View File

@@ -67,7 +67,7 @@ void do_deletion(undo_type action)
/* If there is a magic line, and we're before it: don't eat it. */
if (joining == openfile->filebot && openfile->current_x != 0 &&
ISSET(FINAL_NEWLINE)) {
!ISSET(NO_NEWLINES)) {
#ifndef NANO_TINY
if (action == BACK)
add_undo(BACK);
@@ -279,7 +279,7 @@ void do_cut_text(bool copy_text, bool marked, bool cut_till_eof, bool append)
size_t cb_save_len = 0;
/* The length of the string at the current end of the cutbuffer,
* before we add text to it. */
bool using_magicline = ISSET(FINAL_NEWLINE);
bool using_magicline = !ISSET(NO_NEWLINES);
/* Whether an automatic newline should be added at end-of-buffer. */
bool right_side_up = TRUE;
/* There *is* no region, *or* it is marked forward. */
@@ -301,7 +301,7 @@ void do_cut_text(bool copy_text, bool marked, bool cut_till_eof, bool append)
cb_save_len = strlen(cutbottom->data);
}
/* Don't add a magic line when moving text to the cutbuffer. */
UNSET(FINAL_NEWLINE);
SET(NO_NEWLINES);
}
if (cut_till_eof) {
@@ -339,7 +339,7 @@ void do_cut_text(bool copy_text, bool marked, bool cut_till_eof, bool append)
}
/* Restore the magic-line behavior now that we're done fiddling. */
if (using_magicline)
SET(FINAL_NEWLINE);
UNSET(NO_NEWLINES);
} else
#endif /* !NANO_TINY */
@@ -358,8 +358,8 @@ bool is_cuttable(bool test_cliff)
(openfile->mark == openfile->current &&
openfile->mark_x == openfile->current_x) ||
(test_cliff && openfile->current->data[openfile->current_x] == '\0' &&
((!ISSET(FINAL_NEWLINE) && openfile->current == openfile->filebot) ||
(ISSET(FINAL_NEWLINE) && openfile->current == openfile->filebot->prev))
((ISSET(NO_NEWLINES) && openfile->current == openfile->filebot) ||
(!ISSET(NO_NEWLINES) && openfile->current == openfile->filebot->prev))
#endif
)) {
#ifndef NANO_TINY
@@ -428,7 +428,7 @@ void do_copy_text(void)
void do_cut_till_eof(void)
{
if ((openfile->current == openfile->filebot && openfile->current->data[0] == '\0') ||
(ISSET(FINAL_NEWLINE) && openfile->current->next == openfile->filebot &&
(!ISSET(NO_NEWLINES) && openfile->current->next == openfile->filebot &&
openfile->current->data[openfile->current_x] == '\0')) {
statusbar(_("Nothing was cut"));
return;
@@ -478,7 +478,7 @@ void do_uncut_text(void)
/* The leftedge where we started the paste. */
if (cutbuffer == NULL) {
statusbar(_("The cutbuffer is empty"));
statusbar(_("Cutbuffer is empty"));
return;
}

View File

@@ -557,7 +557,7 @@ void replace_marked_buffer(const char *filename)
{
FILE *f;
int descriptor;
bool using_magicline = ISSET(FINAL_NEWLINE);
bool using_magicline = !ISSET(NO_NEWLINES);
linestruct *was_cutbuffer = cutbuffer;
descriptor = open_file(filename, FALSE, TRUE, &f);
@@ -566,7 +566,7 @@ void replace_marked_buffer(const char *filename)
return;
/* Don't add a magic line when replacing text in the buffer. */
UNSET(FINAL_NEWLINE);
SET(NO_NEWLINES);
add_undo(COUPLE_BEGIN);
openfile->undotop->strdata = mallocstrcpy(NULL, _("spelling correction"));
@@ -584,7 +584,7 @@ void replace_marked_buffer(const char *filename)
/* Restore the magic-line behavior now that we're done fiddling. */
if (using_magicline)
SET(FINAL_NEWLINE);
UNSET(NO_NEWLINES);
add_undo(COUPLE_END);
openfile->undotop->strdata = mallocstrcpy(NULL, _("spelling correction"));
@@ -800,6 +800,10 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable)
topline = make_new_node(NULL);
bottomline = topline;
#ifndef NANO_TINY
block_sigwinch(TRUE);
#endif
/* Lock the file before starting to read it, to avoid the overhead
* of locking it for each single byte that we read from it. */
flockfile(f);
@@ -875,6 +879,10 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable)
/* We are done with the file, unlock it. */
funlockfile(f);
#ifndef NANO_TINY
block_sigwinch(FALSE);
#endif
/* Perhaps this could use some better handling. */
if (ferror(f))
nperror(filename);
@@ -2054,7 +2062,7 @@ bool write_marked_file(const char *name, FILE *f_open, bool tmp,
/* If we are using a magic line, and the last line of the partition
* isn't blank, then add a newline at the end of the buffer. */
if (ISSET(FINAL_NEWLINE) && openfile->filebot->data[0] != '\0') {
if (!ISSET(NO_NEWLINES) && openfile->filebot->data[0] != '\0') {
new_magicline();
added_magicline = TRUE;
}
@@ -2101,7 +2109,7 @@ int do_writeout(bool exiting, bool withprompt)
while (TRUE) {
const char *msg;
int response, choice;
int response = 0, choice = 0;
functionptrtype func;
#ifndef NANO_TINY
const char *formatstr, *backupstr;

View File

@@ -194,13 +194,13 @@ bool refresh_needed = FALSE;
int currmenu = MMOST;
/* The currently active menu, initialized to a dummy value. */
sc *sclist = NULL;
keystruct *sclist = NULL;
/* The start of the shortcuts list. */
subnfunc *allfuncs = NULL;
funcstruct *allfuncs = NULL;
/* The start of the functions list. */
subnfunc *tailfunc;
funcstruct *tailfunc;
/* The last function in the list. */
subnfunc *exitfunc;
funcstruct *exitfunc;
/* A pointer to the special Exit/Close item. */
linestruct *search_history = NULL;
@@ -269,7 +269,7 @@ size_t light_to_col = 0;
/* Return the number of entries in the shortcut list for a given menu. */
size_t length_of_list(int menu)
{
subnfunc *f;
funcstruct *f;
size_t i = 0;
for (f = allfuncs; f != NULL; f = f->next)
@@ -359,7 +359,7 @@ void do_cancel(void)
void add_to_funcs(void (*func)(void), int menus, const char *desc, const char *help,
bool blank_after, bool viewok)
{
subnfunc *f = nmalloc(sizeof(subnfunc));
funcstruct *f = nmalloc(sizeof(funcstruct));
if (allfuncs == NULL)
allfuncs = f;
@@ -386,18 +386,17 @@ void add_to_funcs(void (*func)(void), int menus, const char *desc, const char *h
void add_to_sclist(int menus, const char *scstring, const int keycode,
void (*func)(void), int toggle)
{
static sc *tailsc;
static keystruct *tailsc;
#ifndef NANO_TINY
static int counter = 0;
#endif
sc *s = nmalloc(sizeof(sc));
keystruct *s = nmalloc(sizeof(keystruct));
/* Start the list, or tack on the next item. */
if (sclist == NULL)
sclist = s;
else
tailsc->next = s;
tailsc = s;
s->next = NULL;
/* Fill in the data. */
@@ -405,11 +404,14 @@ void add_to_sclist(int menus, const char *scstring, const int keycode,
s->func = func;
#ifndef NANO_TINY
s->toggle = toggle;
/* When not the same toggle as the previous one, increment the ID. */
if (toggle)
s->ordinal = ++counter;
s->ordinal = (tailsc->toggle == toggle) ? counter : ++counter;
#endif
assign_keyinfo(s, scstring, keycode);
tailsc = s;
#ifdef DEBUG
fprintf(stderr, "Setting keycode to %d for shortcut \"%s\" in menus %x\n", s->keycode, scstring, s->menus);
#endif
@@ -417,9 +419,9 @@ void add_to_sclist(int menus, const char *scstring, const int keycode,
/* Return the first shortcut in the list of shortcuts that
* matches the given func in the given menu. */
const sc *first_sc_for(int menu, void (*func)(void))
const keystruct *first_sc_for(int menu, void (*func)(void))
{
const sc *s;
const keystruct *s;
for (s = sclist; s != NULL; s = s->next)
if ((s->menus & menu) && s->func == func)
@@ -435,7 +437,7 @@ const sc *first_sc_for(int menu, void (*func)(void))
* current menu, if any; otherwise, return the given default value. */
int the_code_for(void (*func)(void), int defaultval)
{
const sc *s = first_sc_for(currmenu, func);
const keystruct *s = first_sc_for(currmenu, func);
if (s == NULL)
return defaultval;
@@ -447,7 +449,7 @@ int the_code_for(void (*func)(void), int defaultval)
/* Return a pointer to the function that is bound to the given key. */
functionptrtype func_from_key(int *kbinput)
{
const sc *s = get_shortcut(kbinput);
const keystruct *s = get_shortcut(kbinput);
if (s)
return s->func;
@@ -456,7 +458,7 @@ functionptrtype func_from_key(int *kbinput)
}
/* Set the string and its corresponding keycode for the given shortcut s. */
void assign_keyinfo(sc *s, const char *keystring, const int keycode)
void assign_keyinfo(keystruct *s, const char *keystring, const int keycode)
{
s->keystr = keystring;
s->meta = (keystring[0] == 'M' && keycode == 0);
@@ -505,8 +507,8 @@ int keycode_from_string(const char *keystring)
#ifdef DEBUG
void print_sclist(void)
{
sc *s;
const subnfunc *f;
keystruct *s;
const funcstruct *f;
for (s = sclist; s != NULL; s = s->next) {
f = sctofunc(s);
@@ -1039,7 +1041,7 @@ void shortcut_init(void)
N_("No Conversion"), WITHORSANS(convert_gist), TOGETHER, NOVIEW);
/* Command execution is only available when not in restricted mode. */
if (!ISSET(RESTRICTED)) {
if (!ISSET(RESTRICTED) && !ISSET(VIEW_MODE)) {
add_to_funcs(flip_execute, MINSERTFILE,
N_("Execute Command"), WITHORSANS(execute_gist), TOGETHER, NOVIEW);
@@ -1256,9 +1258,10 @@ void shortcut_init(void)
/* Group of "Appearance" toggles. */
add_to_sclist(MMAIN, "M-X", 0, do_toggle_void, NO_HELP);
add_to_sclist(MMAIN, "M-C", 0, do_toggle_void, CONSTANT_SHOW);
add_to_sclist(MMAIN, "M-S", 0, do_toggle_void, JUMPY_SCROLLING);
add_to_sclist(MMAIN, "M-S", 0, do_toggle_void, SOFTWRAP);
add_to_sclist(MMAIN, "M-$", 0, do_toggle_void, SOFTWRAP);
#ifdef ENABLE_LINENUMBERS
add_to_sclist(MMAIN, "M-N", 0, do_toggle_void, LINE_NUMBERS);
add_to_sclist(MMAIN, "M-#", 0, do_toggle_void, LINE_NUMBERS);
#endif
add_to_sclist(MMAIN, "M-P", 0, do_toggle_void, WHITESPACE_DISPLAY);
@@ -1309,6 +1312,9 @@ void shortcut_init(void)
#endif
add_to_sclist(MGOTOLINE, "^Y", 0, to_first_line, 0);
add_to_sclist(MGOTOLINE, "^V", 0, to_last_line, 0);
/* Some people are used to having these keystrokes in the Search menu. */
add_to_sclist(MWHEREIS, "^Y", 0, to_first_line, 0);
add_to_sclist(MWHEREIS, "^V", 0, to_last_line, 0);
#ifdef ENABLE_BROWSER
add_to_sclist(MWHEREISFILE, "^Y", 0, to_first_file, 0);
add_to_sclist(MWHEREISFILE, "^V", 0, to_last_file, 0);
@@ -1328,7 +1334,7 @@ void shortcut_init(void)
add_to_sclist(MWRITEFILE, "M-M", 0, mac_format_void, 0);
/* Only when not in restricted mode, allow Appending, Prepending,
* making backups, and executing a command. */
if (!ISSET(RESTRICTED)) {
if (!ISSET(RESTRICTED) && !ISSET(VIEW_MODE)) {
add_to_sclist(MWRITEFILE, "M-A", 0, append_void, 0);
add_to_sclist(MWRITEFILE, "M-P", 0, prepend_void, 0);
add_to_sclist(MWRITEFILE, "M-B", 0, backup_file_void, 0);
@@ -1387,9 +1393,9 @@ void shortcut_init(void)
#endif
}
const subnfunc *sctofunc(const sc *s)
const funcstruct *sctofunc(const keystruct *s)
{
subnfunc *f = allfuncs;
funcstruct *f = allfuncs;
while (f != NULL && f->func != s->func)
f = f->next;
@@ -1408,8 +1414,6 @@ const char *flagtostr(int flag)
return N_("Help mode");
case CONSTANT_SHOW:
return N_("Constant cursor position display");
case JUMPY_SCROLLING:
return N_("Jumpy scrolling (per half-screen)");
case SOFTWRAP:
return N_("Soft wrapping of overlong lines");
case WHITESPACE_DISPLAY:
@@ -1441,9 +1445,9 @@ const char *flagtostr(int flag)
#ifdef ENABLE_NANORC
/* Interpret a function string given in the rc file, and return a
* shortcut record with the corresponding function filled in. */
sc *strtosc(const char *input)
keystruct *strtosc(const char *input)
{
sc *s = nmalloc(sizeof(sc));
keystruct *s = nmalloc(sizeof(keystruct));
#ifndef NANO_TINY
s->toggle = 0;
@@ -1661,8 +1665,6 @@ sc *strtosc(const char *input)
s->toggle = NO_HELP;
else if (!strcasecmp(input, "constantshow"))
s->toggle = CONSTANT_SHOW;
else if (!strcasecmp(input, "smoothscroll"))
s->toggle = JUMPY_SCROLLING;
else if (!strcasecmp(input, "softwrap"))
s->toggle = SOFTWRAP;
#ifdef ENABLE_LINENUMBERS

View File

@@ -291,8 +291,8 @@ void help_init(void)
/* Untranslated help introduction. We break it up into three chunks
* in case the full string is too long for the compiler to handle. */
char *ptr;
const subnfunc *f;
const sc *s;
const funcstruct *f;
const keystruct *s;
/* First, set up the initial help text for the current function. */
if (currmenu == MWHEREIS || currmenu == MREPLACE || currmenu == MREPLACEWITH) {
@@ -556,9 +556,6 @@ void help_init(void)
}
}
#endif /* !NANO_TINY */
if (strlen(help_text) > allocsize)
statusline(ALERT, "Help text spilled over -- please report a bug");
}
/* Return the function that is bound to the given key, accepting certain

View File

@@ -178,16 +178,7 @@ void free_lines(linestruct *src)
/* Renumber the lines in a buffer, starting with the given line. */
void renumber(linestruct *line)
{
ssize_t number;
if (line == NULL) {
#ifndef NANO_TINY
statusline(ALERT, "Trying to renumber nothing -- please report a bug");
#endif
return;
}
number = (line->prev == NULL) ? 0 : line->prev->lineno;
ssize_t number = (line->prev == NULL) ? 0 : line->prev->lineno;
while (line != NULL) {
line->lineno = ++number;
@@ -389,7 +380,7 @@ void extract_buffer(linestruct **file_top, linestruct **file_bot,
renumber(top_save);
/* If the text doesn't end with a newline, and it should, add one. */
if (ISSET(FINAL_NEWLINE) && openfile->filebot->data[0] != '\0')
if (!ISSET(NO_NEWLINES) && openfile->filebot->data[0] != '\0')
new_magicline();
}
@@ -486,7 +477,7 @@ void ingraft_buffer(linestruct *somebuffer)
renumber(top_save);
/* If the text doesn't end with a newline, and it should, add one. */
if (ISSET(FINAL_NEWLINE) && openfile->filebot->data[0] != '\0')
if (!ISSET(NO_NEWLINES) && openfile->filebot->data[0] != '\0')
new_magicline();
}
@@ -806,7 +797,7 @@ void usage(void)
N_("Fix numeric keypad key confusion problem"));
#ifndef NANO_TINY
print_opt("-L", "--nonewlines",
N_("Don't add an automatic newline [default]"));
N_("Don't add an automatic newline"));
#endif
#ifdef ENABLED_WRAPORJUSTIFY
print_opt("-M", "--trimblanks",
@@ -853,7 +844,6 @@ void usage(void)
print_opt("-d", "--rebinddelete",
N_("Fix Backspace/Delete confusion problem"));
print_opt("-e", "--emptyline", N_("Keep the line below the title bar empty"));
print_opt("-f", "--finalnewline", N_("Ensure that text ends with a newline"));
#ifdef ENABLE_BROWSER
if (!ISSET(RESTRICTED))
print_opt("-g", "--showcursor", N_("Show cursor in file browser & help text"));
@@ -1064,8 +1054,7 @@ void do_exit(void)
if (ISSET(TEMP_FILE))
warn_and_shortly_pause(_("No file name"));
choice = do_yesno_prompt(FALSE, _("Save modified buffer? "
"(Answering \"No\" will DISCARD changes.) "));
choice = do_yesno_prompt(FALSE, _("Save modified buffer? "));
}
/* If the user chose not to save, or if the user chose to save and
@@ -1300,6 +1289,23 @@ RETSIGTYPE do_continue(int signal)
ungetch(KEY_FLUSH);
}
#if !defined(NANO_TINY) || defined(ENABLE_SPELLER)
/* Block or unblock the SIGWINCH signal, depending on the blockit parameter. */
void block_sigwinch(bool blockit)
{
sigset_t winch;
sigemptyset(&winch);
sigaddset(&winch, SIGWINCH);
sigprocmask(blockit ? SIG_BLOCK : SIG_UNBLOCK, &winch, NULL);
#ifndef NANO_TINY
if (the_window_resized)
regenerate_screen();
#endif
}
#endif
#ifndef NANO_TINY
/* Handler for SIGWINCH (window size change). */
RETSIGTYPE handle_sigwinch(int signal)
@@ -1649,9 +1655,9 @@ bool wanted_to_move(void (*func)(void))
}
/* Return TRUE when the given shortcut is admissible in view mode. */
bool okay_for_view(const sc *shortcut)
bool okay_for_view(const keystruct *shortcut)
{
const subnfunc *func = sctofunc(shortcut);
const funcstruct *func = sctofunc(shortcut);
return (func == NULL || func->viewok);
}
@@ -1668,7 +1674,7 @@ void do_input(void)
/* The length of the input buffer. */
bool retain_cuts = FALSE;
/* Whether to conserve the current contents of the cutbuffer. */
const sc *shortcut;
const keystruct *shortcut;
/* Read in a keystroke, and show the cursor while waiting. */
input = get_kbinput(edit, VISIBLE);
@@ -1906,7 +1912,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
#endif
/* If we've added text to the magic line, create a new magic line. */
if (openfile->filebot == openfile->current && ISSET(FINAL_NEWLINE)) {
if (openfile->filebot == openfile->current && !ISSET(NO_NEWLINES)) {
new_magicline();
if (margin > 0)
refresh_needed = TRUE;
@@ -1953,6 +1959,8 @@ int main(int argc, char **argv)
bool fill_used = FALSE;
/* Was the fill option used on the command line? */
#endif
int hardwrap = -2;
/* Becomes 0 when --nowrap and 1 when --breaklonglines is used. */
#ifdef ENABLE_JUSTIFY
int quoterc;
/* Whether the quoting regex was compiled successfully. */
@@ -1985,7 +1993,6 @@ int main(int argc, char **argv)
{"constantshow", 0, NULL, 'c'},
{"rebinddelete", 0, NULL, 'd'},
{"emptyline", 0, NULL, 'e'},
{"finalnewline", 0, NULL, 'f'},
#ifdef ENABLE_BROWSER
{"showcursor", 0, NULL, 'g'},
#endif
@@ -2083,7 +2090,6 @@ int main(int argc, char **argv)
/* Set sensible defaults, different from what Pico does. */
SET(NO_WRAP);
SET(NO_NEWLINES);
SET(SMOOTH_SCROLL);
/* Give a small visual hint that nano has changed. */
@@ -2095,7 +2101,7 @@ int main(int argc, char **argv)
while ((optchr =
getopt_long(argc, argv,
"ABC:DEFGHIJ:KLMNOPQ:RST:UVWX:Y:Zabcdefghijklmno:pr:s:tuvwxyz$",
"ABC:DEFGHIJ:KLMNOPQ:RST:UVWX:Y:Zabcdeghijklmno:pr:s:tuvwxyz$",
long_options, NULL)) != -1) {
switch (optchr) {
#ifndef NANO_TINY
@@ -2151,7 +2157,7 @@ int main(int argc, char **argv)
break;
#ifndef NANO_TINY
case 'L':
UNSET(FINAL_NEWLINE);
SET(NO_NEWLINES);
break;
#endif
#ifdef ENABLED_WRAPORJUSTIFY
@@ -2223,7 +2229,7 @@ int main(int argc, char **argv)
#endif
#ifdef ENABLE_WRAPPING
case 'b':
SET(BREAK_LONG_LINES);
hardwrap = 1;
break;
#endif
case 'c':
@@ -2235,9 +2241,6 @@ int main(int argc, char **argv)
case 'e':
SET(EMPTY_LINE);
break;
case 'f':
SET(FINAL_NEWLINE);
break;
case 'g':
SET(SHOW_CURSOR);
break;
@@ -2308,7 +2311,7 @@ int main(int argc, char **argv)
break;
#ifdef ENABLE_WRAPPING
case 'w':
UNSET(BREAK_LONG_LINES);
hardwrap = 0;
break;
#endif
case 'x':
@@ -2426,8 +2429,6 @@ int main(int argc, char **argv)
/* If an rcfile undid the default settings, copy it to the new flags. */
if (!ISSET(NO_WRAP))
SET(BREAK_LONG_LINES);
if (!ISSET(NO_NEWLINES))
SET(FINAL_NEWLINE);
if (!ISSET(SMOOTH_SCROLL))
SET(JUMPY_SCROLLING);
if (!ISSET(MORE_SPACE))
@@ -2436,6 +2437,11 @@ int main(int argc, char **argv)
/* Simply OR the boolean flags from rcfile and command line. */
for (size_t i = 0; i < sizeof(flags) / sizeof(flags[0]); i++)
flags[i] |= flags_cmdline[i];
if (hardwrap == 0)
UNSET(BREAK_LONG_LINES);
else if (hardwrap == 1)
SET(BREAK_LONG_LINES);
}
#endif /* ENABLE_NANORC */

View File

@@ -426,17 +426,17 @@ typedef struct rcoption {
} rcoption;
#endif
typedef struct sc {
typedef struct keystruct {
const char *keystr;
/* The string that describes a keystroke, like "^C" or "M-R". */
/* The string that describes the keystroke, like "^C" or "M-R". */
bool meta;
/* Whether this is a Meta keystroke. */
int keycode;
/* The integer that, together with meta, identifies the keystroke. */
int menus;
/* Which menus this applies to. */
/* The menus in which this keystroke is bound. */
void (*func)(void);
/* The function we're going to run. */
/* The function to which this keystroke is bound. */
#ifndef NANO_TINY
int toggle;
/* If a toggle, what we're toggling. */
@@ -448,11 +448,11 @@ typedef struct sc {
char *expansion;
/* The string of keycodes to which this shortcut is expanded. */
#endif
struct sc *next;
struct keystruct *next;
/* Next in the list. */
} sc;
} keystruct;
typedef struct subnfunc {
typedef struct funcstruct {
void (*func)(void);
/* The actual function to call. */
int menus;
@@ -470,9 +470,9 @@ typedef struct subnfunc {
/* Is this function allowed when in view mode? */
long toggle;
/* If this is a toggle, which toggle to affect. */
struct subnfunc *next;
struct funcstruct *next;
/* Next item in the list. */
} subnfunc;
} funcstruct;
#ifdef ENABLE_WORDCOMPLETION
typedef struct completion_word {
@@ -543,7 +543,6 @@ enum
AFTER_ENDS,
LET_THEM_ZAP,
BREAK_LONG_LINES,
FINAL_NEWLINE,
JUMPY_SCROLLING,
EMPTY_LINE
};

View File

@@ -61,7 +61,7 @@ int do_statusbar_input(bool *finished)
/* The input buffer. */
static size_t kbinput_len = 0;
/* The length of the input buffer. */
const sc *shortcut;
const keystruct *shortcut;
*finished = FALSE;
@@ -667,7 +667,7 @@ int do_yesno_prompt(bool all, const char *msg)
if (!ISSET(NO_HELP)) {
char shortstr[MAXCHARLEN + 2];
/* Temporary string for (translated) " Y", " N" and " A". */
const sc *cancelshortcut = first_sc_for(MYESNO, do_cancel);
const keystruct *cancelshortcut = first_sc_for(MYESNO, do_cancel);
/* The keystroke that is bound to the Cancel function. */
if (COLS < 32)

View File

@@ -143,9 +143,9 @@ extern bool have_palette;
extern bool refresh_needed;
extern int currmenu;
extern sc *sclist;
extern subnfunc *allfuncs;
extern subnfunc *exitfunc;
extern keystruct *sclist;
extern funcstruct *allfuncs;
extern funcstruct *exitfunc;
extern linestruct *search_history;
extern linestruct *replace_history;
@@ -315,17 +315,17 @@ char *input_tab(char *buf, bool allow_files, size_t *place,
/* Some functions in global.c. */
size_t length_of_list(int menu);
const sc *first_sc_for(int menu, void (*func)(void));
const keystruct *first_sc_for(int menu, void (*func)(void));
int the_code_for(void (*func)(void), int defaultval);
functionptrtype func_from_key(int *kbinput);
int keycode_from_string(const char *keystring);
void assign_keyinfo(sc *s, const char *keystring, const int keycode);
void assign_keyinfo(keystruct *s, const char *keystring, const int keycode);
void print_sclist(void);
void shortcut_init(void);
const subnfunc *sctofunc(const sc *s);
const funcstruct *sctofunc(const keystruct *s);
const char *flagtostr(int flag);
#ifdef ENABLE_NANORC
sc *strtosc(const char *input);
keystruct *strtosc(const char *input);
int name_to_menu(const char *name);
char *menu_to_name(int menu);
#endif
@@ -424,6 +424,9 @@ RETSIGTYPE handle_crash(int signal);
#endif
RETSIGTYPE do_suspend(int signal);
RETSIGTYPE do_continue(int signal);
#if !defined(NANO_TINY) || defined(ENABLE_SPELLER)
void block_sigwinch(bool blockit);
#endif
#ifndef NANO_TINY
RETSIGTYPE handle_sigwinch(int signal);
void regenerate_screen(void);
@@ -437,7 +440,7 @@ void terminal_init(void);
void confirm_margin(void);
#endif
void unbound_key(int code);
bool okay_for_view(const sc *shortcut);
bool okay_for_view(const keystruct *shortcut);
void do_output(char *output, size_t output_len, bool allow_cntrls);
/* Most functions in prompt.c. */
@@ -557,7 +560,6 @@ int digits(ssize_t n);
#endif
bool parse_num(const char *str, ssize_t *val);
bool parse_line_column(const char *str, ssize_t *line, ssize_t *column);
void null_at(char **data, size_t index);
void unsunder(char *str, size_t true_len);
void sunder(char *str);
#if !defined(ENABLE_TINY) || defined(ENABLE_TABCOMP) || defined(ENABLE_BROWSER)
@@ -613,7 +615,7 @@ 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 sc *get_shortcut(int *kbinput);
const keystruct *get_shortcut(int *kbinput);
void blank_row(WINDOW *win, int y, int x, int n);
void blank_edit(void);
void blank_statusbar(void);

View File

@@ -50,7 +50,6 @@ static const rcoption rcopts[] = {
#ifdef ENABLED_WRAPORJUSTIFY
{"fill", 0},
#endif
{"finalnewline", FINAL_NEWLINE},
#ifdef ENABLE_HISTORIES
{"historylog", HISTORYLOG},
#endif
@@ -66,7 +65,7 @@ static const rcoption rcopts[] = {
{"multibuffer", MULTIBUFFER},
#endif
{"nohelp", NO_HELP},
{"nonewlines", NO_NEWLINES}, /* Deprecated; remove in 2021. */
{"nonewlines", NO_NEWLINES},
{"nopauses", NO_PAUSES},
#ifdef ENABLE_WRAPPING
{"nowrap", NO_WRAP}, /* Deprecated; remove in 2021. */
@@ -347,9 +346,9 @@ bool is_universal(void (*func)(void))
void parse_binding(char *ptr, bool dobind)
{
char *keyptr = NULL, *keycopy = NULL, *funcptr = NULL, *menuptr = NULL;
sc *s, *newsc = NULL;
keystruct *s, *newsc = NULL;
int menu, mask = 0;
subnfunc *f;
funcstruct *f;
if (*ptr == '\0') {
rcfile_error(N_("Missing key name"));
@@ -413,7 +412,7 @@ void parse_binding(char *ptr, bool dobind)
/* If the thing to bind starts with a double quote, it is a string,
* otherwise it is the name of a function. */
if (*funcptr == '"') {
newsc = nmalloc(sizeof(sc));
newsc = nmalloc(sizeof(keystruct));
newsc->func = (functionptrtype)implant;
newsc->expansion = mallocstrcpy(NULL, funcptr + 1);
#ifndef NANO_TINY
@@ -462,7 +461,7 @@ void parse_binding(char *ptr, bool dobind)
menu = menu & (is_universal(newsc->func) ? MMOST : mask);
if (!menu) {
if (!ISSET(RESTRICTED))
if (!ISSET(RESTRICTED) && !ISSET(VIEW_MODE))
rcfile_error(N_("Function '%s' does not exist in menu '%s'"),
funcptr, menuptr);
goto free_things;
@@ -556,7 +555,7 @@ void parse_includes(char *ptr)
/* Expand a tilde first, then try to match the globbing pattern. */
expanded = real_dir_from_tilde(pattern);
result = glob(expanded, GLOB_ERR|GLOB_NOSORT, NULL, &files);
result = glob(expanded, GLOB_ERR, NULL, &files);
/* If there are matches, process each of them. Otherwise, only
* report an error if it's something other than zero matches. */
@@ -884,7 +883,7 @@ void pick_up_name(const char *kind, char *ptr, char **storage)
* function that we consider 'vital' (such as "Exit"). */
static void check_vitals_mapped(void)
{
subnfunc *f;
funcstruct *f;
int v;
#define VITALS 3
void (*vitals[VITALS])(void) = { do_exit, do_exit, do_cancel };
@@ -893,7 +892,7 @@ static void check_vitals_mapped(void)
for (v = 0; v < VITALS; v++) {
for (f = allfuncs; f != NULL; f = f->next) {
if (f->func == vitals[v] && f->menus & inmenus[v]) {
const sc *s = first_sc_for(inmenus[v], f->func);
const keystruct *s = first_sc_for(inmenus[v], f->func);
if (!s) {
fprintf(stderr, _("No key is bound to function '%s' in "
"menu '%s'. Exiting.\n"), f->desc,
@@ -1126,11 +1125,13 @@ void parse_rcfile(FILE *rcstream, bool syntax_only)
stripe_column = 0;
}
free(option);
}
if (strcasecmp(rcopts[i].name, "matchbrackets") == 0) {
} else if (strcasecmp(rcopts[i].name, "matchbrackets") == 0) {
if (has_blank_char(option)) {
rcfile_error(N_("Non-blank characters required"));
free(option);
} else if (mbstrlen(option) % 2 != 0) {
rcfile_error(N_("Even number of characters required"));
free(option);
} else
matchbrackets = option;
} else if (strcasecmp(rcopts[i].name, "whitespace") == 0) {

View File

@@ -681,7 +681,7 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
/* If "automatic newline" is enabled, and text has been added to the
* magic line, make a new magic line. */
if (ISSET(FINAL_NEWLINE) && openfile->filebot->data[0] != '\0')
if (!ISSET(NO_NEWLINES) && openfile->filebot->data[0] != '\0')
new_magicline();
return numreplaced;
@@ -862,58 +862,53 @@ void do_gotolinecolumn_void(void)
}
#ifndef NANO_TINY
/* Search for a match to one of the two characters in bracket_set. If
* reverse is TRUE, search backwards for the leftmost bracket.
* Otherwise, search forwards for the rightmost bracket. Return TRUE if
* we found a match, and FALSE otherwise. */
/* Search, starting from the current position, for any of the two characters
* in bracket_set. If reverse is TRUE, search backwards, otherwise forwards.
* Return TRUE when one of the brackets was found, and FALSE otherwise. */
bool find_bracket_match(bool reverse, const char *bracket_set)
{
linestruct *fileptr = openfile->current;
const char *rev_start = NULL, *found = NULL;
linestruct *line = openfile->current;
const char *pointer = line->data + openfile->current_x;
const char *found = NULL;
assert(mbstrlen(bracket_set) == 2);
/* Step away from the current bracket, either backwards or forwards. */
if (reverse) {
if (--pointer < line->data) {
line = line->prev;
if (line == NULL)
return FALSE;
pointer = line->data + strlen(line->data);
}
} else
++pointer;
/* rev_start might end up 1 character before the start or after the
* end of the line. This won't be a problem because we'll skip over
* it below in that case, and rev_start will be properly set when
* the search continues on the previous or next line. */
if (reverse)
rev_start = fileptr->data + (openfile->current_x - 1);
else
rev_start = fileptr->data + (openfile->current_x + 1);
/* Look for either of the two characters in bracket_set. rev_start
* can be 1 character before the start or after the end of the line.
* In either case, just act as though no match is found. */
/* Now seek for any of the two brackets, either backwards or forwards. */
while (TRUE) {
if ((rev_start > fileptr->data && *(rev_start - 1) == '\0') ||
rev_start < fileptr->data)
found = NULL;
else if (reverse)
found = mbrevstrpbrk(fileptr->data, bracket_set, rev_start);
if (reverse)
found = mbrevstrpbrk(line->data, bracket_set, pointer);
else
found = mbstrpbrk(rev_start, bracket_set);
found = mbstrpbrk(pointer, bracket_set);
if (found)
break;
if (reverse)
fileptr = fileptr->prev;
line = line->prev;
else
fileptr = fileptr->next;
line = line->next;
/* If we've reached the start or end of the buffer, get out. */
if (fileptr == NULL)
if (line == NULL)
return FALSE;
rev_start = fileptr->data;
pointer = line->data;
if (reverse)
rev_start += strlen(fileptr->data);
pointer += strlen(line->data);
}
/* Set the current position to the found matching bracket. */
openfile->current = fileptr;
openfile->current_x = found - fileptr->data;
/* Set the current position to the found bracket. */
openfile->current = line;
openfile->current_x = found - line->data;
return TRUE;
}
@@ -922,73 +917,52 @@ bool find_bracket_match(bool reverse, const char *bracket_set)
* there is one. */
void do_find_bracket(void)
{
linestruct *current_save;
size_t current_x_save;
linestruct *was_current = openfile->current;
size_t was_current_x = openfile->current_x;
/* The current cursor position, in case we don't find a complement. */
const char *ch;
/* The location in matchbrackets of the bracket at the current
* cursor position. */
/* The location in matchbrackets of the bracket under the cursor. */
int ch_len;
/* The length of ch in bytes. */
const char *wanted_ch;
/* The location in matchbrackets of the bracket complementing
* the bracket at the current cursor position. */
/* The location in matchbrackets of the complementing bracket. */
int wanted_ch_len;
/* The length of wanted_ch in bytes. */
char bracket_set[MAXCHARLEN * 2 + 1];
/* The pair of characters in ch and wanted_ch. */
size_t i;
/* Generic loop variable. */
size_t matchhalf;
/* The number of single-byte characters in one half of
* matchbrackets. */
size_t mbmatchhalf;
/* The number of multibyte characters in one half of
* matchbrackets. */
size_t count = 1;
size_t halfway = 0;
/* The index in matchbrackets where the closing brackets start. */
size_t charcount = mbstrlen(matchbrackets) / 2;
/* Half the number of characters in matchbrackets. */
size_t balance = 1;
/* The initial bracket count. */
bool reverse;
/* The direction we search. */
assert(mbstrlen(matchbrackets) % 2 == 0);
ch = mbstrchr(matchbrackets, openfile->current->data + openfile->current_x);
ch = openfile->current->data + openfile->current_x;
if ((ch = mbstrchr(matchbrackets, ch)) == NULL) {
if (ch == NULL) {
statusbar(_("Not a bracket"));
return;
}
/* Save where we are. */
current_save = openfile->current;
current_x_save = openfile->current_x;
/* Find the halfway point in matchbrackets, where the closing ones start. */
for (size_t i = 0; i < charcount; i++)
halfway += parse_mbchar(matchbrackets + halfway, NULL, NULL);
/* If we're on an opening bracket, which must be in the first half
* of matchbrackets, we want to search forwards for a closing
* bracket. If we're on a closing bracket, which must be in the
* second half of matchbrackets, we want to search backwards for an
* opening bracket. */
matchhalf = 0;
mbmatchhalf = mbstrlen(matchbrackets) / 2;
/* When on a closing bracket, we have to search backwards for a matching
* opening bracket; otherwise, forward for a matching closing bracket. */
reverse = (ch >= (matchbrackets + halfway));
for (i = 0; i < mbmatchhalf; i++)
matchhalf += parse_mbchar(matchbrackets + matchhalf, NULL, NULL);
reverse = ((ch - matchbrackets) >= matchhalf);
/* If we're on an opening bracket, set wanted_ch to the character
* that's matchhalf characters after ch. If we're on a closing
* bracket, set wanted_ch to the character that's matchhalf
* characters before ch. */
/* Step half the number of total characters either backwards or forwards
* through matchbrackets to find the wanted complementary bracket. */
wanted_ch = ch;
while (mbmatchhalf > 0) {
while (charcount-- > 0) {
if (reverse)
wanted_ch = matchbrackets + move_mbleft(matchbrackets,
wanted_ch - matchbrackets);
else
wanted_ch += move_mbright(wanted_ch, 0);
mbmatchhalf--;
}
ch_len = parse_mbchar(ch, NULL, NULL);
@@ -1001,23 +975,23 @@ void do_find_bracket(void)
while (TRUE) {
if (find_bracket_match(reverse, bracket_set)) {
/* If we found an identical bracket, increment count. If we
/* If we found an identical bracket, increment balance. If we
* found a complementary bracket, decrement it. */
count += (strncmp(openfile->current->data + openfile->current_x,
balance += (strncmp(openfile->current->data + openfile->current_x,
ch, ch_len) == 0) ? 1 : -1;
/* If count is zero, we've found a matching bracket. Update
/* If balance is zero, we've found a matching bracket. Update
* the screen and get out. */
if (count == 0) {
edit_redraw(current_save, FLOWING);
if (balance == 0) {
edit_redraw(was_current, FLOWING);
break;
}
} else {
/* We didn't find either an opening or closing bracket.
* Indicate this, restore where we were, and get out. */
statusbar(_("No matching bracket"));
openfile->current = current_save;
openfile->current_x = current_x_save;
openfile->current = was_current;
openfile->current_x = was_current_x;
break;
}
}

View File

@@ -167,6 +167,7 @@ void do_indent(void)
free(indentation);
set_modified();
ensure_firstcolumn_is_aligned();
refresh_needed = TRUE;
shift_held = TRUE;
}
@@ -262,6 +263,7 @@ void do_unindent(void)
}
set_modified();
ensure_firstcolumn_is_aligned();
refresh_needed = TRUE;
shift_held = TRUE;
}
@@ -323,7 +325,7 @@ bool comment_line(undo_type action, linestruct *line, const char *comment_seq)
/* Length of postfix. */
size_t line_len = strlen(line->data);
if (ISSET(FINAL_NEWLINE) && line == openfile->filebot)
if (!ISSET(NO_NEWLINES) && line == openfile->filebot)
return FALSE;
if (action == COMMENT) {
@@ -393,7 +395,7 @@ void do_comment(void)
get_range((const linestruct **)&top, (const linestruct **)&bot);
/* If only the magic line is selected, don't do anything. */
if (top == bot && bot == openfile->filebot && ISSET(FINAL_NEWLINE)) {
if (top == bot && bot == openfile->filebot && !ISSET(NO_NEWLINES)) {
statusbar(_("Cannot comment past end of file"));
return;
}
@@ -427,6 +429,7 @@ void do_comment(void)
}
set_modified();
ensure_firstcolumn_is_aligned();
refresh_needed = TRUE;
shift_held = TRUE;
}
@@ -480,7 +483,7 @@ void undo_cut(undo *u)
copy_from_buffer(u->cutbuffer);
/* If the final line was originally cut, remove the extra magic line. */
if ((u->xflags & WAS_FINAL_LINE) && ISSET(FINAL_NEWLINE) &&
if ((u->xflags & WAS_FINAL_LINE) && !ISSET(NO_NEWLINES) &&
openfile->current != openfile->filebot)
remove_magicline();
@@ -521,8 +524,8 @@ void do_undo(void)
char *data, *undidmsg = NULL;
size_t from_x, to_x;
if (!u) {
statusbar(_("Nothing in undo buffer!"));
if (u == NULL) {
statusbar(_("Nothing to undo"));
return;
}
@@ -538,7 +541,7 @@ void do_undo(void)
/* TRANSLATORS: The next thirteen strings describe actions
* that are undone or redone. They are all nouns, not verbs. */
undidmsg = _("addition");
if ((u->xflags & WAS_FINAL_LINE) && ISSET(FINAL_NEWLINE))
if ((u->xflags & WAS_FINAL_LINE) && !ISSET(NO_NEWLINES))
remove_magicline();
data = charalloc(strlen(f->data) - strlen(u->strdata) + 1);
strncpy(data, f->data, u->begin);
@@ -548,10 +551,6 @@ void do_undo(void)
goto_line_posx(u->lineno, u->begin);
break;
case ENTER:
if (f->next == NULL) {
statusline(ALERT, "Missing break line -- please report a bug");
break;
}
undidmsg = _("line break");
from_x = (u->begin == 0) ? 0 : u->mark_begin_x;
to_x = (u->begin == 0) ? u->mark_begin_x : u->begin;
@@ -578,7 +577,7 @@ void do_undo(void)
/* When the join was done by a Backspace at the tail of the file,
* and the nonewlines flag isn't set, do not re-add a newline that
* wasn't actually deleted; just position the cursor. */
if ((u->xflags & WAS_FINAL_BACKSPACE) && ISSET(FINAL_NEWLINE)) {
if ((u->xflags & WAS_FINAL_BACKSPACE) && !ISSET(NO_NEWLINES)) {
goto_line_posx(openfile->filebot->lineno, 0);
break;
}
@@ -669,7 +668,6 @@ void do_undo(void)
break;
#endif
default:
statusline(ALERT, "Wrong undo type -- please report a bug");
break;
}
@@ -699,19 +697,14 @@ void do_redo(void)
undo *u = openfile->undotop;
if (u == NULL || u == openfile->current_undo) {
statusbar(_("Nothing to re-do!"));
statusbar(_("Nothing to redo"));
return;
}
/* Get the previous undo item. */
while (u != NULL && u->next != openfile->current_undo)
/* Find the item before the current one in the undo stack. */
while (u->next != openfile->current_undo)
u = u->next;
if (u == NULL) {
statusline(ALERT, "Bad undo stack -- please report a bug");
return;
}
if (u->type <= REPLACE) {
f = fsfromline(u->mark_begin_lineno);
if (f == NULL)
@@ -721,7 +714,7 @@ void do_redo(void)
switch (u->type) {
case ADD:
redidmsg = _("addition");
if ((u->xflags & WAS_FINAL_LINE) && ISSET(FINAL_NEWLINE))
if ((u->xflags & WAS_FINAL_LINE) && !ISSET(NO_NEWLINES))
new_magicline();
data = charalloc(strlen(f->data) + strlen(u->strdata) + 1);
strncpy(data, f->data, u->begin);
@@ -754,15 +747,11 @@ void do_redo(void)
goto_line_posx(u->lineno, u->begin);
break;
case JOIN:
if (f->next == NULL) {
statusline(ALERT, "Missing join line -- please report a bug");
break;
}
redidmsg = _("line join");
/* When the join was done by a Backspace at the tail of the file,
* and the nonewlines flag isn't set, do not join anything, as
* nothing was actually deleted; just position the cursor. */
if ((u->xflags & WAS_FINAL_BACKSPACE) && ISSET(FINAL_NEWLINE)) {
if ((u->xflags & WAS_FINAL_BACKSPACE) && !ISSET(NO_NEWLINES)) {
goto_line_posx(u->mark_begin_lineno, u->mark_begin_x);
break;
}
@@ -840,7 +829,6 @@ void do_redo(void)
break;
#endif
default:
statusline(ALERT, "Wrong redo type -- please report a bug");
break;
}
@@ -903,7 +891,8 @@ void do_enter(void)
}
#endif
null_at(&openfile->current->data, openfile->current_x);
/* Make the current line end at the cursor position. */
openfile->current->data[openfile->current_x] = '\0';
#ifndef NANO_TINY
add_undo(ENTER);
@@ -1019,6 +1008,8 @@ bool execute_command(const char *command)
return FALSE;
}
statusbar(_("Executing..."));
/* If the command starts with "|", pipe buffer or region to the command. */
if (should_pipe) {
linestruct *was_cutbuffer = cutbuffer;
@@ -1263,7 +1254,6 @@ void add_undo(undo_type action)
break;
#endif
default:
statusline(ALERT, "Wrong undo adding type -- please report a bug");
break;
}
@@ -1402,7 +1392,7 @@ void update_undo(undo_type action)
if (u->lineno == u->mark_begin_lineno)
u->begin += u->mark_begin_x;
} else if (openfile->current == openfile->filebot &&
!ISSET(FINAL_NEWLINE))
ISSET(NO_NEWLINES))
u->begin = strlen(u->cutbottom->data);
}
break;
@@ -1416,7 +1406,6 @@ void update_undo(undo_type action)
u->begin = openfile->current_x;
break;
default:
statusline(ALERT, "Wrong undo update type -- please report a bug");
break;
}
}
@@ -1512,7 +1501,6 @@ bool do_wrap(linestruct *line)
line->data = charealloc(line->data, line_len + 2);
line->data[line_len] = ' ';
line->data[line_len + 1] = '\0';
remainder = line->data + wrap_loc;
rest_length++;
openfile->totsize++;
openfile->current_x++;
@@ -1671,101 +1659,80 @@ size_t indent_length(const char *line)
* number of characters untreated. */
void squeeze(linestruct *line, size_t skip)
{
char *end, *new_end, *newdata;
size_t shift = 0;
char *from, *to, *newdata;
size_t shrunk = 0;
int charlen;
end = line->data + skip;
newdata = charalloc(strlen(line->data) + 1);
strncpy(newdata, line->data, skip);
new_end = newdata + skip;
while (*end != '\0') {
int end_len;
from = line->data + skip;
to = newdata + skip;
while (*from != '\0') {
/* If this character is blank, change it to a space,
* and pass over all blanks after it. */
if (is_blank_mbchar(end)) {
end_len = parse_mbchar(end, NULL, NULL);
if (is_blank_mbchar(from)) {
from += parse_mbchar(from, NULL, NULL);
*(to++) = ' ';
*new_end = ' ';
new_end++;
end += end_len;
while (*end != '\0' && is_blank_mbchar(end)) {
end_len = parse_mbchar(end, NULL, NULL);
end += end_len;
shift += end_len;
while (*from != '\0' && is_blank_mbchar(from)) {
charlen = parse_mbchar(from, NULL, NULL);
from += charlen;
shrunk += charlen;
}
/* If this character is punctuation optionally followed by a bracket
* and then followed by blanks, change no more than two of the blanks
* to spaces if necessary, and pass over all blanks after them. */
} else if (mbstrchr(punct, end) != NULL) {
end_len = parse_mbchar(end, NULL, NULL);
/* If this character is punctuation, then copy it plus a possible
* bracket, and change at most two of subsequent blanks to spaces,
* and pass over all blanks after these. */
} else if (mbstrchr(punct, from) != NULL) {
charlen = parse_mbchar(from, NULL, NULL);
while (end_len > 0) {
*new_end = *end;
new_end++;
end++;
end_len--;
while (charlen > 0) {
*(to++) = *(from++);
charlen--;
}
if (*end != '\0' && mbstrchr(brackets, end) != NULL) {
end_len = parse_mbchar(end, NULL, NULL);
if (*from != '\0' && mbstrchr(brackets, from) != NULL) {
charlen = parse_mbchar(from, NULL, NULL);
while (end_len > 0) {
*new_end = *end;
new_end++;
end++;
end_len--;
while (charlen > 0) {
*(to++) = *(from++);
charlen--;
}
}
if (*end != '\0' && is_blank_mbchar(end)) {
end_len = parse_mbchar(end, NULL, NULL);
*new_end = ' ';
new_end++;
end += end_len;
if (*from != '\0' && is_blank_mbchar(from)) {
from += parse_mbchar(from, NULL, NULL);
*(to++) = ' ';
}
if (*from != '\0' && is_blank_mbchar(from)) {
from += parse_mbchar(from, NULL, NULL);
*(to++) = ' ';
}
if (*end != '\0' && is_blank_mbchar(end)) {
end_len = parse_mbchar(end, NULL, NULL);
*new_end = ' ';
new_end++;
end += end_len;
}
while (*end != '\0' && is_blank_mbchar(end)) {
end_len = parse_mbchar(end, NULL, NULL);
end += end_len;
shift += end_len;
while (*from != '\0' && is_blank_mbchar(from)) {
charlen = parse_mbchar(from, NULL, NULL);
from += charlen;
shrunk += charlen;
}
/* Leave unchanged anything that is neither blank nor punctuation. */
} else {
end_len = parse_mbchar(end, NULL, NULL);
charlen = parse_mbchar(from, NULL, NULL);
while (end_len > 0) {
*new_end = *end;
new_end++;
end++;
end_len--;
while (charlen > 0) {
*(to++) = *(from++);
charlen--;
}
}
}
*new_end = *end;
/* If there are spaces at the end of the line, remove them. */
while (new_end > newdata + skip && *(new_end - 1) == ' ') {
new_end--;
shift++;
while (to > newdata + skip && *(to - 1) == ' ') {
to--;
shrunk++;
}
if (shift > 0) {
null_at(&newdata, new_end - newdata);
if (shrunk > 0) {
*to = '\0';
free(line->data);
line->data = newdata;
} else
@@ -1935,7 +1902,7 @@ void rewrap_paragraph(linestruct **line, char *lead_string, size_t lead_len)
}
/* Now actually break the current line, and go to the next. */
null_at(&(*line)->data, break_pos);
(*line)->data[break_pos] = '\0';
*line = (*line)->next;
}
@@ -2027,32 +1994,6 @@ void do_justify(bool full_justify)
size_t second_lead_len = 0;
#endif
#ifndef NANO_TINY
/* Do normal justification only when the mark is off. */
if (!openfile->mark)
#endif
{
/* When justifying the entire buffer, start at the top. Otherwise, when
* in a paragraph but not at its beginning, move back to its first line. */
if (full_justify)
openfile->current = openfile->filetop;
else if (inpar(openfile->current) && !begpar(openfile->current, 0))
do_para_begin(&openfile->current);
/* Find the first line of the paragraph(s) to be justified. If the
* search fails, there is nothing to justify, and we will be on the
* last line of the file, so put the cursor at the end of it. */
if (!find_paragraph(&openfile->current, &par_len)) {
openfile->current_x = strlen(openfile->filebot->data);
refresh_needed = TRUE;
return;
}
}
/* Prepare to put the text we want to justify in the cutbuffer. */
cutbuffer = NULL;
cutbottom = NULL;
#ifndef NANO_TINY
/* If the mark is on, do as Pico: treat all marked text as one paragraph. */
if (openfile->mark) {
@@ -2099,19 +2040,33 @@ void do_justify(bool full_justify)
size_t jus_len;
/* The number of lines we're storing in the current cutbuffer. */
/* Start out at the first line of the paragraph. */
/* When justifying the entire buffer, start at the top. Otherwise, when
* in a paragraph but not at its beginning, move back to its first line. */
if (full_justify)
openfile->current = openfile->filetop;
else if (inpar(openfile->current) && !begpar(openfile->current, 0))
do_para_begin(&openfile->current);
/* Find the first line of the paragraph(s) to be justified. If the
* search fails, there is nothing to justify, and we will be on the
* last line of the file, so put the cursor at the end of it. */
if (!find_paragraph(&openfile->current, &par_len)) {
openfile->current_x = strlen(openfile->filebot->data);
refresh_needed = TRUE;
return;
}
first_par_line = openfile->current;
last_par_line = openfile->current;
top_x = 0;
/* Set the number of lines to be pulled into the cutbuffer. */
if (full_justify)
jus_len = openfile->filebot->lineno;
jus_len = openfile->filebot->lineno - first_par_line->lineno + 1;
else
jus_len = par_len;
/* Move down to the last line to be extracted. */
for (; jus_len > 1; jus_len--)
for (last_par_line = openfile->current; jus_len > 1; jus_len--)
last_par_line = last_par_line->next;
/* When possible, step one line further; otherwise, to line's end. */
@@ -2132,7 +2087,10 @@ void do_justify(bool full_justify)
add_undo(CUT);
#endif
/* Do the equivalent of a marked cut. */
/* Do the equivalent of a marked cut into an empty cutbuffer. */
cutbuffer = NULL;
cutbottom = NULL;
extract_buffer(&cutbuffer, &cutbottom, first_par_line, top_x,
last_par_line, bot_x);
#ifndef NANO_TINY
@@ -2435,10 +2393,11 @@ bool fix_spello(const char *word)
/* Internal (integrated) spell checking using the spell program,
* filtered through the sort and uniq programs. Return NULL for normal
* termination, and the error string otherwise. */
const char *do_int_speller(const char *tempfile_name)
char *do_int_speller(const char *tempfile_name)
{
char *read_buff, *read_buff_ptr, *read_buff_word;
size_t pipe_buff_size, read_buff_size, read_buff_read, bytesread;
char *misspellings, *pointer, *oneword;
long pipesize;
size_t buffersize, bytesread, totalread;
int spell_fd[2], sort_fd[2], uniq_fd[2], tempfile_fd = -1;
pid_t pid_spell, pid_sort, pid_uniq;
int spell_status, sort_status, uniq_status;
@@ -2538,53 +2497,61 @@ const char *do_int_speller(const char *tempfile_name)
}
/* Get the system pipe buffer size. */
if ((pipe_buff_size = fpathconf(uniq_fd[0], _PC_PIPE_BUF)) < 1) {
pipesize = fpathconf(uniq_fd[0], _PC_PIPE_BUF);
if (pipesize < 1) {
close(uniq_fd[0]);
return _("Could not get size of pipe buffer");
}
/* Read in the returned spelling errors. */
read_buff_read = 0;
read_buff_size = pipe_buff_size + 1;
read_buff = read_buff_ptr = charalloc(read_buff_size);
/* Block SIGWINCHes while reading misspelled words from the pipe. */
block_sigwinch(TRUE);
while ((bytesread = read(uniq_fd[0], read_buff_ptr, pipe_buff_size)) > 0) {
read_buff_read += bytesread;
read_buff_size += pipe_buff_size;
read_buff = read_buff_ptr = charealloc(read_buff, read_buff_size);
read_buff_ptr += read_buff_read;
totalread = 0;
buffersize = pipesize + 1;
misspellings = charalloc(buffersize);
pointer = misspellings;
while ((bytesread = read(uniq_fd[0], pointer, pipesize)) > 0) {
totalread += bytesread;
buffersize += pipesize;
misspellings = charealloc(misspellings, buffersize);
pointer = misspellings + totalread;
}
*read_buff_ptr = '\0';
*pointer = '\0';
close(uniq_fd[0]);
block_sigwinch(FALSE);
/* Do any replacements case sensitive, forward, and without regexes. */
SET(CASE_SENSITIVE);
UNSET(BACKWARDS_SEARCH);
UNSET(USE_REGEXP);
read_buff_word = read_buff_ptr = read_buff;
pointer = misspellings;
oneword = misspellings;
/* Process each of the misspelled words. */
while (*read_buff_ptr != '\0') {
if ((*read_buff_ptr == '\r') || (*read_buff_ptr == '\n')) {
*read_buff_ptr = '\0';
if (read_buff_word != read_buff_ptr) {
if (!fix_spello(read_buff_word)) {
read_buff_word = read_buff_ptr;
while (*pointer != '\0') {
if ((*pointer == '\r') || (*pointer == '\n')) {
*pointer = '\0';
if (oneword != pointer) {
if (!fix_spello(oneword)) {
oneword = pointer;
break;
}
}
read_buff_word = read_buff_ptr + 1;
oneword = pointer + 1;
}
read_buff_ptr++;
pointer++;
}
/* Special case: the last word doesn't end with '\r' or '\n'. */
if (read_buff_word != read_buff_ptr)
fix_spello(read_buff_word);
if (oneword != pointer)
fix_spello(oneword);
free(read_buff);
free(misspellings);
tidy_up_after_search();
refresh_needed = TRUE;
@@ -2618,7 +2585,7 @@ const char *do_int_speller(const char *tempfile_name)
/* External (alternate) spell checking. Return NULL for normal
* termination, and the error string otherwise. */
const char *do_alt_speller(char *tempfile_name)
char *do_alt_speller(char *tempfile_name)
{
int alt_spell_status;
size_t current_x_save = openfile->current_x;
@@ -2652,8 +2619,11 @@ const char *do_alt_speller(char *tempfile_name)
} else if (pid_spell < 0)
return _("Could not fork");
/* Wait for the alternate spell checker to finish. */
/* Block SIGWINCHes while waiting for the alternate spell checker's end,
* so nano doesn't get pushed past the wait(). */
block_sigwinch(TRUE);
wait(&alt_spell_status);
block_sigwinch(FALSE);
/* Reenter curses mode. */
doupdate();
@@ -2718,7 +2688,7 @@ void do_spell(void)
char *temp;
unsigned stash[sizeof(flags) / sizeof(flags[0])];
/* A storage place for the current flag settings. */
const char *result_msg;
char *result_msg;
if (ISSET(RESTRICTED)) {
show_restricted_warning();
@@ -2736,7 +2706,7 @@ void do_spell(void)
memcpy(stash, flags, sizeof(flags));
/* Don't add an extra newline when writing out the (selected) text. */
UNSET(FINAL_NEWLINE);
SET(NO_NEWLINES);
#ifndef NANO_TINY
if (openfile->mark)
@@ -2772,6 +2742,7 @@ void do_spell(void)
else
statusline(ALERT, _("Spell checking failed: %s: %s"), result_msg,
strerror(errno));
free(result_msg);
} else
statusbar(_("Finished checking spelling"));
}
@@ -2782,8 +2753,9 @@ void do_spell(void)
* termination, and the error string otherwise. */
void do_linter(void)
{
char *read_buff, *read_buff_ptr, *read_buff_word;
size_t pipe_buff_size, read_buff_size, read_buff_read, bytesread;
char *lintings, *pointer, *onelint;
long pipesize;
size_t buffersize, bytesread, totalread;
size_t parsesuccess = 0;
int lint_status, lint_fd[2];
pid_t pid_lint;
@@ -2861,36 +2833,40 @@ void do_linter(void)
}
/* Get the system pipe buffer size. */
if ((pipe_buff_size = fpathconf(lint_fd[0], _PC_PIPE_BUF)) < 1) {
pipesize = fpathconf(lint_fd[0], _PC_PIPE_BUF);
if (pipesize < 1) {
close(lint_fd[0]);
statusbar(_("Could not get size of pipe buffer"));
return;
}
/* Read in the returned syntax errors. */
read_buff_read = 0;
read_buff_size = pipe_buff_size + 1;
read_buff = read_buff_ptr = charalloc(read_buff_size);
totalread = 0;
buffersize = pipesize + 1;
lintings = charalloc(buffersize);
pointer = lintings;
while ((bytesread = read(lint_fd[0], read_buff_ptr, pipe_buff_size)) > 0) {
read_buff_read += bytesread;
read_buff_size += pipe_buff_size;
read_buff = read_buff_ptr = charealloc(read_buff, read_buff_size);
read_buff_ptr += read_buff_read;
while ((bytesread = read(lint_fd[0], pointer, pipesize)) > 0) {
totalread += bytesread;
buffersize += pipesize;
lintings = charealloc(lintings, buffersize);
pointer = lintings + totalread;
}
*read_buff_ptr = '\0';
*pointer = '\0';
close(lint_fd[0]);
/* Process the linter output. */
read_buff_word = read_buff_ptr = read_buff;
pointer = lintings;
onelint = lintings;
while (*read_buff_ptr != '\0') {
if ((*read_buff_ptr == '\r') || (*read_buff_ptr == '\n')) {
*read_buff_ptr = '\0';
if (read_buff_word != read_buff_ptr) {
while (*pointer != '\0') {
if ((*pointer == '\r') || (*pointer == '\n')) {
*pointer = '\0';
if (onelint != pointer) {
char *filename = NULL, *linestr = NULL, *maybecol = NULL;
char *message = mallocstrcpy(NULL, read_buff_word);
char *message = mallocstrcpy(NULL, onelint);
/* At the moment we handle the following formats:
*
@@ -2898,7 +2874,7 @@ void do_linter(void)
* filenameorcategory:line,column:message (e.g. pylint)
* filenameorcategory:line:message (e.g. pyflakes) */
if (strstr(message, ": ") != NULL) {
filename = strtok(read_buff_word, ":");
filename = strtok(onelint, ":");
if ((linestr = strtok(NULL, ":")) != NULL) {
if ((maybecol = strtok(NULL, ":")) != NULL) {
ssize_t tmplineno = 0, tmpcolno = 0;
@@ -2906,7 +2882,7 @@ void do_linter(void)
tmplineno = strtol(linestr, NULL, 10);
if (tmplineno <= 0) {
read_buff_ptr++;
pointer++;
free(message);
continue;
}
@@ -2938,24 +2914,27 @@ void do_linter(void)
lints = curlint;
}
}
} else
free(message);
}
free(message);
}
read_buff_word = read_buff_ptr + 1;
onelint = pointer + 1;
}
read_buff_ptr++;
pointer++;
}
free(lintings);
/* Process the end of the linting process. */
waitpid(pid_lint, &lint_status, 0);
if (!WIFEXITED(lint_status) || WEXITSTATUS(lint_status) > 2) {
statusbar(invocation_error(openfile->syntax->linter));
char *result_msg= invocation_error(openfile->syntax->linter);
statusbar(result_msg);
free(result_msg);
return;
}
free(read_buff);
if (parsesuccess == 0) {
statusline(HUSH, _("Got 0 parsable lines from command: %s"),
openfile->syntax->linter);

View File

@@ -159,13 +159,6 @@ bool parse_line_column(const char *str, ssize_t *line, ssize_t *column)
return retval;
}
/* Null a string at a certain index and align it. */
void null_at(char **data, size_t index)
{
*data = charealloc(*data, index + 1);
(*data)[index] = '\0';
}
/* For non-null-terminated lines. A line, by definition, shouldn't
* normally have newlines in it, so encode its nulls as newlines. */
void unsunder(char *str, size_t true_len)
@@ -336,10 +329,6 @@ char *mallocstrncpy(char *dest, const char *src, size_t n)
if (src == NULL)
src = "";
#ifndef NANO_TINY
if (src == dest)
fprintf(stderr, "\r*** Copying a string to itself -- please report a bug ***");
#endif
dest = charealloc(dest, n);
strncpy(dest, src, n);
@@ -519,12 +508,10 @@ linestruct *fsfromline(ssize_t lineno)
while (f->lineno != lineno && f->next != NULL)
f = f->next;
if (f->lineno != lineno) {
statusline(ALERT, "Gone undo line -- please report a bug");
if (f->lineno == lineno)
return f;
else
return NULL;
}
return f;
}
#endif /* !NANO_TINY */

View File

@@ -656,7 +656,7 @@ 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 sc *command = first_sc_for(MMAIN, do_indent);
const keystruct *command = first_sc_for(MMAIN, do_indent);
meta_key = command->meta;
return command->keycode;
@@ -1654,7 +1654,7 @@ int get_mouseinput(int *mouse_y, int *mouse_x, bool allow_shortcuts)
{
MEVENT mevent;
bool in_bottomwin;
subnfunc *f;
funcstruct *f;
/* First, get the actual mouse event. */
if (getmouse(&mevent) == ERR)
@@ -1729,7 +1729,7 @@ int get_mouseinput(int *mouse_y, int *mouse_x, bool allow_shortcuts)
/* And put the corresponding key into the keyboard buffer. */
if (f != NULL) {
const sc *s = first_sc_for(currmenu, f->func);
const keystruct *s = first_sc_for(currmenu, f->func);
unget_kbinput(s->keycode, s->meta);
}
return 1;
@@ -1769,9 +1769,9 @@ int get_mouseinput(int *mouse_y, int *mouse_x, bool allow_shortcuts)
* 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 sc *get_shortcut(int *kbinput)
const keystruct *get_shortcut(int *kbinput)
{
sc *s;
keystruct *s;
/* Plain characters cannot be shortcuts, so just skip those. */
if (!meta_key && ((*kbinput >= 0x20 && *kbinput < 0x7F) ||
@@ -1888,6 +1888,13 @@ char *display_string(const char *buf, size_t column, size_t span,
/* Allocate enough space for converting the relevant part of the line. */
converted = charalloc(strlen(buf) * (MAXCHARLEN + tabsize) + 1);
#ifndef NANO_TINY
if (span > HIGHEST_POSITIVE) {
statusline(ALERT, "Span has underflowed -- please report a bug");
converted[0] = '\0';
return converted;
}
#endif
/* If the first character starts before the left edge, or would be
* overwritten by a "<" token, then show placeholders instead. */
if (*buf != '\0' && *buf != '\t' && (start_col < column ||
@@ -2286,8 +2293,8 @@ void statusline(message_type importance, const char *msg, ...)
void bottombars(int menu)
{
size_t number, itemwidth, i;
subnfunc *f;
const sc *s;
funcstruct *f;
const keystruct *s;
/* Set the global variable to the given menu. */
currmenu = menu;
@@ -2786,15 +2793,6 @@ int update_line(linestruct *fileptr, size_t index)
row = fileptr->lineno - openfile->edittop->lineno;
/* If the line is offscreen, don't even try to display it. */
if (row < 0 || row >= editwinrows) {
#ifndef NANO_TINY
statusline(ALERT, "Badness: tried to display a line on row %i"
" -- please report a bug", row);
#endif
return 0;
}
/* First, blank out the row. */
blank_row(edit, row, 0, COLS);
@@ -3010,20 +3008,13 @@ void edit_scroll(bool direction)
{
linestruct *line;
size_t leftedge;
int remainder = 0, nrows = 1;
int nrows = 1;
/* Move the top line of the edit window one row up or down. */
if (direction == BACKWARD)
remainder = go_back_chunks(1, &openfile->edittop, &openfile->firstcolumn);
go_back_chunks(1, &openfile->edittop, &openfile->firstcolumn);
else
remainder = go_forward_chunks(1, &openfile->edittop, &openfile->firstcolumn);
if (remainder > 0) {
#ifndef NANO_TINY
statusline(ALERT, "Could not scroll -- please report a bug");
#endif
return;
}
go_forward_chunks(1, &openfile->edittop, &openfile->firstcolumn);
/* Actually scroll the text of the edit window one row up or down. */
scrollok(edit, TRUE);
@@ -3197,7 +3188,7 @@ size_t actual_last_column(size_t leftedge, size_t column)
{
#ifndef NANO_TINY
if (ISSET(SOFTWRAP)) {
bool last_chunk;
bool last_chunk = FALSE;
size_t end_col = get_softwrap_breakpoint(openfile->current->data,
leftedge, &last_chunk) - leftedge;

View File

@@ -10,12 +10,11 @@ color brightred "\<[A-Z_][0-9A-Z_]+\>"
color brightmagenta "^[[:space:]]*[A-Z_a-z]+:[[:space:]]*$"
color green "\<(float|double|bool|char|int|short|long|sizeof|enum|void|auto|static|const|struct|union|typedef|extern|(un)?signed|inline)\>"
color green "\<((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\>"
color green "\<([[:lower:]]+|(u_?)?int(8|16|32|64|ptr))_t\>"
color green "\<(class|namespace|template|public|protected|private|typename|this|friend|virtual|override|using|mutable|volatile|register|explicit)\>"
color brightyellow "\<(for|if|while|do|else|case|default|switch)\>"
color brightyellow "\<(try|throw|catch|operator|new|delete)\>"
color magenta "\<(goto|continue|break|return)\>"
color brightcyan "^[[:space:]]*#[[:space:]]*(define|include(_next)?|(un|ifn?)def|endif|el(if|se)|if|warning|error|pragma)"
color brightmagenta "'([^'\]|(\\["'abfnrtv\\]))'" "'\\(([0-3]?[0-7]{1,2}))'" "'\\x[0-9A-Fa-f]{1,2}'"
# GCC builtins.
@@ -23,11 +22,15 @@ color cyan "__attribute__[[:space:]]*\(\([^)]*\)\)" "__(aligned|asm|builtin|hidd
# Strings. In general you will want your strings and comments to come last,
# because highlighting rules are applied in the order they are read in.
color brightyellow ""([^"]|\\")*"" "<[^[:blank:]=]*>"
color brightyellow ""([^"]|\\")*"" "#[[:space:]]*include[[:space:]]+<[^[:blank:]=]*>"
# Multiline strings. This regex is VERY resource intensive,
# and sometimes colours things that shouldn't be coloured.
###color brightyellow start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*""
# Preprocessor directives.
color brightcyan start="^[[:space:]]*#[[:space:]]*(if(n?def)?|elif|warning|error|pragma)\>" end="(\`|[^\\])$"
color brightcyan "^[[:space:]]*#[[:space:]]*(define|else|endif|include(_next)?|undef)\>"
# Comments.
color brightblue "//.*"
color brightblue start="/\*" end="\*/"

View File

@@ -11,7 +11,7 @@ color cyan "^[[:space:]]*#.*"
color ,red " + +"
# Nano's name, including version.
color brightred "(GNU )?[Nn]ano [1-3]\.[0-9][-.[:alnum:]]*\>"
color brightred "(GNU )?[Nn]ano [1-4]\.[0-9][-.[:alnum:]]*\>"
# Email addresses.
color magenta "<[[:alnum:].%_+-]+@[[:alnum:].-]+\.[[:alpha:]]{2,}>"

View File

@@ -1,18 +1,23 @@
## Here is an example for manpages.
## Syntax highlighting for man pages.
syntax man "\.[1-9]x?$"
magic "troff or preprocessor input"
comment ".\""
color green "\.(SH|SS|TH) .*"
color brightgreen "\.(SH|SS|TH) " "\.([HIT]P)"
color brightred "\.(B[IR]?|I[BR]?|R[BI]|S[BM]) .*"
color brightblue "\.(B[IR]?|I[BR]?|R[BI]|S[BM]) " "\.([LP]?P)$"
# Section headers, title line, and indented paragraphs.
color green "^\.(SH|SS|TH) .*"
color brightgreen "^\.(SH|SS|TH) " "^\.([HIT]P)"
# Type faces, and normal paragraphs.
color brightred "^\.(B[IR]?|I[BR]?|R[BI]|S[BM]) .*"
color brightblue "^\.(B[IR]?|I[BR]?|R[BI]|S[BM]) " "^\.([LP]?P)$"
# Inline type faces.
color magenta "\\f[BIPR]"
color yellow "\.(br|DT|RS|RE|PD)"
# Relative margins, hyperlinks, and various other stuff.
color yellow "^\.(RS|RE|UR|UE|PD|DT)"
color yellow "^\.(ad|bp|br|ce|de|ds|el|ie|if|fi|ft|hy|ig|in|na|ne|nf|nh|ps|so|sp|ti|tr)"
# Comments.
color cyan "\.?\\\".*"
color cyan "(^\.)?\\\".*"
# Trailing whitespace.
color ,green "[[:space:]]+$"

View File

@@ -18,7 +18,7 @@ icolor brightgreen "^[[:space:]]*(syntax|linter)[[:space:]]+[^[:blank:]]+"
icolor green "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|comment|linter|extendsyntax)\>"
# Strings
color brightmagenta "".+"([[:space:]]|$)"
color brightmagenta "([[:space:]]|(start|end)=)".+"([[:space:]]|$)"
# Colors
icolor yellow "^[[:space:]]*i?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan|normal)?(,(white|black|red|blue|green|yellow|magenta|cyan|normal))?\>"