Commit Graph

10139 Commits

Author SHA1 Message Date
Benno Schulenberg 0f4db1ed0d docs: say thanks to the Albanian translator
Also, properly sort a nearby name and add its missing diacritic.
2022-12-09 11:58:07 +01:00
Benno Schulenberg 4b35626aec rcfile: report an error when an included file does not exist
That is: do not silently return from parse_one_include() when the
given file does not exist, *and* return the filename (or pattern)
itself when it matches nothing.

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

Bug existed since version 4.0, commit d3f0d32e.
2022-12-02 11:37:05 +01:00
Benno Schulenberg 846588ee81 tweaks: avoid passing NULL to access()
This prevents an unwanted message when nano
is compiled with -fsanitize=undefined.

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

Problem existed since version 4.8, commit 343f97b3,
since the --rcfile option was added.
2022-11-30 12:08:47 +01:00
Benno Schulenberg 4f92b12a6a text: upon Enter, eat only lefthand blanks, not any other characters
Make sure that there is only whitespace to the left of the cursor
before setting 'allblanks' to TRUE, because this latter value will
cause these characters to be eaten (as a special case, to avoid
creating lines that contain only blanks when both --autoindent
and --breaklonglines are on).

This fixes https://savannah.gnu.org/bugs/?63407.
Reported-by: Tasos Papastylianou <tpapastylianou@hotmail.com>

Bug existed since version 2.9.8, commit d00ab406.
2022-11-28 11:01:50 +01:00
Benno Schulenberg 4b4b20f8a9 build: fix compilation when configured with --disable-comment
This fixes https://savannah.gnu.org/bugs/?63372.
Reported-by: Hannu Nyman <hannu.nyman@iki.fi>

Problem existed since version 7.0, commit 4b928b46.
2022-11-18 16:49:23 +01:00
Benno Schulenberg e26fe9bddd po: update translations and regenerate POT file and PO files 2022-11-15 11:44:29 +01:00
Benno Schulenberg 972be2df04 bump version numbers and add a news item for the 7.0 release 2022-11-15 11:17:34 +01:00
Benno Schulenberg 374cb6a7f8 gnulib: update to its current upstream state 2022-11-13 12:23:45 +01:00
Benno Schulenberg 923d6300ad tweaks: attribute some of the features that were added in the last years 2022-11-11 16:39:34 +01:00
Benno Schulenberg baa4edc6ca docs: improve the legibility of an itemized list
Also, mention my email address in the colophon of the PDF,
to avoid the impression that Chris is the sole responsible.

And improve the general layout by adding three blank lines.
2022-10-20 15:44:44 +02:00
Benno Schulenberg 9875311bcc startup: for +/string, center the found occurrence when possible
This places the cursor in a more predictable position.

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

Issue existed since version 4.4, commit a9dd73fb,
since the +/string feature was introduced.
2022-10-17 12:11:41 +02:00
Benno Schulenberg c3a453512a startup: report an empty search string also when there is a modifier
Not just for +/ (a search command without a string) should nano report
an "Empty search string", but also for +c/ or +r/ or similar.

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

Bug existed since version 4.4, commit 2326bf69.
2022-10-16 11:22:32 +02:00
Benno Schulenberg e413ed8e1d execute: show "Cancelled" instead of "Error" when the user hits ^C
(The "Cancelled" is shown with a red background, like an error,
but that is needed so that do_undo() will be called afterward.)
2022-10-09 16:28:06 +02:00
Benno Schulenberg 858f411447 filtering: terminate also the sender process when the user hits ^C
When the user interrupts an external command that hangs or takes too
long, nano should also kill the data-sending process (when present).

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

Bug existed in this form since version 4.3, commit d946f38a,
but basically existed since version 3.0, commit ec339d3b.
2022-10-09 11:24:03 +02:00
Benno Schulenberg 19c8cea8e5 files: improve the error handling when executing an external command
When something goes wrong while executing an external command or while
piping text to it, report an error on the status bar and restore the
state of the buffer to what it was before the execution.

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

Bug existed since version 2.9.8, since filtering text was introduced,
but basically existed since before version 2.0.0, since executing an
external command was introduced.
2022-10-07 09:32:11 +02:00
Benno Schulenberg 1ae10b1487 tweaks: elide an unused return value
The execute_command() function — then called open_pipe() — was changed
to have a boolean return value in commit ce62e82a eighteen years ago,
but the value has never been used or checked.
2022-10-03 10:28:43 +02:00
Benno Schulenberg 35cde9f8d7 tweaks: elide an unused parameter
The parameter has been redundant since commit 9faa9545 from two years ago.
2022-10-03 10:10:10 +02:00
Benno Schulenberg d4d2840f5d filtering: when returning to a line number, ensure it is within range
The function line_from_number() can handle only line numbers that exist,
and will crash otherwise.  (The lack of checks makes the function fast.)

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

