Compare commits

...

57 Commits
v4.3 ... v4.4

Author SHA1 Message Date
Benno Schulenberg
7d9ad31cd9 po: update translations and regenerate POT file and PO files 2019-08-25 10:57:32 +02:00
Benno Schulenberg
aecbc6faa9 bump version numbers and add a news item for the 4.4 release 2019-08-25 10:29:14 +02:00
Benno Schulenberg
a06b921f12 docs: document the search-at-startup feature (+/string or +?string) 2019-08-20 19:22:25 +02:00
Benno Schulenberg
bdf1a9d4e7 syntax: perl: avoid upsetting older glibcs with crafty range expression
The regcomp() function from glibc-2.27 (and older) considers the
bracket expression ['-.] to be invalid -- mistakenly.  Avoid using
any range expression in the relevant regex and instead enumerate
all acceptable characters.

This avoids https://savannah.gnu.org/bugs/?56766.
2019-08-19 17:15:29 +02:00
Benno Schulenberg
5c399dfc6e build: exclude the search-at-startup feature from the tiny version 2019-08-18 13:03:11 +02:00
Benno Schulenberg
ed4b6486a1 search: don't wipe the status bar at startup when there was an error 2019-08-18 12:59:23 +02:00
Brand Huntsman
2326bf695e search: accept toggles for case and regex when searching at startup
Allow the user to specify that the search string should be interpreted
case-sensitively and/or as a regular expression by preceding the search
indicator (/ or ?) with c and/or r.  Or to switch these things off by
using C and/or R.

Signed-off-by: Brand Huntsman <alpha@qzx.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2019-08-18 12:59:04 +02:00
Benno Schulenberg
a9dd73fb16 new feature: allow specifying a search string to "jump to" at startup
The string to "jump to" is specified with +/ for a forward search
(from the top of the file), or with +? for a backward search (from
the bottom of the file).

This fulfills https://savannah.gnu.org/bugs/?54535.
Requested-by: Derek Wolfe <dwwolfe1@gmail.com>

With-help-from: Brand Huntsman <alpha@qzx.com>
2019-08-18 11:16:03 +02:00
Benno Schulenberg
073bd3ad6e rcfile: properly handle an empty syntax before an 'include' statement
So that in the error message the correct filename gets shown
instead of the name of the (first) include file.

Reported-by: Brand Huntsman <alpha@qzx.com>
2019-08-18 10:56:17 +02:00
Benno Schulenberg
4bcc224560 docs: change a few URLs over to https, and rewrap a couple of NEWS items 2019-08-17 17:17:32 +02:00
Benno Schulenberg
f2f367ba9c syntaxes: change some unneeded 'icolor' commands to 'color' commands 2019-08-17 17:01:19 +02:00
Benno Schulenberg
48bff32ee3 gnulib: update to its current upstream state 2019-08-17 15:35:43 +02:00
Brand Huntsman
304f07258b rcfile: for an empty syntax, show the line number of the 'syntax' command
When reporting a syntax without any color commands, show the line number
of the relevant 'syntax' command instead of the line number where the
emptiness is concluded, because the latter can be many lines later.

Signed-off-by: Brand Huntsman <alpha@qzx.com>
2019-08-17 13:47:19 +02:00
Benno Schulenberg
e1c2573c7a tweaks: improve a comment, and drop a superfluous one 2019-08-17 13:28:47 +02:00
Benno Schulenberg
07ec7de8eb tweaks: remove a saving and restoring that has become superfluous
The previous commit saves and restores filename and linenumber for
each single included file (after globbing), so it is now redundant
to do it for each 'include' command.
2019-08-17 13:21:34 +02:00
Brand Huntsman
82f5fed45a rcfile: report the correct command location for an invalid 'include'
For each included file, save and restore file name and line number of
the including file, so that an error message about a faulty 'include'
command can indicate the location of this 'include'.

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

Signed-off-by: Brand Huntsman <alpha@qzx.com>
2019-08-17 13:07:20 +02:00
Benno Schulenberg
a2f7e31ba2 new document: a condensed overview of nano's shortcut keystrokes
It's in a two-column format that fits on a single page, and uses the
more widely known Ctrl+X and Alt+X notations (instead of ^X and M-X).

The file is published on https://nano-editor.org/cheatsheet.html.
2019-08-16 19:49:50 +02:00
Benno Schulenberg
55983ee9d1 docs: make the synopsis of --speller and 'set speller' more accurate 2019-08-16 18:50:49 +02:00
Benno Schulenberg
cd274a7830 syntax: perl: don't color the character after a variable name
And generally improve the regex for coloring Perl variable names.

This fixes https://savannah.gnu.org/bugs/?56713.
With-help-from: Brand Huntsman <alpha@qzx.com>

Bug existed since the Perl syntax was introduced,
in version 1.2.2, commit 70047eef.
2019-08-14 09:24:32 +02:00
Benno Schulenberg
f773fa3968 syntax: default: colorize bracketed section headers in some config files 2019-08-14 09:18:51 +02:00
Benno Schulenberg
288355686b syntax: c: allow an underscore in lowercase type names 2019-08-11 20:06:46 +02:00
Benno Schulenberg
f7d5a82a5d search: wipe the status bar before searching again (M-W / M-Q)
So that any message that is on the status bar after the search
will be a response to this search and not some leftover.

This fixes https://savannah.gnu.org/bugs/?56737.
2019-08-10 13:11:41 +02:00
Benno Schulenberg
63e04ac31e tweaks: make a function name unique, to not overlap with others 2019-08-09 19:34:03 +02:00
Benno Schulenberg
0c63b50fdc tweaks: move a general function to a better place 2019-08-09 19:24:30 +02:00
Benno Schulenberg
94c9defde1 docs: slightly reword some of the descriptions around syntax highlighting 2019-08-09 19:16:16 +02:00
Benno Schulenberg
ee91c51e09 syntax: perl: avoid recognizing embedded hash signs as a comment starter
Require that a comment starts at the start of a line or is preceded by
whitespace.  This prevents most hash signs used for other purposes (and
what follows them) getting colored as comments.
2019-08-08 12:08:34 +02:00
Benno Schulenberg
1e3f3a7511 syntaxes: recognize .ctp extension as a PHP file, and .cu as a C/C++ file
This brings color to CakePHP template files, and to CUDA files.

This addresses https://bugs.debian.org/932192.
Requested-by: Jérôme Bardot <bardot.jerome@gmail.com>
2019-08-08 12:02:07 +02:00
Benno Schulenberg
8fce33afe0 text: copy leading quote characters when automatic hard-wrapping occurs
When the user is typing a long text and --breaklonglines is in effect,
then any leading comment or quoting characters are automatically added
to each automatic new line.

This fulfills https://savannah.gnu.org/bugs/?56042.
Requested-by: Sébastien Desreux <seb@h-k.fr>
2019-08-06 09:10:34 +02:00
Benno Schulenberg
4314b8ded3 display: blank the status bar on a successful cut or paste
But don't blank it when using the word-deletion functions.

This addresses https://savannah.gnu.org/bugs/?56564.

Original-patch-by: Bill Hager <prog00@protonmail.com>
2019-08-03 19:32:54 +02:00
Benno Schulenberg
52e39ae5f7 docs: slightly reword the descriptions of most configure options 2019-08-02 17:10:11 +02:00
Benno Schulenberg
5e7ba03ad1 docs: stop mentioning the 'unjustify' function, as it no longer exists
Unjustifying is done by using the general undo function (M-U).
2019-07-29 19:42:52 +02:00
Benno Schulenberg
97fec5603f docs: mention the M-N toggle instead of the obsolete M-# one
Reported-by: Bill Hager <prog00@protonmail.com>
2019-07-29 19:29:55 +02:00
Benno Schulenberg
3b8847f319 syntax: po: colorize numbers only when they form a self-contained word 2019-07-29 19:12:58 +02:00
Benno Schulenberg
a578d2706c copying: do not prevent M-6 from copying emptiness into the cutbuffer
The check mistakenly prevented the user from copying a region that
ended at EOF.  Removing the check also gives the user a way to clear
the cutbuffer (with M-A M-6 or ^6 M-6, for example).

This fixes https://savannah.gnu.org/bugs/?56563.
Reported-by: Liu Hao <lh_mouse@126.com>
2019-07-29 19:00:22 +02:00
Benno Schulenberg
44d38815cc display: clear the remainder of a row only when there actually is some
Make display_string() report back (via a global variable) whether the
just converted string has room to spare within the allotted span, so
that draw_row() can avoid trying to clear the remainder when there is
nothing to clear.

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

Bug existed since commit 699cacf7 from three days ago.
2019-06-28 20:45:47 +02:00
Benno Schulenberg
b23a5d5b29 tweaks: rewrap two lines, and reshuffle some logic to make more sense 2019-06-26 19:44:51 +02:00
Benno Schulenberg
b96cc8c212 tweaks: rename a parameter in three functions, to say what it points to 2019-06-26 19:44:51 +02:00
Benno Schulenberg
09ad0eb5f7 tweaks: rename a function, to suit better, and reshuffle its parameters 2019-06-26 19:44:51 +02:00
Benno Schulenberg
62ca113ed3 tweaks: reword and condense two comments, and correct another 2019-06-26 19:07:08 +02:00
Benno Schulenberg
5cfb74650d scrolling: don't overscroll when the edit window has just one row
If the edit window consists of a single row, then the do_down() call
has already brought the desired line or chunk into view -- no attempt
should then be made to scroll the screen further.

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

Bug existed since version 2.9.6, commit 0d9080a2.
2019-06-26 12:55:29 +02:00
Benno Schulenberg
8cd6aa0a32 display: when linenumbering, correctly spotlight text that spans two rows
This fixes https://savannah.gnu.org/bugs/?56552.

Bug existed since line numbers were introduced, in version 2.7.1.
2019-06-26 11:24:44 +02:00
Benno Schulenberg
fcbe41942f tweaks: reshuffle an assignment, and trim some excessive blank lines 2019-06-26 10:18:32 +02:00
Benno Schulenberg
39e5b52734 tweaks: call the correct lighting function directly when softwrapping 2019-06-26 10:12:23 +02:00
Benno Schulenberg
70b347183b tweaks: condense some comments, and drop two unneeded initializations 2019-06-26 09:47:07 +02:00
Benno Schulenberg
699cacf7a4 display: don't clear a row beforehand -- just clear the remainder
It is a waste of time to first fully clear a row when right afterward
text will be written to it (for most of the row, on average).  So...
just clear the part of the row after the written text.  Curses has the
perfect function for this: clrtoeol().
2019-06-25 12:09:28 +02:00
Benno Schulenberg
23cb26c58f tweaks: improve a handful of comments 2019-06-25 11:34:04 +02:00
Benno Schulenberg
3422ec3419 browser: draw a bar of spaces only where needed -- for the selected item
The edit window has been fully cleared just before the list-drawing
loop has started, so there is no need to wipe anything.  Only for the
highlighting bar all its characters need to be drawn with the correct
attributes.
2019-06-25 11:25:03 +02:00
Benno Schulenberg
5f1d9af375 tweaks: drop two parameters that are no longer needed 2019-06-25 11:13:35 +02:00
Benno Schulenberg
f3a441043d display: where needed, use slow blanking, but elsewhere do it much faster
Where the row needs to be filled with spaces with the attributes that
were set (title bar, prompt bar, and browser highlight), use printw().
But when the row needs to be actually cleared, use the much faster
clrtoeol().

This reduces the time needed to clear a full row with 95 percent.
2019-06-25 11:12:27 +02:00
Benno Schulenberg
e6c629951f display: use a somewhat faster method to clear a row
On an 80-column terminal, using a single printw() instead of
a loop of addch() reduces the time taken with 13 percent.
2019-06-23 20:49:01 +02:00
Benno Schulenberg
c06d5452f5 tweaks: move a call from two different places to a single place 2019-06-23 19:57:15 +02:00
Benno Schulenberg
1fcb9b99cf tweaks: move a function to before the first one that calls it 2019-06-23 12:29:17 +02:00
Benno Schulenberg
d8c840692e tweaks: reshuffle an 'if' out of a function, and rename the function 2019-06-23 12:15:19 +02:00
Benno Schulenberg
8c7b6bd21a tweaks: when precalculating, allocate all the cache space upfront
Instead of doing it haphazardly while lines are getting categorized.
2019-06-23 11:57:27 +02:00
Benno Schulenberg
21d0755de5 tweaks: try the allocation of a multidata cache just once per line
It does not need to be allocated for each multiline regex separately.
2019-06-23 11:45:03 +02:00
Benno Schulenberg
bbab9e2e62 tweaks: shorten two messages that translators tend to make too long 2019-06-19 19:34:19 +02:00
Benno Schulenberg
9ea1cd947c tweaks: add a translator hint, to clarify four short words 2019-06-19 19:14:47 +02:00
76 changed files with 19118 additions and 18505 deletions

View File

@@ -1,3 +1,67 @@
Changes between v4.3 and v4.4:
------------------------------
Benno Schulenberg (53):
browser: draw a bar of spaces only where needed -- for the selected item
build: exclude the search-at-startup feature from the tiny version
bump version numbers and add a news item for the 4.4 release
copying: do not prevent M-6 from copying emptiness into the cutbuffer
display: blank the status bar on a successful cut or paste
display: clear the remainder of a row only when there actually is some
display: don't clear a row beforehand -- just clear the remainder
display: use a somewhat faster method to clear a row
display: when linenumbering, correctly spotlight text that spans two rows
display: where needed, use slow blanking, but elsewhere do it much faster
docs: change a few URLs over to https, and rewrap a couple of NEWS items
docs: document the search-at-startup feature (+/string or +?string)
docs: make the synopsis of --speller and 'set speller' more accurate
docs: mention the M-N toggle instead of the obsolete M-# one
docs: slightly reword some of the descriptions around syntax highlighting
docs: slightly reword the descriptions of most configure options
docs: stop mentioning the 'unjustify' function, as it no longer exists
gnulib: update to its current upstream state
new document: a condensed overview of nano's shortcut keystrokes
new feature: allow specifying a search string to "jump to" at startup
rcfile: properly handle an empty syntax before an 'include' statement
scrolling: don't overscroll when the edit window has just one row
search: don't wipe the status bar at startup when there was an error
search: wipe the status bar before searching again (M-W / M-Q)
syntax: c: allow an underscore in lowercase type names
syntax: default: colorize bracketed section headers in some config files
syntaxes: change some unneeded 'icolor' commands to 'color' commands
syntaxes: recognize .ctp extension as a PHP file, and .cu as a C/C++ file
syntax: perl: avoid recognizing embedded hash signs as a comment starter
syntax: perl: avoid upsetting older glibcs with crafty range expression
syntax: perl: don't color the character after a variable name
syntax: po: colorize numbers only when they form a self-contained word
text: copy leading quote characters when automatic hard-wrapping occurs
tweaks: add a translator hint, to clarify four short words
tweaks: call the correct lighting function directly when softwrapping
tweaks: condense some comments, and drop two unneeded initializations
tweaks: drop two parameters that are no longer needed
tweaks: improve a comment, and drop a superfluous one
tweaks: improve a handful of comments
tweaks: make a function name unique, to not overlap with others
tweaks: move a call from two different places to a single place
tweaks: move a function to before the first one that calls it
tweaks: move a general function to a better place
tweaks: remove a saving and restoring that has become superfluous
tweaks: rename a function, to suit better, and reshuffle its parameters
tweaks: rename a parameter in three functions, to say what it points to
tweaks: reshuffle an assignment, and trim some excessive blank lines
tweaks: reshuffle an 'if' out of a function, and rename the function
tweaks: reword and condense two comments, and correct another
tweaks: rewrap two lines, and reshuffle some logic to make more sense
tweaks: shorten two messages that translators tend to make too long
tweaks: try the allocation of a multidata cache just once per line
tweaks: when precalculating, allocate all the cache space upfront
Brand Huntsman (3):
rcfile: for an empty syntax, show the line number of the 'syntax' command
rcfile: report the correct command location for an invalid 'include'
search: accept toggles for case and regex when searching at startup
Changes between v4.2 and v4.3:
------------------------------

View File

@@ -2,6 +2,8 @@ Improvements in GNU nano
========================
Since 4.0:
- The ability to perform a search at startup with +/string or +?string.
- Comment characters are copied when automatic hard-wrapping occurs.
- The ability to both read from and write to a FIFO.
- Automatic hard-wrapping is no longer the default.
- Addition of --guidestripe to draw a helpful vertical bar.

87
NEWS
View File

@@ -1,3 +1,10 @@
2019.08.25 - GNU nano 4.4 "Hagelslag"
• At startup, the cursor can be put on the first or last occurrence
of a string by preceding the filename with +/string or +?string.
• When automatic hard-wrapping occurs (--breaklonglines), any leading
quoting characters will be automatically copied to the new line.
• M-6 works again also when the cursor is at end of buffer.
2019.06.18 - GNU nano 4.3 "Musa Kart"
• The ability to read from and write to a FIFO has been regained.
• Startup time is reduced by fully parsing a syntax only when needed.
@@ -615,7 +622,7 @@
like this what could POSSIBLY go WRONG? Hahaha.
Enjoy and if you find new bugs, as always please
use Savannah's bug tracker.
http://savannah.gnu.org/bugs/?func=additem&group=nano
https://savannah.gnu.org/bugs/?func=additem&group=nano
2010.01.17 - GNU nano 2.2.2 is released for you, you, you. This
release includes fixes for: crashes when writing
@@ -700,7 +707,7 @@
editor, via the -$ or --softwrap command-line flags,
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)
(https://savannah.gnu.org/bugs/?func=additem&group=nano)
Remember: data loss happens, back up your files.
2009.07.28 - GNU nano 2.1.10 "Ellie" is released. This version includes
@@ -728,45 +735,41 @@
birthday lenny!
2009.02.07 - GNU nano 2.1.8 "unsafe at any speed" is released. This
release include some long overdue performance
improvements in syntax color highlighting, the ability
to abort running searches (useful mainly when
editing very large files) and the ability to use nano
like a pager for viewing standard input (i.e. "nano -").
Additionally, there are gentoo syntax highlighting
updates and fixes for issues with reading files
in a directory with strange parent directory permissions.
The key bindings code was also substantially changed
in order to be more ISO-C compatible. Be sure to use
the Savannah page not only for bug reports but for any
release includes some long overdue performance improvements
in syntax color highlighting, the ability to abort running
searches (useful mainly when editing very large files) and
the ability to use nano like a pager for viewing standard
input (i.e. "nano -"). Additionally, there are gentoo
syntax highlighting updates and fixes for issues with
reading files in a directory with strange parent directory
permissions. The key-bindings code was also substantially
changed in order to be more ISO-C compatible. Be sure to
use the Savannah page not only for bug reports but for any
features you would like to see before the next stable
series is released. Have fun with it!
2008.11.10 - GNU nano 2.1.7 "Effingham" is ready to make good on those
campaign promises of lower bug rates and 50% more pie.
This release includes a new check for external
modifications when saving a file, some code and
documentation cleanups, and more bug fixes for
the new undo code (but we continue to welcome
your bug reports via the Savannah bug page at
http://savannah.gnu.org/bugs/?func=additem&group=nano).
This release includes a new check for external modifications
when saving a file, some code and documentation cleanups,
and more bug fixes for the new undo code (but we continue
to welcome your bug reports via the Savannah bug page at
https://savannah.gnu.org/bugs/?func=additem&group=nano).
Come get some.
2008.10.03 - GNU nano 2.1.6 was for new features before it was against
them. This release includes more undo capability,
several new syntax highlighting configurations including
Objective C, OCaml, and Fortran, and a new capability
to activate highlighting based on the 1st line of the
file being edited. Also, the new default configure
options now include color syntax highlighting, .nanorc
support, multibuffer and extras. These items can still
be disabled and are not enabled with --enable-tiny. Bug
fixes include better signal handling under Cygwin, and
that's about it. Again please remember to
submit bug reports via Savannah at
http://savannah.gnu.org/bugs/?func=additem&group=nano
as undo functions certainly need more testing.
Bon appetit.
them. This release includes more undo capability, several
new syntax highlighting configurations including Objective
C, OCaml, and Fortran, and a new capability to activate
highlighting based on the 1st line of the file being
edited. Also, the new default configure options now
include color syntax highlighting, .nanorc support,
multibuffer and extras. These items can still be disabled
and are not enabled with --enable-tiny. Bug fixes include
better signal handling under Cygwin, and that's about it.
Again please remember to submit bug reports via Savannah at
https://savannah.gnu.org/bugs/?func=additem&group=nano as
undo functions certainly need more testing. Bon appetit.
2008.08.30 - GNU nano 2.1.5 is ready to lead on day one. This release
contains a better fix for incorrectly reported successful
@@ -789,15 +792,15 @@
are likely to run out of space; see Savannah bug #24000.
Have fun with it!
2008.08.04 - GNU nano 2.1.3 "least stable version ever" is released. This
release includes new (and experimental) undo and redo
functionality for most text operations. The default
key bindings are Meta-U for undo and Meta-E for redo, but
these can be remapped using the new 2.1 keybinding code.
Also included are some fixes for configuring using wide
curses, crashing when invoking the help menu with
certain locales, and not saving the search history when
compiled with configure options.
2008.08.04 - GNU nano 2.1.3 "least stable version ever" is released.
This release includes new (and experimental) undo and redo
functionality for most text operations. The default key
bindings are Meta-U for undo and Meta-E for redo, but these
can be remapped using the new 2.1 keybinding code. Also
included are some fixes for configuring using wide curses,
crashing when invoking the help menu with certain locales,
and not saving the search history when compiled with
configure options.
2008.04.24 - GNU nano 2.1.2 "New York City" is released. This release
contains fixes for binding bad keys, some

View File

@@ -2,7 +2,7 @@
# Generate configure & friends for GIT users.
gnulib_url="git://git.sv.gnu.org/gnulib.git"
gnulib_hash="a1beabcb14cde661c36f7a3c7c17b5871704003e"
gnulib_hash="b3cde21d1fb6391686e4fa68506131fb65ca256f"
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.3], [nano-devel@gnu.org], [nano])
AC_INIT([GNU nano], [4.4], [nano-devel@gnu.org], [nano])
AC_CONFIG_SRCDIR([src/nano.c])
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE([1.14])

131
doc/cheatsheet.html Normal file
View File

@@ -0,0 +1,131 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Cheatsheet for nano</title>
<meta name="description" content="nano">
<meta name="keywords" content="cheatsheet, nano, editor, shortcuts, keystrokes, functions">
</head>
<body lang="en">
<br>
<h1 align="center">Overview of nano's shortcuts &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</h1>
<h3 align="center">The editor's keystrokes and their functions &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</h3>
<br>
<table align="center"><tbody>
<tr><td>
<b>File handling</b>
<table><tbody>
<tr><td>Ctrl+S &nbsp;&nbsp;</td><td>Save current file</td></tr>
<tr><td>Ctrl+O </td><td> Offer to write file ("Save as")</td></tr>
<tr><td>Ctrl+R </td><td> Insert a file into current one</td></tr>
<tr><td>Ctrl+X </td><td> Close buffer, exit from nano</td></tr>
</tbody></table>
<br>
<b>Editing</b>
<table><tbody>
<tr><td>Ctrl+K &nbsp;&nbsp;</td><td>Cut current line into cutbuffer</td></tr>
<tr><td>Alt+6</td><td>Copy current line into cutbuffer</td></tr>
<tr><td>Ctrl+U</td><td>Paste contents of cutbuffer</td></tr>
<tr><td>Alt+T</td><td>Cut until end of buffer</td></tr>
<tr><td>Ctrl+]</td><td>Complete current word</td></tr>
<tr><td>Alt+3</td><td>Comment/uncomment line/region</td></tr>
<tr><td>Alt+U</td><td>Undo last action</td></tr>
<tr><td>Alt+E</td><td>Redo last undone action</td></tr>
</tbody></table>
<br>
<b>Search and replace</b>
<table><tbody>
<tr><td>Ctrl+Q &nbsp;&nbsp;</td><td>Start backward search</td></tr>
<tr><td>Ctrl+W</td><td>Start forward search</td></tr>
<tr><td>Alt+Q</td><td>Find next occurrence backward</td></tr>
<tr><td>Alt+W</td><td>Find next occurrence forward</td></tr>
<tr><td>Alt+R</td><td>Start a replacing session</td></tr>
</tbody></table>
<br>
<b>Deletion</b>
<table><tbody>
<tr><td>Ctrl+H</td><td>Delete character before cursor &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>
<tr><td>Ctrl+D</td><td>Delete character under cursor</td></tr>
<tr><td>Ctrl+Shift+Del &nbsp;&nbsp;</td><td>Delete word to the left</td></tr>
<tr><td>Ctrl+Del</td><td>Delete word to the right</td></tr>
<tr><td>Alt+Del</td><td>Delete current line</td></tr>
</tbody></table>
<br>
<b>Operations</b>
<table><tbody>
<tr><td>Ctrl+T &nbsp;&nbsp;</td><td>Run a spell check</td></tr>
<tr><td>Ctrl+J</td><td>Justify paragraph or region</td></tr>
<tr><td>Alt+J</td><td>Justify entire buffer</td></tr>
<tr><td>Alt+B</td><td>Run a syntax check</td></tr>
<tr><td>Alt+:</td><td>Start/stop recording of macro</td></tr>
<tr><td>Alt+;</td><td>Replay macro</td></tr>
</tbody></table>
<br>
</td><td>
<b>Moving around</b>
<table><tbody>
<tr><td>Ctrl+B &nbsp;&nbsp;</td><td>One character backward</td></tr>
<tr><td>Ctrl+F</td><td>One character forward</td></tr>
<tr><td>Ctrl+⯇</td><td>One word backward</td></tr>
<tr><td>Ctrl+⯈</td><td>One word forward</td></tr>
<tr><td>Ctrl+A</td><td>To start of line</td></tr>
<tr><td>Ctrl+E</td><td>To end of line</td></tr>
<tr><td>Ctrl+P</td><td>One line up</td></tr>
<tr><td>Ctrl+N</td><td>One line down</td></tr>
<tr><td>Ctrl+⯅</td><td>To previous block</td></tr>
<tr><td>Ctrl+⯆</td><td>To next block</td></tr>
<tr><td>Ctrl+Y</td><td>One page up</td></tr>
<tr><td>Ctrl+V</td><td>One page down</td></tr>
<tr><td>Alt+\</td><td>To top of buffer</td></tr>
<tr><td>Alt+/</td><td>To end of buffer</td></tr>
</tbody></table>
<br>
<b>Special movement</b>
<table><tbody>
<tr><td>Alt+G &nbsp;&nbsp;</td><td>Go to specified line</td></tr>
<tr><td>Alt+]</td><td>Go to complementary bracket</td></tr>
<tr><td>Alt+⯅</td><td>Scroll viewport up</td></tr>
<tr><td>Alt+⯆</td><td>Scroll viewport down</td></tr>
<tr><td>Alt+&lt;</td><td>Switch to preceding buffer</td></tr>
<tr><td>Alt+&gt;</td><td>Switch to succeeding buffer</td></tr>
</tbody></table>
<br>
<b>Information</b>
<table><tbody>
<tr><td>Ctrl+C &nbsp;&nbsp;</td><td>Report cursor position</td></tr>
<tr><td>Alt+D</td><td>Report word/line/char count</td></tr>
<tr><td>Ctrl+G</td><td>Display help text</td></tr>
</tbody></table>
<br>
<b>Various</b>
<table><tbody>
<tr><td>Alt+A</td><td>Turn the mark on/off</td></tr>
<tr><td>Tab</td><td>Indent marked region</td></tr>
<tr><td>Shift+Tab &nbsp;&nbsp;</td><td>Unindent marked region</td></tr>
<tr><td>Alt+P</td><td>Turn visible whitespace on/off</td></tr>
<tr><td>Alt+V</td><td>Enter next keystroke verbatim</td></tr>
<tr><td>Ctrl+L</td><td>Refresh the screen</td></tr>
<tr><td>Ctrl+Z</td><td>Suspend nano</td></tr>
</tbody></table>
<br>
</td></tr>
</tbody></table>
</body>
</html>

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.3</b>. Of course, you should always check the <a href="https://nano-editor.org/">nano homepage</a> to see what the latest and greatest version is.</p></blockquote>
<blockquote><p>The current version of nano <i>should</i> be <b>4.4</b>. Of course, you should always check the <a href="https://nano-editor.org/">nano homepage</a> to see what the latest and greatest version is.</p></blockquote>
<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,14 +16,16 @@
.\" Documentation License along with this program. If not, see
.\" <https://www.gnu.org/licenses/>.
.\"
.TH NANO 1 "version 4.3" "June 2019"
.TH NANO 1 "version 4.4" "August 2019"
.SH NAME
nano \- Nano's ANOther editor, inspired by Pico
.SH SYNOPSIS
.B nano
.RI [ options "] [[+" line [, column "]]\ " file "]..."
.RI [ options "] [[\fB+" line [\fB, column "]] " file ]...
.sp
.BR nano " [" \fIoptions "] [[" + [ crCR ]( / | ? ) \fIstring "] " \fIfile ]...
.SH NOTICE
Starting with version 4.0, \fBnano\fR no longer hard-wraps an overlong
@@ -38,11 +40,23 @@ If you want the old, Pico behavior back, you can use \fB\-\-breaklonglines\fR,
of Pico, but is free software, and implements several features that Pico
lacks, such as: opening multiple files, scrolling per line, undo/redo,
syntax coloring, line numbering, and soft-wrapping overlong lines.
.sp
When giving a filename on the command line, the cursor can be put on a
specific line by adding the line number with a plus sign (\fB+\fR) before
the filename, and even in a specific column by adding it with a comma.
The cursor can be put on the first or last occurrence of a specific string
by specifying that string after \fB+/\fR or \fB+?\fR before the filename.
The string can be made case sensitive and/or caused to be interpreted as a
regular expression by inserting \fBc\fR and/or \fBr\fR after the \fB+\fR sign.
These search modes can be explicitly disabled by using the uppercase variant
of those letters: \fBC\fR and/or \fBR\fR. When the string contains spaces,
it needs to be enclosed in quotes. To give an example: to open a file at
the first occurrence of the word "Foo", one would do:
.sp
.RS 4
.BI "nano +c/Foo " file
.RE
.sp
As a special case: if instead of a filename a dash (\fB\-\fR) is given,
\fBnano\fR will read data from standard input.
@@ -263,8 +277,8 @@ at the width of the screen minus \fInumber\fR columns, allowing the wrap
point to vary along with the width of the screen if the screen is resized.
The default value is \-8.
.TP
.BR \-s\ \fIprogram ", " \-\-speller= \fIprogram
Use this alternative spell checker command.
.B "\-s ""\fIprogram\fR [\fIarg\fR...]\fB""\fR, \fB\-\-speller=""\fIprogram\fR [\fIarg\fR...]\fB"""
Use this alternative command to perform spell checking.
.TP
.BR \-t ", " \-\-tempfile
Save a changed buffer without prompting (when exiting with \fB^X\fR).

View File

@@ -8,8 +8,8 @@
@smallbook
@set EDITION 0.5
@set VERSION 4.3
@set UPDATED June 2019
@set VERSION 4.4
@set UPDATED August 2019
@dircategory Editors
@direntry
@@ -23,7 +23,7 @@
@titlepage
@title GNU @command{nano}
@subtitle a small and friendly text editor
@subtitle version 4.3
@subtitle version 4.4
@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.3.
This manual documents the GNU @command{nano} editor, version 4.4.
@menu
* Introduction::
@@ -127,13 +127,21 @@ But it is also possible to specify one or more options (see the next
section), and to edit several files in a row. Additionally, the cursor
can be put on a specific line of a file by adding the line number
with a plus sign before the filename, and even in a specific column by
adding it with a comma. So a more complete command synopsis is:
adding it with a comma.
The cursor can also be put on the first or last occurrence of a specific string
by specifying that string after @code{+/} or @code{+?} before the filename.
The string can be made case sensitive and/or caused to be interpreted as a
regular expression by inserting a @code{c} and/or @code{r} after the plus sign.
These search modes can be explicitly disabled by using the uppercase variant
of those letters: @code{C} and/or @code{R}. When the string contains spaces,
it needs to be enclosed in quotes.
A more complete command synopsis thus is:
@iftex
@sp 1
@end iftex
@example
@code{nano [OPTION]@dots{} [[+LINE[,COLUMN]|+,COLUMN] FILE]@dots{}}
@code{nano [OPTION]@dots{} [[+LINE[,COLUMN]|+[crCR](/|?)STRING] FILE]@dots{}}
@end example
@iftex
@sp 1
@@ -388,8 +396,8 @@ point to vary along with the width of the screen if the screen is resized.
The default value is @t{-8}.
@anchor{@option{--speller}}
@item -s @var{program}
@itemx --speller=@var{program}
@item -s "@var{program} [@var{arg} @dots{}]"
@itemx --speller="@var{program} [@var{arg} @dots{}]"
Use the given program to do spell checking and correcting. By default,
@command{nano} uses the command specified in the @env{SPELL} environment
variable. If @env{SPELL} is not set, and @option{--speller} is
@@ -915,7 +923,7 @@ When needed, use @code{unset jumpyscrolling} instead.
@item set softwrap
Enable soft line wrapping for easier viewing of very long lines.
@item set speller "@var{program}"
@item set speller "@var{program} [@var{arg} @dots{}]"
Use the given program to do spell checking and correcting.
@xref{@option{--speller}} for details.
@@ -989,7 +997,7 @@ powerful enough to fully parse a file. Nevertheless, regular
expressions can do a lot and are easy to make, so they are a
good fit for a small editor like @command{nano}.
All regular expressions in @command{nano} are extended regular expressions
All regular expressions in @command{nano} are POSIX extended regular expressions
(ERE). This means that @code{.}, @code{?}, @code{*}, @code{+}, @code{^},
@code{$}, and several other characters are special.
The period @code{.} matches any single character,
@@ -1021,7 +1029,7 @@ activated by using the @option{-Y} or @option{--syntax}
command-line option followed by the @var{name}.
The @code{default} syntax is special: it takes no @var{fileregex},
and applies to files that don't match any syntax's @var{fileregex}.
and applies to files that don't match any syntax's regexes.
The @code{none} syntax is reserved; specifying it on the
command line is the same as not having a syntax at all.
@@ -1053,25 +1061,24 @@ functions are disabled; for example, @t{""} for JSON.
The default value is @t{"#"}.
@item color @var{fgcolor},@var{bgcolor} "@var{regex}" @dots{}
Display all pieces of text that match the
extended regular expression "regex" with foreground color "fgcolor" and
background color "bgcolor", at least one of which must be specified.
Valid names for foreground and background color are:
Paint all pieces of text that match the extended regular expression "regex"
with the given foreground and background colors, at least one of which must
be specified. Valid color names are:
@code{white}, @code{black}, @code{blue}, @code{green},
@code{red}, @code{cyan}, @code{yellow}, @code{magenta}, and @code{normal}
--- where @code{normal} means the default foreground or background color.
You may use the prefix @code{bright}
to get a stronger color highlight for the foreground. If your
terminal supports transparency, not specifying a "bgcolor" tells @command{nano}
to attempt to use a transparent background.
You may use the prefix @code{bright} for the foreground color to get a
stronger highlight.
If your terminal supports transparency, not specifying a "bgcolor"
tells @command{nano} to attempt to use a transparent background.
@item icolor @var{fgcolor},@var{bgcolor} "@var{regex}" @dots{}
Same as above, except that the matching is case insensitive.
@item color @var{fgcolor},@var{bgcolor} start="@var{fromrx}" end="@var{torx}"
Display all pieces of text whose start matches extended regular expression
Paint all pieces of text whose start matches extended regular expression
"fromrx" and whose end matches extended regular expression "torx" with
foreground color "fgcolor" and background color "bgcolor", at least one of
the given foreground and background colors, at least one of
which must be specified. This means that, after an initial instance of
"fromrx", all text until the first instance of "torx" will be colored.
This allows syntax highlighting to span multiple lines.
@@ -1677,54 +1684,54 @@ The possible options to @code{./configure} are:
@table @code
@item --disable-browser
Disable the mini file browser that can be called with @kbd{^T} when reading
or writing files.
Exclude the mini file browser that can be called with @kbd{^T} when
wanting to read or write a file.
@item --disable-color
Disable support for the syntax coloring of files. This also eliminates
the @option{-Y} command-line option, which chooses a specific syntax.
Exclude support for syntax coloring. This also eliminates the @option{-Y}
command-line option, which allows choosing a specific syntax.
@item --disable-comment
Disable the single-keystroke comment/uncomment function (@kbd{M-3}).
Exclude the single-keystroke comment/uncomment function (@kbd{M-3}).
@item --disable-extra
Disable the Easter egg: a crawl of major contributors.
Exclude the Easter egg: a crawl of major contributors.
@item --disable-help
Disable the help function. Doing this makes the binary much smaller,
but makes it difficult for new users to learn more than very basic
Exclude the help texts (@kbd{^G}). This makes the binary much smaller,
but also makes it difficult for new users to learn more than very basic
things about using the editor.
@item --disable-histories
Disable the code for the handling of the history files: the search and
Exclude the code for handling the history files: the search and
replace strings that were used, and the cursor position at which each
file was closed. This also eliminates the @option{-H} and @option{-P}
command-line options, which switch on the logging of search/replace
strings and cursor positions.
@item --disable-justify
Disable the justify and unjustify functions.
Exclude the justify functions (@kbd{^J} and @kbd{M-J}).
@item --disable-libmagic
Disable the use of the library of magic-number tests (for determining
the file type and thus which syntax to use for colouring --- often the
tests on filename extension and header line will be enough).
Exclude the code for using the library of magic-number tests (for determining
the file type and thus which syntax to use for coloring --- often the regexes
for filename and header line will be enough).
@item --disable-linenumbers
Disable the line-numbering function (@kbd{M-#}). This also eliminates the
Exclude the line-numbering function (@kbd{M-N}). This also eliminates the
@option{-l} command-line option, which turns line numbering on.
@item --disable-mouse
Disable all mouse functionality. This also eliminates the @option{-m}
Exclude all mouse functionality. This also eliminates the @option{-m}
command-line option, which enables the mouse functionality.
@item --disable-multibuffer
Disable support for opening multiple files at a time and switching
Exclude support for opening multiple files at a time and switching
between them on the fly. This also eliminates the @option{-F} command-line
option, which causes a file to be read into a separate buffer by default.
@item --disable-nanorc
Disable support for reading the nanorc files at startup. With such
Exclude support for reading the nanorc files at startup. With such
support, you can store custom settings in a system-wide and a per-user
nanorc file rather than having to pass command-line options to get
the desired behavior. @xref{Nanorc Files} for more info.
@@ -1732,22 +1739,23 @@ Disabling this also eliminates the @option{-I} command-line option,
which inhibits the reading of nanorc files.
@item --disable-operatingdir
Disable setting the operating directory. This also eliminates the @option{-o}
command-line option, which sets the operating directory.
Exclude the code for setting the operating directory. This also eliminates
the @option{-o} command-line option, which sets the operating directory.
@item --disable-speller
Disable use of the spell checker. This also eliminates the @option{-s}
Exclude the code for spell checking. This also eliminates the @option{-s}
command-line option, which allows specifying an alternate spell checker.
@item --disable-tabcomp
Disable tab completion (when nano asks for a filename or a search string).
Exclude tab completion (when nano asks for a filename or a search string).
@item --disable-wordcomp
Disable word completion (@kbd{^]}).
Exclude word completion (@kbd{^]}).
@item --disable-wrapping
Disable all hard-wrapping of overlong lines. This also eliminates the
@option{-w} command-line option, which switches long-line wrapping off.
Exclude all hard-wrapping of overlong lines. This also eliminates the
@option{-b} and @option{-w} command-line options, which switch automatic
long-line wrapping on and off, respectively.
@item --enable-tiny
This option implies all of the above. It also disables some other
@@ -1757,19 +1765,19 @@ counterpart of the above options together with @option{--enable-tiny},
specific features can be switched back on --- but a few cannot.
@item --enable-debug
Enable support for runtime debug output. This can get pretty messy, so
Include some code for runtime debugging output. This can get pretty messy, so
chances are you only want this feature when you're working on the nano source.
@item --disable-nls
Disables Native Language support. This will disable the use of any
Exclude Native Language support. This will disable the use of any
available GNU @command{nano} translations.
@item --enable-utf8
Enable support for reading and writing Unicode files. This will require
Include support for reading and writing Unicode files. This will require
either a wide version of curses, or a UTF-8-enabled version of Slang.
@item --disable-utf8
Disable support for reading and writing Unicode files. Normally the
Exclude support for reading and writing Unicode files. Normally the
configure script auto-detects whether to enable UTF-8 support or not.
You can use this or the previous option to override that detection.

View File

@@ -16,7 +16,7 @@
.\" Documentation License along with this program. If not, see
.\" <https://www.gnu.org/licenses/>.
.\"
.TH NANORC 5 "version 4.3" "June 2019"
.TH NANORC 5 "version 4.4" "August 2019"
.SH NAME
nanorc \- GNU nano's configuration file
@@ -261,7 +261,7 @@ When needed, use \fBunset jumpyscrolling\fR instead.
.B set softwrap
Enable soft line wrapping for easier viewing of very long lines.
.TP
.B set speller "\fIprogram\fP"
.B set speller """\fIprogram\fR [\fIarg\fR...]\fB"""
Use the given \fIprogram\fR to do spell checking and correcting,
instead of the built-in corrector that calls \fBspell\fR.
.TP
@@ -335,7 +335,7 @@ powerful enough to fully parse a file. Nevertheless, regular
expressions can do a lot and are easy to make, so they are a
good fit for a small editor like \fBnano\fR.
.sp
All regular expressions in \fBnano\fR are extended regular expressions (ERE).
All regular expressions in \fBnano\fR are POSIX extended regular expressions.
This means that \fB.\fR, \fB?\fR, \fB*\fR, \fB+\fR, \fB^\fR, \fB$\fR, and
several other characters are special.
The period \fB.\fR matches any single character,
@@ -397,25 +397,23 @@ function is disabled; for example, "" for JSON.
The default value is "\fB#\fP".
.TP
.BI "color " fgcolor , bgcolor " """ regex """ " \fR...
Display all pieces of text that match
the extended regular expression \fIregex\fP with foreground color
\fIfgcolor\fP and background color \fIbgcolor\fP, at least one of which
must be specified. Valid names for foreground and background colors are:
Paint all pieces of text that match the extended regular expression
\fIregex\fP with the given foreground and background colors, at least
one of which must be specified. Valid color names are:
.BR white ", " black ", " blue ", " green ", " red ", "
.BR cyan ", " yellow ", " magenta ", and " normal
-- where \fBnormal\fR means the default foreground or background color.
You may use the prefix \fBbright\fR to get a stronger color highlight for the
foreground. If your terminal supports transparency, not specifying a
\fIbgcolor\fP tells \fBnano\fP to attempt to use a transparent
background.
You may use the prefix \fBbright\fR for the foreground color to get a
stronger highlight. If your terminal supports transparency, not specifying
a \fIbgcolor\fP tells \fBnano\fP to attempt to use a transparent background.
.TP
.BI "icolor " fgcolor , bgcolor " """ regex """ " \fR...
Same as above, except that the matching is case insensitive.
.TP
.BI "color " fgcolor , bgcolor " start=""" fromrx """ end=""" torx """
Display all pieces of text whose start matches extended regular expression
\fIfromrx\fP and whose end matches extended regular expression \fItorx\fP with
foreground color \fIfgcolor\fP and background color \fIbgcolor\fP,
Paint all pieces of text whose start matches extended regular expression
\fIfromrx\fP and whose end matches extended regular expression \fItorx\fP
with the given foreground and background colors,
at least one of which must be specified. This means that, after an
initial instance of \fIfromrx\fP, all text until the first instance of
\fItorx\fP will be colored. This allows syntax highlighting to span

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.3" "June 2019"
.TH RNANO 1 "version 4.4" "August 2019"
.SH NAME
rnano \- a restricted nano

1000
po/bg.po

File diff suppressed because it is too large Load Diff

1011
po/ca.po

File diff suppressed because it is too large Load Diff

1004
po/cs.po

File diff suppressed because it is too large Load Diff

1004
po/da.po

File diff suppressed because it is too large Load Diff

1087
po/de.po

File diff suppressed because it is too large Load Diff

1011
po/eo.po

File diff suppressed because it is too large Load Diff

1109
po/es.po

File diff suppressed because it is too large Load Diff

1000
po/eu.po

File diff suppressed because it is too large Load Diff

1004
po/fi.po

File diff suppressed because it is too large Load Diff

1010
po/fr.po

File diff suppressed because it is too large Load Diff

1003
po/ga.po

File diff suppressed because it is too large Load Diff

1004
po/gl.po

File diff suppressed because it is too large Load Diff

1010
po/hr.po

File diff suppressed because it is too large Load Diff

1004
po/hu.po

File diff suppressed because it is too large Load Diff

1000
po/id.po

File diff suppressed because it is too large Load Diff

1004
po/it.po

File diff suppressed because it is too large Load Diff

1012
po/ja.po

File diff suppressed because it is too large Load Diff

1004
po/ko.po

File diff suppressed because it is too large Load Diff

1021
po/ms.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1204
po/nb.po

File diff suppressed because it is too large Load Diff

1011
po/nl.po

File diff suppressed because it is too large Load Diff

1000
po/nn.po

File diff suppressed because it is too large Load Diff

1004
po/pl.po

File diff suppressed because it is too large Load Diff

1013
po/pt.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1004
po/ro.po

File diff suppressed because it is too large Load Diff

1004
po/ru.po

File diff suppressed because it is too large Load Diff

1002
po/sl.po

File diff suppressed because it is too large Load Diff

1004
po/sr.po

File diff suppressed because it is too large Load Diff

1051
po/sv.po

File diff suppressed because it is too large Load Diff

1008
po/tr.po

File diff suppressed because it is too large Load Diff

1010
po/uk.po

File diff suppressed because it is too large Load Diff

1004
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.3"
VERSION="4.4"
./configure -C --enable-tiny && make && ./configure -C &&

View File

@@ -524,16 +524,15 @@ void browser_refresh(void)
/* The filename (or a fragment of it) in displayable format.
* When a fragment, account for dots plus one space padding. */
/* If this is the selected item, start its highlighting, and
/* If this is the selected item, draw its highlighted bar upfront, and
* remember its location to be able to place the cursor on it. */
if (i == selected) {
wattron(edit, interface_color_pair[SELECTED_TEXT]);
mvwprintw(edit, row, col, "%*s", longest, " ");
the_row = row;
the_column = col;
}
blank_row(edit, row, col, longest);
/* If the name is too long, we display something like "...ename". */
if (dots)
mvwaddstr(edit, row, col, "...");

View File

@@ -602,6 +602,15 @@ bool has_blank_char(const char *string)
}
#endif /* ENABLE_NANORC && (!NANO_TINY || ENABLE_JUSTIFY) */
/* Return TRUE when the given string is empty or consists of only blanks. */
bool white_string(const char *string)
{
while (*string != '\0' && (is_blank_mbchar(string) || *string == '\r'))
string += char_length(string);
return !*string;
}
#ifdef ENABLE_UTF8
/* Return TRUE if wc is valid Unicode, and FALSE otherwise. */
bool is_valid_unicode(wchar_t wc)

View File

@@ -282,6 +282,15 @@ void color_update(void)
openfile->colorstrings = (sint == NULL ? NULL : sint->color);
}
/* Allocate and initialize (for the given line) the cache for multiline info. */
void set_up_multicache(linestruct *line)
{
line->multidata = (short *)nmalloc(openfile->syntax->nmultis * sizeof(short));
for (int index = 0; index < openfile->syntax->nmultis; index++)
line->multidata[index] = -1;
}
/* Determine whether the matches of multiline regexes are still the same,
* and if not, schedule a screen refresh, so things will be repainted. */
void check_the_multis(linestruct *line)
@@ -295,13 +304,14 @@ void check_the_multis(linestruct *line)
if (openfile->syntax == NULL || openfile->syntax->nmultis == 0)
return;
if (line->multidata == NULL)
set_up_multicache(line);
for (ink = openfile->colorstrings; ink != NULL; ink = ink->next) {
/* If it's not a multiline regex, skip. */
if (ink->end == NULL)
continue;
alloc_multidata_if_needed(line);
astart = (regexec(ink->start, line->data, 1, &startmatch, 0) == 0);
afterstart = line->data + (astart ? startmatch.rm_eo : 0);
anend = (regexec(ink->end, afterstart, 1, &endmatch, 0) == 0);
@@ -328,17 +338,6 @@ void check_the_multis(linestruct *line)
}
}
/* Allocate (for one line) the cache space for multiline color regexes. */
void alloc_multidata_if_needed(linestruct *fileptr)
{
if (fileptr->multidata == NULL) {
fileptr->multidata = (short *)nmalloc(openfile->syntax->nmultis * sizeof(short));
for (int i = 0; i < openfile->syntax->nmultis; i++)
fileptr->multidata[i] = -1;
}
}
/* Precalculate the multi-line start and end regex info so we can
* speed up rendering (with any hope at all...). */
void precalc_multicolorinfo(void)
@@ -350,6 +349,10 @@ void precalc_multicolorinfo(void)
if (openfile->colorstrings == NULL || ISSET(NO_COLOR_SYNTAX))
return;
/* For each line, allocate cache space for the multiline-regex info. */
for (line = openfile->filetop; line != NULL; line = line->next)
set_up_multicache(line);
for (ink = openfile->colorstrings; ink != NULL; ink = ink->next) {
/* If this is not a multi-line regex, skip it. */
if (ink->end == NULL)
@@ -358,7 +361,6 @@ void precalc_multicolorinfo(void)
for (line = openfile->filetop; line != NULL; line = line->next) {
int index = 0;
alloc_multidata_if_needed(line);
/* Assume nothing applies until proven otherwise below. */
line->multidata[ink->id] = CNONE;
@@ -410,12 +412,9 @@ void precalc_multicolorinfo(void)
* the lines in between and the end properly. */
line->multidata[ink->id] = CENDAFTER;
for (line = line->next; line != tailline; line = line->next) {
alloc_multidata_if_needed(line);
for (line = line->next; line != tailline; line = line->next)
line->multidata[ink->id] = CWHOLELINE;
}
alloc_multidata_if_needed(tailline);
tailline->multidata[ink->id] = CBEGINBEFORE;
/* Begin looking for a new start after the end match. */

View File

@@ -182,7 +182,9 @@ void chop_word(bool forward)
openfile->current_x = is_current_x;
/* Now kill the marked region and a word is gone. */
cut_text();
add_undo(CUT);
do_snip(FALSE, TRUE, FALSE, FALSE);
update_undo(CUT);
/* Discard the cut word and restore the cutbuffer. */
free_lines(cutbuffer);
@@ -268,7 +270,7 @@ void cut_to_eof(void)
* If until_eof is TRUE, move all text from the current cursor
* position to the end of the file into the cutbuffer. If append
* is TRUE (when zapping), always append the cut to the cutbuffer. */
void do_cut_text(bool copying, bool marked, bool until_eof, bool append)
void do_snip(bool copying, bool marked, bool until_eof, bool append)
{
#ifndef NANO_TINY
linestruct *was_bottom = NULL;
@@ -383,13 +385,14 @@ void cut_text(void)
add_undo(CUT);
}
do_cut_text(FALSE, openfile->mark != NULL, FALSE, FALSE);
do_snip(FALSE, openfile->mark != NULL, FALSE, FALSE);
update_undo(CUT);
#else
if (is_cuttable(FALSE))
do_cut_text(FALSE, FALSE, FALSE, FALSE);
do_snip(FALSE, FALSE, FALSE, FALSE);
#endif
wipe_statusbar();
}
#ifndef NANO_TINY
@@ -406,11 +409,7 @@ void copy_text(void)
ssize_t is_current_lineno = openfile->current->lineno;
size_t is_current_x = openfile->current_x;
/* If there is nothing to copy, don't even try. */
if (openfile->current->next == NULL && openfile->current->data[0] == '\0')
return;
do_cut_text(TRUE, mark_is_set, FALSE, FALSE);
do_snip(TRUE, mark_is_set, FALSE, FALSE);
/* If the mark was set, restore the viewport and cursor position. */
if (mark_is_set) {
@@ -435,8 +434,9 @@ void cut_till_eof(void)
}
add_undo(CUT_TO_EOF);
do_cut_text(FALSE, FALSE, TRUE, FALSE);
do_snip(FALSE, FALSE, TRUE, FALSE);
update_undo(CUT_TO_EOF);
wipe_statusbar();
}
/* Erase text (current line or marked region), sending it into oblivion. */
@@ -456,9 +456,10 @@ void zap_text(void)
/* Use the cutbuffer from the ZAP undo item, so the cut can be undone. */
cutbuffer = openfile->current_undo->cutbuffer;
do_cut_text(FALSE, openfile->mark != NULL, FALSE, TRUE);
do_snip(FALSE, openfile->mark != NULL, FALSE, TRUE);
update_undo(ZAP);
wipe_statusbar();
cutbuffer = was_cutbuffer;
}
@@ -500,5 +501,6 @@ void paste_text(void)
openfile->placewewant = xplustabs();
set_modified();
wipe_statusbar();
refresh_needed = TRUE;
}

View File

@@ -178,8 +178,7 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
/* First run things that might fail before blowing away the old state. */
if ((mypwuid = getpwuid(myuid)) == NULL) {
/* TRANSLATORS: Keep the next eight messages at most 76 characters. */
statusline(MILD, _("Couldn't determine my identity for lock file "
"(getpwuid() failed)"));
statusline(MILD, _("Couldn't determine my identity for lock file"));
goto free_the_data;
}
@@ -187,8 +186,7 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
if (errno == ENAMETOOLONG)
myhostname[31] = '\0';
else {
statusline(MILD, _("Couldn't determine hostname for lock file: %s"),
strerror(errno));
statusline(MILD, _("Couldn't determine hostname: %s"), strerror(errno));
goto free_the_data;
}
}
@@ -542,7 +540,7 @@ bool replace_buffer(const char *filename, undo_type action, bool marked)
#ifndef NANO_TINY
add_undo(action);
#endif
do_cut_text(FALSE, marked, !marked, FALSE);
do_snip(FALSE, marked, !marked, FALSE);
#ifndef NANO_TINY
update_undo(action);
#endif

View File

@@ -68,6 +68,9 @@ bool more_than_one = FALSE;
bool also_the_last = FALSE;
/* Whether indenting/commenting should include the last line of
* the marked region. */
bool is_shorter;
/* Whether a row's text is narrower than the screen's width. */
int didfind = 0;
/* Whether the last search found something. */
@@ -902,6 +905,7 @@ void shortcut_init(void)
#endif
add_to_funcs(do_tab, MMAIN,
/* TRANSLATORS: The next four strings are names of keyboard keys. */
N_("Tab"), WITHORSANS(tab_gist), TOGETHER, NOVIEW);
add_to_funcs(do_enter, MMAIN,
N_("Enter"), WITHORSANS(enter_gist), BLANKAFTER, NOVIEW);

View File

@@ -554,12 +554,12 @@ void do_scroll_down(void)
if (openfile->current_y == 0)
do_down();
if (openfile->edittop->next != NULL
if (editwinrows > 1 && (openfile->edittop->next != NULL
#ifndef NANO_TINY
|| chunk_for(openfile->firstcolumn, openfile->edittop) <
number_of_chunks_in(openfile->edittop)
#endif
)
))
edit_scroll(FORWARD);
}
#endif

View File

@@ -288,10 +288,8 @@ void extract(linestruct *top, size_t top_x, linestruct *bot, size_t bot_x)
bool mark_inside = FALSE;
bool same_line = FALSE;
if (top == bot && top_x == bot_x) {
statusline(ALERT, "Extracting nothing -- please report a bug");
if (top == bot && top_x == bot_x)
return;
}
#endif
/* Partition the buffer so that it contains only the text from
@@ -2583,10 +2581,37 @@ int main(int argc, char **argv)
/* Read the files mentioned on the command line into new buffers. */
while (optind < argc && (!openfile || read_them_all)) {
ssize_t givenline = 0, givencol = 0;
#ifndef NANO_TINY
char *searchstring = NULL;
#endif
/* If there's a +LINE[,COLUMN] argument here, eat it up. */
if (optind < argc - 1 && argv[optind][0] == '+') {
if (!parse_line_column(&argv[optind++][1], &givenline, &givencol))
int n = 1;
#ifndef NANO_TINY
while (isalpha(argv[optind][n])) {
switch (argv[optind][n++]) {
case 'c': SET(CASE_SENSITIVE); break;
case 'C': UNSET(CASE_SENSITIVE); break;
case 'r': SET(USE_REGEXP); break;
case 'R': UNSET(USE_REGEXP); break;
default:
statusline(ALERT, _("Invalid search modifier '%c'"),
argv[optind][n - 1]);
}
}
if (argv[optind][n] == '/' || argv[optind][n] == '?') {
if (argv[optind][n + 1]) {
searchstring = mallocstrcpy(NULL, &argv[optind][n + 1]);
if (argv[optind][n] == '?')
SET(BACKWARDS_SEARCH);
} else if (n == 1)
statusline(ALERT, _("Empty search string"));
optind++;
} else
#endif
if (!parse_line_column(&argv[optind++][n], &givenline, &givencol))
statusline(ALERT, _("Invalid line or column number"));
}
@@ -2602,6 +2627,22 @@ int main(int argc, char **argv)
/* If a position was given on the command line, go there. */
if (givenline != 0 || givencol != 0)
do_gotolinecolumn(givenline, givencol, FALSE, FALSE);
#ifndef NANO_TINY
else if (searchstring != NULL) {
if (ISSET(USE_REGEXP))
regexp_init(searchstring);
if (!findnextstr(searchstring, FALSE, JUSTFIND, NULL, TRUE,
openfile->filetop, 0))
not_found_msg(searchstring);
else if (lastmessage == HUSH)
wipe_statusbar();
if (ISSET(USE_REGEXP))
tidy_up_after_search();
free(last_search);
last_search = searchstring;
searchstring = NULL;
}
#endif
#ifdef ENABLE_HISTORIES
else if (ISSET(POSITIONLOG) && openfile->filename[0] != '\0') {
ssize_t savedline, savedcol;

View File

@@ -394,7 +394,7 @@ void draw_the_promptbar(void)
/* Color the promptbar over its full width. */
wattron(bottomwin, interface_color_pair[TITLE_BAR]);
blank_statusbar();
mvwprintw(bottomwin, 0, 0, "%*s", COLS, " ");
mvwaddstr(bottomwin, 0, 0, prompt);
waddch(bottomwin, ':');
@@ -695,9 +695,9 @@ int do_yesno_prompt(bool all, const char *msg)
post_one_key(cancelshortcut->keystr, _("Cancel"), width);
}
/* Color the statusbar over its full width and display the question. */
/* Color the promptbar over its full width and display the question. */
wattron(bottomwin, interface_color_pair[TITLE_BAR]);
blank_statusbar();
mvwprintw(bottomwin, 0, 0, "%*s", COLS, " ");
mvwaddnstr(bottomwin, 0, 0, msg, actual_x(msg, COLS - 1));
wattroff(bottomwin, interface_color_pair[TITLE_BAR]);
wnoutrefresh(bottomwin);

View File

@@ -55,6 +55,8 @@ extern bool more_than_one;
extern bool also_the_last;
extern bool is_shorter;
extern int didfind;
extern int controlleft, controlright;
@@ -233,6 +235,7 @@ char *mbrevstrpbrk(const char *head, const char *accept, const char *index);
#if defined(ENABLE_NANORC) && (!defined(NANO_TINY) || defined(ENABLE_JUSTIFY))
bool has_blank_char(const char *s);
#endif
bool white_string(const char *s);
#ifdef ENABLE_UTF8
bool is_valid_unicode(wchar_t wc);
#endif
@@ -242,8 +245,8 @@ bool is_valid_unicode(wchar_t wc);
void set_colorpairs(void);
void color_init(void);
void color_update(void);
void set_up_multicache(linestruct *line);
void check_the_multis(linestruct *line);
void alloc_multidata_if_needed(linestruct *fileptr);
void precalc_multicolorinfo(void);
#endif
@@ -255,7 +258,7 @@ void chop_previous_word(void);
void chop_next_word(void);
void cut_marked(bool *right_side_up);
#endif
void do_cut_text(bool copying, bool marked, bool until_eof, bool append);
void do_snip(bool copying, bool marked, bool until_eof, bool append);
bool is_cuttable(bool test_cliff);
void cut_text(void);
#ifndef NANO_TINY
@@ -476,6 +479,8 @@ void do_rcfiles(void);
#endif /* ENABLE_NANORC */
/* Most functions in search.c. */
bool regexp_init(const char *regexp);
void tidy_up_after_search(void);
int findnextstr(const char *needle, bool whole_word_only, int modus,
size_t *match_len, bool skipone, const linestruct *begin, size_t begin_x);
void do_search(void);
@@ -506,7 +511,6 @@ void do_tab(void);
void do_indent(void);
void do_unindent(void);
#endif
bool white_string(const char *s);
#ifdef ENABLE_COMMENT
void do_comment(void);
#endif
@@ -531,6 +535,7 @@ ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl);
size_t indent_length(const char *line);
#endif
#ifdef ENABLE_JUSTIFY
size_t quote_length(const char *line);
bool begpar(const linestruct *const foo, int depth);
bool inpar(const linestruct *const foo);
void do_justify(bool full_justify);
@@ -613,7 +618,6 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *count);
int get_mouseinput(int *mouse_row, int *mouse_col, bool allow_shortcuts);
#endif
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);
void wipe_statusbar(void);
@@ -628,8 +632,6 @@ void statusline(message_type importance, const char *msg, ...);
void bottombars(int menu);
void post_one_key(const char *keystroke, const char *tag, int width);
void place_the_cursor(void);
void edit_draw(linestruct *fileptr, const char *converted,
int line, size_t from_col);
int update_line(linestruct *fileptr, size_t index);
#ifndef NANO_TINY
int update_softwrapped_line(linestruct *fileptr);

View File

@@ -362,8 +362,13 @@ void begin_new_syntax(char *ptr)
void check_for_nonempty_syntax(void)
{
#ifdef ENABLE_COLOR
if (opensyntax && !seen_color_command)
if (opensyntax && !seen_color_command) {
size_t current_lineno = lineno;
lineno = live_syntax->lineno;
jot_error(N_("Syntax \"%s\" has no color commands"), live_syntax->name);
lineno = current_lineno;
}
opensyntax = FALSE;
#endif
@@ -557,9 +562,12 @@ bool is_good_file(char *file)
}
#ifdef ENABLE_COLOR
/* Read and parse one included syntax file. */
/* Partially parse the syntaxes in the given file, or (when syntax
* is not NULL) fully parse one specific syntax from the file . */
void parse_one_include(char *file, syntaxtype *syntax)
{
char *was_nanorc = nanorc;
size_t was_lineno = lineno;
augmentstruct *extra;
FILE *rcstream;
@@ -567,7 +575,6 @@ void parse_one_include(char *file, syntaxtype *syntax)
if (!is_good_file(file))
return;
/* Open the included syntax file. */
rcstream = fopen(file, "rb");
if (rcstream == NULL) {
@@ -583,6 +590,8 @@ void parse_one_include(char *file, syntaxtype *syntax)
/* If this is the first pass, parse only the prologue. */
if (syntax == NULL) {
parse_rcfile(rcstream, TRUE, TRUE);
nanorc = was_nanorc;
lineno = was_lineno;
return;
}
@@ -610,17 +619,20 @@ void parse_one_include(char *file, syntaxtype *syntax)
free(syntax->filename);
syntax->filename = NULL;
nanorc = was_nanorc;
lineno = was_lineno;
}
/* Expand globs in the passed name, and parse the resultant files. */
void parse_includes(char *ptr)
{
char *pattern, *expanded;
char *was_nanorc = nanorc;
size_t was_lineno = lineno;
glob_t files;
int result;
check_for_nonempty_syntax();
pattern = ptr;
if (*pattern == '"')
pattern++;
@@ -640,11 +652,6 @@ void parse_includes(char *ptr)
globfree(&files);
free(expanded);
/* We're done with the included file(s). Restore the original
* filename and line number position. */
nanorc = was_nanorc;
lineno = was_lineno;
}
/* Return the short value corresponding to the color named in colorname,

View File

@@ -359,6 +359,8 @@ void do_research(void)
/* Use the search-menu key bindings, to allow cancelling. */
currmenu = MWHEREIS;
wipe_statusbar();
go_looking();
tidy_up_after_search();

View File

@@ -297,15 +297,6 @@ void handle_indent_action(undo *u, bool undoing, bool add_indent)
}
#endif /* !NANO_TINY */
/* Return TRUE when the given string is empty or consists of only blanks. */
bool white_string(const char *s)
{
while (*s != '\0' && (is_blank_mbchar(s) || *s == '\r'))
s += char_length(s);
return !*s;
}
#ifdef ENABLE_COMMENT
/* Test whether the given line can be uncommented, or add or remove a comment,
* depending on action. Return TRUE if the line is uncommentable, or when
@@ -503,7 +494,7 @@ void redo_cut(undo *u)
openfile->mark = line_from_number(u->mark_begin_lineno);
openfile->mark_x = (u->xflags & WAS_WHOLE_LINE) ? 0 : u->mark_begin_x;
do_cut_text(FALSE, TRUE, FALSE, u->type == ZAP);
do_snip(FALSE, TRUE, FALSE, u->type == ZAP);
free_lines(cutbuffer);
cutbuffer = oldcutbuffer;
@@ -1001,7 +992,7 @@ bool execute_command(const char *command)
if (ISSET(MULTIBUFFER)) {
openfile = openfile->prev;
if (openfile->mark)
do_cut_text(TRUE, TRUE, FALSE, FALSE);
do_snip(TRUE, TRUE, FALSE, FALSE);
} else
#endif
{
@@ -1012,7 +1003,7 @@ bool execute_command(const char *command)
openfile->current_x = 0;
}
add_undo(CUT);
do_cut_text(FALSE, openfile->mark != NULL, openfile->mark == NULL, FALSE);
do_snip(FALSE, openfile->mark != NULL, openfile->mark == NULL, FALSE);
update_undo(CUT);
}
@@ -1426,6 +1417,13 @@ bool do_wrap(void)
add_undo(SPLIT_BEGIN);
#endif
#ifdef ENABLE_JUSTIFY
bool autowhite = ISSET(AUTOINDENT);
size_t lead_len = quote_length(line->data);
if (lead_len > 0)
UNSET(AUTOINDENT);
#endif
/* The remainder is the text that will be wrapped to the next line. */
remainder = line->data + wrap_loc;
@@ -1455,10 +1453,19 @@ bool do_wrap(void)
#endif
}
/* Join the next line to this one, and delete any extra blanks. */
do {
/* Join the next line to this one. */
do_delete();
#ifdef ENABLE_JUSTIFY
/* If the quoting part of the current line equals the quoting part of
* what was the next line, then strip this second quoting part. */
if (strncmp(line->data, line->data + openfile->current_x, lead_len) == 0)
for (size_t i = lead_len; i > 0; i--)
do_delete();
#endif
/* Remove any extra blanks. */
while (is_blank_mbchar(&line->data[openfile->current_x]))
do_delete();
} while (is_blank_mbchar(&line->data[openfile->current_x]));
}
/* Go to the wrap location. */
@@ -1480,6 +1487,27 @@ bool do_wrap(void)
/* Now split the line. */
do_enter();
#ifdef ENABLE_JUSTIFY
/* If the original line has quoting, copy it to the spillage line. */
if (lead_len > 0) {
lead_len += indent_length(line->data + lead_len);
line = line->next;
line_len = strlen(line->data);
line->data = charealloc(line->data, lead_len + line_len + 1);
charmove(line->data + lead_len, line->data, line_len + 1);
strncpy(line->data, line->prev->data, lead_len);
openfile->current_x += lead_len;
#ifndef NANO_TINY
update_undo(ENTER);
#endif
if (autowhite)
SET(AUTOINDENT);
}
#endif
openfile->spillage_line = openfile->current;
if (cursor_x < wrap_loc) {

View File

@@ -1790,52 +1790,45 @@ const keystruct *get_shortcut(int *kbinput)
return NULL;
}
/* Move to (x, y) in win, and display a line of n spaces with the
* current attributes. */
void blank_row(WINDOW *win, int y, int x, int n)
/* Move (in the given window) to the given row and wipe it clean. */
void blank_row(WINDOW *window, int row)
{
wmove(win, y, x);
for (; n > 0; n--)
waddch(win, ' ');
wmove(window, row, 0);
wclrtoeol(window);
}
/* Blank the first line of the top portion of the window. */
/* Blank the first line of the top portion of the screen. */
void blank_titlebar(void)
{
blank_row(topwin, 0, 0, COLS);
mvwprintw(topwin, 0, 0, "%*s", COLS, " ");
}
/* Blank all the lines of the middle portion of the window, i.e. the
* edit window. */
/* Blank all lines of the middle portion of the screen (the edit window). */
void blank_edit(void)
{
int row;
for (row = 0; row < editwinrows; row++)
blank_row(edit, row, 0, COLS);
for (int row = 0; row < editwinrows; row++)
blank_row(edit, row);
}
/* Blank the first line of the bottom portion of the window. */
/* Blank the first line of the bottom portion of the screen. */
void blank_statusbar(void)
{
blank_row(bottomwin, 0, 0, COLS);
blank_row(bottomwin, 0);
}
/* Wipe the status bar clean and include this in the next screen update. */
void wipe_statusbar(void)
{
blank_row(bottomwin, 0, 0, COLS);
blank_row(bottomwin, 0);
wnoutrefresh(bottomwin);
}
/* If the NO_HELP flag isn't set, blank the last two lines of the bottom
* portion of the window. */
/* Blank out the two help lines (when they are present). */
void blank_bottombars(void)
{
if (!ISSET(NO_HELP) && LINES > 4) {
blank_row(bottomwin, 1, 0, COLS);
blank_row(bottomwin, 2, 0, COLS);
blank_row(bottomwin, 1);
blank_row(bottomwin, 2);
}
}
@@ -2030,6 +2023,8 @@ char *display_string(const char *buf, size_t column, size_t span,
#endif
}
is_shorter = (column < beyond);
/* Null-terminate the converted string. */
converted[index] = '\0';
@@ -2413,24 +2408,19 @@ void place_the_cursor(void)
openfile->current_y = row;
}
/* edit_draw() takes care of the job of actually painting a line into
* the edit window. fileptr is the line to be painted, at row row of
* the window. converted is the actual string to be written to the
* window, with tabs and control characters replaced by strings of
* regular characters. from_col is the column number of the first
* character of this page. That is, the first character of converted
* corresponds to character number actual_x(fileptr->data, from_col) of the
* line. */
void edit_draw(linestruct *fileptr, const char *converted,
int row, size_t from_col)
/* Draw the given text on the given row of the edit window. line is the
* line to be drawn, and converted is the actual string to be written with
* tabs and control characters replaced by strings of regular characters.
* from_col is the column number of the first character of this "page". */
void draw_row(int row, const char *converted, linestruct *line, size_t from_col)
{
#if !defined(NANO_TINY) || defined(ENABLE_COLOR)
size_t from_x = actual_x(fileptr->data, from_col);
/* The position in fileptr->data of the leftmost character
size_t from_x = actual_x(line->data, from_col);
/* The position in the line's data of the leftmost character
* that displays at least partially on the window. */
size_t till_x = actual_x(fileptr->data, from_col + editwincols - 1) + 1;
/* The position in fileptr->data of the first character that is
* completely off the window to the right. Note that till_x
size_t till_x = actual_x(line->data, from_col + editwincols - 1) + 1;
/* The position in the line's data of the first character that
* is completely off the window to the right. Note that till_x
* might be beyond the null terminator of the string. */
#endif
@@ -2441,10 +2431,10 @@ void edit_draw(linestruct *fileptr, const char *converted,
wattron(edit, interface_color_pair[LINE_NUMBER]);
#ifndef NANO_TINY
if (ISSET(SOFTWRAP) && from_col != 0)
mvwprintw(edit, row, 0, "%*s", margin - 1, " ");
mvwprintw(edit, row, 0, "%*s", margin, " ");
else
#endif
mvwprintw(edit, row, 0, "%*zd", margin - 1, fileptr->lineno);
mvwprintw(edit, row, 0, "%*zd ", margin - 1, line->lineno);
wattroff(edit, interface_color_pair[LINE_NUMBER]);
}
#endif
@@ -2453,6 +2443,10 @@ void edit_draw(linestruct *fileptr, const char *converted,
* and the marking highlight on just the pieces that need it. */
mvwaddstr(edit, row, margin, converted);
/* When needed, clear the remainder of the row. */
if (is_shorter || ISSET(SOFTWRAP))
wclrtoeol(edit);
#ifdef USING_OLD_NCURSES
/* Tell ncurses to really redraw the line without trying to optimize
* for what it thinks is already there, because it gets it wrong in
@@ -2467,8 +2461,8 @@ void edit_draw(linestruct *fileptr, const char *converted,
const colortype *varnish = openfile->colorstrings;
/* If there are multiline regexes, make sure there is a cache. */
if (openfile->syntax->nmultis > 0)
alloc_multidata_if_needed(fileptr);
if (openfile->syntax->nmultis > 0 && line->multidata == NULL)
set_up_multicache(line);
/* Iterate through all the coloring regexes. */
for (; varnish != NULL; varnish = varnish->next) {
@@ -2482,9 +2476,9 @@ void edit_draw(linestruct *fileptr, const char *converted,
/* The place in converted from where painting starts. */
regmatch_t match;
/* The match positions of a single-line regex. */
const linestruct *start_line = fileptr->prev;
/* The first line before fileptr that matches 'start'. */
const linestruct *end_line = fileptr;
const linestruct *start_line = line->prev;
/* The first line before line that matches 'start'. */
const linestruct *end_line = line;
/* The line that matches 'end'. */
regmatch_t startmatch, endmatch;
/* The match positions of the start and end regexes. */
@@ -2507,13 +2501,13 @@ void edit_draw(linestruct *fileptr, const char *converted,
* unless index is zero. If regexec() returns
* REG_NOMATCH, there are no more matches in the
* line. */
if (regexec(varnish->start, &fileptr->data[index], 1,
if (regexec(varnish->start, &line->data[index], 1,
&match, (index == 0) ? 0 : REG_NOTBOL) != 0)
break;
/* If the match is of length zero, skip it. */
if (match.rm_so == match.rm_eo) {
index = step_right(fileptr->data, index + match.rm_eo);
index = step_right(line->data, index + match.rm_eo);
continue;
}
@@ -2527,12 +2521,12 @@ void edit_draw(linestruct *fileptr, const char *converted,
continue;
start_col = (match.rm_so <= from_x) ?
0 : wideness(fileptr->data,
0 : wideness(line->data,
match.rm_so) - from_col;
thetext = converted + actual_x(converted, start_col);
paintlen = actual_x(thetext, wideness(fileptr->data,
paintlen = actual_x(thetext, wideness(line->data,
match.rm_eo) - from_col - start_col);
mvwaddnstr(edit, row, margin + start_col, thetext, paintlen);
@@ -2543,7 +2537,7 @@ void edit_draw(linestruct *fileptr, const char *converted,
/* Second case: varnish is a multiline expression. */
/* Assume nothing gets painted until proven otherwise below. */
fileptr->multidata[varnish->id] = CNONE;
line->multidata[varnish->id] = CNONE;
/* First check the multidata of the preceding line -- it tells
* us about the situation so far, and thus what to do here. */
@@ -2617,31 +2611,31 @@ void edit_draw(linestruct *fileptr, const char *converted,
/* If there is no end, there is nothing to paint. */
if (end_line == NULL) {
fileptr->multidata[varnish->id] = CWOULDBE;
line->multidata[varnish->id] = CWOULDBE;
goto tail_of_loop;
}
/* If the end is on a later line, paint whole line, and be done. */
if (end_line != fileptr) {
if (end_line != line) {
mvwaddnstr(edit, row, margin, converted, -1);
fileptr->multidata[varnish->id] = CWHOLELINE;
line->multidata[varnish->id] = CWHOLELINE;
goto tail_of_loop;
}
/* Only if it is visible, paint the part to be coloured. */
if (endmatch.rm_eo > from_x) {
paintlen = actual_x(converted, wideness(fileptr->data,
paintlen = actual_x(converted, wideness(line->data,
endmatch.rm_eo) - from_col);
mvwaddnstr(edit, row, margin, converted, paintlen);
}
fileptr->multidata[varnish->id] = CBEGINBEFORE;
line->multidata[varnish->id] = CBEGINBEFORE;
step_two:
/* Second step: look for starts on this line, but begin
* looking only after an end match, if there is one. */
index = (paintlen == 0) ? 0 : endmatch.rm_eo;
while (regexec(varnish->start, fileptr->data + index,
while (regexec(varnish->start, line->data + index,
1, &startmatch, (index == 0) ?
0 : REG_NOTBOL) == 0) {
/* Translate the match to be relative to the
@@ -2650,12 +2644,12 @@ void edit_draw(linestruct *fileptr, const char *converted,
startmatch.rm_eo += index;
start_col = (startmatch.rm_so <= from_x) ?
0 : wideness(fileptr->data,
0 : wideness(line->data,
startmatch.rm_so) - from_col;
thetext = converted + actual_x(converted, start_col);
if (regexec(varnish->end, fileptr->data + startmatch.rm_eo,
if (regexec(varnish->end, line->data + startmatch.rm_eo,
1, &endmatch, (startmatch.rm_eo == 0) ?
0 : REG_NOTBOL) == 0) {
/* Translate the end match to be relative to
@@ -2666,27 +2660,27 @@ void edit_draw(linestruct *fileptr, const char *converted,
* it is more than zero characters long. */
if (endmatch.rm_eo > from_x &&
endmatch.rm_eo > startmatch.rm_so) {
paintlen = actual_x(thetext, wideness(fileptr->data,
paintlen = actual_x(thetext, wideness(line->data,
endmatch.rm_eo) - from_col - start_col);
mvwaddnstr(edit, row, margin + start_col,
thetext, paintlen);
fileptr->multidata[varnish->id] = CSTARTENDHERE;
line->multidata[varnish->id] = CSTARTENDHERE;
}
index = endmatch.rm_eo;
/* If both start and end match are anchors, advance. */
if (startmatch.rm_so == startmatch.rm_eo &&
endmatch.rm_so == endmatch.rm_eo) {
if (fileptr->data[index] == '\0')
if (line->data[index] == '\0')
break;
index = step_right(fileptr->data, index);
index = step_right(line->data, index);
}
continue;
}
/* There is no end on this line. But maybe on later lines? */
end_line = fileptr->next;
end_line = line->next;
while (end_line != NULL && regexec(varnish->end, end_line->data,
0, NULL, 0) == REG_NOMATCH)
@@ -2694,13 +2688,13 @@ void edit_draw(linestruct *fileptr, const char *converted,
/* If there is no end, we're done with this regex. */
if (end_line == NULL) {
fileptr->multidata[varnish->id] = CWOULDBE;
line->multidata[varnish->id] = CWOULDBE;
break;
}
/* Paint the rest of the line, and we're done. */
mvwaddnstr(edit, row, margin + start_col, thetext, -1);
fileptr->multidata[varnish->id] = CENDAFTER;
line->multidata[varnish->id] = CENDAFTER;
break;
}
tail_of_loop:
@@ -2738,13 +2732,11 @@ void edit_draw(linestruct *fileptr, const char *converted,
wattroff(edit, interface_color_pair[GUIDE_STRIPE]);
}
/* If the mark is on, and fileptr is at least partially selected, we
* need to paint it. */
if (openfile->mark &&
(fileptr->lineno <= openfile->mark->lineno ||
fileptr->lineno <= openfile->current->lineno) &&
(fileptr->lineno >= openfile->mark->lineno ||
fileptr->lineno >= openfile->current->lineno)) {
/* If the line is at least partially selected, paint the marked part. */
if (openfile->mark && ((line->lineno >= openfile->mark->lineno &&
line->lineno <= openfile->current->lineno) ||
(line->lineno <= openfile->mark->lineno &&
line->lineno >= openfile->current->lineno))) {
const linestruct *top, *bot;
/* The lines where the marked region begins and ends. */
size_t top_x, bot_x;
@@ -2758,15 +2750,15 @@ void edit_draw(linestruct *fileptr, const char *converted,
get_region(&top, &top_x, &bot, &bot_x, NULL);
if (top->lineno < fileptr->lineno || top_x < from_x)
if (top->lineno < line->lineno || top_x < from_x)
top_x = from_x;
if (bot->lineno > fileptr->lineno || bot_x > till_x)
if (bot->lineno > line->lineno || bot_x > till_x)
bot_x = till_x;
/* Only paint if the marked part of the line is on this page. */
if (top_x < till_x && bot_x > from_x) {
/* Compute on which screen column to start painting. */
start_col = wideness(fileptr->data, top_x) - from_col;
start_col = wideness(line->data, top_x) - from_col;
if (start_col < 0)
start_col = 0;
@@ -2776,7 +2768,7 @@ void edit_draw(linestruct *fileptr, const char *converted,
/* If the end of the mark is onscreen, compute how many
* characters to paint. Otherwise, just paint all. */
if (bot_x < till_x) {
size_t end_col = wideness(fileptr->data, bot_x) - from_col;
size_t end_col = wideness(line->data, bot_x) - from_col;
paintlen = actual_x(thetext, end_col - start_col);
}
@@ -2788,40 +2780,29 @@ void edit_draw(linestruct *fileptr, const char *converted,
#endif /* !NANO_TINY */
}
/* Redraw the line at fileptr. The line will be displayed so that the
* character with the given index is visible -- if necessary, the line
* will be horizontally scrolled. In softwrap mode, however, the entire
* line will be passed to update_softwrapped_line(). Likely values of
* index are current_x or zero. Return the number of additional rows
* consumed (when softwrapping). */
int update_line(linestruct *fileptr, size_t index)
/* Redraw the given line so that the character at the given index is visible
* -- if necessary, scroll the line horizontally (when not softwrapping).
* Return the number of rows "consumed" (relevant when softwrapping). */
int update_line(linestruct *line, size_t index)
{
int row = 0;
int row;
/* The row in the edit window we will be updating. */
char *converted;
/* The data of the line with tabs and control characters expanded. */
size_t from_col = 0;
size_t from_col;
/* From which column a horizontally scrolled line is displayed. */
#ifndef NANO_TINY
if (ISSET(SOFTWRAP))
return update_softwrapped_line(fileptr);
return update_softwrapped_line(line);
#endif
row = fileptr->lineno - openfile->edittop->lineno;
row = line->lineno - openfile->edittop->lineno;
from_col = get_page_start(wideness(line->data, index));
/* First, blank out the row. */
blank_row(edit, row, 0, COLS);
/* Next, find out from which column to start displaying the line. */
from_col = get_page_start(wideness(fileptr->data, index));
/* Expand the line, replacing tabs with spaces, and control
* characters with their displayed forms. */
converted = display_string(fileptr->data, from_col, editwincols, TRUE, FALSE);
/* Draw the line. */
edit_draw(fileptr, converted, row, from_col);
/* Expand the piece to be drawn to its representable form, and draw it. */
converted = display_string(line->data, from_col, editwincols, TRUE, FALSE);
draw_row(row, converted, line, from_col);
free(converted);
if (from_col > 0) {
@@ -2829,7 +2810,7 @@ int update_line(linestruct *fileptr, size_t index)
mvwaddch(edit, row, margin, '<');
wattroff(edit, hilite_attribute);
}
if (breadth(fileptr->data) > from_col + editwincols) {
if (breadth(line->data) > from_col + editwincols) {
wattron(edit, hilite_attribute);
mvwaddch(edit, row, COLS - 1, '>');
wattroff(edit, hilite_attribute);
@@ -2844,31 +2825,31 @@ int update_line(linestruct *fileptr, size_t index)
#ifndef NANO_TINY
/* Redraw all the chunks of the given line (as far as they fit onscreen),
* unless it's edittop, which will be displayed from column firstcolumn.
* Return the number of additional rows consumed. */
int update_softwrapped_line(linestruct *fileptr)
* Return the number of rows that were "consumed". */
int update_softwrapped_line(linestruct *line)
{
int row = 0;
/* The row in the edit window we will write to. */
linestruct *line = openfile->edittop;
linestruct *someline = openfile->edittop;
/* An iterator needed to find the relevant row. */
int starting_row;
/* The first row in the edit window that gets updated. */
size_t from_col = 0;
/* The starting column of the current chunk. */
size_t to_col = 0;
/* To which column a line is displayed. */
/* The end column of the current chunk. */
char *converted;
/* The data of the chunk with tabs and control characters expanded. */
if (fileptr == openfile->edittop)
if (line == openfile->edittop)
from_col = openfile->firstcolumn;
else
row -= chunk_for(openfile->firstcolumn, openfile->edittop);
/* Find out on which screen row the target line should be shown. */
while (line != fileptr && line != NULL) {
row += number_of_chunks_in(line) + 1;
line = line->next;
while (someline != line && someline != NULL) {
row += number_of_chunks_in(someline) + 1;
someline = someline->next;
}
/* If the first chunk is offscreen, don't even try to display it. */
@@ -2883,14 +2864,12 @@ int update_softwrapped_line(linestruct *fileptr)
while (row < editwinrows) {
bool end_of_line = FALSE;
to_col = get_softwrap_breakpoint(fileptr->data, from_col, &end_of_line);
blank_row(edit, row, 0, COLS);
to_col = get_softwrap_breakpoint(line->data, from_col, &end_of_line);
/* Convert the chunk to its displayable form and draw it. */
converted = display_string(fileptr->data, from_col, to_col - from_col,
converted = display_string(line->data, from_col, to_col - from_col,
TRUE, FALSE);
edit_draw(fileptr, converted, row++, from_col);
draw_row(row++, converted, line, from_col);
free(converted);
if (end_of_line)
@@ -2905,7 +2884,7 @@ int update_softwrapped_line(linestruct *fileptr)
}
if (spotlighted && !inhelp)
spotlight(light_from_col, light_to_col);
spotlight_softwrapped(light_from_col, light_to_col);
return (row - starting_row);
}
@@ -3337,7 +3316,7 @@ void edit_refresh(void)
}
while (row < editwinrows)
blank_row(edit, row++, 0, COLS);
blank_row(edit, row++);
place_the_cursor();
wnoutrefresh(edit);
@@ -3466,21 +3445,12 @@ void enable_waiting(void)
/* Highlight the text between from_col and to_col. */
void spotlight(size_t from_col, size_t to_col)
{
size_t right_edge;
size_t right_edge = get_page_start(from_col) + editwincols;
bool overshoots = FALSE;
char *word;
place_the_cursor();
#ifndef NANO_TINY
if (ISSET(SOFTWRAP)) {
spotlight_softwrapped(from_col, to_col);
return;
}
#endif
right_edge = get_page_start(from_col) + editwincols;
/* Limit the end column to the edge of the screen. */
if (to_col > right_edge) {
to_col = right_edge;
@@ -3496,12 +3466,9 @@ void spotlight(size_t from_col, size_t to_col)
to_col - from_col, FALSE, overshoots);
wattron(edit, interface_color_pair[SELECTED_TEXT]);
waddnstr(edit, word, actual_x(word, to_col));
if (overshoots)
mvwaddch(edit, openfile->current_y, COLS - 1, '>');
wattroff(edit, interface_color_pair[SELECTED_TEXT]);
free(word);
@@ -3520,6 +3487,8 @@ void spotlight_softwrapped(size_t from_col, size_t to_col)
bool end_of_line = FALSE;
char *word;
place_the_cursor();
while (row < editwinrows) {
break_col = get_softwrap_breakpoint(openfile->current->data,
leftedge, &end_of_line);
@@ -3540,9 +3509,7 @@ void spotlight_softwrapped(size_t from_col, size_t to_col)
break_col - from_col, FALSE, FALSE);
wattron(edit, interface_color_pair[SELECTED_TEXT]);
waddnstr(edit, word, actual_x(word, break_col));
wattroff(edit, interface_color_pair[SELECTED_TEXT]);
free(word);
@@ -3550,7 +3517,7 @@ void spotlight_softwrapped(size_t from_col, size_t to_col)
if (end_of_line)
break;
wmove(edit, ++row, 0);
wmove(edit, ++row, margin);
leftedge = break_col;
from_col = break_col;

View File

@@ -8,7 +8,7 @@ color red "\<[A-Z_]{2,}\>"
color brightgreen "\.(data|subsection|text)"
color green "\.(align|file|globl|global|hidden|section|size|type|weak)"
color brightyellow "\.(ascii|asciz|byte|double|float|hword|int|long|short|single|struct|word)"
icolor brightred "^[[:space:]]*[.0-9A-Z_]*:"
color brightred "^[[:space:]]*[.0-9A-Za-z_]*:"
color brightcyan "^[[:space:]]*#[[:space:]]*(define|undef|include|ifn?def|endif|elif|else|if|warning|error)"
# Strings.

View File

@@ -6,7 +6,7 @@ magic "awk script"
comment "#"
# Records.
icolor brightred "\$[0-9A-Z_!@#$*?-]+"
color brightred "\$[0-9A-Za-z_!@#$*?-]+"
# Awk-set variables.
color red "\<(ARGC|ARGIND|ARGV|BINMODE|CONVFMT|ENVIRON|ERRNO|FIELDWIDTHS)\>"
color red "\<(FILENAME|FNR|FS|IGNORECASE|LINT|NF|NR|OFMT|OFS|ORS)\>"

View File

@@ -1,6 +1,6 @@
## Here is an example for C/C++.
syntax c "\.([ch](pp|xx)?|C|cc|c\+\+|H|hh|ii?)$"
syntax c "\.([ch](pp|xx)?|C|cc|c\+\+|cu|H|hh|ii?)$"
magic "^(C|C\+\+) (source|program)"
comment "//"
@@ -10,7 +10,7 @@ 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 "\<([[:lower:]]+|(u_?)?int(8|16|32|64|ptr))_t\>"
color green "\<([[:lower:]][[:lower:]_]*|(u_?)?int(8|16|32|64))_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)\>"

View File

@@ -3,7 +3,7 @@
syntax cmake "(CMakeLists\.txt|\.cmake)$"
comment "#"
icolor green "^[[:space:]]*[A-Z0-9_]+"
color green "^[[:space:]]*[0-9A-Za-z_]+"
icolor brightyellow "^[[:space:]]*(include|include_directories|include_external_msproject)\>"
icolor brightgreen "^[[:space:]]*((else|end)?if|else|(end)?while|(end)?foreach|break)\>"
@@ -12,7 +12,7 @@ color brightgreen "[[:space:]](OR|AND|IS_NEWER_THAN|MATCHES|(STR|VERSION_)?(LESS
icolor brightred "^[[:space:]]*((end)?(function|macro)|return)"
icolor cyan start="\$(\{|ENV\{)" end="\}"
icolor cyan start="\$(ENV)?\{" end="\}"
color magenta "\<(APPLE|UNIX|WIN32|CYGWIN|BORLAND|MINGW|MSVC(_IDE|60|71|80|90)?)\>"
color brightblue "(^|[[:space:]])#.*"

View File

@@ -15,3 +15,6 @@ color brightred "(GNU )?[Nn]ano [1-4]\.[0-9][-.[:alnum:]]*\>"
# Email addresses.
color magenta "<[[:alnum:].%_+-]+@[[:alnum:].-]+\.[[:alpha:]]{2,}>"
# Bracketed captions in certain config files.
color brightgreen "^\[.*\]$"

View File

@@ -34,7 +34,7 @@ icolor yellow "\<(.or.|repeat|select case|then|where|while)\>"
icolor magenta "\<(continue|cycle|exit|go?to|result|return)\>"
# Strings.
icolor yellow "<[^= ]*>" ""(\\.|[^"])*""
color yellow "<[^= ]*>" ""(\\.|[^"])*""
# Comments.
icolor blue "!.*"
color blue "!.*"

View File

@@ -44,7 +44,7 @@ color brightmagenta "\<(false|nil|true)\>"
# Decimal and hexadecimal numbers
color red "\<[0-9]+(\.[0-9]*)?([Ee][+-]?[0-9]+)?\>"
icolor red "\<0x[0-9a-f]+(\.[0-9a-f]*)?(p[+-]?[0-9]+)?\>"
color red "\<0x[0-9A-Fa-f]+(\.[0-9A-Fa-f]*)?([Pp][+-]?[0-9]+)?\>"
# Brackets
color brightmagenta "\(|\)|\[|\]|\{|\}"

View File

@@ -4,6 +4,6 @@ syntax mgp "\.mgp$"
header "^%include.*"
comment "#"
icolor green "^%[a-z].*"
color green "^%[A-Za-z].*"
color cyan "(^|[[:space:]])(#|%%).*"
color ,green "[[:space:]]+$"

View File

@@ -7,9 +7,18 @@ comment "#"
color red "\<(accept|alarm|atan2|bin(d|mode)|c(aller|h(dir|mod|op|own|root)|lose(dir)?|onnect|os|rypt)|d(bm(close|open)|efined|elete|ie|o|ump)|e(ach|of|val|x(ec|ists|it|p))|f(cntl|ileno|lock|ork))\>" "\<(get(c|login|peername|pgrp|ppid|priority|pwnam|(host|net|proto|serv)byname|pwuid|grgid|(host|net)byaddr|protobynumber|servbyport)|([gs]et|end)(pw|gr|host|net|proto|serv)ent|getsock(name|opt)|gmtime|goto|grep|hex|index|int|ioctl|join)\>" "\<(keys|kill|last|length|link|listen|local(time)?|log|lstat|m|mkdir|msg(ctl|get|snd|rcv)|next|oct|open(dir)?|ord|pack|pipe|pop|printf?|push|q|qq|qx|rand|re(ad(dir|link)?|cv|do|name|quire|set|turn|verse|winddir)|rindex|rmdir|s|scalar|seek(dir)?)\>" "\<(se(lect|mctl|mget|mop|nd|tpgrp|tpriority|tsockopt)|shift|shm(ctl|get|read|write)|shutdown|sin|sleep|socket(pair)?|sort|spli(ce|t)|sprintf|sqrt|srand|stat|study|substr|symlink|sys(call|read|tem|write)|tell(dir)?|time|tr(y)?|truncate|umask)\>" "\<(un(def|link|pack|shift)|utime|values|vec|wait(pid)?|wantarray|warn|write)\>"
color magenta "\<(continue|else|elsif|do|for|foreach|if|unless|until|while|eq|ne|lt|gt|le|ge|cmp|x|my|sub|use|package|can|isa)\>"
icolor cyan start="[$@%]" end="( |[^0-9A-Z_]|-)"
# Variable names.
color cyan "[$%&@]([A-Za-z_][0-9A-Za-z_]*|\^[][A-Z?\^_]|[0-9]+)\>"
color cyan "[$%&@]\{(\^?[A-Za-z_][0-9A-Za-z_]*|\^[][?\^][0-9]+)\}"
color cyan "[$%&@]([][!"#'()*+,.:;<=>?`|~-]|\{[][!-/:-@\`|~]\})|\$[$%&@]"
color cyan "(^|[[:space:]])[$%@][/\]"
color yellow "".*"|qq\|.*\|"
color white "[sm]/.*/"
color white start="(^use| = new)" end=";"
color green "#.*"
# Comments.
color green "(^|[[:space:]])#.*"
color yellow start="<< 'STOP'" end="STOP"

View File

@@ -1,6 +1,6 @@
## Here is an example for PHP.
syntax php "\.ph(p[23457s~]?|tml)$"
syntax php "\.(php[23457s~]?|phtml|ctp)$"
magic "PHP script"
comment "//"

View File

@@ -12,7 +12,7 @@ color brightmagenta "\<(Project\-Id\-Version|Report\-Msgid\-Bugs\-To|Last\-Trans
color cyan "\<(POT\-Creation\-Date|PO\-Revision\-Date|MIME\-Version|Content\-Type|Content\-Transfer\-Encoding)\>"
# Encodings and numbers.
color yellow "\<(UTF|ISO|Windows|Mac|IBM)-[0-9]+"
color yellow "[0-9]|pre[0-9]|[0-9]bit"
color yellow "\<((pre|rc)?[0-9]+|[0-9]bit)\>"
# Msgids.
color brightblue "^(msgid|msgid_plural|msgstr)\>"
# Tags.

View File

@@ -7,7 +7,7 @@ linter pyflakes
comment "#"
# Function definitions.
icolor brightblue "def [0-9A-Z_]+"
color brightblue "def [0-9A-Za-z_]+"
# Keywords.
color brightcyan "\<(and|as|assert|async|await|break|class|continue)\>"
color brightcyan "\<(def|del|elif|else|except|finally|for|from)\>"

View File

@@ -12,7 +12,7 @@ color yellow "\<(next|nil|not|or|redo|rescue|retry|return|self|super|then|true|u
# Constants.
color brightblue "(\$|@|@@)?\<[A-Z]+[0-9A-Z_a-z]*"
# Ruby "symbols".
icolor magenta "([ ]|^):[0-9A-Z_]+\>"
color magenta "([ ]|^):[0-9A-Za-z_]+\>"
# Some unique things we want to stand out.
color brightyellow "\<(__FILE__|__LINE__)\>"
# Regular expressions.

View File

@@ -5,6 +5,6 @@ magic "(La)?TeX document"
linter chktex -v0 -q -I
comment "%"
icolor green "\\.|\\[A-Z]*"
color green "\\.|\\[A-Za-z]*"
color magenta "[{}]"
color blue "(^|[^\])%.*"