Compare commits

..

65 Commits

Author SHA1 Message Date
Benno Schulenberg
06c3e1acde po: update translations and regenerate POT file and PO files 2018-05-15 09:14:23 +02:00
Benno Schulenberg
09d8ee82b7 bump version numbers and add a news item for the 2.9.7 release 2018-05-15 08:48:00 +02:00
Benno Schulenberg
dac3b25d16 docs: note a small difference with Pico in the default hard-wrapping 2018-05-14 12:10:38 +02:00
Benno Schulenberg
ca538e6f08 scrolling: only do a scroll when the edit window has more than one row
If the edit window consists of a single row, then the do_up() call has
already brought the desired line into view -- which means that trying
to scroll then (when already on the first line of the file) would fail.

This fixes https://savannah.gnu.org/bugs/?53891.
2018-05-13 19:31:57 +02:00
Benno Schulenberg
4b26308b6a tweaks: put Yes/No/All in a consistent order (for the translators)
So that it matches the order of the preceding Yy/Nn/Aa.
2018-05-13 09:57:49 +02:00
Benno Schulenberg
f5eeb92f40 tweaks: sort an option better, and reschedule a removal 2018-05-13 09:47:40 +02:00
Benno Schulenberg
ae1ba5e259 tweaks: put check for -h and -l options in their alphabetical positions
And put the Pico-compatibility flags last, as normally they are never
given.
2018-05-12 19:56:37 +02:00
Benno Schulenberg
cecf453b14 tweaks: use symbolic names instead of puzzling TRUE and FALSE 2018-05-10 18:19:12 +02:00
Benno Schulenberg
c3a02f8094 tweaks: rename two variables, to be more descriptive 2018-05-10 18:11:35 +02:00
Benno Schulenberg
87283711ee tweaks: improve a couple of comments 2018-05-10 18:10:23 +02:00
Benno Schulenberg
123f77ff1a docs: say thanks to three recent translators, and re-sort two others 2018-05-10 15:17:04 +02:00
Benno Schulenberg
10c49edd3b prompt: when asking for Yes/No/All, recognize also UTF-8 letters
Letters in other scripts than English often consist of multiple bytes.
When in a UTF-8 locale, correctly gather these bytes from the input and
put them together as the single letter that they are, before comparing
this letter against the translated "Yy", "Nn" and "Aa" strings.
2018-05-10 12:29:08 +02:00
Benno Schulenberg
2d5c917b1a signals: exclude the crash handler from the tiny version
The tiny version contains much less code, so is less likely
to crash.  And the users most likely use it for very simple
and short editing jobs, making the chance of a crash still
smaller.  So the handler would just be bloat.
2018-05-10 12:21:53 +02:00
Benno Schulenberg
95002da66c tweaks: normalize indentation and whitespace after previous changes 2018-05-10 11:33:24 +02:00
Mark-Weston
858663444e new feature: an option to make the 'nextword' function stop at word ends
When 'afterends' is set and Ctrl+Right or Shift+Ctrl+Right is pressed,
nano will stop at the ends of words instead of their beginnings.

Signed-off-by: Mark-Weston <markweston@cock.li>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2018-05-10 11:32:01 +02:00
Benno Schulenberg
4046dfca63 docs: break down some old improvements further per version 2018-05-09 11:55:16 +02:00
Benno Schulenberg
c0b15c2982 signals: don't trap segfault/abort when envvar NANO_NOCATCH is defined
When the user wants to get a backtrace, the crash handler shouldn't
kick in.
2018-05-09 11:53:34 +02:00
Devin Hussey
e889c28a95 signals: upon a crash, save changed buffers and reset terminal state
Upon a segmentation fault or an abort signal, instead of crashing,
losing all changes, and leaving the terminal in curses mode, nano
now calls die(), to save any changed buffers and to restore the
terminal to a usable state.

For the remote chance that nano segfaults in die(), the handler for
SIGSEGV and for SIGABRT is reset to its default value as soon as the
signal fires, to prevent a crash-handler loop.

Since a core dump is usually more helpful for debugging, the crash
handler is not included in a debug build.

This addresses https://savannah.gnu.org/patch/?9623.

Signed-off-by: Devin Hussey <husseydevin@gmail.com>
2018-05-06 16:36:25 +02:00
Benno Schulenberg
0da554e6d7 startup: suggest using ^D to finish reading from standard input
Also, add a period after the "Read nn lines" message, and
don't let the next shell prompt overwrite this message.

This addresses https://savannah.gnu.org/bugs/?53779.
2018-05-01 11:15:19 +02:00
Benno Schulenberg
f1530c7ba0 docs: add notes about deprecated options and function names
Also remove two notes that are obsolete by now.
2018-04-30 15:28:47 +02:00
Benno Schulenberg
0e46c0f4a5 main: clear a spurious error number, to avoid irrelevant messages later
This addresses https://savannah.gnu.org/bugs/?53777.
2018-04-29 12:08:42 +02:00
Benno Schulenberg
6a064503e5 docs: slightly improve the description of the file browser in the manual 2018-04-28 12:34:39 +02:00
Benno Schulenberg
4d92dffb3a bindings: rename constupdate to constantshow, cuttoend to cutfromcursor
This makes the names of these bindable functions equal to the names of
their corresponding options -- like for all the other toggles that have
a corresponding option.
2018-04-28 12:01:23 +02:00
Benno Schulenberg
4c1c425bbb bindings: add the 'linenumbers' bindable function
This makes the line-numbers toggle rebindable, like all the others.
2018-04-28 11:44:53 +02:00
Benno Schulenberg
21a54a3cf6 syntax: po: highlight also other escaped characters, not just \n 2018-04-27 11:17:12 +02:00
Benno Schulenberg
a0147c5a72 bump version numbers and add a news item for the 2.9.6 release 2018-04-27 10:56:10 +02:00
Benno Schulenberg
553940760e tweaks: set the correct flags just once for each spell-fixing session 2018-04-25 17:27:15 +02:00
Benno Schulenberg
faa0eb991e speller: don't add an extra newline when saving the text to a tempfile
Set the NO_NEWLINES flag to achieve this.  And move the saving and
restoring of the global flags to the main speller routine, so the
flags aren't saved and restored for each internal spell fix.

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

Acked-by: David Lawrence Ramsey <pooka109@gmail.com>
2018-04-25 17:26:14 +02:00
Benno Schulenberg
f54cd02652 tweaks: adjust the translator hint about Yes/No/All
There is no longer any need to burden the translators with also
providing the English letters.
2018-04-25 17:14:33 +02:00
Benno Schulenberg
6dd308d0fb prompt: recognize Yes/No/All in English when the locale gives no match 2018-04-25 17:03:13 +02:00
Benno Schulenberg
4872f42cd2 tweaks: rename a function, to be more distinct from its caller 2018-04-25 12:21:40 +02:00
Benno Schulenberg
62007c84c6 tweaks: invert two conditions and reshuffle, to reduce duplication 2018-04-24 13:27:57 +02:00
Benno Schulenberg
d0f37205af search: always go forward by default, also when coming from Goto-Line
This fixes https://savannah.gnu.org/bugs/?53735.
2018-04-24 13:13:38 +02:00
Benno Schulenberg
f05874ea23 gnulib: update to its current upstream state 2018-04-24 10:02:04 +02:00
Benno Schulenberg
0d9080a22c scrolling: don't redraw entire edit window when cursor goes offscreen
When the cursor is on the top or bottom line of the edit window, and
an <Up> or <Down> pushes the cursor offscreen, then use edit_scroll()
to bring it back into view, instead of using edit_redraw(), because
the latter would redraw *every row* on the screen, which is a waste
of time.

This addresses https://savannah.gnu.org/bugs/?53562.
Reported-by: Devin Hussey <husseydevin@gmail.com>
2018-04-24 09:59:39 +02:00
Benno Schulenberg
1ae90e205a command-execution: do not crash when opening the pipe would fail
This fixes https://savannah.gnu.org/bugs/?53723.
2018-04-23 18:04:25 +02:00
Benno Schulenberg
d53086d38d completion: correctly do a signed comparison, to avoid a segfault
Bug existed since commit 30fc197b (a month ago) which changed the
type of 'i' from int to size_t, causing the comparison to do the
wrong thing when 'threshold' is negative.

This fixes https://savannah.gnu.org/bugs/?53722.
Reported-by: Devin Hussey <husseydevin@gmail.com>
2018-04-23 17:09:54 +02:00
Benno Schulenberg
0b6bb37c56 tweaks: improve some comments, and exit with nonzero status upon error 2018-04-23 14:04:08 +02:00
Benno Schulenberg
c43a6fdcc1 tweaks: rename a variable, to match another and to be more visible 2018-04-23 13:04:31 +02:00
Benno Schulenberg
0c613cb1ac tweaks: rename a variable, to be more clear and to match another 2018-04-23 12:57:58 +02:00
Benno Schulenberg
1e5064ef84 tweaks: fix a typo, remove a blank line, and improve some comments 2018-04-23 12:19:25 +02:00
Benno Schulenberg
5b40bad629 files: prevent a hang when a call to sigaction() would fail
Don't try to re-enter curses mode when the terminal is not in
the correct state yet.

This fixes https://savannah.gnu.org/bugs/?53720.
2018-04-23 11:58:18 +02:00
Benno Schulenberg
45f8fc77e0 tweaks: rename a variable, to be a bit more fitting 2018-04-22 12:05:19 +02:00
Benno Schulenberg
94347f0811 memory: use a reallocation to reduce the amount of leakage 2018-04-22 12:00:26 +02:00
Benno Schulenberg
1a4a3de68b formatting, linting: redetermine the argument list for every run
The formatter or linter might have changed in the meantime -- when
the filename was changed to have a different extension, for example.

This fixes https://savannah.gnu.org/bugs/?53716.
2018-04-22 11:44:07 +02:00
Benno Schulenberg
bf8bd02558 build: do not prefix an alternative rcfilename with a dot
When the user configures nano with --enable-altrcname=name,
the specified name should not be prefixed with a dot.

This fixes https://savannah.gnu.org/bugs/?53694.
Reported-by: Cody A. Taylor <codemister99@yahoo.com>
2018-04-21 10:03:30 +02:00
Benno Schulenberg
544d426d86 tweaks: group some more of the empty functions together 2018-04-17 10:34:57 +02:00
Benno Schulenberg
30a984661b syntax: po: highlight also other escaped characters, not just \n
Especially color \a and \t, to make it easier to distinguish them
from contiguous text.
2018-04-17 09:56:19 +02:00
Benno Schulenberg
7ab8a4d835 tweaks: improve the ordering of a couple of functions 2018-04-13 21:09:44 +02:00
Benno Schulenberg
0353a24400 tweaks: rearrange a few if statements more symmetrically 2018-04-13 20:43:08 +02:00
Benno Schulenberg
d4304ca88c search: use a better value to mean "nothing was typed"
When the keyboard buffer is empty, return a value that is not equivalent
to <Ctrl+Space>, so that typing a bunch of these while searching is going
on will not result in some of them getting executed afterward.
2018-04-13 20:13:05 +02:00
Benno Schulenberg
02d8da3bdd tweaks: rename a function, to be more fitting and descriptive
It is not an abort but simply a bit of cleaning up.
2018-04-13 10:32:29 +02:00
Benno Schulenberg
7a09b655c1 tweaks: rename a variable, for clarity 2018-04-13 10:22:39 +02:00
Benno Schulenberg
c8b26baee8 tweaks: elide a function that is called just once
Also adjust and correct a comment.
2018-04-13 10:17:08 +02:00
Liu Hao
bb394990cd replacing: always clear the backwards flag for ^\, just like for ^W
This makes it easier to predict in which direction the replacements
will go when hitting ^\ or M-R.

Signed-off-by: Liu Hao <lh_mouse@126.com>
2018-04-12 20:32:15 +02:00
Benno Schulenberg
7c5d099c6f tweaks: frob a couple of comments 2018-04-01 21:07:18 +02:00
Benno Schulenberg
152cc24d1f tweaks: reshuffle two declarations 2018-04-01 20:08:57 +02:00
Benno Schulenberg
8965103a4d tweaks: remove the group handling for undoing/redoing (un)indents
Indenting/unindenting always happens in a single contiguous block.
Lines that cannot or should not be indented or unindented do not
need to remembered separately as it follows from their content.
2018-04-01 11:41:26 +02:00
Benno Schulenberg
d0d293b8af tweaks: correct or improve a couple of comments 2018-04-01 11:24:44 +02:00
Benno Schulenberg
839743fd24 tweaks: move a function to its proper location 2018-04-01 10:54:14 +02:00
Benno Schulenberg
0b30835dd0 tweaks: use meaningful names instead of puzzling values
Suggested-by: Brand Huntsman <alpha@qzx.com>
2018-04-01 09:49:58 +02:00
Benno Schulenberg
a865c25eea build: fix compilation when configured with --disable-help
This fixes https://savannah.gnu.org/bugs/?53532.
2018-03-31 16:52:22 +02:00
Benno Schulenberg
cf1129a8b4 syntax: sh: colorize options only when they are preceded by whitespace
To prevent any filenames containing hyphens getting partially colored.

