Commit Graph

10217 Commits

Author SHA1 Message Date
Benno Schulenberg
c19012d4cd docs: say "mini bar", not "minibar", when referring to the actual bar
Like is done for the other bars: title bar, status bar, prompt bar.
2024-01-20 11:02:54 +01:00
Benno Schulenberg
b502631d10 docs: mention the changed meanings of ^F/^B and also in the texi manual
Also somewhat reword the note for version 4.0.
2024-01-18 11:06:01 +01:00
Benno Schulenberg
6728e5d791 docs: mention the missing two options that override --bold
And improve one word.
2024-01-16 16:15:22 +01:00
Benno Schulenberg
101b53b541 docs: add ^T^S (spell check) and M-S (softwrap) to the cheatsheet
Also, adjust the alignment of the two header lines,
and slightly reword one of the descriptions.
2024-01-16 10:56:41 +01:00
Benno Schulenberg
11c492fdd0 docs: add M-C and M-Z to the cheatsheet, and reshuffle for balance 2024-01-13 11:27:28 +01:00
Benno Schulenberg
792d4e9a23 docs: adjust the cheatsheet for the changed meanings of ^F, ^B, M-F, M-B 2024-01-13 11:22:14 +01:00
Mike Frysinger
c59e9d228e build: link in $(GETRANDOM_LIB) from gnulib
On Windows builds, gnulib might set GETRANDOM_LIB to -lbcrypt and then
use that API.  But since we don't include $(GETRANDOM_LIB) when linking,
we fail.  On Linux systems, this is empty as getrandom APIs are part of
the main C library already.  This is also what the link requirements say
in gnulib's modules/getrandom spec.
2024-01-12 17:00:34 +01:00
Mike Frysinger
d8848df14f gnulib: import canonicalize-lgpl for realpath
Building for mingw fails due to missing realpath.  Pull in the gnulib
module to get it working again.
2024-01-12 16:59:40 +01:00
Benno Schulenberg
4a2729b780 copyright: update the years for the FSF 2024-01-10 11:24:28 +01:00
Benno Schulenberg
7c174a1a25 syntax: c: require a preceding blank when a line comment contains a quote
This avoids miscolorizing part of a string when it contains a URL.

This fixes https://savannah.gnu.org/bugs/?64340.
Reported-by: Yonut Smith <deanlast3@gmail.com>

Problem has existed for more than twenty years, at least since support
for multine-line regexes was added in commit 6c1e6612 in 2002.
2024-01-09 10:20:50 +01:00
Benno Schulenberg
f0e69b4a51 tweaks: use a pair of parentheses to clarify the order of operations
(Parentheses are used everywhere else with a bitwise &.)
2024-01-08 17:25:03 +01:00
Benno Schulenberg
4a915b1ed5 input: avoid hanging after a 39-character paste on a VSCode terminal
The terminal in VSCode splits pastes into 50-byte chunks and can
thus split an escape sequence somewhere in the middle, resulting
in nano failing to recognize the end-of-bracketed-paste sequence
and thus hanging -- until another, different-sized paste is made.

Avoid this hang by interpreting any invalid escape sequence that
starts with "\e [ 2" as a truncated end-of-bracketed-paste.

(This will leave a spurious tilde after the 39-character paste,
which is not nice but... better than hanging.)

This works around https://savannah.gnu.org/bugs/?64996.
Reported-by: Jacob Lifshay <programmerjake@gmail.com>
2023-12-21 15:40:21 +01:00
Benno Schulenberg
cbf5a5b5d3 docs: in the sample nanorc, set the guidestripe to a soft grey
This gives both an example of the #rgb format and shows that the
guidestripe can be set to an unobtrusive color.
2023-12-18 16:14:10 +01:00
Benno Schulenberg
41b52d70be input: recognize certain escape sequences for F13 to F16 again
Even though in nano the names F13 to F24 exist, these names actually
refer to Shift+F1...Shift+F12.  One cannot blame people for thinking
that F13 in nano is the same as F13 in Xorg, so... recognize the escape
sequence for the latter and map it to what nano calls F13.

This accommodates users that put F13...F16 in a custom keymap for Xorg.

This fixes https://savannah.gnu.org/bugs/?64632.
Reported-by: Danny Milosavljevic <dannym@scratchpost.org>

Problem existed since version 5.0, commit 9a6158cd.
2023-12-17 17:48:04 +01:00
Benno Schulenberg
129696cdbe gnulib: update to current upstream state, to make a fresh checkout work
Also, increase the checkout depth, so that it will work for longer.

Indirectly-reported-by: Jacob Lifshay <programmerjake@gmail.com>
2023-12-10 10:58:01 +01:00
Benno Schulenberg
8cc3ab213d tweaks: rename a variable, to be clearer when seen in context 2023-12-09 16:25:02 +01:00
Benno Schulenberg
9bf966af37 tweaks: add an extra variable, to avoid reusing one for another purpose 2023-12-08 16:12:17 +01:00
Benno Schulenberg
a76a6bf692 softwrap: remember the actual breaking point when wrapping at blanks
When softwrapping at blanks, the wrapping routine should, when called
again, continue searching from where the previous chunk ended, not from
the point it reached during that previous search, because this could be
*just* beyond the space that could be the next breaking point.

