Commit Graph

9901 Commits (master)

Author SHA1 Message Date
Benno Schulenberg 308d6e73e3 tweaks: normalize whitespace, drop unneeded prototype, condense comment 2021-11-07 15:51:32 +01:00
Benno Schulenberg 167c93b85c justify: correctly determine whether top-of-buffer has been reached
The text to be justified has been excised from the buffer and is now
in the cutbuffer, so we cannot compare any of its lines to 'filetop'.

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

Bug existed since version 4.0, commit 14c08589.
2021-11-07 15:20:18 +01:00
Benno Schulenberg 13c5bcb4d8 tweaks: improve a comment, and drop two cluttering compile conditions 2021-11-07 11:33:02 +01:00
Benno Schulenberg c692a6ca70 tweaks: reshuffle a line into its proper order, and improve two comments 2021-11-07 11:23:45 +01:00
Benno Schulenberg 0346e63c20 build: fix compilation when configured with --enable-tiny
Problem existed since commit 50106266 from two weeks ago.
2021-11-05 16:00:34 +01:00
Benno Schulenberg 9e982f3283 tweaks: rename a function, for some contrast and to get rid of a suffix 2021-11-05 15:59:32 +01:00
Benno Schulenberg 11fec6f63c feedback: when the user types ^Z, say they can suspend nano with ^T^Z
Inspired-by: Sébastien Desreux <seb@h-k.fr>
2021-11-05 15:25:03 +01:00
Benno Schulenberg d0c2c1e6b9 suspension: leave ^Z unbound by default -- just ^T^Z will suspend nano
Suggest in the documentation how to get a one-keystroke Suspend.
2021-11-05 15:24:45 +01:00
Benno Schulenberg fab4d0afcb tweaks: reshuffle a coloring rule, to have related ones together
(We don't want the rule for control codes after the rule for comments,
because then control codes in commented-out binds would stand out.)
2021-11-03 17:35:52 +01:00
Benno Schulenberg d9e42cb274 syntax: nanorc: require whitespace before the start= and end= keywords
Also, drop the unneeded and mistaken 'end=' in the first regex, as
a coloring rule with just end="something" is not valid.  And drop
the requirement for having trailing whitespace or nothing at all,
as it does not constitute a useful restriction.

Also, fold two regexes together, for economy.
2021-11-03 17:33:45 +01:00
Benno Schulenberg 4d9be13316 syntax: nanorc: add 'execute' menu for unbind, and drop a bad constraint
The coloring rule for 'unbind' still checked for the old 'extcmd' and
'externalcmd' menu names.  And not coloring binds and unbinds as valid
when followed by something other than a comment was overrestrictive,
because the bind or unbind command would work just fine.

(Nano silently allows trailing garbage on any line without a regex.)

Also, take the opportunity to order the menu names in the bind and
unbind rules in the same way.

This fixes https://savannah.gnu.org/bugs/?61419,
and fixes https://savannah.gnu.org/bugs/?61420.

First bug existed since version 5.0, commit d9106abf.
Second bug existed since version 2.3.3, commit 9c11ba93.
2021-11-03 16:57:27 +01:00
Benno Schulenberg 7365ef4092 docs: mention "grey" also at the other place where color names are listed
And harmonize the wrapping of the phrase.