Reported-by: Brand Huntsman <alpha@qzx.com>
2018-03-30 10:46:56 +02:00
Benno Schulenberg
0cd833e64b tweaks: move a function to its proper location
Put it after the function that it calls, and before the functions
it is called from.
2018-03-30 10:34:40 +02:00
Benno Schulenberg
cbf226476d rcfile: skip color commands where some color name is invalid
That is, do not fall back to the default background color when the
name for the background color is invalid, but reject the entire
color command, just like for an invalid foreground color.
2018-03-30 10:30:55 +02:00
64 changed files with 17434 additions and 16737 deletions

View File

@@ -1,3 +1,84 @@
Changes between v2.9.6 and v2.9.7:
----------------------------------
Benno Schulenberg (21):
bindings: add the 'linenumbers' bindable function
bindings: rename constupdate to constantshow, cuttoend to cutfromcursor
bump version numbers and add a news item for the 2.9.7 release
docs: add notes about deprecated options and function names
docs: break down some old improvements further per version
docs: note a small difference with Pico in the default hard-wrapping
docs: say thanks to three recent translators, and re-sort two others
docs: slightly improve the description of the file browser in the manual
main: clear a spurious error number, to avoid irrelevant messages later
prompt: when asking for Yes/No/All, recognize also UTF-8 letters
scrolling: only do a scroll when the edit window has more than one row
signals: don't trap segfault/abort when envvar NANO_NOCATCH is defined
signals: exclude the crash handler from the tiny version
startup: suggest using ^D to finish reading from standard input
tweaks: improve a couple of comments
tweaks: normalize indentation and whitespace after previous changes
tweaks: put check for -h and -l options in their alphabetical positions
tweaks: put Yes/No/All in a consistent order (for the translators)
tweaks: rename two variables, to be more descriptive
tweaks: sort an option better, and reschedule a removal
tweaks: use symbolic names instead of puzzling TRUE and FALSE
Devin Hussey (1):
signals: upon a crash, save changed buffers and reset terminal state
Mark-Weston (1):
new feature: an option to make the 'nextword' function stop at word ends
Changes between v2.9.5 and v2.9.6:
----------------------------------
Benno Schulenberg (39):
build: do not prefix an alternative rcfilename with a dot
build: fix compilation when configured with --disable-help
bump version numbers and add a news item for the 2.9.6 release
command-execution: do not crash when opening the pipe would fail
completion: correctly do a signed comparison, to avoid a segfault
files: prevent a hang when a call to sigaction() would fail
formatting, linting: redetermine the argument list for every run
gnulib: update to its current upstream state
memory: use a reallocation to reduce the amount of leakage
prompt: recognize Yes/No/All in English when the locale gives no match
rcfile: skip color commands where some color name is invalid
scrolling: don't redraw entire edit window when cursor goes offscreen
search: always go forward by default, also when coming from Goto-Line
search: use a better value to mean "nothing was typed"
speller: don't add an extra newline when saving the text to a tempfile
syntax: po: highlight also other escaped characters, not just \n
syntax: sh: colorize options only when they are preceded by whitespace
tweaks: adjust the translator hint about Yes/No/All
tweaks: correct or improve a couple of comments
tweaks: elide a function that is called just once
tweaks: fix a typo, remove a blank line, and improve some comments
tweaks: frob a couple of comments
tweaks: group some more of the empty functions together
tweaks: improve some comments, and exit with nonzero status upon error
tweaks: improve the ordering of a couple of functions
tweaks: invert two conditions and reshuffle, to reduce duplication
tweaks: move a function to its proper location
tweaks: move a function to its proper location
tweaks: rearrange a few if statements more symmetrically
tweaks: remove the group handling for undoing/redoing (un)indents
tweaks: rename a function, to be more distinct from its caller
tweaks: rename a function, to be more fitting and descriptive
tweaks: rename a variable, for clarity
tweaks: rename a variable, to be a bit more fitting
tweaks: rename a variable, to be more clear and to match another
tweaks: rename a variable, to match another and to be more visible
tweaks: reshuffle two declarations
tweaks: set the correct flags just once for each spell-fixing session
tweaks: use meaningful names instead of puzzling values
Liu Hao (1):
replacing: always clear the backwards flag for ^\, just like for ^W
Changes between v2.9.4 and v2.9.5:
----------------------------------

View File

@@ -2,6 +2,8 @@ Improvements in GNU nano
========================
Since 2.9.0:
- Option 'set afterends' for making Ctrl+Right stop at word ends.
- A crash handler that saves changed buffers in case of a crash.
- Addition of the color name "normal", meaning the default color.
- A key can be bound to a string -- any mix of text and commands.
- Error messages are shown by default in bright white on red.
@@ -34,24 +36,25 @@ Since 2.6.0:
- The option 'wordchars' for specifying extra word characters.
- Hi-bit control characters are shown in a more readable manner.
- The ability to use negative numbers at the Go To Line prompt.
Noteworthy changes since 2.2
----------------------------
- The ability to comment/uncomment lines with a single keystroke (M-3).
- The ability to refresh the file list in the browser (^L).
- The ability to abort re-searches (^C after an M-W).
- Better feedback at startup when opening large or multiple files.
Since 2.5.0:
- The option 'justifytrim' for snipping whitespace from justified lines.
- The ability to discard a buffer (^O ^Q) when --tempfile is used.
- Replacing things in a marked region now takes place in situ, in context,
instead of changing the view to only the marked text.
- On some terminals Ctrl+Left / Ctrl+Right now work for PrevWord/NextWord.
- On most terminals Ctrl+Left / Ctrl+Right now work for PrevWord/NextWord.
- When in the middle of a word, PrevWord now jumps to the start of this
word (like Pico does) instead of to the start of the preceding word.
Since 2.4.0:
- Replacing things in a marked region now takes place in situ, in context,
instead of changing the view to only the marked text.
- Invalid byte sequences are properly displayed and not mistakenly found.
- Resizing the window does not exit from help viewer nor file browser.
- Improved arrangement of the shortcuts in the two help lines.
- Several small bug fixes in the syntax highlighting.
Since 2.3.0:
- System syntaxes can be improved upon with the 'extendsyntax' command.
- The ability to delete whole words with 'cutwordleft' and 'cutwordright'.
- The ability to save a file without prompting for its name ('savefile').

19
NEWS
View File

@@ -1,3 +1,22 @@
2018.05.15 - GNU nano 2.9.7 "Hvide Sande" adds the option '--afterends'
for making Ctrl+Right (the nextword function) stop at word
ends instead of beginnings, accepts multibyte letters for
the Yes/No/All answers, does emergency saves of changed
buffers in the unlikely event that nano crashes, adds the
until-now missing bindable function 'linenumbers', and
renames the toggles 'constupdate' to 'constantshow' and
'cuttoend' to 'cutfromcursor', for consistency with the
corresponding options -- adjust your nanorc files soon.
2018.04.27 - GNU nano 2.9.6 "Gomance" fixes a crash in word completion,
makes --enable-altrcname work again, improves the fluidity
of scrolling when using the touchpad, tweaks the syntaxes
for shell scripts and PO files, makes a replacing session
go always forward by default, no longer inserts a newline
after an external spell check of a selected region, always
accepts the English Y and N (and A) at a yes-no prompt in
any locale, and solves a few hypothetical bugs.
2018.03.29 - GNU nano 2.9.5 "Kiša pada" changes the way the Scroll-Up
and Scroll-Down commands work (M-- and M-+): instead of
keeping the cursor in the same screen position they now

7
THANKS
View File

@@ -4,7 +4,7 @@ If we missed you here, let us know!
Translations:
============
Sharuzzaman Ahmat Raslan <sharuzzaman@excite.com> Malay
Pedro Albuquerque <palbuquerque73@gmail.com> Portuguese
Josef Andersson <josef.andersson@fripost.org> Swedish
Laurentiu Buzdugan <buzdugan@voyager.net> Romanian
Mario Blättermann <mario.blaettermann@gmail.com> German
@@ -44,16 +44,18 @@ João Victor Duarte Martins <jvdm@sdf.lonestar.org> Brazilian Portuguese
Pavel Maryanov <acid@jack.kiev.ua> Russian
Daniele Medri <madrid@linux.it> Italian
Gergely Nagy <algernon@debian.org> Hungarian
Claudio Neves <cneves@nextis.com> Brazilian Portuguese
Kalle Olavi Niemitalo <kon@iki.fi> Finnish
Мирослав Николић <miroslavnikolic@rocketmail.com> Serbian
Claudio Neves <cneves@nextis.com> Brazilian Portuguese
Lauri Nurmi <lanurmi@iki.fi> Finnish
Daniel Nylander <po@danielnylander.se> Swedish
Mikel Olasagasti <hey_neken@mundurat.net> Basque
Yi-Jyun Pan <pan93412@gmail.com> Chinese (traditional)
Michael Piefel <piefel@informatik.hu-berlin.de> German
Sergey Poznyakoff <gray@gnu.org> Polish
Božidar Putanec <bozidarp@yahoo.com> Croatian
Trần Ngọc Quân <vnwildman@gmail.com> Vietnamese
Sharuzzaman Ahmat Raslan <sharuzzaman@excite.com> Malay
Sergey A. Ribalchenko <fisher@obu.ck.ua> Ukrainian and Russian
Michel Robitaille <robitail@IRO.UMontreal.CA> French
Christian Rose <menthos@menthos.com> Swedish
@@ -76,6 +78,7 @@ Miquel Vidal <miquel@sindominio.net> Catalan
Phan Vinh Thinh <teppi82@gmail.com> Vietnamese
Pauli Virtanen <pauli.virtanen@saunalahti.fi> Finnish
Aron Xu <happyaron.xu@gmail.com> Chinese (simplified)
Boyuan Yang <073plan@gmail.com> Chinese (simplified)
Peio Ziarsolo <peio@sindominio.net> Basque
Anton Zinoviev <zinoviev@debian.org> Bulgarian

View File

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

View File

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

View File

@@ -91,7 +91,7 @@
<h3><a name="1.3"></a>1.3. Why the name change from TIP?</h3>
<blockquote><p>On January 10, 2000, TIP was officially renamed to nano because of a namespace conflict with another program called 'tip'. The original 'tip' program &quot;establishes a full duplex terminal connection to a remote host&quot;, and was included with many older Unix systems (and newer ones like Solaris). The conflict was not noticed at first because there is no 'tip' utility included with most GNU/Linux distributions (where nano was developed).</p></blockquote>
<h3><a name="1.4"></a>1.4. What is the current version of nano?</h3>
<blockquote><p>The current version of nano <i>should</i> be <b>2.9.5</b>. Of course, you should always check the <a href="https://nano-editor.org/">nano homepage</a> to see what the latest and greatest version is.</p></blockquote>
<blockquote><p>The current version of nano <i>should</i> be <b>2.9.7</b>. Of course, you should always check the <a href="https://nano-editor.org/">nano homepage</a> to see what the latest and greatest version is.</p></blockquote>
<h3><a name="1.5"></a>1.5. I want to read the man page without having to download the program!</h3>
<blockquote><p>Jeez, demanding, aren't we? Okay, look <a href="https://nano-editor.org/dist/latest/nano.1.html">here</a>.</p></blockquote>
<hr width="100%">

View File

@@ -16,7 +16,7 @@
.\" Documentation License along with this program. If not, see
.\" <http://www.gnu.org/licenses/>.
.\"
.TH NANO 1 "version 2.9.5" "March 2018"
.TH NANO 1 "version 2.9.7" "May 2018"
.SH NAME
nano \- Nano's ANOther editor, an enhanced free Pico clone
@@ -250,6 +250,9 @@ Disable the hard-wrapping of long lines. This option conflicts with
.BR \-x ", " \-\-nohelp
Don't show the two help lines at the bottom of the screen.
.TP
.BR \-y ", " \-\-afterends
Make Ctrl+Right stop at word ends instead of beginnings.
.TP
.BR \-z ", " \-\-suspend
Enable the suspend ability.
.TP
@@ -309,6 +312,10 @@ not by default distinguish modified from unmodified arrow keys.
Please report any other bugs that you encounter via:
.br
\fIhttps://savannah.gnu.org/bugs/?group=nano\fR.
.sp
When nano crashes, it will save any modified buffers to emergency .save files.
If you are able to reproduce the crash and you want to get a backtrace, define
the environment variable \fBNANO_NOCATCH\fR.
.SH HOMEPAGE
\fIhttps://nano-editor.org/\fR

