Commit Graph

9901 Commits (master)

Author SHA1 Message Date
Benno Schulenberg e0334e861d shutdown: when dying, do not install/restore a handler for Ctrl+C
First, we don't want the writing of an emergency file to be interrupted
by the user.  But more important: the routine for restoring the handler
also disables SIGINT, which would leave the terminal with a non-working
Ctrl+C.

Saving an emergency file calls write_file() in a unique manner: with
thefile == NULL, fullbuffer == FALSE (even though the entire buffer
will be saved, of course) and tmp == TRUE (even though it is not a
temporary file, as it will persist after nano exits).  But in fact
we want the handler for Ctrl+C installed only for normal files, not
for temporary files and not for emergency files -- the user should
not be able to interrupt the writing of those.

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

Bug existed since version 4.3, commit 8550c6bd.
2021-09-29 11:32:48 +02:00
Benno Schulenberg b07fb5a811 files: exclude the call of fsync() from the tiny version
To avoid a spurious error message when the user chooses to write
the current buffer to a fifo.

Reported-by: André Kugland <kugland@gmail.com>
  https://lists.gnu.org/archive/html/nano-devel/2021-09/msg00031.html
2021-09-28 11:00:48 +02:00
Benno Schulenberg 9ab49658d7 files: prepending to a fifo makes no sense, so do not try that
Trying to prepend would hang nano until some other process writes
something to the fifo.

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

Bug existed since before version 2.2.4.
2021-09-28 10:10:37 +02:00
Benno Schulenberg bb3d367716 files: making a backup of a fifo makes no sense, so do not try that
This fixes https://savannah.gnu.org/bugs/?61235.

Bug existed since version 4.3, commit 1b2018e9,
since opening a fifo was made possible again.
2021-09-28 09:45:49 +02:00
Benno Schulenberg 26c0a7962e files: check for a fifo only when it is an existing file
To avoid referencing an uninitialized value.

Reported-by: André Kugland <kugland@gmail.com>
  https://lists.gnu.org/archive/html/nano-devel/2021-09/msg00031.html
2021-09-28 09:44:52 +02:00
Benno Schulenberg a2b20a1915 files: do not call fsync() on a fifo, to avoid a spurious error message
This fixes https://savannah.gnu.org/bugs/?61234.

The original report was in:
  https://lists.gnu.org/archive/html/nano-devel/2021-09/msg00029.html
Reported-by: André Kugland <kugland@gmail.com>

Bug existed since version 5.0, commit a84cdaaa.
2021-09-27 17:23:49 +02:00
Benno Schulenberg 2087c20a83 tweaks: in comments, say "buffer" instead of "file" where appropriate 2021-09-27 16:37:03 +02:00
Benno Schulenberg 5512c63bdd copyright: update to the current year for significantly changed files 2021-09-24 11:01:41 +02:00
Benno Schulenberg d31cf1da68 gnulib: update to its current upstream state 2021-09-21 16:52:04 +02:00
Benno Schulenberg ce656cfca8 docs: improve the description of the spotlighting of a search match 2021-09-21 16:49:40 +02:00
Benno Schulenberg 46cdf8b745 startup: if TERM is unset, try falling back to VT220 instead of failing
Curses cannot function if not informed via TERM which type of terminal
is being used.  As many terminals are mostly compatible with a VT220,
falling back to "vt220" when TERM is unset has a good chance of giving
the user a usable nano, instead of simply failing.

(Falling back to "vt100" is not good as it contains padding delays.)

This partially addresses https://bugs.debian.org/991982.
2021-09-20 10:38:25 +02:00
Benno Schulenberg fdc0b0ac24 tweaks: rename three variables, to follow the general scheme
Also rewrap a line, reshuffle two others, and remove two redundant
comments.
2021-09-20 10:08:56 +02:00
Benno Schulenberg 42b7dea14b docs: add some details to the bug-reporting paragraph in the README
And add a blank line at the end, to make EOF look better.
2021-09-19 12:03:12 +02:00
Benno Schulenberg 239c794503 feedback: use a smaller diamond to represent an anchor, to not overflow
In the terminal font that I use nowadays (that deals well with
combining characters), the normal diamond exceeded the boundaries
of a single cell and thus partly covered the first character of
the relevant line.
2021-09-19 12:03:12 +02:00
Benno Schulenberg 189960c467 cutting: copy anchors into the cutbuffer, so that undo can restore them
When a segment of text is extracted, copy any anchors that it has
into the cutbuffer, so that they get saved in the undo item, so that
an undo will put these anchors back on the lines where they were,
instead of leaving an inherited anchor at the top of the segment.