Indirectly-reported-by: Brad Town <brad@bradtown.com>
2021-11-03 11:21:39 +01:00
Benno Schulenberg 13edbedc79 tweaks: replace a verbose condition with a simpler early return 2021-11-01 18:17:47 +01:00
Benno Schulenberg fc5d58ad97 tweaks: add two spaces and two comments, and drop an internal check 2021-10-31 16:45:43 +01:00
Benno Schulenberg a373fa500a docs: add a suggested rebind and three suggested unbinds to the sample rc 2021-10-31 11:14:09 +01:00
Benno Schulenberg 8da098f5e0 help: group the now lone mouse toggle with the "behavioral" ones 2021-10-31 10:55:07 +01:00
Benno Schulenberg 52d4b96639 docs: mark options -z, --suspendable, and 'set suspendable' as obsolete 2021-10-31 10:55:07 +01:00
Benno Schulenberg 83f94a88df suspension: enable ^Z by default -- ignore -z option and drop M-Z toggle
In the beginning, the goal for nano was to be a drop-in replacement for
Pico.  Pico did not know a Suspend command, so the ^Z keystroke needed
to be conditionalized on an option (-z or --suspend or the toggle M-Z),
just like the ^S and ^Q keystrokes (for stopping and resuming terminal
output) were conditionalized on --preserve.

But nano has abandoned full Pico compatibility since version 4.0.  It
is time to unconditionalize ^Z as well.  This should not be a problem:
Debian and Ubuntu have had 'set suspend' in their /etc/nanorc for years,
so a considerable portion of nano users have had ^Z enabled by default
for a long time, and no one seems to have complained.

If the keystroke bothers some user, they can unbind it in their nanorc.
They will still be able to suspend nano through the Execute menu: ^T^Z.

This addresses https://savannah.gnu.org/bugs/?61372.
2021-10-31 10:55:07 +01:00
Benno Schulenberg 8762e04631 replacing: keep the spotlighting, also after toggling the help lines
The spotlighting should only be dropped when in the main menu, like in
the code thirty lines up, where 'timed' became TRUE only for MMAIN.

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

Bug existed since version 5.8, commit 3f340836.
2021-10-29 10:28:00 +02:00
Benno Schulenberg 256a0d670e replacing: keep centering the occurrence, also after toggling help lines
Normally, returning to the main loop will set 'focusing' back to TRUE,
but the replacement loop doesn't return until replacing is finished.

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

Bug existed since version 5.0, commit d8249917.
2021-10-29 09:35:38 +02:00
Benno Schulenberg 50106266bc pasting: when less than a line is pasted, allow automatic hard-wrapping
When --breaklonglines is in effect and the user pasted just a few words
(anything without a linebreak), then act as if this short text had been
typed by the user and hard-wrap the line when it became overlong.

This fulfills https://savannah.gnu.org/bugs/?61353.
2021-10-27 16:42:07 +02:00
Benno Schulenberg ba093b0b48 tweaks: elide two parameters, as they are now always the same 2021-10-27 16:30:23 +02:00
Benno Schulenberg 33041d0ad5 statusbar: count words in the way that matches how Ctrl+Right moves
When --wordbounds (-W) is active, nano considers punctuation as
word-forming characters and will thus count words the same way
as 'wc -w' does.  This is how nano counted words until now.

But when --wordbounds is not active (the default), only letters
and digits will be considered word-forming and thus lone groups
of lines and dashes and other punctuation will not be counted
as words, which is more like how a human would count words.

This addresses https://savannah.gnu.org/bugs/?61367.
2021-10-27 16:23:29 +02:00
Benno Schulenberg b46c8c586b build: include the YAML syntax file among the distributed files
(It would be much better if the build rules automatically included
any *.nanorc files in the syntax/ directory into the tarball...)

This fixes https://savannah.gnu.org/bugs/?61391.
Reported-by: John Prokos <jprokos@gmail.com>

Bug existed since version 5.9, commit c2790a8a.
2021-10-27 11:58:52 +02:00
Benno Schulenberg 0e1d45dc36 tweaks: fold some regexes together, and trim or improve some comments
Also, trim some whitespace and group one rule better.