View File

@@ -8,8 +8,8 @@
@smallbook
@set EDITION 0.5
@set VERSION 2.9.5
@set UPDATED March 2018
@set VERSION 2.9.7
@set UPDATED May 2018
@dircategory Editors
@direntry
@@ -23,7 +23,7 @@
@titlepage
@title GNU @command{nano}
@subtitle a small and friendly text editor
@subtitle version 2.9.5
@subtitle version 2.9.7
@author Chris Allegretta
@page
@@ -63,7 +63,7 @@ e-mail: @email{chrisa@@asty.org}@*
@node Top
@top
This manual documents the GNU @command{nano} editor, version 2.9.5.
This manual documents the GNU @command{nano} editor, version 2.9.7.
@menu
* Introduction::
@@ -392,6 +392,10 @@ is located at the very bottom of the editor.
Note: When accessing the help system, Expert Mode is temporarily
disabled to display the help-system navigation keys.
@item -y
@itemx --afterends
Make Ctrl+Right stop at word ends instead of beginnings.
@item -z
@itemx --suspend
Enable the ability to suspend @command{nano} using the system's suspend
@@ -689,6 +693,9 @@ The supported settings in a nanorc file are:
@table @code
@item set afterends
Make Ctrl+Right stop at word ends instead of beginnings.
@item set allow_insecure_backup
When backing up files, allow the backup to succeed even if its
permissions can't be (re)set due to special OS considerations.
@@ -909,6 +916,7 @@ Use this color combination for the title bar.
@item set trimblanks
Remove trailing whitespace from wrapped lines when automatic
hard-wrapping occurs or when text is justified.
(The old form of this option, @code{set justifytrim}, is deprecated.)
@item set unix
Save a file by default in Unix format. This overrides nano's
@@ -1347,8 +1355,9 @@ Goes to the last file when using the file browser (reading or writing files).
@item nohelp
Toggles the presence of the two-line list of key bindings at the bottom of the screen.
@item constupdate
@item constantshow
Toggles the constant display of the current line, column, and character positions.
(The form @code{constupdate} is deprecated.)
@item morespace
Toggles the presence of the blank line that 'separates' the title bar from the file text.
@@ -1359,6 +1368,9 @@ Toggles smooth scrolling (when moving around with the arrow keys).
@item softwrap
Toggles the displaying of overlong lines on multiple screen lines.
@item linenumbers
Toggles the display of line numbers in front of the text.
@item whitespacedisplay
Toggles the showing of whitespace.
@@ -1371,9 +1383,10 @@ Toggles the smartness of the Home key.
@item autoindent
Toggles whether new lines will contain the same amount of whitespace as the preceding line.
@item cuttoend
@item cutfromcursor
Toggles whether cutting text will cut the whole line or just from the current cursor
position to the end of the line.
(The form @code{cuttoend} is deprecated.)
@item nowrap
Toggles whether long lines will be hard-wrapped to the next line.
@@ -1438,7 +1451,7 @@ The interactive spell checker Yes/no menu.
The linter menu.
@item browser
The file browser for inserting or writing a file.
The file browser, for choosing a file to read from or write to.
@item whereisfile
The 'search for a file' menu in the file browser.
@@ -1457,14 +1470,15 @@ it means all menus where the specified @code{key} exists.
@node The File Browser
@chapter The File Browser
When reading or writing files, pressing @kbd{^T} will invoke the file browser.
When in the Read-File (@kbd{^R}) or Write-Out menu (@kbd{^O}),
pressing @kbd{^T} will invoke the file browser.
Here, one can navigate directories in a graphical manner in order to
find the desired file.
Basic movement in the file browser is accomplished with the arrow keys,
page up, and page down. More advanced movement is accomplished by
searching via @kbd{^W} (or @kbd{w'} and changing directories via
@kbd{^_} (or @kbd{g}). The behavior of the @kbd{Enter} key (or @kbd{s})
Basic movement in the file browser is accomplished with the arrow and
other cursor-movement keys. More targeted movement is accomplished by
searching, via @kbd{^W} or @kbd{w'}, or by changing directory, via
@kbd{^_} or @kbd{g}. The behavior of the @kbd{Enter} key (or @kbd{s})
varies by what is currently selected.
If the currently selected object is a directory, the file browser will
enter and display the contents of the directory. If the object is a
@@ -1505,6 +1519,11 @@ The output of the "Display Cursor Position" command (@kbd{^C}) displays
not only the current line and character position of the cursor,
but also (between the two) the current column position.
@item Hard-Wrapping
By default, @command{nano} hard-wraps lines at screen width minus eight
columns, whereas Pico does it at screen width minus six columns. You can
make @command{nano} do the same as Pico by using @option{--fill=-6}.
@item Spell Checking
In the internal spell checker misspelled words are sorted alphabetically
and trimmed for uniqueness, such that the words 'apple' and 'Apple' will

View File

@@ -16,7 +16,7 @@
.\" Documentation License along with this program. If not, see
.\" <http://www.gnu.org/licenses/>.
.\"
.TH NANORC 5 "version 2.9.5" "March 2018"
.TH NANORC 5 "version 2.9.7" "May 2018"
.SH NAME
nanorc \- GNU nano's configuration file
@@ -53,6 +53,9 @@ match \fB"\fP, \fB'\fP, \fB)\fP, \fB>\fP, \fB]\fP, and \fB}\fP.
The supported commands and arguments are:
.TP 3
.B set afterends
Make Ctrl+Right stop at word ends instead of beginnings.
.TP
.B set allow_insecure_backup
When backing up files, allow the backup to succeed even if its permissions
can't be (re)set due to special OS considerations. You should
@@ -273,6 +276,7 @@ And either "\fIfgcolor\fR" or ",\fIbgcolor\fR" may be left out.
.B set trimblanks
Remove trailing whitespace from wrapped lines when automatic
hard-wrapping occurs or when text is justified.
(The old form of this option, '\fBset justifytrim\fR', is deprecated.)
.TP
.B set unix
Save a file by default in Unix format. This overrides nano's
@@ -703,8 +707,9 @@ Goes to the last file when using the file browser (reading or writing files).
.B nohelp
Toggles the presence of the two-line list of key bindings at the bottom of the screen.
.TP
.B constupdate
.B constantshow
Toggles the constant display of the current line, column, and character positions.
(The form 'constupdate' is deprecated.)
.TP
.B morespace
Toggles the presence of the blank line that 'separates' the title bar from the file text.
@@ -715,6 +720,9 @@ Toggles smooth scrolling (when moving around with the arrow keys).
.B softwrap
Toggles the displaying of overlong lines on multiple screen lines.
.TP
.B linenumbers
Toggles the display of line numbers in front of the text.
.TP
.B whitespacedisplay
Toggles the showing of whitespace.
.TP
@@ -727,9 +735,10 @@ Toggles the smartness of the Home key.
.B autoindent
Toggles whether new lines will contain the same amount of whitespace as the preceding line.
.TP
.B cuttoend
.B cutfromcursor
Toggles whether cutting text will cut the whole line or just from the current cursor
position to the end of the line.
(The form 'cuttoend' is deprecated.)
.TP
.B nowrap
Toggles whether long lines will be hard-wrapped to the next line.

View File

@@ -16,7 +16,7 @@
.\" Documentation License along with this program. If not, see
.\" <http://www.gnu.org/licenses/>.
.\"
.TH RNANO 1 "version 2.9.5" "March 2018"
.TH RNANO 1 "version 2.9.7" "May 2018"
.SH NAME
rnano \- a restricted nano

View File

@@ -15,6 +15,10 @@
## its end. For example, for the "brackets" option, ""')>]}" will match
## ", ', ), >, ], and }.
## Make the 'nextword' function (Ctrl+Right) stop at word ends
## instead of at beginnings.
# set afterends
## When soft line wrapping is enabled, make it wrap lines at blanks
## (tabs and spaces) instead of always at the edge of the screen.
# set atblanks
@@ -43,7 +47,6 @@
## Constantly display the cursor position in the status bar. Note that
## this overrides "quickblank".
# set constantshow
## (The old form, 'const', is deprecated.)
## Use cut-from-cursor-to-end-of-line by default.
# set cutfromcursor
@@ -107,7 +110,6 @@
## Remember the cursor position in each file for the next editing session.
# set positionlog
## (The old form, 'poslog', is deprecated.)
## Preserve the XON and XOFF keys (^Q and ^S).
# set preserve
@@ -174,6 +176,7 @@
## Snip whitespace at the end of lines when justifying or hard-wrapping.
# set trimblanks
## (The old form, 'justifytrim', is deprecated.)
## Disallow file modification. Why would you want this in an rcfile? ;)
# set view

926
po/bg.po

File diff suppressed because it is too large Load Diff

911
po/ca.po

File diff suppressed because it is too large Load Diff

931
po/cs.po

File diff suppressed because it is too large Load Diff

975
po/da.po

File diff suppressed because it is too large Load Diff

907
po/de.po

File diff suppressed because it is too large Load Diff

913
po/eo.po

File diff suppressed because it is too large Load Diff

907
po/es.po

File diff suppressed because it is too large Load Diff

950
po/eu.po

File diff suppressed because it is too large Load Diff

901
po/fi.po

File diff suppressed because it is too large Load Diff

924
po/fr.po

File diff suppressed because it is too large Load Diff

901
po/ga.po

File diff suppressed because it is too large Load Diff

929
po/gl.po

File diff suppressed because it is too large Load Diff

1247
po/hr.po

File diff suppressed because it is too large Load Diff

901
po/hu.po

File diff suppressed because it is too large Load Diff

896
po/id.po

File diff suppressed because it is too large Load Diff

904
po/it.po

File diff suppressed because it is too large Load Diff

907
po/ja.po

File diff suppressed because it is too large Load Diff

926
po/ms.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

913
po/nb.po

File diff suppressed because it is too large Load Diff

911
po/nl.po

File diff suppressed because it is too large Load Diff

935
po/nn.po

File diff suppressed because it is too large Load Diff

901
po/pl.po

File diff suppressed because it is too large Load Diff

905
po/pt.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

909
po/ro.po

File diff suppressed because it is too large Load Diff

931
po/ru.po

File diff suppressed because it is too large Load Diff

931
po/sl.po

File diff suppressed because it is too large Load Diff

901
po/sr.po

File diff suppressed because it is too large Load Diff

901
po/sv.po

File diff suppressed because it is too large Load Diff

907
po/tr.po

File diff suppressed because it is too large Load Diff

909
po/uk.po

File diff suppressed because it is too large Load Diff

905
po/vi.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -168,12 +168,12 @@ char *do_browser(char *path)
} else if (func == do_search_forward) {
do_filesearch();
} else if (func == do_research) {
do_fileresearch(TRUE);
do_fileresearch(FORWARD);
#ifndef NANO_TINY
} else if (func == do_findprevious) {
do_fileresearch(FALSE);
do_fileresearch(BACKWARD);
} else if (func == do_findnext) {
do_fileresearch(TRUE);
do_fileresearch(FORWARD);
#endif
} else if (func == do_left) {
if (selected > 0)
@@ -659,42 +659,40 @@ void browser_select_dirname(const char *needle)
}
}
/* Set up the system variables for a filename search. Return -1 or -2 if
* the search should be canceled (due to Cancel or a blank search string),
* return 0 when we have a string, and return a positive value when some
* function was run. */
/* Prepare the prompt and ask the user what to search for. Return -2
* for a blank answer, -1 for Cancel, 0 when we have a string, and a
* positive value when some function was run. */
int filesearch_init(void)
{
int input;
char *buf;
char *thedefault;
int response;
/* If something was searched for before, show it between square brackets. */
if (*last_search != '\0') {
char *disp = display_string(last_search, 0, COLS / 3, FALSE);
buf = charalloc(strlen(disp) + 7);
thedefault = charalloc(strlen(disp) + 7);
/* We use (COLS / 3) here because we need to see more on the line. */
sprintf(buf, " [%s%s]", disp,
sprintf(thedefault, " [%s%s]", disp,
(strlenpt(last_search) > COLS / 3) ? "..." : "");
free(disp);
} else
buf = mallocstrcpy(NULL, "");
thedefault = mallocstrcpy(NULL, "");
/* This is now one simple call. It just does a lot. */
input = do_prompt(FALSE, FALSE, MWHEREISFILE, NULL, &search_history,
browser_refresh, "%s%s", _("Search"), buf);
/* Release buf now that we don't need it anymore. */
free(buf);
/* Now ask what to search for. */
response = do_prompt(FALSE, FALSE, MWHEREISFILE, NULL, &search_history,
browser_refresh, "%s%s", _("Search"), thedefault);
free(thedefault);
/* If only Enter was pressed but we have a previous string, it's okay. */
if (input == -2 && *last_search != '\0')
if (response == -2 && *last_search != '\0')
return 0;
/* Otherwise negative inputs are a bailout. */
if (input < 0)
/* Otherwise negative responses are a bailout. */
if (response < 0)
statusbar(_("Cancelled"));
return input;
return response;
}
/* Look for the given needle in the list of files. If forwards is TRUE,

View File

@@ -60,9 +60,9 @@ void set_colorpairs(void)
colortype *combo = color_combo[i];
if (combo != NULL) {
if (combo->fg == -1 && !using_defaults)
if (combo->fg == USE_THE_DEFAULT && !using_defaults)
combo->fg = COLOR_WHITE;
if (combo->bg == -1 && !using_defaults)
if (combo->bg == USE_THE_DEFAULT && !using_defaults)
combo->bg = COLOR_BLACK;
init_pair(i + 1, combo->fg, combo->bg);
interface_color_pair[i] = COLOR_PAIR(i + 1) | A_BANDAID |
@@ -125,10 +125,10 @@ void color_init(void)
foreground = ink->fg;
background = ink->bg;
if (foreground == -1 && !using_defaults)
if (foreground == USE_THE_DEFAULT && !using_defaults)
foreground = COLOR_WHITE;
if (background == -1 && !using_defaults)
if (background == USE_THE_DEFAULT && !using_defaults)
background = COLOR_BLACK;
init_pair(ink->pairnum, foreground, background);

View File

@@ -46,11 +46,6 @@ bool focusing = TRUE;
bool as_an_at = TRUE;
/* Whether a 0x0A byte should be shown as a ^@ instead of a ^J. */
int margin = 0;
/* The amount of space reserved at the left for line numbers. */
int editwincols = -1;
/* The number of usable columns in the edit window: COLS - margin. */
bool suppress_cursorpos = FALSE;
/* Should we skip constant position display for current keystroke? */
@@ -98,18 +93,22 @@ char *present_path = NULL;
unsigned flags[4] = {0, 0, 0, 0};
/* Our flag containing the states of all global options. */
WINDOW *topwin = NULL;
/* The top portion of the window, where we display the version
* number of nano, the name of the current file, and whether the
* current file has been modified. */
/* The top portion of the screen, showing the version number of nano,
* the name of the file, and whether the buffer was modified. */
WINDOW *edit = NULL;
/* The middle portion of the window, i.e. the edit window, where
* we display the current file we're editing. */
/* The middle portion of the screen: the edit window, showing the
* contents of the current buffer, the file we are editing. */
WINDOW *bottomwin = NULL;
/* The bottom portion of the window, where we display statusbar
/* The bottom portion of the screen, where we display statusbar
* messages, the statusbar prompt, and a list of shortcuts. */
int editwinrows = 0;
/* How many rows does the edit window take up? */
int editwincols = -1;
/* The number of usable columns in the edit window: COLS - margin. */
int margin = 0;
/* The amount of space reserved at the left for line numbers. */
filestruct *cutbuffer = NULL;
/* The buffer where we store cut text. */
@@ -266,7 +265,7 @@ size_t length_of_list(int menu)
#define BLANKAFTER TRUE /* A blank line after this one. */
#define TOGETHER FALSE
/* Just throw this here. */
/* Empty functions, for the most part corresponding to toggles. */
void case_sens_void(void)
{
}
@@ -291,6 +290,9 @@ void goto_dir_void(void)
}
#endif
#ifndef NANO_TINY
void do_toggle_void(void)
{
}
void dos_format_void(void)
{
}
@@ -318,6 +320,9 @@ void flip_newbuffer(void)
void discard_buffer(void)
{
}
void do_cancel(void)
{
}
/* Add a function to the function list. */
void add_to_funcs(void (*func)(void), int menus, const char *desc, const char *help,
@@ -392,7 +397,6 @@ const sc *first_sc_for(int menu, void (*func)(void))
#ifdef DEBUG
fprintf(stderr, "Whoops, returning null given func %ld in menu %x\n", (long)func, menu);
#endif
/* Otherwise... */
return NULL;
}
@@ -576,6 +580,8 @@ void shortcut_init(void)
const char *lastline_gist = N_("Go to the last line of the file");
#ifndef NANO_TINY
const char *bracket_gist = N_("Go to the matching bracket");
#endif
#ifdef ENABLE_HELP
const char *scrollup_gist =
N_("Scroll up one line without moving the cursor textually");
const char *scrolldown_gist =
@@ -859,7 +865,7 @@ void shortcut_init(void)
prevline_tag, WITHORSANS(prevline_gist), TOGETHER, VIEW);
add_to_funcs(do_down, MMAIN|MHELP|MBROWSER,
nextline_tag, WITHORSANS(nextline_gist), TOGETHER, VIEW);
#ifndef NANO_TINY
#ifdef ENABLE_HELP
add_to_funcs(do_scroll_up, MMAIN,
N_("Scroll Up"), WITHORSANS(scrollup_gist), TOGETHER, VIEW);
add_to_funcs(do_scroll_down, MMAIN,
@@ -1206,7 +1212,7 @@ void shortcut_init(void)
add_to_sclist(MMAIN, "M-)", 0, do_para_end_void, 0);
add_to_sclist(MMAIN, "M-0", 0, do_para_end_void, 0);
#endif
#ifndef NANO_TINY
#ifdef ENABLE_HELP
add_to_sclist(MMAIN, "M--", 0, do_scroll_up, 0);
add_to_sclist(MMAIN, "M-_", 0, do_scroll_up, 0);
add_to_sclist(MMAIN, "M-+", 0, do_scroll_down, 0);
@@ -1387,8 +1393,7 @@ const subnfunc *sctofunc(const sc *s)
}
#ifndef NANO_TINY
/* Now let's come up with a single (hopefully) function to get a string
* for each flag. */
/* Return the textual description that corresponds to the given flag. */
const char *flagtostr(int flag)
{
switch (flag) {
@@ -1526,10 +1531,6 @@ sc *strtosc(const char *input)
s->func = do_indent;
else if (!strcasecmp(input, "unindent"))
s->func = do_unindent;
else if (!strcasecmp(input, "scrollup"))
s->func = do_scroll_up;
else if (!strcasecmp(input, "scrolldown"))
s->func = do_scroll_down;
else if (!strcasecmp(input, "cutwordleft"))
s->func = do_cut_prev_word;
else if (!strcasecmp(input, "cutwordright"))
@@ -1559,6 +1560,12 @@ sc *strtosc(const char *input)
else if (!strcasecmp(input, "down") ||
!strcasecmp(input, "nextline"))
s->func = do_down;
#ifdef ENABLE_HELP
else if (!strcasecmp(input, "scrollup"))
s->func = do_scroll_up;
else if (!strcasecmp(input, "scrolldown"))
s->func = do_scroll_down;
#endif
else if (!strcasecmp(input, "prevword"))
s->func = do_prev_word_void;
else if (!strcasecmp(input, "nextword"))
@@ -1652,7 +1659,8 @@ sc *strtosc(const char *input)
s->func = do_toggle_void;
if (!strcasecmp(input, "nohelp"))
s->toggle = NO_HELP;
else if (!strcasecmp(input, "constupdate"))
else if (!strcasecmp(input, "constantshow") ||
!strcasecmp(input, "constupdate")) /* Deprecated. Remove end of 2018. */
s->toggle = CONSTANT_SHOW;
else if (!strcasecmp(input, "morespace"))
s->toggle = MORE_SPACE;
@@ -1660,6 +1668,10 @@ sc *strtosc(const char *input)
s->toggle = SMOOTH_SCROLL;
else if (!strcasecmp(input, "softwrap"))
s->toggle = SOFTWRAP;
#ifdef ENABLE_LINENUMBERS
else if (!strcasecmp(input, "linenumbers"))
s->toggle = LINE_NUMBERS;
#endif
else if (!strcasecmp(input, "whitespacedisplay"))
s->toggle = WHITESPACE_DISPLAY;
#ifdef ENABLE_COLOR
@@ -1670,7 +1682,8 @@ sc *strtosc(const char *input)
s->toggle = SMART_HOME;
else if (!strcasecmp(input, "autoindent"))
s->toggle = AUTOINDENT;
else if (!strcasecmp(input, "cuttoend"))
else if (!strcasecmp(input, "cutfromcursor") ||
!strcasecmp(input, "cuttoend")) /* Deprecated. Remove end of 2018. */
s->toggle = CUT_FROM_CURSOR;
#ifdef ENABLE_WRAPPING
else if (!strcasecmp(input, "nowrap"))

View File

@@ -227,7 +227,7 @@ char *get_history_completion(filestruct **h, char *s, size_t len)
* match, or len is 0. Return s. */
return (char *)s;
}
#endif /* ENSABLE_TABCOMP */
#endif /* ENABLE_TABCOMP */
void history_error(const char *msg, ...)
{

View File

@@ -314,15 +314,17 @@ void do_prev_word(bool allow_punct, bool update_screen)
edit_redraw(was_current, FLOWING);
}
/* Move to the next word. If allow_punct is TRUE, treat punctuation
* as part of a word. When requested, update the screen afterwards.
/* Move to the next word. If after_ends is TRUE, stop at the ends of words
* instead of their beginnings. If allow_punct is TRUE, treat punctuation
* as part of a word. When requested, update the screen afterwards.
* Return TRUE if we started on a word, and FALSE otherwise. */
bool do_next_word(bool allow_punct, bool update_screen)
bool do_next_word(bool after_ends, bool allow_punct, bool update_screen)
{
filestruct *was_current = openfile->current;
bool started_on_word = is_word_mbchar(openfile->current->data +
openfile->current_x, allow_punct);
bool seen_space = !started_on_word;
bool seen_word = started_on_word;
/* Move forward until we reach the start of a word. */
while (TRUE) {
@@ -340,13 +342,26 @@ bool do_next_word(bool allow_punct, bool update_screen)
openfile->current_x);
}
/* If this is not a word character, then it's a separator; else
* if we've already seen a separator, then it's a word start. */
if (!is_word_mbchar(openfile->current->data + openfile->current_x,
#ifndef NANO_TINY
if (after_ends) {
/* If this is a word character, continue; else it's a separator,
* and if we've already seen a word, then it's a word end. */
if (is_word_mbchar(openfile->current->data + openfile->current_x,
allow_punct))
seen_space = TRUE;
else if (seen_space)
break;
seen_word = TRUE;
else if (seen_word)
break;
} else
#endif
{
/* If this is not a word character, then it's a separator; else
* if we've already seen a separator, then it's a word start. */
if (!is_word_mbchar(openfile->current->data + openfile->current_x,
allow_punct))
seen_space = TRUE;
else if (seen_space)
break;
}
}
if (update_screen)
@@ -363,11 +378,12 @@ void do_prev_word_void(void)
do_prev_word(ISSET(WORD_BOUNDS), TRUE);
}
/* Move to the next word in the file, treating punctuation as part of a word
* if the WORD_BOUNDS flag is set, and update the screen afterwards. */
/* Move to the next word in the file. If the AFTER_ENDS flag is set, stop
* at word ends instead of beginnings. If the WORD_BOUNDS flag is set, treat
* punctuation as part of a word. Update the screen afterwards. */
void do_next_word_void(void)
{
do_next_word(ISSET(WORD_BOUNDS), TRUE);
do_next_word(ISSET(AFTER_ENDS), ISSET(WORD_BOUNDS), TRUE);
}
/* Move to the beginning of the current line (or softwrapped chunk).
@@ -495,7 +511,10 @@ void do_up(void)
set_proper_index_and_pww(&leftedge, target_column, FALSE);
edit_redraw(was_current, FLOWING);
if (openfile->current_y == 0 && ISSET(SMOOTH_SCROLL))
edit_scroll(BACKWARD);
else
edit_redraw(was_current, FLOWING);
/* <Up> should not change placewewant, so restore it. */
openfile->placewewant = leftedge + target_column;
@@ -515,7 +534,10 @@ void do_down(void)
set_proper_index_and_pww(&leftedge, target_column, TRUE);
edit_redraw(was_current, FLOWING);
if (openfile->current_y == editwinrows - 1 && ISSET(SMOOTH_SCROLL))
edit_scroll(FORWARD);
else
edit_redraw(was_current, FLOWING);
/* <Down> should not change placewewant, so restore it. */
openfile->placewewant = leftedge + target_column;
@@ -532,7 +554,8 @@ void do_scroll_up(void)
if (openfile->current_y == editwinrows - 1)
do_up();
edit_scroll(BACKWARD);
if (editwinrows > 1)
edit_scroll(BACKWARD);
}
/* Scroll down one line or chunk without scrolling the cursor. */

