Commit Graph

9802 Commits (ea4bbf4285c45a206bdf8fbd6fe2d9d6cc66f161)

Author SHA1 Message Date
Benno Schulenberg b27efce732 docs: mention that "grey"/"gray" may be used as a synonym of "lightblack"
Also, colorize "grey" and "gray" as valid names in a nanorc file.
2021-05-26 15:31:04 +02:00
Benno Schulenberg 8974430c11 rcfile: allow using "grey" or "gray" as a synonym for "lightblack"
Because "lightblack" sounds strange and will not occur to many people
as a possible color name.
2021-05-26 15:31:04 +02:00
Benno Schulenberg e044284998 rcfile: do not allow color name "normal" to have a prefix
Because "lightnormal" sounds strange, and can have unexpected effects.

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

Bug existed since version 2.9.5, since the name "normal" was introduced.
2021-05-25 15:43:06 +02:00
Benno Schulenberg 4f9d55bb15 tweaks: normalize the indentation after the previous change 2021-05-25 15:31:54 +02:00
Benno Schulenberg 89adacff3d tweaks: condense some code by putting all color names in a single array 2021-05-25 15:28:02 +02:00
Benno Schulenberg 2314a1932f tweaks: use a symbol instead of a hard-coded number 2021-05-25 15:14:10 +02:00
Benno Schulenberg fb5eb4856b tweaks: drop an assignment that is already part of the called function 2021-05-25 15:11:33 +02:00
Benno Schulenberg f857959b8e startup: suppress "Search Wrapped" when using +? to search from EOF
When using +/ or +?, any minor feedback should be cleared,
to not distract from the highligted search result.

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

Bug existed since version 5.5, commit b86f7868,
since the manner of grading status-bar messages changed.
2021-05-25 14:51:03 +02:00
Benno Schulenberg 405c2162b5 startup: allow using a bare "+" to mean put-cursor-on-last-line
Editors like 'vim' and 'ne' and 'uemacs' know this shorthand too.

This fulfills https://savannah.gnu.org/bugs/?60663.
2021-05-25 12:18:48 +02:00
Benno Schulenberg 8797ada815 startup: do not accept stray characters after a "+" on the command line
After a "+" only c, r, C, and R are valid characters,
and only when immediately followed by / or ?.

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

Bug existed since version 4.4, commit 2326bf6,
since searching at startup with +/ or +? was introduced.
2021-05-25 12:15:52 +02:00
Benno Schulenberg 30bafc70cc tweaks: prevent two more size_t subtractions from going negative
This fully fixes https://savannah.gnu.org/bugs/?60658.

Found by compiling with -fsanitize=undefined.
2021-05-24 11:00:29 +02:00
Benno Schulenberg b38f0cbaf4 feedback: ensure that the reporting of DOS/Mac format is truthful
This fixes https://savannah.gnu.org/bugs/?60660.

Bug existed since version 5.7, commit 77da54c6.
2021-05-23 18:55:41 +02:00
Benno Schulenberg ceaae49b2d tweaks: avoid the subtraction of two size_t variables becoming negative
This fixes https://savannah.gnu.org/bugs/?60658.

Found by compiling with -fsanitize=undefined.
2021-05-23 11:46:37 +02:00
Benno Schulenberg d1957819c4 bindings: show either "^/" or "^-" in the help lines, instead of "^_"
The "^_" has always been poorly legible (the underscore melting into
the bottom of the terminal) and difficult to type (Shift+Ctrl+minus).
The "^/" is both more readable and easier to type.

In terminal emulators, "^/" is shown, but on a Linux console "^-",
as ^/ does a backspace in the default console key mapping.

Also, allow using "^-" when rebinding ^_ in a nanorc file.

This addresses https://savannah.gnu.org/bugs/?57393.
2021-05-22 16:52:56 +02:00
Benno Schulenberg 7993fc8b12 syntax: nanorc: colorize literal control codes, to make them stand out
This makes it easier to read string binds that contain control codes.
2021-05-14 15:05:05 +02:00
Benno Schulenberg 51adf02d34 wrapping: when copying the quoting part, adjust the file size accordingly
Simply adding the number of bytes in the quoting part is not entirely
correct, but... currently the indenting and commenting routines also
assume that the whitespace and commenting characters that are added or
removed are single-byte characters...  It will require another patch
to make this all fully correct, but for the default configuration
(and probably most other cases) the current fix will work fine.

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

Bug existed since version 4.4, commit 8fce33af from two years ago,
since this automatic copying of the quoting part was introduced.
2021-05-14 10:24:07 +02:00
Benno Schulenberg f23e98dd3a memory: prevent a leak when copying the leading quoting to the next line
This fixes https://savannah.gnu.org/bugs/?60596.

Bug existed since version 4.4, commit 8fce33af from two years ago,
since this automatic copying of the quoting part was introduced.
2021-05-14 09:56:45 +02:00
Benno Schulenberg 6472a6b828 display: when a message gets overwritten, note that it is cleared
When on a one-row terminal a message gets automatically "dropped"
after a few moments, the subsequent waiting for a keystroke should
not think that there is still a message on the status bar.

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