Bug existed since commit d1e28417 from five weeks ago.
2022-09-28 16:40:31 +02:00
Benno Schulenberg 119ec47072 tweaks: replace sizeof(char) with 1, as that is assumed anyway
Since commit c848ec3d from three years ago, nano has assumed that
'char' is always a single byte.  So... elide the last occurrences
of sizeof(char), as they give a false impression of generality.
2022-09-28 12:48:45 +02:00
Benno Schulenberg ceb305a780 tweaks: avoid iterating over the same string twice in a row
The function recode_LF_to_NUL() has to iterate over the string anyway
(to replace each \n with \0), so... instead of calling strlen() right
before it, just let recode_LF_to_NUL() return the length of the string.

(This is not speed-critical code, but... it saves one iteration over
the entire buffer contents whenever writing out a file.)
2022-09-28 12:22:40 +02:00
Benno Schulenberg 1dc2a75cb6 files: before sending data to an external command, decode LF back to NUL
(There is no need to recode the NULs back to LFs because the sending of
the data happens in a separate process, which then simply disappears.)

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

Bug existed since version 2.9.8, since filtering a buffer or a region
through an external command was introduced.
2022-09-27 15:48:03 +02:00
Benno Schulenberg 8d7b716ea7 startup: quit when standard input is not a TTY (after handling arguments)
Not quitting would make nano hang for several seconds (which is very
annoying) and then die and save an emergency file (which is useless).

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

Bug existed chiefly since version 5.9, commit 8d1a666d,
but basically existed since before version 2.0.0.
2022-09-27 12:18:28 +02:00
Benno Schulenberg 034af70a65 tweaks: simplify a pasting routine, modelling it after the injection one 2022-09-26 16:10:15 +02:00
Benno Schulenberg 162c213e7b tweaks: improve two comments, and exclude two unneeded prototypes
And declare two more variables as 'static', like all its neighbors.
2022-09-26 15:53:22 +02:00
Benno Schulenberg 6fde7d8a51 input: allocate two small character buffers too, and never free them
Analogous to commit 3922b531: instead of allocating and later freeing
a tiny fragment of memory for every character that the user enters (in
the edit window or at a prompt), reserve a small piece in the beginning
and retain it, and increase (but never decrease) its size as needed.

This addresses the second part of https://savannah.gnu.org/bugs/?63086.
2022-09-25 16:15:31 +02:00
Benno Schulenberg e4abef5768 input: give up when the capacity of the keystroke buffer overflows
In theory, the 'size_t' of 'capacity' could be just two bytes, which
means the keystroke buffer would overflow for pastes that are larger
than 32 kilobytes -- which are unlikely to occur, but... possible.
However, previously there was *no* overflow check when extending the
keystroke buffer (only when trying to put back a key code), so this
check is an improvement.

(On a regular machine, 'size_t' is at least four bytes, which means
the keystroke buffer would overflow at 2 gigabytes.  Such a paste
is extremely unlikely to occur, so this check is really a no-op.)
2022-09-25 10:17:32 +02:00
Benno Schulenberg 3922b531a8 input: allocate a small keystroke buffer, and never free it
Instead of allocating and freeing a tiny fragment of memory for every
keystroke, reserve a small piece in the beginning and then retain it,
because it will be needed again and again and again.  Increase the size
when needed (for a large paste, probably), but don't bother to shrink
it afterward.

This addresses the first part of https://savannah.gnu.org/bugs/?63086.
2022-09-25 09:22:29 +02:00
Benno Schulenberg 0d1438a731 tweaks: reshuffle a declaration, and correct the wording of a comment
Also, drop an unneeded condition, as memmove() allows moving zero bytes.
2022-09-23 09:34:14 +02:00
Benno Schulenberg 7eb66d3e09 tweaks: condense a comment, add two small ones, and reshuffle a line
(Apart from reducing the verbosity of the long comment, also harmonize
its format: mentioning the FreeBSD key always first.)
2022-09-22 10:50:05 +02:00
Benno Schulenberg c7a600063d tweaks: reshuffle some lines, to be more readable instead of compact 2022-09-20 16:21:32 +02:00
Benno Schulenberg 5b654ce9fb docs: suggest a key binding for snipping trailing blanks
This addresses https://savannah.gnu.org/bugs/?63062.
2022-09-18 10:44:05 +02:00
Benno Schulenberg 98e9a881c0 docs: mention in the man page how M-V can insert any Unicode code point
This addresses https://savannah.gnu.org/bugs/?63055.

Inspired-by: Tasos Papastylianou <tpapastylianou@hotmail.com>
2022-09-18 09:05:28 +02:00
Benno Schulenberg f420f7c177 verbatim: do not overwrite the status bar when the code is invalid
Move the triggering of the line redraw out of the error path, and
into a better place: next to the normal clearing of the feedback.

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

Bug existed since version 6.0, commit 6d828cf4.
2022-09-13 16:57:28 +02:00
Benno Schulenberg 50954a4b6a search: skip a match on the magic line, as it is a just convenience line
As the magic line isn't really a line (it is not counted in the number
of lines read and written), and nothing is on it (not even a newline),
it doesn't make sense to allow any regex, like ^ or $, to match it.