View File

@@ -551,14 +551,15 @@ void say_there_is_no_help(void)
}
#endif
/* Make nano exit gracefully. */
/* Exit normally: restore the terminal state and save history files. */
void finish(void)
{
/* Blank the statusbar and (if applicable) the shortcut list,
* and move the cursor to the last line of the screen. */
/* Blank the statusbar and (if applicable) the shortcut list. */
blank_statusbar();
blank_bottombars();
wrefresh(bottomwin);
/* Switch on the cursor and exit from curses mode. */
curs_set(1);
endwin();
@@ -582,7 +583,8 @@ void finish(void)
exit(0);
}
/* Make nano die gracefully. */
/* Die gracefully -- by restoring the terminal state and saving any buffers
* that were modified. */
void die(const char *msg, ...)
{
va_list ap;
@@ -888,6 +890,9 @@ void usage(void)
print_opt("-w", "--nowrap", N_("Don't hard-wrap long lines"));
#endif
print_opt("-x", "--nohelp", N_("Don't show the two help lines"));
#ifndef NANO_TINY
print_opt("-y", "--afterends", N_("Make Ctrl+Right stop at word ends"));
#endif
if (!ISSET(RESTRICTED))
print_opt("-z", "--suspend", N_("Enable suspension"));
#ifndef NANO_TINY
@@ -1087,12 +1092,6 @@ void close_and_go(void)
finish();
}
/* Another placeholder for function mapping. */
void do_cancel(void)
{
;
}
/* Make a note that reading from stdin was concluded with ^C. */
RETSIGTYPE make_a_note(int signal)
{
@@ -1105,7 +1104,7 @@ bool scoop_stdin(void)
struct sigaction oldaction, newaction;
/* Original and temporary handlers for SIGINT. */
bool setup_failed = FALSE;
/* Whether setting up the SIGINT handler failed. */
/* Whether setting up the temporary SIGINT handler failed. */
FILE *stream;
int thetty;
@@ -1113,7 +1112,7 @@ bool scoop_stdin(void)
endwin();
tcsetattr(0, TCSANOW, &oldterm);
fprintf(stderr, _("Reading from stdin, ^C to abort\n"));
fprintf(stderr, _("Reading from standard input; type ^D or ^D^D to finish.\n"));
#ifndef NANO_TINY
/* Enable interpretation of the special control keys so that
@@ -1124,12 +1123,12 @@ bool scoop_stdin(void)
/* Set things up so that SIGINT will cancel the reading. */
if (sigaction(SIGINT, NULL, &newaction) == -1) {
setup_failed = TRUE;
nperror("sigaction");
perror("sigaction");
} else {
newaction.sa_handler = make_a_note;
if (sigaction(SIGINT, &newaction, &oldaction) == -1) {
setup_failed = TRUE;
nperror("sigaction");
perror("sigaction");
}
}
@@ -1148,6 +1147,7 @@ bool scoop_stdin(void)
open_buffer("", TRUE);
read_file(stream, 0, "stdin", TRUE);
openfile->edittop = openfile->fileage;
fprintf(stderr, ".\n");
/* Reconnect the tty as the input source. */
thetty = open("/dev/tty", O_RDONLY);
@@ -1162,7 +1162,7 @@ bool scoop_stdin(void)
/* If it was changed, restore the handler for SIGINT. */
if (!setup_failed && sigaction(SIGINT, &oldaction, NULL) == -1)
nperror("sigaction");
perror("sigaction");
terminal_init();
doupdate();
@@ -1216,6 +1216,18 @@ void signal_init(void)
sigaction(SIGTSTP, &act, NULL);
#endif
}
#if !defined(NANO_TINY) && !defined(DEBUG)
if (getenv("NANO_NOCATCH") == NULL) {
/* Trap SIGSEGV and SIGABRT to save any changed buffers and reset
* the terminal to a usable state. Reset these handlers to their
* defaults as soon as their signal fires. */
act.sa_handler = handle_crash;
act.sa_flags |= SA_RESETHAND;
sigaction(SIGSEGV, &act, NULL);
sigaction(SIGABRT, &act, NULL);
}
#endif
}
/* Handler for SIGHUP (hangup) and SIGTERM (terminate). */
@@ -1224,6 +1236,14 @@ RETSIGTYPE handle_hupterm(int signal)
die(_("Received SIGHUP or SIGTERM\n"));
}
#if !defined(NANO_TINY) && !defined(DEBUG)
/* Handler for SIGSEGV (segfault) and SIGABRT (abort). */
RETSIGTYPE handle_crash(int signal)
{
die(_("Sorry! Nano crashed! Code: %d. Please report a bug.\n"), signal);
}
#endif
/* Handler for SIGTSTP (suspend). */
RETSIGTYPE do_suspend(int signal)
{
@@ -1401,12 +1421,6 @@ void do_toggle(int flag)
statusline(HUSH, "%s %s", _(flagtostr(flag)),
enabled ? _("enabled") : _("disabled"));
}
/* Bleh. */
void do_toggle_void(void)
{
;
}
#endif /* !NANO_TINY */
/* Disable extended input and output processing in our terminal
@@ -1499,7 +1513,6 @@ void terminal_init(void)
if (!newterm_set) {
#endif
raw();
nonl();
noecho();
@@ -1995,6 +2008,7 @@ int main(int argc, char **argv)
{"autoindent", 0, NULL, 'i'},
{"cutfromcursor", 0, NULL, 'k'},
{"unix", 0, NULL, 'u'},
{"afterends", 0, NULL, 'y'},
{"softwrap", 0, NULL, '$'},
#endif
{NULL, 0, NULL, 0}
@@ -2053,15 +2067,9 @@ int main(int argc, char **argv)
while ((optchr =
getopt_long(argc, argv,
"ABC:DEFGHIKLMNOPQ:RST:UVWX:Y:abcdefghijklmno:pqr:s:tuvwxz$",
"ABC:DEFGHIKLMNOPQ:RST:UVWX:Y:abcdefghijklmno:pqr:s:tuvwxyz$",
long_options, NULL)) != -1) {
switch (optchr) {
case 'b':
case 'e':
case 'f':
case 'j':
/* Pico compatibility flags. */
break;
#ifndef NANO_TINY
case 'A':
SET(SMART_HOME);
@@ -2178,6 +2186,9 @@ int main(int argc, char **argv)
case 'g':
SET(SHOW_CURSOR);
break;
case 'h':
usage();
exit(0);
#ifndef NANO_TINY
case 'i':
SET(AUTOINDENT);
@@ -2186,6 +2197,11 @@ int main(int argc, char **argv)
SET(CUT_FROM_CURSOR);
break;
#endif
#ifdef ENABLE_LINENUMBERS
case 'l':
SET(LINE_NUMBERS);
break;
#endif
#ifdef ENABLE_MOUSE
case 'm':
SET(USE_MOUSE);
@@ -2248,6 +2264,11 @@ int main(int argc, char **argv)
case 'x':
SET(NO_HELP);
break;
#ifndef NANO_TINY
case 'y':
SET(AFTER_ENDS);
break;
#endif
case 'z':
SET(SUSPEND);
break;
@@ -2256,14 +2277,11 @@ int main(int argc, char **argv)
SET(SOFTWRAP);
break;
#endif
#ifdef ENABLE_LINENUMBERS
case 'l':
SET(LINE_NUMBERS);
case 'b': /* Pico compatibility flags. */
case 'e':
case 'f':
case 'j':
break;
#endif
case 'h':
usage();
exit(0);
default:
printf(_("Type '%s -h' for a list of available options.\n"), argv[0]);
exit(1);
@@ -2662,6 +2680,7 @@ int main(int argc, char **argv)
} else
edit_refresh();
errno = 0;
focusing = TRUE;
/* Forget any earlier statusbar x position. */