Also, fix a stray closing parenthesis in the JSON syntax,
and add the missing slash to the possible escaped characters.
(Reference: https://www.json.org/json-en.html.)

Also, improve the ending of multiline strings in the Rust syntax.
2021-10-27 11:25:45 +02:00
Benno Schulenberg 1cd92458e9 tweaks: swap two parts of specific regexes, for consistency with others
This order makes more sense to me: first the part that allows
almost everything, and then the special case.
2021-10-27 11:20:07 +02:00
Benno Schulenberg 7bd68365ec syntaxes: avoid coloring "this\" as if it were a valid string
A backslash should not be allowed inside a quoted string unless
it is used to escape another character.

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

Bug existed since each of these syntaxes was introduced.

(Awk and Fortran do not know include files with names between
angled brackets, so those regexes are dropped in the bargain.)
2021-10-26 14:35:40 +02:00
Benno Schulenberg 485eb18d83 syntaxes: use one regex for coloring quoted strings, to avoid overlap
Quoted strings cannot start within another quoted string and end after
that other string has ended.  Therefore single-quoted and double-quoted
strings should (as much as possible) be colorized by a single rule, so
that overlapping colorations are avoided.

(This also fixes a double typo in the PHP syntax (\. --> \\.) that has
been there since the PHP syntax was added in 2008, commit 90ee8ee4.)

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

Bug existed since each of these syntaxes was introduced,
the oldest ones around 2006, a few others around 2015.

The one that got it right was the Lua syntax from 2011.
2021-10-26 13:28:33 +02:00
Benno Schulenberg 375b30507e syntax: ruby: colorize embedded documentation as a comment
Vim and Emacs do this too.

Reference:
  https://en.wikibooks.org/wiki/Ruby_Programming/Syntax/Lexicology

Also, when colorizing double-hashed comments specially anyway,
avoid colorizing ##.* as a single-hashed comment.
2021-10-25 13:45:21 +02:00
Benno Schulenberg 7691527f35 tweaks: remove redundant parentheses, trim comments, fold some regexes 2021-10-25 12:45:45 +02:00
Benno Schulenberg 3313fac8eb tweaks: remove redundant pair of parentheses, and swap two alternatives 2021-10-25 12:45:45 +02:00
Benno Schulenberg e52c81f5db syntax: nanorc: improve the file-matching regex
The "\.?" part was pointless.  It says that the string "nanorc"
*might* be preceded with a period.  Sure, but if the period is
absent, then anything else may be there too, so the optional
period gives zero restriction.

The restriction should be: either the filename has the extension
".nanorc" OR the full filename is "nanorc".  So the "nanorc" part
must be preceded by either a period or a slash.

(However, in the times of commits 3dc0e23e and dc9c40a5, fifteen
and eighteen years ago, it was still the user-provided filename
that was matched against the regex, not the full-path filename.
The latter method arrived in commit ec8d51be, six years ago.)
2021-10-25 12:44:28 +02:00
Benno Schulenberg 9b419d0bff tweaks: rename a function, to describe better what it does nowadays 2021-10-22 11:50:04 +02:00
Benno Schulenberg 0f40752139 docs: add a hint about making ^L do just 'refresh' to the sample nanorc
Just for the sake of completeness -- I doubt anyone ever uses Refresh.
2021-10-22 11:50:04 +02:00
Benno Schulenberg d57bfc057f syntax: rust: do not colorize as string the text between two strings
Strings may not contain a double quote unless it is escaped.

Reference:
  https://doc.rust-lang.org/reference/tokens.html#string-literals

(This will still not colorize multi-line strings with an unescaped
newline, will still colorize "this\" as if it were a valid string,
and will still miscolor things when there is another string after
the closing quote of a two-line string.  But those things can't
be helped -- line-based regexes cannot emulate a full parser.)

This fixes https://savannah.gnu.org/bugs/?61361.
Reported-by: Elias Jonsson <e@ejon.eu>

Bug existed since version 2.6.1, since the Rust syntax was introduced.
2021-10-22 10:44:49 +02:00
Benno Schulenberg 918ce1afa3 tweaks: just let do_wrap() set 'refresh_needed' instead of returning TRUE
This gets rid of performing an action in the condition of an 'if'.
2021-10-21 11:58:43 +02:00
Benno Schulenberg 5d285ca896 tweaks: rewrap three old NEWS items, for esthetics, and fix a date
Version 2.1.2 was released in June 2008, not April.
2021-10-21 11:47:44 +02:00
Benno Schulenberg f368e2732d docs: reword several of the descriptions in the chapter on building nano 2021-10-20 16:12:48 +02:00
Benno Schulenberg ad13746da9 docs: reword the beginning of the chapter on nanorc files
Also, move the text about valid color names to another item,
for shorter cross references.
2021-10-20 16:05:01 +02:00
Benno Schulenberg 440f39e558 docs: correct the description of the layout -- four areas, not five
Also, remove the concept of "shortcut list", as there is no need.
Just use "two help lines" instead, like elsewhere.
2021-10-19 16:17:53 +02:00
Benno Schulenberg 108c84daf8 docs: move the chapter about editor basics into third position
Or rather, move the chapter about command-line options to between
the chapters on file browser and feature toggles.  Also, rename the
chapter about the built-in help, and move the section about screen
layout to be the first in the editor-basics chapter.
2021-10-19 15:53:49 +02:00
Benno Schulenberg e63fe3be69 tweaks: reword a paragraph, and use usual M- to depict Meta keystrokes 2021-10-19 15:36:38 +02:00
Benno Schulenberg bc4a141cba tweaks: mark keystrokes consistently with @kbd in the manual
The @key command has the same visual result in the Info output, but
looks different (non-italic) from @kbd in the HTML and PDF outputs.
2021-10-19 14:21:28 +02:00
Benno Schulenberg 0dbe857ba2 syntaxes: undouble the backslash within bracket expressions
Within a bracket expression, the backslash is not special,
so it does not need to be escaped.

The double backslashes within brackets were found with:

  grep -o  '\[[^][]*\\\\[^][]*\]'  syntax{,/extra}/*rc

Also, incorporate the square brackets into some bracket expressions
by listing the closing bracket first, saving a separate regex for
those two brackets.
2021-10-18 12:14:05 +02:00
Benno Schulenberg 483538f8f3 syntax: email: use a character class, as \s does not work inside brackets
This fixes https://savannah.gnu.org/bugs/?61347.

Bug existed since version 4.9.3, commit 4f9bebdd.
2021-10-18 11:52:05 +02:00
Benno Schulenberg 1f36d5411a docs: improve the title of the manual, away from the bare "nano"
Also, suppress two unwanted blank lines in the HTML output, and
use a macro to avoid repeating the same three lines eight times.
2021-10-18 10:47:32 +02:00
Benno Schulenberg 46f76ca8b8 docs: avoid large Table of Contents at top of HTML version of manual
Texinfo-6.8 (that was used to build the docs of nano-5.9) changed
the way the @contents command is processed for HTML output, with as
result a detailed table of contents at the start of the HTML page.
That is ugly and too much detail.  To avoid that, produce a table
of contents only when generating output meant for printing.

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

Bug existed since version 5.9.
2021-10-17 16:55:24 +02:00
Benno Schulenberg 3a09577e0c tweaks: replace the obscure @* with the slightly clearer @sp
What @* does is guesswork when you don't use Texinfo regularly.
That the "sp" in the @sp command refers to vertical space is not
very clear either, but the command is used on nearby lines too,
so better use it more.

Also, improve two wordings and fix a four-year old typo.
2021-10-17 12:36:57 +02:00
Benno Schulenberg b9f472a905 syntax: texinfo: be more precise in colorizing @commands
An @command must either start at the beginning of the line and be
followed by whitespace or EOL, or it must be followed by a brace.
Colorizing just any "@text" string colored too much.
2021-10-17 12:25:01 +02:00
Benno Schulenberg 557d8131ca docs: prevent a black square in the PDF after the long synopsis line
Also, prevent an unwanted break in a keystroke.
2021-10-16 17:46:33 +02:00