And when text is pasted, clear any anchors in it, so that they will
not travel nor multiply.

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

Bug existed since version 5.0, since anchors were introduced.
2021-09-19 11:29:39 +02:00
Benno Schulenberg 04f8aa83ef tweaks: reshuffle a few lines, for esthetics and to elide an #ifdef 2021-09-17 10:06:21 +02:00
Benno Schulenberg 802a20b222 tweaks: rename a variable, to be more grammatical 2021-09-16 12:32:19 +02:00
Benno Schulenberg 88f7ec38f8 docs: spell "filename" as a single word, like in most other occurrences 2021-09-15 10:27:31 +02:00
Benno Schulenberg baaff48547 syntax: nanorc: recognize also the template of the sample nanorc file 2021-09-15 10:00:41 +02:00
Benno Schulenberg 0010cd4443 tweaks: slightly reword or rewrap some comments in the sample nanorc 2021-09-15 09:55:14 +02:00
Benno Schulenberg 7d6ffd9e78 docs: don't use "light" after "bold", as the latter often implies "light"
On most terminals "bold" also makes the relevant text lighter (or just
makes it lighter, like on a Linux console).  Only some terminals allow
the user to switch this coupling of bold to light off.

Suggested-by: Hussam al-Homsi <sawuare@gmail.com>
2021-09-14 12:40:32 +02:00
Hussam al-Homsi b8daf1fb0b docs: correct the default value of the errorcolor option
It should be "bold,white,red" instead of "brightwhite,red"
because "bright" is deprecated and not documented.

Signed-off-by: Hussam al-Homsi <sawuare@gmail.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2021-09-14 12:03:04 +02:00
Benno Schulenberg fe5f05f037 files: give the user time to absorb a warning about someone else editing
That is: pause a little to jolt the user, and then leave the message
on the status bar.

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

Bug existed since version 4.8, commit 416386ed.
2021-09-12 10:43:07 +02:00
Benno Schulenberg 5cedb53c62 files: write a lock file also for a freshly saved buffer
This fixes https://savannah.gnu.org/bugs/?61146

Bug existed since version 2.3.2, since --locking was introduced,
and continued to exist since version 4.8 despite commit 497f126b
claiming to have fixed it.
2021-09-12 10:00:17 +02:00
Benno Schulenberg 650dc14e0f tweaks: rename a defined type, to fit within the general pattern
So that it can be colorized as a type by a general syntax rule.

(The name is now uglier than it was, but... alas.)
2021-09-11 18:05:03 +02:00
Benno Schulenberg 43ebabe05d docs: mention how to properly colorize all types in nano's source code 2021-09-11 17:50:11 +02:00
Benno Schulenberg b6366411dc tweaks: reshuffle a few lines to avoid an #ifdef and unbalanced braces 2021-09-11 15:07:05 +02:00
Benno Schulenberg 914921887e tweaks: rename a variable, to make more sense 2021-09-11 11:09:56 +02:00
Benno Schulenberg 64a8f1930e history: emit a warning when file cannot be made private [coverity] 2021-09-08 09:15:41 +02:00
Benno Schulenberg 0ac2dfd920 docs: refer to the FAQ when <Alt+Up> does nothing on a Linux console 2021-09-04 12:29:31 +02:00
Benno Schulenberg aa553ee5d6 docs: correct the descriptions of how to invoke the spell checker
The keystrokes to invoke it changed in version 5.0.
2021-08-30 17:09:41 +02:00
Benno Schulenberg a8961c561f po: permit the Indonesian PO file to come back -- there was a big update 2021-08-27 12:37:26 +02:00
Benno Schulenberg abce19b0e4 docs: improve the recipe in the FAQ for dealing with Alt+Up on a console 2021-08-25 11:53:27 +02:00
Benno Schulenberg fc317660cb tweaks: harmonize the indentations in the FAQ somewhat 2021-08-25 11:28:45 +02:00
Benno Schulenberg 949fcde6f7 docs: indent the paragraphs in the FAQ that list commands to be typed
And use a monospaced font for them.
2021-08-25 11:27:26 +02:00
Benno Schulenberg 9f24b6ea65 po: delete the ancient PO files for Indonesian and Nynorsk
These files haven't been updated in more than fifteen years and their
number of translated strings has dropped to below twenty percent.