This fixes https://savannah.gnu.org/bugs/?63034.
Indirectly-reported-by: Mike Scalora <mike@scalora.org>

Bug existed since before version 2.0.0.
2022-09-12 08:47:51 +02:00
Benno Schulenberg 567310e698 tweaks: reduce four variations of a message to a single common form
(This could have been done a long time ago, but it simply didn't occur
to me.)
2022-09-12 08:45:37 +02:00
Benno Schulenberg f90b710c9b tweaks: group the special keycodes for implanted strings together
This shows better that they are related.
2022-09-11 17:49:44 +02:00
Benno Schulenberg bdaec3f934 docs: clarify the distinction between binding a function and "{function}"
This addresses https://savannah.gnu.org/bugs/?63010.

Inspired-by: Tasos Papastylianou <tpapastylianou@hotmail.com>
2022-09-11 16:29:18 +02:00
Benno Schulenberg 8198fd9c58 tweaks: reword and/or condense four comments 2022-09-11 16:29:02 +02:00
Benno Schulenberg 358a10e3cc tweaks: elide an assignment by iterating with the target variable 2022-09-11 12:03:06 +02:00
Benno Schulenberg 7b935e0d40 tweaks: elide an intermediary variable that is no longer needed 2022-09-11 11:57:11 +02:00
Benno Schulenberg 7034c3cc47 tweaks: drop shunting of flags by calling the needed function directly
Calling strstrwrapper() with the Backwards, Casesens, and Regex flags
unset is equivalent to calling mbstrcasestr().  So... do that instead
and quit saving and restoring the flags for each call of findfile().

This saving-and-restoring has been redundant since commit b0957254
from eight years ago.
2022-09-11 11:51:34 +02:00
Benno Schulenberg e30eadb4de verbatim: don't show dots during Unicode input, as they give wrong idea
The dots gave the impression that the next keystroke (hex digit) would
land somewhere on the dots.  But this is not so -- the current digits
are instead shifted to the left and the new digit is added at the end.

Also adjust and improve several comments.
2022-09-11 09:23:44 +02:00
Benno Schulenberg 3e3f4a167a tweaks: elide a function that does not need to be a separate function
Also elide three calls of tolower(), using ORing with 0x20 instead,
as we're dealing with plain ASCII here.

Rename a variable too, away from a double abbreviation.
2022-09-11 09:01:06 +02:00
Benno Schulenberg c98528f8d3 tweaks: simplify a function now that a Unicode code can be typed quicker 2022-09-11 09:01:06 +02:00
Benno Schulenberg 75e5f885e5 verbatim: allow the user to finish Unicode input with <Enter> or <Space>
Instead of requiring always six digits, allow the user to indicate
with <Enter> or <Space> that the digits typed so far are the complete
Unicode code point (when prefixed with the missing number of zeroes).

This fulfills https://savannah.gnu.org/bugs/?63021.

Inspired-by: the <Ctrl+Shift+U> shortcut that some desktops have
2022-09-11 09:01:06 +02:00
Benno Schulenberg 40b9e68e02 goto: don't center the current line when the user specified a column only
This does not quite do what I would have liked (scroll only when needed)
when on a softwrapped line and jumping to a different chunk, but... it's
still better than needlessly centering the line.

(The user can still center the line, if that is what they want, by using
a period or a slash instead of a comma.)

This addresses https://savannah.gnu.org/bugs/?63008.
2022-09-04 10:49:52 +02:00
Benno Schulenberg e7491920fd docs: explain how to include a double quote plus space in a nanorc regex
As double-quote-plus-space indicates the end of a regular expression
in a nanorc file, the inclusion of this combination *in* a regular
expression requires breaking the juxtaposition of the two, which
can be achieved by putting either of them between square brackets.

(It can also be achieved by preceding the space with a backslash,
which is shorter, but... the above method is more symmetrical.)

This addresses https://savannah.gnu.org/bugs/?62997.
2022-09-01 17:29:04 +02:00
Benno Schulenberg 9904aa5538 tweaks: make the crawl use the whole screen also in the tiny version
Nobody will configure nano with --enable-tiny --enable-extra, but *if*
someone does, the title bar should be absent during the crawl.

Also, swap two messages, so that their order in the POT file will be
more sensible -- a closing brace comes after the function name.
2022-09-01 08:38:18 +02:00
Benno Schulenberg 41b89aef8c tweaks: move the arrays of menu names and symbols to where they are used
Also, use a better return value for the "unrecognized name" case,
so that it cannot possibly be confused with the "all menus" case.
2022-08-31 17:28:09 +02:00
Benno Schulenberg 3925c137a4 tweaks: make two error messages more succinct and easier to translate
"Cannot map name %s to <thing>..." was unnecessarily verbose and vague.
I have kept these strings unchanged all these years because I didn't
want to invalidate the existing translations.  But now it's time to
harmonize things and simply say "Unknown <thing>: %s" for an invalid
function name, menu name, option name, and syntax name.

("No such <thing>: %s" is nice and snappy, but its translations often
are clumsy and longer and unclear.)
2022-08-31 16:57:58 +02:00