This fixes https://savannah.gnu.org/bugs/?64945.
Reported-by: Andreas Schamanek <schamane@fam.tuwien.ac.at>

Bug existed since version 6.4, commit 0e9bef34.
2023-12-06 17:18:41 +01:00
Benno Schulenberg
6a7a0c8f50 display: show the help lines down to the tiniest possible terminal size
That is: compute the minimum needed terminal height more accurately.
2023-11-25 17:07:05 +01:00
Benno Schulenberg
f5bc261944 general: let the constant-show toggle override the zero-interface mode
When the user hits the M-C toggle while option --zero is in effect,
instead of complaining "Not possible", do what the user probably
tries to achieve: cancel `zero` mode and switch on `constantshow`.
2023-11-25 17:07:05 +01:00
Benno Schulenberg
8a304bdf7c bindings: make ^F start a forward search by default
This makes nano more usable for users that are accustomed to the
near universal use of ^F for Find/Search in other programs, and
especially for users that somehow access a terminal through their
browser (where ^W will, destructively, close the terminal tab).

(To keep the bindings consistent, make ^B start a backward search,
and let M-F and M-B search for the next occurrence in the matching
direction.)

Suggested-by: Chris Allegretta <chrisa@asty.org>
Suggested-by: Donnie Ferris <DonnyBahama@gmx.com>
  https://lists.gnu.org/archive/html/nano-devel/2023-01/msg00001.html
2023-11-24 16:24:08 +01:00
Benno Schulenberg
124e86a6d2 undo the prelast commit in order to redo it with a fuller commit message 2023-11-24 14:42:08 +01:00
Benno Schulenberg
96df9e0a20 docs: mention how to get the old behavior of ^F, ^B, M-F, and M-B back 2023-11-22 10:52:34 +01:00
Benno Schulenberg
a04d2a433c bindings: make ^F start a forward search by default
This makes nano more usable for users that are accustomed to the
near universal use of ^F for Find/Search in other programs.

To keep the bindings consistent, make ^B start a backward search,
and let M-F and M-B search for the next occurrence in the matching
direction.
2023-10-30 15:01:53 +01:00
Benno Schulenberg
ef35ea72cf input: neutralize two spurious keycodes from VTE terminals
At least some of the VTE-based terminals claim to be compatible with
xterm-25color (and set TERM to that value).  But they really aren't:
they mishandle the focus-in and focus-out events, for example.  So,
catch and discard the corresponding keycodes that nano shouldn't be
seeing at all.

This improves the fix for https://savannah.gnu.org/bugs/?64578.
2023-10-16 08:55:06 +02:00
Benno Schulenberg
8804b6dcd4 tweaks: adjust a comment for the changed handling of gray #rgb codes 2023-10-03 15:41:00 +02:00
Andy Koppe
86b8388889 rcfile: map the gray #rgb codes (#111 to #EEE) to the xterm grayscale
When the red, green and blue components of a three-digit hex #RGB code
are equal and they aren't #000 for black or #FFF for white, map them to
xterm-256color's 24-level grayscale ranging from index 232 to 255.

This means that the 14 gray levels available in #RGB codes all map to
different tones, whereas previously they mapped to only the four gray
tones available in the 6x6x6 color cube.

Signed-off-by: Andy Koppe <andy.koppe@gmail.com>
2023-09-25 16:10:42 +02:00
Benno Schulenberg
812c48dde4 tweaks: add a comment that refers to the VTE spurious-code issue 2023-08-29 16:17:40 +02:00
Benno Schulenberg
f0f1c94afa input: intercept a spurious keycode and say what the actual problem is
Xfce Terminal sets TERM to xterm-256color even though it does not have
all the capabilities that an xterm has, leading it to misinterpret some
escape sequence and produce a spurious 0x24C key code.

Intercept this mistaken key code and tell the user what is wrong.

This mitigates https://savannah.gnu.org/bugs/?64578.
Reported-by: Lawrence R. Steeger
2023-08-27 15:01:37 +02:00
Benno Schulenberg
75b312ded1 revert the previous commit -- forget about -? as a synonym for --help
An ambiguous option like --back or --word would cause nano to spew
the entire help text.  It should do the latter only when the user
explicitly requests it.
2023-08-27 14:56:05 +02:00
Mateusz Kazimierczuk
e65b0ba654 options: add -? as a synonym of -h (--help)
The short option '-?' was removed nine years ago in commit 43019189,
then restored six years later in 5bd92d4c, and then removed again two
months later in 743100fe due to getopt() returning '?' for options
that aren't recognized, preventing the use of '-?' as a valid option.

However, getopt() provides a way to check for unrecognized options
via the 'optopt' variable, which gets set only for invalid options.