Also, prevent them from coming back when next syncing with the TP.
2021-08-24 10:23:06 +02:00
Benno Schulenberg c6ba4ae89a docs: improve the descriptions of several bindable functions
Some functions behave differently when some lines or a region is marked.
2021-08-23 10:12:55 +02:00
Benno Schulenberg dab3f95c71 tweaks: instead of "one" use "you", like in the rest of the man page 2021-08-23 10:04:01 +02:00
Benno Schulenberg 840ad5890f docs: move the notice in the main man page, to try and catch other eyes 2021-08-23 10:00:44 +02:00
Benno Schulenberg ae61bab60b files: when there is a slash after the dot, then there is no extension
This fixes https://savannah.gnu.org/bugs/?61071.

Bug existed since commit f429ebe3 from three days ago.
2021-08-23 09:52:32 +02:00
Benno Schulenberg d3a7f3abed tweaks: restore a quote that was accidentally deleted four months ago
Commit a69a8ce3 unintentionally removed the double quote that should
terminate the version string.
2021-08-23 09:39:12 +02:00
Benno Schulenberg 694cd9ddd4 build: ensure that mkstemps() is available by importing the gnulib module
The mkstemps() function is not part of the POSIX standard,
so there might be some platforms that don't have it.
2021-08-22 11:42:34 +02:00
Benno Schulenberg 47c8e627f4 build: help Haiku find the header files that define mkstemps()
The documentation (https://www.haiku-os.org/docs/api/libroot.html)
says that BSD extensions are enabled by default, but somehow this
does not seem to be the case on my system.  With _DEFAULT_SOURCE
defined, though, src/files.c now compiles fine.
2021-08-22 11:42:34 +02:00
Benno Schulenberg f429ebe34d files: add the original file's suffix to the name of a temporary file
This allows 'aspell' to recognize a C file and thus
spell check only the comments and strings.

This fulfills https://savannah.gnu.org/bugs/?61056.
2021-08-22 11:41:19 +02:00
Benno Schulenberg 083bbae0e4 tweaks: rename a variable, away form an abbreviation 2021-08-20 10:35:56 +02:00
Benno Schulenberg eaff5ec9e5 files: check the result of fdopen(), to avoid a possible crash
When safe_tempfile() returns a valid filename, it should also
return a valid open stream.

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

Bug existed since version 1.3.8, commit 5e068c60.
2021-08-20 10:28:42 +02:00
Benno Schulenberg 51eb938fea tweaks: rewrap three lines, for esthetics 2021-08-20 10:14:21 +02:00
Benno Schulenberg 296c5a32c7 docs: replace a non-problem in the FAQ with something possibly useful
Opening a file whose name starts with a plus is not a problem at all.
Instead describe how to get the Alt+Up keystroke to scroll on a Linux
console (on Debian and friends).

This addresses https://savannah.gnu.org/bugs/?57294.
2021-08-18 11:54:54 +02:00
Hussam al-Homsi ef6ccc47c8 syntax: perl, ruby: remove arbitrary highlighting of here documents
The rules assume that 'STOP' (for Perl) or EOT (for Ruby) is the
terminating string while it could be anything.  Also, the rules
don't take quotes nor backticks nor a tilde into account.

In short: these coloring rules are far too limited.

References:
  https://perldoc.perl.org/perlop#%3C%3CEOF
  https://docs.ruby-lang.org/en/3.0.0/doc/syntax/literals_rdoc.html#label-Here+Documents+-28heredocs-29

Signed-off-by: Hussam al-Homsi <sawuare@gmail.com>
2021-08-09 09:56:50 +02:00
Benno Schulenberg eea2dfce48 tweaks: fix a typo 2021-07-31 20:48:10 +02:00