Bug existed since commit 8d974cd2 from two days ago.
2021-05-12 16:00:11 +02:00
Benno Schulenberg b741b1c985 startup: skip drawing edit window when having message on one-row terminal
When there is just one row and there is a message, it is not a good idea
to draw the contents of the buffer as it would overwrite the message.

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

Bug existed since version 2.7.0, since nano allows very flat terminals,
and was made worse by commit 2cf28f9d from yesterday.
2021-05-12 15:47:21 +02:00
Benno Schulenberg 5f87ed5644 statusbar: ensure that "No further matches" does not get overwritten
Redraw the content of the edit window (for the undone final completion)
before pushing out the "No further matches" message, so that the latter
will not get overwritten by the buffer content -- in case the terminal
has just one row.

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

Bug existed since commit 2cf28f9d from yesterday.
2021-05-11 15:58:21 +02:00
Benno Schulenberg 8d974cd292 statusbar: on a one-row terminal, drop light messages after a few moments
Only important error messages (ALERT) and information that the user
requested (^C, M-D) should stay put until the next keystroke.  Other
messages should be overwritten by the text of the buffer after just
a few moments, to make a one-row terminal slightly more friendly.

This addresses https://savannah.gnu.org/bugs/?60570.
2021-05-10 20:08:49 +02:00
Benno Schulenberg 2cf28f9db7 statusbar: suppress the cursor when the terminal has just one row
When showing a message on the status bar, the cursor should be off.

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

Bug existed since version 2.7.0, since nano allows very flat terminals.
2021-05-10 12:27:56 +02:00
Benno Schulenberg 36ffb5f0ac statusbar: suppress --constantshow when the terminal has just one row
When there is just one row, the text to be edited needs to be shown
there, not some meta information about the cursor position.

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

Bug existed since version 2.7.0, since nano allows very flat terminals.
2021-05-09 19:16:03 +02:00
Benno Schulenberg 07fd4c4598 tweaks: condense and correct a comment, and move another
Since commit 5dcf375f from four years ago, a linter message must
contain a colon followed by a space for it to be recognized as a
linter message.
2021-05-07 12:40:25 +02:00
Benno Schulenberg 44fb3e9991 tweaks: frob some whitespace, and rewrap a line 2021-05-07 12:33:22 +02:00
Benno Schulenberg 088557c516 tweaks: remove a check that has become superfluous
Since version 5.6, commit 76742cc1, nano highlights the search match,
which means that the screen gets refreshed anyhow, so this specific
refresh for a one-row terminal is no longer needed.
2021-05-07 12:20:50 +02:00
Benno Schulenberg 4712d46462 linter: block the resizing signal while reading output from the linter
This prevents read() from returning unexpectedly and causing a crash.

This fixes https://savannah.gnu.org/bugs/?60537.
Reported-by: Filips Romāns <frfilips@gmail.com>

Bug existed since version 2.4.2, since the handling of SIGWINCH changed.
2021-05-06 13:30:41 +02:00
Benno Schulenberg c01b13a32c syntax: php: colorize the full short tag for echo (<?=) 2021-05-05 12:09:17 +02:00
Benno Schulenberg b368faf11c replacing: report the number of replacements also on a one-row terminal
That is: call edit_refresh() right away, to prevent the edit_refresh()
in the main loop from overwriting the status-bar message.

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

Bug existed since version 2.7.2, commit f920e0d3.
2021-05-05 10:41:55 +02:00
Benno Schulenberg 7303f0c7b4 search: show "This is the only occurrence" also on a one-row terminal
That is: call edit_refresh() right away, to prevent the edit_refresh()
in the main loop from overwriting the status-bar message.

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

Bug existed since version 5.6, commit 76742cc1.
2021-05-05 10:36:18 +02:00
Benno Schulenberg eb3cc3a32d minibar: stay out of sight when the terminal has just one row
When there is just one row, the user wants to see text on this row,
not a bar with some meta info.

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

Bug existed since version 5.5, since the minibar was introduced
with commit d31cc373.
2021-05-03 15:52:15 +02:00
Benno Schulenberg 02df950240 po: update translations and regenerate POT file and PO files 2021-04-29 12:57:17 +02:00
Benno Schulenberg a69a8ce3ca bump version numbers and add a news item for the 5.7 release 2021-04-29 11:28:21 +02:00
Benno Schulenberg 8a03d55c53 gnulib: pull in the fix for a build problem on older Debian
The issue was reported here:
  https://lists.gnu.org/archive/html/bug-gnulib/2021-04/msg00198.html
2021-04-28 09:49:14 +02:00
Benno Schulenberg 544351f3be syntaxes: replace [[:space:]] with [[:blank:]] to exclude carriage return
In many places a carriage return is not valid whitespace and should
thus not be colored as such.  In some of these places a vertical tab
or form feed is maybe valid whitespace, but it would be ugly or even
wrong to color them because they are not part of the subsequent
comment or keyword.

