Compare commits
57 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7d9ad31cd9 | ||
|
|
aecbc6faa9 | ||
|
|
a06b921f12 | ||
|
|
bdf1a9d4e7 | ||
|
|
5c399dfc6e | ||
|
|
ed4b6486a1 | ||
|
|
2326bf695e | ||
|
|
a9dd73fb16 | ||
|
|
073bd3ad6e | ||
|
|
4bcc224560 | ||
|
|
f2f367ba9c | ||
|
|
48bff32ee3 | ||
|
|
304f07258b | ||
|
|
e1c2573c7a | ||
|
|
07ec7de8eb | ||
|
|
82f5fed45a | ||
|
|
a2f7e31ba2 | ||
|
|
55983ee9d1 | ||
|
|
cd274a7830 | ||
|
|
f773fa3968 | ||
|
|
288355686b | ||
|
|
f7d5a82a5d | ||
|
|
63e04ac31e | ||
|
|
0c63b50fdc | ||
|
|
94c9defde1 | ||
|
|
ee91c51e09 | ||
|
|
1e3f3a7511 | ||
|
|
8fce33afe0 | ||
|
|
4314b8ded3 | ||
|
|
52e39ae5f7 | ||
|
|
5e7ba03ad1 | ||
|
|
97fec5603f | ||
|
|
3b8847f319 | ||
|
|
a578d2706c | ||
|
|
44d38815cc | ||
|
|
b23a5d5b29 | ||
|
|
b96cc8c212 | ||
|
|
09ad0eb5f7 | ||
|
|
62ca113ed3 | ||
|
|
5cfb74650d | ||
|
|
8cd6aa0a32 | ||
|
|
fcbe41942f | ||
|
|
39e5b52734 | ||
|
|
70b347183b | ||
|
|
699cacf7a4 | ||
|
|
23cb26c58f | ||
|
|
3422ec3419 | ||
|
|
5f1d9af375 | ||
|
|
f3a441043d | ||
|
|
e6c629951f | ||
|
|
c06d5452f5 | ||
|
|
1fcb9b99cf | ||
|
|
d8c840692e | ||
|
|
8c7b6bd21a | ||
|
|
21d0755de5 | ||
|
|
bbab9e2e62 | ||
|
|
9ea1cd947c |
64
ChangeLog
64
ChangeLog
@@ -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:
|
||||
------------------------------
|
||||
|
||||
|
||||
@@ -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
87
NEWS
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
131
doc/cheatsheet.html
Normal 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 </h1>
|
||||
<h3 align="center">The editor's keystrokes and their functions </h3>
|
||||
<br>
|
||||
|
||||
<table align="center"><tbody>
|
||||
<tr><td>
|
||||
|
||||
<b>File handling</b>
|
||||
<table><tbody>
|
||||
<tr><td>Ctrl+S </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 </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 </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 </td></tr>
|
||||
<tr><td>Ctrl+D</td><td>Delete character under cursor</td></tr>
|
||||
<tr><td>Ctrl+Shift+Del </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 </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 </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 </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+<</td><td>Switch to preceding buffer</td></tr>
|
||||
<tr><td>Alt+></td><td>Switch to succeeding buffer</td></tr>
|
||||
</tbody></table>
|
||||
<br>
|
||||
|
||||
<b>Information</b>
|
||||
<table><tbody>
|
||||
<tr><td>Ctrl+C </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 </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>
|
||||
@@ -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 "establishes a full duplex terminal connection to a remote host", and was included with many older Unix systems (and newer ones like Solaris). The conflict was not noticed at first because there is no 'tip' utility included with most GNU/Linux distributions (where nano was developed).</p></blockquote>
|
||||
<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%">
|
||||
|
||||
26
doc/nano.1
26
doc/nano.1
@@ -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).
|
||||
|
||||
106
doc/nano.texi
106
doc/nano.texi
@@ -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.
|
||||
|
||||
|
||||
26
doc/nanorc.5
26
doc/nanorc.5
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
1002
po/nano.pot
1002
po/nano.pot
File diff suppressed because it is too large
Load Diff
1008
po/pt_BR.po
1008
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
1010
po/zh_CN.po
1010
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
1010
po/zh_TW.po
1010
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
VERSION="4.3"
|
||||
VERSION="4.4"
|
||||
|
||||
./configure -C --enable-tiny && make && ./configure -C &&
|
||||
|
||||
|
||||
@@ -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, "...");
|
||||
|
||||
@@ -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)
|
||||
|
||||
35
src/color.c
35
src/color.c
@@ -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. */
|
||||
|
||||
24
src/cut.c
24
src/cut.c
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
51
src/nano.c
51
src/nano.c
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
14
src/proto.h
14
src/proto.h
@@ -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);
|
||||
|
||||
27
src/rcfile.c
27
src/rcfile.c
@@ -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,
|
||||
|
||||
@@ -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();
|
||||
|
||||
58
src/text.c
58
src/text.c
@@ -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) {
|
||||
|
||||
227
src/winio.c
227
src/winio.c
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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)\>"
|
||||
|
||||
@@ -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)\>"
|
||||
|
||||
@@ -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:]])#.*"
|
||||
|
||||
@@ -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 "^\[.*\]$"
|
||||
|
||||
@@ -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 "!.*"
|
||||
|
||||
@@ -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 "\(|\)|\[|\]|\{|\}"
|
||||
|
||||
@@ -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:]]+$"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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 "//"
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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)\>"
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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 "(^|[^\])%.*"
|
||||
|
||||
Reference in New Issue
Block a user