View File

@@ -142,6 +142,11 @@
#define REPLACING 1
#define INREGION 2
#ifdef ENABLE_COLOR
#define USE_THE_DEFAULT -1
#define BAD_COLOR -2
#endif
/* Enumeration types. */
typedef enum {
NIX_FILE, DOS_FILE, MAC_FILE
@@ -538,7 +543,8 @@ enum
SHOW_CURSOR,
LINE_NUMBERS,
NO_PAUSES,
AT_BLANKS
AT_BLANKS,
AFTER_ENDS
};
/* Flags for the menus in which a given function should be present. */

View File

@@ -292,17 +292,28 @@ void do_statusbar_cut_text(void)
void do_statusbar_next_word(void)
{
bool seen_space = !is_word_mbchar(answer + statusbar_x, FALSE);
bool seen_word = !seen_space;
/* Move forward until we reach the start of a word. */
/* Move forward until we reach either the end or the start of a word,
* depending on whether the AFTER_ENDS flag is set or not. */
while (answer[statusbar_x] != '\0') {
statusbar_x = move_mbright(answer, statusbar_x);
/* If this is not a word character, then it's a separator; else
* if we've already seen a separator, then it's a word start. */
if (!is_word_mbchar(answer + statusbar_x, FALSE))
seen_space = TRUE;
else if (seen_space)
break;
if (ISSET(AFTER_ENDS)) {
/* If this is a word character, continue; else it's a separator,
* and if we've already seen a word, then it's a word end. */
if (is_word_mbchar(answer + statusbar_x, FALSE))
seen_word = TRUE;
else if (seen_word)
break;
} else {
/* If this is not a word character, then it's a separator; else
* if we've already seen a separator, then it's a word start. */
if (!is_word_mbchar(answer + statusbar_x, FALSE))
seen_space = TRUE;
else if (seen_space)
break;
}
}
update_the_statusbar();
@@ -659,20 +670,16 @@ int do_prompt(bool allow_tabs, bool allow_files,
int do_yesno_prompt(bool all, const char *msg)
{
int response = -2, width = 16;
/* TRANSLATORS: For the next three strings, if possible, specify
* the single-byte letters for both your language and English.
* For example, in French: "OoYy", for both "Oui" and "Yes". */
/* TRANSLATORS: For the next three strings, specify the starting letters
* of the translations for "Yes"/"No"/"All". The first letter of each of
* these strings MUST be a single-byte letter; others may be multi-byte. */
const char *yesstr = _("Yy");
const char *nostr = _("Nn");
const char *allstr = _("Aa");
/* The above three variables consist of all the single-byte characters
* that are accepted for the corresponding answer. Of each variable,
* the first character is displayed in the help lines. */
while (response == -2) {
int kbinput;
char letter[MAXCHARLEN + 1];
int kbinput, index = 0;
if (!ISSET(NO_HELP)) {
char shortstr[MAXCHARLEN + 2];
@@ -689,16 +696,16 @@ int do_yesno_prompt(bool all, const char *msg)
wmove(bottomwin, 1, 0);
post_one_key(shortstr, _("Yes"), width);
shortstr[1] = nostr[0];
wmove(bottomwin, 2, 0);
post_one_key(shortstr, _("No"), width);
if (all) {
shortstr[1] = allstr[0];
wmove(bottomwin, 1, width);
post_one_key(shortstr, _("All"), width);
}
shortstr[1] = nostr[0];
wmove(bottomwin, 2, 0);
post_one_key(shortstr, _("No"), width);
wmove(bottomwin, 2, width);
post_one_key("^C", _("Cancel"), width);
}
@@ -715,12 +722,34 @@ int do_yesno_prompt(bool all, const char *msg)
/* When not replacing, show the cursor while waiting for a key. */
kbinput = get_kbinput(bottomwin, !all);
/* See if the pressed key is in the Yes, No, or All strings. */
if (strchr(yesstr, kbinput) != NULL)
#ifdef ENABLE_NLS
letter[index++] = (unsigned char)kbinput;
#ifdef ENABLE_UTF8
/* If the received code is a UTF-8 starter byte, get also the
* continuation bytes and assemble them into one letter. */
if (using_utf8() && 0xC0 <= kbinput && kbinput <= 0xF7) {
int extras = (kbinput / 16) % 4 + (kbinput <= 0xCF ? 1 : 0);
while (extras <= get_key_buffer_len() && extras-- > 0)
letter[index++] = (unsigned char)get_kbinput(bottomwin, !all);
}
#endif
letter[index] = '\0';
/* See if the typed letter is in the Yes, No, or All strings. */
if (strstr(yesstr, letter) != NULL)
response = 1;
else if (strchr(nostr, kbinput) != NULL)
else if (strstr(nostr, letter) != NULL)
response = 0;
else if (all && strchr(allstr, kbinput) != NULL)
else if (all && strstr(allstr, letter) != NULL)
response = 2;
else
#endif /* ENABLE_NLS */
if (strchr("Yy", kbinput) != NULL)
response = 1;
else if (strchr("Nn", kbinput) != NULL)
response = 0;
else if (all && strchr("Aa", kbinput) != NULL)
response = 2;
else if (func_from_key(&kbinput) == do_cancel)
response = -1;

View File

@@ -40,9 +40,6 @@ extern bool focusing;
extern bool as_an_at;
extern int margin;
extern int editwincols;
extern bool suppress_cursorpos;
extern message_type lastmessage;
@@ -91,10 +88,13 @@ extern char *last_search;
extern char *present_path;
extern unsigned flags[4];
extern WINDOW *topwin;
extern WINDOW *edit;
extern WINDOW *bottomwin;
extern int editwinrows;
extern int editwincols;
extern int margin;
extern filestruct *cutbuffer;
extern filestruct *cutbottom;
@@ -380,7 +380,7 @@ void do_para_end_void(void);
void do_prev_block(void);
void do_next_block(void);
void do_prev_word(bool allow_punct, bool update_screen);
bool do_next_word(bool allow_punct, bool update_screen);
bool do_next_word(bool after_ends, bool allow_punct, bool update_screen);
void do_prev_word_void(void);
void do_next_word_void(void);
void do_home(void);
@@ -426,6 +426,9 @@ void window_init(void);
void do_exit(void);
void close_and_go(void);
RETSIGTYPE handle_hupterm(int signal);
#ifndef DEBUG
RETSIGTYPE handle_crash(int signal);
#endif
RETSIGTYPE do_suspend(int signal);
RETSIGTYPE do_continue(int signal);
#ifndef NANO_TINY
@@ -433,7 +436,6 @@ RETSIGTYPE handle_sigwinch(int signal);
void regenerate_screen(void);
void allow_sigwinch(bool allow);
void do_toggle(int flag);
void do_toggle_void(void);
void enable_signals(void);
#endif
void disable_flow_control(void);
@@ -471,7 +473,6 @@ int do_yesno_prompt(bool all, const char *msg);
/* Most functions in rcfile.c. */
#ifdef ENABLE_NANORC
#ifdef ENABLE_COLOR
bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright);
void grab_and_store(const char *kind, char *ptr, regexlisttype **storage);
#endif
void parse_rcfile(FILE *rcstream, bool syntax_only);
@@ -479,18 +480,18 @@ void do_rcfiles(void);
#endif /* ENABLE_NANORC */
/* Most functions in search.c. */
void not_found_msg(const char *str);
void search_replace_abort(void);
void tidy_up_after_search(void);
int findnextstr(const char *needle, bool whole_word_only, int modus,
size_t *match_len, bool skipone, const filestruct *begin, size_t begin_x);
void do_search(void);
void do_search_forward(void);
void do_search_backward(void);
void do_research(void);
#ifndef NANO_TINY
void do_findprevious(void);
void do_findnext(void);
#endif
void do_research(void);
void not_found_msg(const char *str);
void go_looking(void);
ssize_t do_replace_loop(const char *needle, bool whole_word_only,
const filestruct *real_current, size_t *real_current_x);
@@ -522,7 +523,6 @@ void do_unindent(void);
bool white_string(const char *s);
#ifdef ENABLE_COMMENT
void do_comment(void);
bool comment_line(undo_type action, filestruct *f, const char *comment_seq);
#endif
void do_undo(void);
void do_redo(void);
@@ -692,7 +692,6 @@ void do_credits(void);
#endif
/* These are just name definitions. */
void do_cancel(void);
void case_sens_void(void);
void regexp_void(void);
void backwards_void(void);
@@ -703,6 +702,7 @@ void to_files_void(void);
void goto_dir_void(void);
#endif
#ifndef NANO_TINY
void do_toggle_void(void);
void dos_format_void(void);
void mac_format_void(void);
void append_void(void);
@@ -714,5 +714,6 @@ void flip_execute(void);
void flip_newbuffer(void);
#endif
void discard_buffer(void);
void do_cancel(void);
#endif /* !PROTO_H */

View File

@@ -31,14 +31,14 @@
#ifdef ENABLE_NANORC
#ifndef RCFILE_NAME
#define HOME_RC_NAME ".nanorc"
#define RCFILE_NAME "nanorc"
#else
#define HOME_RC_NAME RCFILE_NAME
#endif
static const rcoption rcopts[] = {
{"boldtext", BOLD_TEXT},
#ifdef ENABLE_LINENUMBERS
{"linenumbers", LINE_NUMBERS},
#endif
#ifdef ENABLE_JUSTIFY
{"brackets", 0},
#endif
@@ -48,6 +48,9 @@ static const rcoption rcopts[] = {
#endif
#ifdef ENABLE_HISTORIES
{"historylog", HISTORYLOG},
#endif
#ifdef ENABLE_LINENUMBERS
{"linenumbers", LINE_NUMBERS},
#endif
{"morespace", MORE_SPACE},
#ifdef ENABLE_MOUSE
@@ -85,6 +88,7 @@ static const rcoption rcopts[] = {
{"tempfile", TEMP_FILE},
{"view", VIEW_MODE},
#ifndef NANO_TINY
{"afterends", AFTER_ENDS},
{"allow_insecure_backup", INSECURE_BACKUP},
{"atblanks", AT_BLANKS},
{"autoindent", AUTOINDENT},
@@ -92,9 +96,9 @@ static const rcoption rcopts[] = {
{"backupdir", 0},
{"backwards", BACKWARDS_SEARCH},
{"casesensitive", CASE_SENSITIVE},
{"cut", CUT_FROM_CURSOR}, /* deprecated form, remove in 2020 */
{"cut", CUT_FROM_CURSOR}, /* deprecated form, remove end of 2018 */
{"cutfromcursor", CUT_FROM_CURSOR},
{"justifytrim", TRIM_BLANKS}, /* deprecated form, remove in 2020 */
{"justifytrim", TRIM_BLANKS}, /* deprecated form, remove end of 2018 */
{"locking", LOCKING},
{"matchbrackets", 0},
{"noconvert", NO_CONVERT},
@@ -603,10 +607,38 @@ short color_to_short(const char *colorname, bool *bright)
else if (strcasecmp(colorname, "black") == 0)
return COLOR_BLACK;
else if (strcasecmp(colorname, "normal") == 0)
return -1;
return USE_THE_DEFAULT;
rcfile_error(N_("Color \"%s\" not understood"), colorname);
return -2;
return BAD_COLOR;
}
/* Parse the color name (or pair of color names) in the given string.
* Return FALSE when any color name is invalid; otherwise return TRUE. */
bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright)
{
char *comma = strchr(combostr, ',');
if (comma != NULL) {
*bg = color_to_short(comma + 1, bright);
if (*bright) {
rcfile_error(N_("A background color cannot be bright"));
return FALSE;
}
if (*bg == BAD_COLOR)
return FALSE;
*comma = '\0';
} else
*bg = USE_THE_DEFAULT;
if (comma != combostr) {
*fg = color_to_short(combostr, bright);
if (*fg == BAD_COLOR)
return FALSE;
} else
*fg = USE_THE_DEFAULT;
return TRUE;
}
/* Parse the color string in the line at ptr, and add it to the current
@@ -736,36 +768,6 @@ void parse_colors(char *ptr, int rex_flags)
}
}
/* Parse the color name, or pair of color names, in combostr. */
bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright)
{
char *comma = strchr(combostr, ',');
if (comma != NULL) {
*bg = color_to_short(comma + 1, bright);
if (*bright) {
rcfile_error(N_("A background color cannot be bright"));
return FALSE;
}
*comma = '\0';
} else
*bg = -1;
if (comma != combostr) {
*fg = color_to_short(combostr, bright);
/* If the specified foreground color is bad, ignore the regexes. */
if (*fg == -2)
return FALSE;
} else
*fg = -1;
if (*bg == -2)
*bg = -1;
return TRUE;
}
/* Parse the argument of an interface color option. */
colortype *parse_interface_color(char *combostr)
{
@@ -1254,7 +1256,7 @@ void do_rcfiles(void)
/* Now try the to find a nanorc file in the user's home directory
* or in the XDG configuration directories. */
if (have_nanorc(homedir, "/." RCFILE_NAME))
if (have_nanorc(homedir, "/" HOME_RC_NAME))
parse_one_nanorc();
else if (have_nanorc(xdgconfdir, "/nano/" RCFILE_NAME))
parse_one_nanorc();

View File

@@ -28,8 +28,8 @@
static bool came_full_circle = FALSE;
/* Have we reached the starting line again while searching? */
static bool regexp_compiled = FALSE;
/* Have we compiled any regular expressions? */
static bool have_compiled_regexp = FALSE;
/* Whether we have compiled a regular expression for the search. */
/* Compile the given regular expression and store it in search_regexp.
* Return TRUE if the expression is valid, and FALSE otherwise. */
@@ -50,43 +50,23 @@ bool regexp_init(const char *regexp)
return FALSE;
}
regexp_compiled = TRUE;
have_compiled_regexp = TRUE;
return TRUE;
}
/* Decompile the compiled regular expression we used in the last
* search, if any. */
void regexp_cleanup(void)
/* Free a compiled regular expression, if one was compiled; and schedule a
* full screen refresh when the mark is on, in case the cursor has moved. */
void tidy_up_after_search(void)
{
if (regexp_compiled) {
regexp_compiled = FALSE;
if (have_compiled_regexp) {
regfree(&search_regexp);
have_compiled_regexp = FALSE;
}
}
/* Report on the status bar that the given string was not found. */
void not_found_msg(const char *str)
{
char *disp = display_string(str, 0, (COLS / 2) + 1, FALSE);
size_t numchars = actual_x(disp, strnlenpt(disp, COLS / 2));
statusline(HUSH, _("\"%.*s%s\" not found"), numchars, disp,
(disp[numchars] == '\0') ? "" : "...");
free(disp);
}
/* Abort the current search or replace. Clean up by displaying the main
* shortcut list, updating the screen if the mark was on before, and
* decompiling the compiled regular expression we used in the last
* search, if any. */
void search_replace_abort(void)
{
#ifndef NANO_TINY
if (openfile->mark)
refresh_needed = TRUE;
#endif
regexp_cleanup();
}
/* Prepare the prompt and ask the user what to search for. Keep looping
@@ -135,7 +115,7 @@ void search_init(bool replacing, bool keep_the_answer)
* nothing was searched for yet during this session, get out. */
if (i == -1 || (i == -2 && *last_search == '\0')) {
statusbar(_("Cancelled"));
search_replace_abort();
tidy_up_after_search();
free(thedefault);
return;
}
@@ -150,21 +130,18 @@ void search_init(bool replacing, bool keep_the_answer)
#endif
}
free(thedefault);
/* If doing a regular-expression search, compile the
* search string, and get out when it's invalid. */
if (ISSET(USE_REGEXP) && !regexp_init(last_search)) {
search_replace_abort();
return;
/* When not doing a regular-expression search, just search;
* otherwise compile the search string, and only search when
* the expression is valid. */
if (!ISSET(USE_REGEXP) || regexp_init(last_search)) {
if (replacing)
ask_for_replacement();
else
go_looking();
}
if (replacing)
ask_for_replacement();
else
go_looking();
search_replace_abort();
tidy_up_after_search();
free(thedefault);
return;
}
@@ -184,7 +161,7 @@ void search_init(bool replacing, bool keep_the_answer)
if (func == flip_goto)
do_gotolinecolumn(openfile->current->lineno,
openfile->placewewant + 1, TRUE, TRUE);
search_replace_abort();
tidy_up_after_search();
free(thedefault);
return;
}
@@ -228,7 +205,7 @@ int findnextstr(const char *needle, bool whole_word_only, int modus,
lastkbcheck = time(NULL);
/* Consume all waiting keystrokes until a Cancel. */
while (input) {
while (input != ERR) {
if (func_from_key(&input) == do_cancel) {
statusbar(_("Cancelled"));
enable_waiting();
@@ -363,22 +340,6 @@ void do_search_backward(void)
do_search();
}
#ifndef NANO_TINY
/* Search in the backward direction for the next occurrence. */
void do_findprevious(void)
{
SET(BACKWARDS_SEARCH);
do_research();
}
/* Search in the forward direction for the next occurrence. */
void do_findnext(void)
{
UNSET(BACKWARDS_SEARCH);
do_research();
}
#endif /* !NANO_TINY */
/* Search for the last string without prompting. */
void do_research(void)
{
@@ -402,7 +363,34 @@ void do_research(void)
go_looking();
search_replace_abort();
tidy_up_after_search();
}
#ifndef NANO_TINY
/* Search in the backward direction for the next occurrence. */
void do_findprevious(void)
{
SET(BACKWARDS_SEARCH);
do_research();
}
/* Search in the forward direction for the next occurrence. */
void do_findnext(void)
{
UNSET(BACKWARDS_SEARCH);
do_research();
}
#endif /* !NANO_TINY */
/* Report on the status bar that the given string was not found. */
void not_found_msg(const char *str)
{
char *disp = display_string(str, 0, (COLS / 2) + 1, FALSE);
size_t numchars = actual_x(disp, strnlenpt(disp, COLS / 2));
statusline(HUSH, _("\"%.*s%s\" not found"), numchars, disp,
(disp[numchars] == '\0') ? "" : "...");
free(disp);
}
/* Search for the global string 'last_search'. Inform the user when
@@ -702,8 +690,10 @@ void do_replace(void)
{
if (ISSET(VIEW_MODE))
print_view_warning();
else
else {
UNSET(BACKWARDS_SEARCH);
search_init(TRUE, FALSE);
}
}
/* Ask the user what the already given search string should be replaced with. */
@@ -782,6 +772,7 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
}
if (func_from_key(&i) == flip_goto) {
UNSET(BACKWARDS_SEARCH);
/* Retain what the user typed so far and switch to searching. */
search_init(FALSE, TRUE);
return;

View File

@@ -209,7 +209,7 @@ void do_cutword(bool backward)
if (backward)
do_prev_word(ISSET(WORD_BOUNDS), FALSE);
else
do_next_word(ISSET(WORD_BOUNDS), FALSE);
do_next_word(FALSE, ISSET(WORD_BOUNDS), FALSE);
/* Set the mark at the start of that word. */
openfile->mark = openfile->current;
@@ -320,11 +320,11 @@ void do_indent(void)
add_undo(INDENT);
/* Go through each of the lines, but skip empty ones. */
/* Go through each of the lines, adding an indent to the non-empty ones,
* and recording whatever was added in the undo item. */
for (line = top; line != bot->next; line = line->next) {
char *real_indent = (line->data[0] == '\0') ? "" : indentation;
/* Indent a line, add undo data, and save the original indent. */
indent_a_line(line, real_indent);
update_multiline_undo(line->lineno, real_indent);
}
@@ -412,14 +412,14 @@ void do_unindent(void)
add_undo(UNINDENT);
/* Go through each of the lines and remove their leading indent. */
/* Go through each of the lines, removing their leading indent where
* possible, and saving the removed whitespace in the undo item. */
for (line = top; line != bot->next; line = line->next) {
size_t indent_len = length_of_white(line->data);
char *indentation = mallocstrncpy(NULL, line->data, indent_len + 1);
indentation[indent_len] = '\0';
/* Unindent a line, add undo data, and save the original indent. */
unindent_a_line(line, indent_len);
update_multiline_undo(line->lineno, indentation);
@@ -435,27 +435,25 @@ void do_unindent(void)
void handle_indent_action(undo *u, bool undoing, bool add_indent)
{
undo_group *group = u->grouping;
filestruct *line = fsfromline(group->top_line);
if (group->next != NULL)
statusline(ALERT, "Multiple groups -- please report a bug");
/* When redoing, reposition the cursor and let the indenter adjust it. */
if (!undoing)
goto_line_posx(u->lineno, u->begin);
while (group) {
filestruct *line = fsfromline(group->top_line);
/* For each line in the group, add or remove the individual indent. */
while (line && line->lineno <= group->bottom_line) {
char *blanks = group->indentations[line->lineno - group->top_line];
/* For each line in the group, add or remove the individual indent. */
while (line && line->lineno <= group->bottom_line) {
char *blanks = group->indentations[line->lineno - group->top_line];
if (undoing ^ add_indent)
indent_a_line(line, blanks);
else
unindent_a_line(line, strlen(blanks));
if (undoing ^ add_indent)
indent_a_line(line, blanks);
else
unindent_a_line(line, strlen(blanks));
line = line->next;
}
group = group->next;
line = line->next;
}
/* When undoing, reposition the cursor to the recorded location. */
@@ -476,66 +474,6 @@ bool white_string(const char *s)
}
#ifdef ENABLE_COMMENT
/* Comment or uncomment the current line or the marked lines. */
void do_comment(void)
{
const char *comment_seq = GENERAL_COMMENT_CHARACTER;
undo_type action = UNCOMMENT;
filestruct *top, *bot, *line;
bool empty, all_empty = TRUE;
#ifdef ENABLE_COLOR
if (openfile->syntax)
comment_seq = openfile->syntax->comment;
if (*comment_seq == '\0') {
statusbar(_("Commenting is not supported for this file type"));
return;
}
#endif
/* Determine which lines to work on. */
get_range((const filestruct **)&top, (const filestruct **)&bot);
/* If only the magic line is selected, don't do anything. */
if (top == bot && bot == openfile->filebot && !ISSET(NO_NEWLINES)) {
statusbar(_("Cannot comment past end of file"));
return;
}
/* Figure out whether to comment or uncomment the selected line or lines. */
for (line = top; line != bot->next; line = line->next) {
empty = white_string(line->data);
/* If this line is not blank and not commented, we comment all. */
if (!empty && !comment_line(PREFLIGHT, line, comment_seq)) {
action = COMMENT;
break;
}
all_empty = all_empty && empty;
}
/* If all selected lines are blank, we comment them. */
action = all_empty ? COMMENT : action;
add_undo(action);
/* Store the comment sequence used for the operation, because it could
* change when the file name changes; we need to know what it was. */
openfile->current_undo->strdata = mallocstrcpy(NULL, comment_seq);
/* Process the selected line or lines. */
for (line = top; line != bot->next; line = line->next) {
/* Comment/uncomment a line, and add undo data when line changed. */
if (comment_line(action, line, comment_seq))
update_multiline_undo(line->lineno, "");
}
set_modified();
refresh_needed = TRUE;
shift_held = TRUE;
}
/* 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
* anything was added or removed; FALSE otherwise. */
@@ -598,6 +536,66 @@ bool comment_line(undo_type action, filestruct *line, const char *comment_seq)
return FALSE;
}
/* Comment or uncomment the current line or the marked lines. */
void do_comment(void)
{
const char *comment_seq = GENERAL_COMMENT_CHARACTER;
undo_type action = UNCOMMENT;
filestruct *top, *bot, *line;
bool empty, all_empty = TRUE;
#ifdef ENABLE_COLOR
if (openfile->syntax)
comment_seq = openfile->syntax->comment;
if (*comment_seq == '\0') {
statusbar(_("Commenting is not supported for this file type"));
return;
}
#endif
/* Determine which lines to work on. */
get_range((const filestruct **)&top, (const filestruct **)&bot);
/* If only the magic line is selected, don't do anything. */
if (top == bot && bot == openfile->filebot && !ISSET(NO_NEWLINES)) {
statusbar(_("Cannot comment past end of file"));
return;
}
/* Figure out whether to comment or uncomment the selected line or lines. */
for (line = top; line != bot->next; line = line->next) {
empty = white_string(line->data);
/* If this line is not blank and not commented, we comment all. */
if (!empty && !comment_line(PREFLIGHT, line, comment_seq)) {
action = COMMENT;
break;
}
all_empty = all_empty && empty;
}
/* If all selected lines are blank, we comment them. */
action = all_empty ? COMMENT : action;
add_undo(action);
/* Store the comment sequence used for the operation, because it could
* change when the file name changes; we need to know what it was. */
openfile->current_undo->strdata = mallocstrcpy(NULL, comment_seq);
/* Comment/uncomment each of the selected lines when possible, and
* store undo data when a line changed. */
for (line = top; line != bot->next; line = line->next) {
if (comment_line(action, line, comment_seq))
update_multiline_undo(line->lineno, "");
}
set_modified();
refresh_needed = TRUE;
shift_held = TRUE;
}
/* Perform an undo or redo for a comment or uncomment action. */
void handle_comment_action(undo *u, bool undoing, bool add_comment)
{
@@ -1085,81 +1083,80 @@ RETSIGTYPE cancel_command(int signal)
bool execute_command(const char *command)
{
int fd[2];
FILE *f;
FILE *stream;
const char *shellenv;
struct sigaction oldaction, newaction;
/* Original and temporary handlers for SIGINT. */
bool sig_failed = FALSE;
/* Did sigaction() fail without changing the signal handlers? */
bool setup_failed = FALSE;
/* Whether setting up the temporary SIGINT handler failed. */
/* Make our pipes. */
/* Create a pipe to read the command's output from. */
if (pipe(fd) == -1) {
statusbar(_("Could not create pipe"));
return FALSE;
}
/* Check $SHELL for the shell to use. If it isn't set, use /bin/sh.
* Note that $SHELL should contain only a path, with no arguments. */
/* Check which shell to use. If none is specified, use /bin/sh. */
shellenv = getenv("SHELL");
if (shellenv == NULL)
shellenv = (char *) "/bin/sh";
/* Fork a child. */
/* Fork a child process to run the command in. */
if ((pid = fork()) == 0) {
/* Child: close the unused read end of the pipe. */
close(fd[0]);
/* Connect the write end of the pipe to the process' output streams. */
dup2(fd[1], fileno(stdout));
dup2(fd[1], fileno(stderr));
/* If execl() returns at all, there was an error. */
/* Run the given command inside the preferred shell. */
execl(shellenv, tail(shellenv), "-c", command, NULL);
exit(0);
/* If the exec call returns, there was an error. */
exit(1);
}
/* Continue as parent. */
/* Parent: close the unused write end of the pipe. */
close(fd[1]);
if (pid == -1) {
close(fd[0]);
statusbar(_("Could not fork"));
close(fd[0]);
return FALSE;
}
/* Before we start reading the forked command's output, we set
* things up so that Ctrl-C will cancel the new process. */
/* Enable interpretation of the special control keys so that we get
/* Re-enable interpretation of the special control keys so that we get
* SIGINT when Ctrl-C is pressed. */
enable_signals();
/* Set things up so that Ctrl-C will terminate the forked process. */
if (sigaction(SIGINT, NULL, &newaction) == -1) {
sig_failed = TRUE;
setup_failed = TRUE;
nperror("sigaction");
} else {
newaction.sa_handler = cancel_command;
if (sigaction(SIGINT, &newaction, &oldaction) == -1) {
sig_failed = TRUE;
setup_failed = TRUE;
nperror("sigaction");
}
}
/* Note that now oldaction is the previous SIGINT signal handler,
* to be restored later. */
f = fdopen(fd[0], "rb");
if (f == NULL)
nperror("fdopen");
read_file(f, 0, "stdin", TRUE);
stream = fdopen(fd[0], "rb");
if (stream == NULL)
statusline(ALERT, _("Failed to open pipe: %s"), strerror(errno));
else
read_file(stream, 0, "pipe", TRUE);
if (wait(NULL) == -1)
nperror("wait");
if (!sig_failed && sigaction(SIGINT, &oldaction, NULL) == -1)
/* If it was changed, restore the handler for SIGINT. */
if (!setup_failed && sigaction(SIGINT, &oldaction, NULL) == -1)
nperror("sigaction");
/* Restore the terminal to its previous state. In the process,
* disable interpretation of the special control keys so that we can
* use Ctrl-C for other things. */
/* Restore the terminal to its desired state, and disable
* interpretation of the special control keys again. */
terminal_init();
return TRUE;
@@ -1335,8 +1332,8 @@ void add_undo(undo_type action)
}
/* Update a multiline undo item. This should be called once for each line
* affected by a multiple-line-altering feature. The existing indentation
* is saved separately for each line in the undo item. */
* affected by a multiple-line-altering feature. The indentation that is
* added or removed is saved separately for each line in the undo item. */
void update_multiline_undo(ssize_t lineno, char *indentation)
{
undo *u = openfile->current_undo;
@@ -2506,10 +2503,28 @@ void do_full_justify(void)
}
#endif /* ENABLE_JUSTIFY */
#if defined(ENABLE_SPELLER) || defined (ENABLE_COLOR)
/* Set up an argument list for executing the given command. */
void construct_argument_list(char ***arguments, char *command, char *filename)
{
char *copy_of_command = mallocstrcpy(NULL, command);
char *element = strtok(copy_of_command, " ");
int count = 2;
while (element != NULL) {
*arguments = (char **)nrealloc(*arguments, ++count * sizeof(char *));
(*arguments)[count - 3] = element;
element = strtok(NULL, " ");
}
(*arguments)[count - 2] = filename;
(*arguments)[count - 1] = NULL;
}
#endif
#ifdef ENABLE_SPELLER
/* A word is misspelled in the file. Let the user replace it. We
* return FALSE if the user cancels. */
bool do_int_spell_fix(const char *word)
/* Let the user edit the misspelled word. Return FALSE if the user cancels. */
bool fix_spello(const char *word)
{
char *save_search;
size_t firstcolumn_save = openfile->firstcolumn;
@@ -2521,8 +2536,6 @@ bool do_int_spell_fix(const char *word)
/* The return value of this function. */
bool result;
/* The return value of searching for a misspelled word. */
unsigned stash[sizeof(flags) / sizeof(flags[0])];
/* A storage place for the current flag settings. */
#ifndef NANO_TINY
bool right_side_up = FALSE;
/* TRUE if (mark_begin, mark_begin_x) is the top of the mark,
@@ -2531,14 +2544,6 @@ bool do_int_spell_fix(const char *word)
size_t top_x, bot_x;
#endif
/* Save the settings of the global flags. */
memcpy(stash, flags, sizeof(flags));
/* Do the spell checking case sensitive, forward, and without regexes. */
SET(CASE_SENSITIVE);
UNSET(BACKWARDS_SEARCH);
UNSET(USE_REGEXP);
/* Save the current search string, then set it to the misspelled word. */
save_search = last_search;
last_search = mallocstrcpy(NULL, word);
@@ -2630,9 +2635,6 @@ bool do_int_spell_fix(const char *word)
openfile->edittop = edittop_save;
openfile->firstcolumn = firstcolumn_save;
/* Restore the settings of the global flags. */
memcpy(flags, stash, sizeof(flags));
return proceed;
}
@@ -2760,14 +2762,19 @@ const char *do_int_speller(const char *tempfile_name)
*read_buff_ptr = '\0';
close(uniq_fd[0]);
/* Process the spelling errors. */
/* Do any replacements case sensitive, forward, and without regexes. */
SET(CASE_SENSITIVE);
UNSET(BACKWARDS_SEARCH);
UNSET(USE_REGEXP);
read_buff_word = read_buff_ptr = read_buff;
/* Process each of the misspelled words. */
while (*read_buff_ptr != '\0') {
if ((*read_buff_ptr == '\r') || (*read_buff_ptr == '\n')) {
*read_buff_ptr = '\0';
if (read_buff_word != read_buff_ptr) {
if (!do_int_spell_fix(read_buff_word)) {
if (!fix_spello(read_buff_word)) {
read_buff_word = read_buff_ptr;
break;
}
@@ -2779,10 +2786,10 @@ const char *do_int_speller(const char *tempfile_name)
/* Special case: the last word doesn't end with '\r' or '\n'. */
if (read_buff_word != read_buff_ptr)
do_int_spell_fix(read_buff_word);
fix_spello(read_buff_word);
free(read_buff);
search_replace_abort();
tidy_up_after_search();
refresh_needed = TRUE;
/* Process the end of the three processes. */
@@ -2826,8 +2833,6 @@ const char *do_alt_speller(char *tempfile_name)
struct stat spellfileinfo;
time_t timestamp;
pid_t pid_spell;
char *ptr;
static int arglen = 3;
static char **spellargs = NULL;
/* Get the timestamp and the size of the temporary file. */
@@ -2841,20 +2846,7 @@ const char *do_alt_speller(char *tempfile_name)
/* Exit from curses mode. */
endwin();
/* Set up the argument list to pass to execvp(). */
if (spellargs == NULL) {
spellargs = (char **)nmalloc(arglen * sizeof(char *));
spellargs[0] = strtok(alt_speller, " ");
while ((ptr = strtok(NULL, " ")) != NULL) {
arglen++;
spellargs = (char **)nrealloc(spellargs, arglen *
sizeof(char *));
spellargs[arglen - 3] = ptr;
}
spellargs[arglen - 1] = NULL;
}
spellargs[arglen - 2] = tempfile_name;
construct_argument_list(&spellargs, alt_speller, tempfile_name);
/* Fork a child process and run the alternate spell program in it. */
if ((pid_spell = fork()) == 0) {
@@ -2944,6 +2936,8 @@ void do_spell(void)
bool status;
FILE *temp_file;
char *temp;
unsigned stash[sizeof(flags) / sizeof(flags[0])];
/* A storage place for the current flag settings. */
const char *spell_msg;
if (ISSET(RESTRICTED)) {
@@ -2958,6 +2952,12 @@ void do_spell(void)
return;
}
/* Save the settings of the global flags. */
memcpy(stash, flags, sizeof(flags));
/* Don't add an extra newline when writing out the (selected) text. */
SET(NO_NEWLINES);
#ifndef NANO_TINY
if (openfile->mark)
status = write_marked_file(temp, temp_file, TRUE, OVERWRITE);
@@ -2979,6 +2979,9 @@ void do_spell(void)
unlink(temp);
free(temp);
/* Restore the settings of the global flags. */
memcpy(flags, stash, sizeof(flags));
/* If the spell-checker printed any error messages onscreen, make
* sure that they're cleared off. */
total_refresh();
@@ -3000,12 +3003,11 @@ void do_spell(void)
* termination, and the error string otherwise. */
void do_linter(void)
{
char *read_buff, *read_buff_ptr, *read_buff_word, *ptr, *lintcopy;
char *read_buff, *read_buff_ptr, *read_buff_word;
size_t pipe_buff_size, read_buff_size, read_buff_read, bytesread;
size_t parsesuccess = 0;
int lint_status, lint_fd[2];
pid_t pid_lint;
static int arglen = 3;
static char **lintargs = NULL;
lintstruct *lints = NULL, *tmplint = NULL, *curlint = NULL;
@@ -3034,7 +3036,6 @@ void do_linter(void)
return;
}
lintcopy = mallocstrcpy(NULL, openfile->syntax->linter);
/* Create a pipe up front. */
if (pipe(lint_fd) == -1) {
statusbar(_("Could not create pipe"));
@@ -3044,19 +3045,7 @@ void do_linter(void)
blank_bottombars();
statusbar(_("Invoking linter, please wait"));
/* Set up an argument list to pass to execvp(). */
if (lintargs == NULL) {
lintargs = (char **)nmalloc(arglen * sizeof(char *));
lintargs[0] = strtok(lintcopy, " ");
while ((ptr = strtok(NULL, " ")) != NULL) {
arglen++;
lintargs = (char **)nrealloc(lintargs, arglen * sizeof(char *));
lintargs[arglen - 3] = ptr;
}
lintargs[arglen - 1] = NULL;
}
lintargs[arglen - 2] = openfile->filename;
construct_argument_list(&lintargs, openfile->syntax->linter, openfile->filename);
/* Start a new process to run the linter in. */
if ((pid_lint = fork()) == 0) {
@@ -3336,9 +3325,8 @@ void do_formatter(void)
size_t pww_save = openfile->placewewant;
bool was_at_eol = (openfile->current->data[openfile->current_x] == '\0');
pid_t pid_format;
static int arglen = 3;
static char **formatargs = NULL;
char *temp, *ptr, *finalstatus = NULL;
char *temp, *finalstatus = NULL;
if (openfile->totsize == 0) {
statusbar(_("Finished"));
@@ -3367,19 +3355,7 @@ void do_formatter(void)
blank_bottombars();
statusbar(_("Invoking formatter, please wait"));
/* Set up an argument list to pass to execvp(). */
if (formatargs == NULL) {
formatargs = (char **)nmalloc(arglen * sizeof(char *));
formatargs[0] = strtok(openfile->syntax->formatter, " ");
while ((ptr = strtok(NULL, " ")) != NULL) {
arglen++;
formatargs = (char **)nrealloc(formatargs, arglen * sizeof(char *));
formatargs[arglen - 3] = ptr;
}
formatargs[arglen - 1] = NULL;
}
formatargs[arglen - 2] = temp;
construct_argument_list(&formatargs, openfile->syntax->formatter, temp);
/* Start a new process for the formatter. */
if ((pid_format = fork()) == 0) {
@@ -3483,7 +3459,7 @@ void do_wordlinechar_count(void)
* count whenever we're on a word just before moving. */
while (openfile->current != openfile->filebot ||
openfile->current->data[openfile->current_x] != '\0') {
if (do_next_word(TRUE, FALSE))
if (do_next_word(FALSE, TRUE, FALSE))
words++;
}
@@ -3640,7 +3616,7 @@ void complete_a_word(void)
/* The point where we can stop searching for shard. */
/* Traverse the whole line, looking for shard. */
for (i = pletion_x; i < threshold; i++) {
for (i = pletion_x; (int)i < threshold; i++) {
/* If the first byte doesn't match, run on. */
if (pletion_line->data[i] != shard[0])
continue;

View File

@@ -325,15 +325,18 @@ const char *strstrwrapper(const char *haystack, const char *needle,
else
return haystack + regmatches[0].rm_so;
}
if (ISSET(CASE_SENSITIVE)) {
if (ISSET(BACKWARDS_SEARCH))
return revstrstr(haystack, needle, start);
else
return strstr(start, needle);
} else if (ISSET(BACKWARDS_SEARCH))
return mbrevstrcasestr(haystack, needle, start);
}
return mbstrcasestr(start, needle);
if (ISSET(BACKWARDS_SEARCH))
return mbrevstrcasestr(haystack, needle, start);
else
return mbstrcasestr(start, needle);
}
/* This is a wrapper for the perror() function. The wrapper temporarily

View File

@@ -363,7 +363,7 @@ int parse_kbinput(WINDOW *win)
kbinput = get_input(win, 1);
if (kbinput == NULL && !waiting_mode)
return 0;
return ERR;
while (kbinput == NULL)
kbinput = get_input(win, 1);
@@ -1944,7 +1944,7 @@ char *display_string(const char *buf, size_t column, size_t span, bool isdata)
continue;
}
/* Represent an invalid sequence with the Replacement Character. */
/* Represent an invalid starter byte with the Replacement Character. */
converted[index++] = '\xEF';
converted[index++] = '\xBF';
converted[index++] = '\xBD';
@@ -2159,6 +2159,7 @@ void statusline(message_type importance, const char *msg, ...)
/* Curses mode is turned off. If we use wmove() now, it will muck
* up the terminal settings. So we just use vfprintf(). */
if (isendwin()) {
fprintf(stderr, "\n");
vfprintf(stderr, msg, ap);
va_end(ap);
return;

View File

@@ -7,7 +7,7 @@ comment "#"
icolor brightred "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|comment|linter|formatter|i?color|extendsyntax).*$"
# Keywords
icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(allow_insecure_backup|atblanks|autoindent|backup|backwards|boldtext|casesensitive|constantshow|cutfromcursor|fill[[:space:]]+-?[[:digit:]]+|historylog|linenumbers|locking|morespace|mouse|multibuffer|noconvert|nohelp|nopauses|nonewlines|nowrap|positionlog|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|showcursor|smarthome|smooth|softwrap|suspend|tabsize[[:space:]]+[1-9][0-9]*|tabstospaces|tempfile|trimblanks|unix|view|wordbounds)\>"
icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(afterends|allow_insecure_backup|atblanks|autoindent|backup|backwards|boldtext|casesensitive|constantshow|cutfromcursor|fill[[:space:]]+-?[[:digit:]]+|historylog|linenumbers|locking|morespace|mouse|multibuffer|noconvert|nohelp|nopauses|nonewlines|nowrap|positionlog|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|showcursor|smarthome|smooth|softwrap|suspend|tabsize[[:space:]]+[1-9][0-9]*|tabstospaces|tempfile|trimblanks|unix|view|wordbounds)\>"
icolor yellow "^[[:space:]]*set[[:space:]]+((error|function|key|number|selected|status|title)color)[[:space:]]+(bright)?(white|black|red|blue|green|yellow|magenta|cyan|normal)?(,(white|black|red|blue|green|yellow|magenta|cyan|normal))?\>"
icolor brightgreen "^[[:space:]]*set[[:space:]]+(backupdir|brackets|errorcolor|functioncolor|keycolor|matchbrackets|numbercolor|operatingdir|punct|quotestr|selectedcolor|speller|statuscolor|titlecolor|whitespace|wordchars)[[:space:]]+"
icolor brightgreen "^[[:space:]]*bind[[:space:]]+((\^([[:alpha:]]|[]0-9\^_]|Space)|M-([[:alpha:]]|[]!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+([[:alpha:]]+|".*")[[:space:]]+(all|main|search|replace(with)?|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)"

View File

@@ -20,9 +20,9 @@ color red " fuzzy(,|$)"
color yellow " (no-)?[-[:alpha:]]+-format(,|$)"
# Format specifiers.
color brightmagenta "%([1-9]\$)?[a-z]*"
# Quotes and newlines.
# Quotes and escaped characters.
color yellow "\""
color cyan "\\n"
color cyan "\\[abcefnrtv"\]"
# Reminders.
color brightwhite,yellow "(FIXME|TODO|XXX)"
# Obsolete strings.

View File

@@ -16,7 +16,7 @@ color green "[{}():;|`$<>!=&\\]" "(\]|\[)"
color green "-(eq|ne|gt|lt|ge|le|ef|ot|nt)\>"
# Short and long options.
color brightmagenta "-[A-Za-z]\>" "--[A-Za-z-]+\>"
color brightmagenta "[[:blank:]]-[A-Za-z]\>" "[[:blank:]]--[A-Za-z-]+\>"
# Common commands.
color brightblue "\<(awk|cat|cd|ch(grp|mod|own)|cp|cut|echo|env|grep|head|install|ln|make|mkdir|mv|popd|printf|pushd|rm|rmdir|sed|set|sort|tail|tar|touch|umask|unset)\>"