This fixes https://savannah.gnu.org/bugs/?60456.
2021-04-27 11:18:41 +02:00
Hussam al-Homsi 96ebaf8ab4 syntax: c: make the highlighting of '#include <...>' more compliant
Changes:
  1. There may be zero spaces between 'include' and '<...>'.
  2. Blanks and '=' may occur inside '<...>' but '>' may not.
  3. There must be at least one character inside '<...>'.

References:
  Change 1:
    C:   www.open-std.org/jtc1/sc22/wg14/www/docs/n2310.pdf#subsection.6.10.2
    C++: www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/n4659.pdf#section.19.2

  Changes 2 and 3:
    C:   www.open-std.org/jtc1/sc22/wg14/www/docs/n2310.pdf#subsection.6.4.7
    C++: www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/n4659.pdf#section.5.8

Signed-off-by: Hussam al-Homsi <sawuare@gmail.com>
2021-04-26 12:14:44 +02:00
Benno Schulenberg 6b7c661fb7 syntax: po: improve the coloring of format specifiers
This now handles most of the things listed in 'man 3 printf'.
2021-04-26 11:29:05 +02:00
Benno Schulenberg 6823831c06 build: drop the check for two functions that we don't use any more
Since commits b0209374 and 1c010d8e from a month ago, nano does not use
mblen() and mbtowc() any more, so there is no need to check for their
presence.

Instead, add a check for iswalpha(), which we do use.
2021-04-25 11:55:04 +02:00
Benno Schulenberg ec82530125 gnulib: update to its current upstream state 2021-04-25 10:48:56 +02:00
Benno Schulenberg a45e1f89c0 oops: that doesn't work -- you can't break out of two for loops at once
This effectively reverts the previous commit.
2021-04-24 13:56:36 +02:00
Benno Schulenberg c1cd813dcb tweaks: elide a function that is now basically just two lines 2021-04-24 11:48:04 +02:00
Benno Schulenberg c96e62e33a startup: save the compiled file-matching regexes, to avoid recompiling
This reduces startup time by seven percent (when using the standard set
of syntaxes) when opening just one file that doesn't match any syntax,
and more than ten percent when opening multiple files.  It takes some
extra memory, but... not wasting CPU cycles is more important.

This addresses https://savannah.gnu.org/bugs/?56433.
2021-04-24 10:54:04 +02:00
Benno Schulenberg 6283557d2f memory: prevent a use-after-free when the user respects a lock file
This fixes https://savannah.gnu.org/bugs/?60447.

Bug existed since commit 2f718e11 from a month ago.
2021-04-23 12:20:45 +02:00
Benno Schulenberg af90f03ac5 tweaks: condense three comments, drop another, and rewrap a line 2021-04-23 12:04:19 +02:00
Benno Schulenberg 588022ab8c editing: prevent the pointer for the top row from becoming dangling
When undoing several actions, it is possible for the line at the top
of the screen to be removed, leaving 'edittop' pointing to a structure
that has been freed.  Soon after, 'edittop' is referenced to determine
whether the cursor is offscreen...  Prevent this invalid reference by
stepping 'edittop' one line back in that special case.  This changes
the normal centering behavior of Undo when the cursor goes offscreen,
but... so be it.

When a single node is deleted, it is always possible to step one line
back, because a buffer contains always at least one line (even though
maybe empty), so if the current line could be deleted, there must be
one before it (when at the top of the screen).

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

Bug existed since version 2.3.3, commit 60815461,
since undoing does not always center the cursor.
2021-04-23 09:35:12 +02:00
Benno Schulenberg cf0820549b tweaks: avoid calling extra_chunks_in() when not softwrapping
The function is somewhat costly; better avoid it whenever possible.
2021-04-22 12:19:09 +02:00
Benno Schulenberg f54bc6c7d6 indicator: adjust the size to the number of visible lines, not chunks
Since two commits ago, the position of the indicator shows the position
of the viewport relative to the full buffer in terms of actual lines,
not of visual chunks (to avoid excessive computation).  But the size of
the indicator stayed constant, as if it always covered as many lines as
the edit window has rows.  But the latter will not be the case when
softwrapping occurs.  Therefore, when softwrapping, compute how many
actual lines are visible in the viewport, and adjust the size of the
indicator accordingly.
2021-04-22 11:52:57 +02:00
Benno Schulenberg 2cdff6c32c tweaks: adjust two comments, and reshuffle two fragments
Also rename two variables, to be more fitting.
2021-04-21 16:52:35 +02:00
Benno Schulenberg 49d8b99e4f softwrap: avoid time-consuming computations, to burden large files less
Whenever softwrap was toggled on or line numbers were toggled on/off or
the window was resized, the extra rows per line needed to be recomputed
for ALL the lines.  For large files with many long lines this was too
costly.

(This change causes the indicator to have an incorrect size when there
are many softwrapped chunks onscreen, but that will be addressed later.)

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

Problem existed since version 5.0, since the indicator was introduced.
2021-04-21 16:40:20 +02:00
Benno Schulenberg bb81932422 chars: work around the wrong private-use-character widths on OpenBSD
This fixes https://savannah.gnu.org/bugs/?60393.
2021-04-20 11:13:08 +02:00