Signed-off-by: Mateusz Kazimierczuk <mataha+savannah@protonmail.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2023-07-31 07:40:07 +02:00
Benno Schulenberg
d3dd403dc7 browser: report an error instead of crashing when the folder disappears
When the directory that the user is browsing in is deleted by another
process at the moment that nano is building the list of file names,
this can result in an empty list, which some items in the main loop
in browse() cannot handle.  Prevent this mishandling by not entering
the loop when the list is empty.

This fixes https://savannah.gnu.org/bugs/?64465.
Reported-by: Jerry Meng <jerrytstng@gmail.com>
2023-07-24 15:25:35 +02:00
Benno Schulenberg
7f4c2c6a25 docs: add a caveat in the FAQ about bracketed pastes 2023-06-04 08:07:10 +02:00
Benno Schulenberg
cb1b3a28ab tweaks: normalize the indentation after the previous changes 2023-05-21 11:29:02 +02:00
Benno Schulenberg
f7d8735b6b tweaks: reshuffle four lines, to allow folding some #ifdefs together
Also remove an unneeded pair of braces, split a comment,
and correct a mistaken #ifdef.
2023-05-21 11:27:45 +02:00
Benno Schulenberg
fc42ab9b46 bindings: allow speller and friends to be rebound also in restricted mode
Speller, linter, formatter, and execute-a-command cannot be used in
restricted mode, but the relevant keys should report that the function
is *disabled*, not that the key is unbound.

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

Problem existed since version 3.2, since nano reads the nanorc files
also in restricted mode.
2023-05-21 10:51:37 +02:00
Benno Schulenberg
7f17777a4b docs: mention that a restricted nano does not access the history files
With some imagination, the lack of access could be inferred from the
other descriptions, but it's much better to be clear and explicit.

Also, separate two items that are unrelated and reshuffle them into
a neater order.

Triggered by https://savannah.gnu.org/bugs/?64181.
2023-05-14 08:17:25 +02:00
Benno Schulenberg
bcdb27416c docs: describe nano more specifically as a text editor
Especially the first sentences introducing nano should use the words
"text editor" and not just "editor".
2023-05-14 08:11:44 +02:00
Benno Schulenberg
15c6396d42 tweaks: rename a symbol (to be clearer), and add three missing comments 2023-05-14 08:11:05 +02:00
Benno Schulenberg
2c19345e58 docs: in a synopsis, use braces around a choice of required parts
This seems to be the convention.  For an example, see `man tar`.

This addresses https://savannah.gnu.org/bugs/?64125.
Reported-by: Eric S. Raymond <esr@thyrsus.com>
2023-05-01 10:48:02 +02:00
Benno Schulenberg
69a7dd86ec feedback: suppress filename and linecount when --zero is active
This suppression prevents the filename flashing by at the bottom
of the screen when switching between buffers.

This addresses https://savannah.gnu.org/bugs/?64019
Reported-by: Alan Cristhian Ruiz <alancristhian@protonmail.com>

Problem existed since version 6.0, since --zero was introduced.
2023-04-12 09:58:28 +02:00
Benno Schulenberg
fdcafb83e3 startup: use a format string, to deflect format-string attacks
This fixes the second part of https://savannah.gnu.org/bugs/?63964.

Reported-by: Vince Vince
2023-03-27 12:09:21 +02:00
Benno Schulenberg
b8ead3b511 linter: use a format string, to deflect format-string attacks
This fixes the first part of https://savannah.gnu.org/bugs/?63964.

Reported-by: Vince Vince
2023-03-27 12:09:21 +02:00
Benno Schulenberg
ffff664918 tweaks: shrink the set of characters recognized as line-column separator
This slightly reduces the chance that a filename is accidentally parsed
as containing both a line and a column number at its end.
2023-03-10 15:14:31 +01:00
Benno Schulenberg
bf984ecb9b docs: document the <filename>:<linenumber> thing for cursor positioning 2023-03-09 16:14:44 +01:00
Benno Schulenberg
f1e238a9af tweaks: condense the code that searches for a colon plus line number 2023-03-09 12:56:17 +01:00
Benjamin Valentin
5290a85afd new feature: interpret also <filename>:<linenumber> when opening a file
Various tools will output filenames with line numbers in the format
<filename>:<line>:<column>.  Support this format in addition to the
+<line>,<column> format when opening files.

Signed-off-by: Benjamin Valentin <benpicco@googlemail.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2023-03-08 11:48:20 +01:00
Benno Schulenberg
b5157dd9cb tweaks: avoid calling isblank()/isalpha() on what could be a signed char
The isxxxxx() functions expect their parameter to be either EOF or
a value in the unsigned char range.  Passing a negative char value
could (in theory) result in unexpected behavior.
2023-02-24 17:31:58 +01:00
Benno Schulenberg
94812d17c8 tweaks: rename a struct element, to avoid a theoretical name collision
The <term.h> header file form ncurses defines the name "tab".
2023-02-23 17:08:45 +01:00
Benno Schulenberg
7681090c12 docs: clarify that a fileregex is matched against the absolute filename 2023-02-16 11:02:15 +01:00