Commit Graph

8539 Commits (f2ae08ab19ca8f9810b1cfb25255d3acf902faf6)

Author SHA1 Message Date
Benno Schulenberg f2ae08ab19 bump version numbers and add a news item for the 4.8 release 2020-02-07 10:50:44 +01:00
Benno Schulenberg 325d774393 locking: accept a minimal amount of data, enough for PID plus username
Maybe reading from a remote filesystem happens in small chunks;
don't call foul when the first chunk contains all we need.
2020-02-06 16:13:22 +01:00
Benno Schulenberg 0856f53703 docs: mention that -D/--boldtext gets overridden by some nanorc options
Also, remove an obsolete anchor, and add a missing word.
2020-02-06 16:07:11 +01:00
Benno Schulenberg 7f0bfdfeb2 docs: put the three new behaviors in a bulletted list, to catch the eye
Also, move the relevant section down in the nanorc man page, to increase
the contrast between the two pages.
2020-02-06 16:07:11 +01:00
Benno Schulenberg 51371e0ca5 tweaks: exclude two unneeded fragments of code from the tiny version 2020-02-05 11:41:31 +01:00
Benno Schulenberg 3bd66b78c1 tweaks: don't bother including Haiku escape sequences in the tiny version 2020-02-05 11:31:03 +01:00
Benno Schulenberg 5ea6054a75 tweaks: use a simple subtraction instead of a function call 2020-02-05 11:29:36 +01:00
Benno Schulenberg 04738996fc tweaks: rename two parameters, to be more general and to sound shorter 2020-02-04 17:32:05 +01:00
Benno Schulenberg 07a9477213 tweaks: rename five variables, away from a single letter 2020-02-04 17:20:37 +01:00
Benno Schulenberg a5b48f9a0d build: fix compilation for --enable-{tiny,help,multibuffer} 2020-02-04 12:58:57 +01:00
Benno Schulenberg d141e849a3 tweaks: unabbreviate "argument" in the documentation
Also, show that the argument in the extendsyntax format is not optional,
as any command requires at least one argument.  Also mention 'tabgives'
among the commands that are allowed in an included file.
2020-02-04 12:23:58 +01:00
Benno Schulenberg da68ee19e7 tweaks: reorder two symbols 2020-02-04 11:41:05 +01:00
Benno Schulenberg 8b2f7bd5a2 tweaks: drop a message that will never be seen
Since the previous commit, nano exits from curses mode soon after
this message is printed, so that the user does not have any time
to read it or even see it.
2020-02-03 19:59:58 +01:00
Benno Schulenberg 6119756347 speller: avoid messing up the screen when an unknown locale is used
When invoking the "internal" speller, leave curses mode while the three
programs in the pipe array are executing, to prevent 'hunspell' from
writing a long error message to the end of the status bar, making the
screen scroll, and thus messing it up.  Now the error message gets
printed to the screen that nano was started up from, and will thus be
visible when the user exits from nano.  (At least: it will be so on a
terminal emulator -- on a VT, nothing will be seen.)

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

Bug existed since version 4.6, commit 4d77e0ad.
2020-02-03 13:50:33 +01:00
Benno Schulenberg 06c80b6ccd tweaks: rearrange a few global variables, to group things better 2020-02-02 17:05:06 +01:00
Benno Schulenberg 7ce1f6d86d locking: when finding a lock file at startup, quit when user cancels
When at startup the user presses Cancel at the "open anyway?" prompt,
cancel the whole startup: quit.  But when the user answers No, just
skip the file and continue starting up.
2020-02-02 13:00:37 +01:00
Benno Schulenberg 88087f2b2f tweaks: move a function to related ones, and after one that it calls 2020-02-02 12:26:33 +01:00
Benno Schulenberg 16c4f5bbd0 tweaks: move a function to be before the ones that call it 2020-02-02 12:21:28 +01:00
Benno Schulenberg e877c2406e tweaks: allocate the lock data only when ready to write them 2020-02-02 12:05:45 +01:00
Benno Schulenberg b6a1583e8e tweaks: take just one shot at reading the lock file, and correct a type
Don't bother looping until the 1024 bytes are read.  Writing the lock
file takes just one shot too, and that is more important to get right.

Also, correct the type for the result of read(), so that -1 doesn't
get turned into a positive number, which would mean that any error
would get ignored.
2020-02-02 11:41:20 +01:00
Benno Schulenberg 48df800db3 tweaks: rewrite the same file name into the lock file as the first time
It would be better if nano wrote the full filename into the lock file,
because that would be clearer when Vim displays its warning, but...
this is faster and will do for now.

(Nano should simply also store the full filename in the openfile struct,
so that get_full_path() needs to be called just once for each file.)

This addresses https://savannah.gnu.org/bugs/?57713.
2020-02-02 11:22:22 +01:00
Benno Schulenberg ee05daab92 tweaks: do not leak a file descriptor when fdopen() fails 2020-02-02 11:08:59 +01:00
Benno Schulenberg 74f4c37d5f locking: avoid crashing when there is a problem writing the lock file
The call of ferror() as parameter of a %s specifier was a mistake --
it returns a number, not a string.  Avoid the problem by combining
two error checks.

The man page of fwrite() does not say anything about errno, but I guess
that the function calls write() and that the possible error numbers of
that function apply.

In theory it is now possible that fclose() fails and returns an error
that then masks an earlier error of fwrite().  But I can't be bothered:
lock files are not essential, and any errors that might occur are most
likely overlooked anyway because they are not displayed in red.

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

Bug existed since lock files were introduced, in version 2.3.2,
commit bf88d27a.
2020-02-02 10:55:19 +01:00
Benno Schulenberg 3f5ba950d6 tweaks: suggest a few more alternative key bindings and unbindings
This demonstrates the presence of the 'savefile' function,
and makes the main help text look better.
2020-01-31 17:16:31 +01:00
Benno Schulenberg 0a52e92d4c docs: for the alternative bindings, rebind ^C only in the main menu
Because ^C is needed for Cancel in most other menus.

This fixes https://bugs.debian.org/950223.
Reported-by: Jonas Smedegaard <dr@jones.dk>

Bug existed since version 4.0, commit 3a170d2c.
2020-01-31 16:54:55 +01:00
Benno Schulenberg 7c57806c6f rcfile: require "bright", "start=", and "end=" to be in lowercase too 2020-01-31 16:11:38 +01:00
Benno Schulenberg a2f8703df5 tweaks: tumble three conditions, for consistency in comparisons 2020-01-31 16:05:51 +01:00
Benno Schulenberg 073251fdb1 tweaks: condense two comments, and reshuffle an #endif
There is no need to fake success when the whole writing of the lock file
is skipped, because also a zero return value means "continue anyway".
2020-01-31 11:39:11 +01:00
Benno Schulenberg 5a0ee3c2f9 tweaks: harmonize the amount of lock data that we read and write
All the things that we need are located within the first 68 bytes of
the .swp file.  We do write byte 1007 when the file is modified, but
we never reference it.  We always wrote just 1024 bytes to the .swp
file, so it makes no sense to read in any more than that.

(Vim writes 4096 bytes to a .swp at first, before adding undo stuff
four seconds later.  But the 1024 bytes appear to be enough for Vim
to recognize it as a lock file.)
2020-01-31 11:06:11 +01:00
Benno Schulenberg 6bd5dce954 tweaks: ensure that editor name and user name are NUL terminated
When copying those pieces from a lock file, it is not certain that
they end with a NUL character.
2020-01-30 20:00:17 +01:00
Benno Schulenberg f25059c244 tweaks: frob a couple of indentations and white lines 2020-01-30 19:55:26 +01:00
Benno Schulenberg 856f2c433e feedback: ask a clearer question when a valid lock file is encountered
When asking "continue?", I always thought that answering No would mean
that nano would not continue, that it would stop, that it would abort.
But No only means that it will not open the relevant file but continues
anyway to start up.  Asking "open anyway?" is more easily understood in
that way.
2020-01-30 19:44:25 +01:00
Benno Schulenberg 38c5a4465b tweaks: reshuffle some assignments for a return value 2020-01-30 19:43:19 +01:00
Benno Schulenberg f494bfcbb9 locking: when a lock file is unreadable, open the file itself anyway
Unreadable or corrupt lock files are not a user error nor user intent,
so they should not keep the user from editing the corresponding file.

Also, combine some error conditions to compact the code.

This addresses https://savannah.gnu.org/bugs/?57700.
2020-01-30 19:10:34 +01:00
Benno Schulenberg b856fc4664 locking: check two magic bytes, to verify that it is a lock file
Also, when the check fails, then nano should continue and simply
open the file, just like Vim.

This fixes https://savannah.gnu.org/bugs/?57698.
2020-01-30 18:48:35 +01:00
Benno Schulenberg faa96ead44 tweaks: correct the description of what nano writes into the lock file
Also, limit the stored program's name to ten bytes.  Vim uses four for
its name plus a space, and a maximum of six for its version number.
2020-01-30 17:44:04 +01:00
Benno Schulenberg 26444bf8df tweaks: reformat a comment, and resuffle a line to match byte order 2020-01-30 15:55:42 +01:00
Benno Schulenberg 4eaade2938 gnulib: update to its current upstream state 2020-01-29 19:48:15 +01:00
Benno Schulenberg 662e8b2d20 tweaks: remove some superfluous conditions for rewriting a lock file
A lock file needs to be rewritten (with the modified flag) only when the
relevant lock file already exists.  All other conditions are redundant.
2020-01-29 19:38:07 +01:00
Benno Schulenberg 4502295a34 locking: do not write a lock file when in view mode
When in view mode, the file cannot be edited, so there is no need to
warn anyone (through a lock file) that the file might soon change.

This fixes https://savannah.gnu.org/bugs/?57694.
2020-01-29 19:14:41 +01:00
Benno Schulenberg 25b0bf0ae8 tweaks: correct a couple of comments about escape sequences 2020-01-29 18:48:03 +01:00
Benno Schulenberg f6b6bc47d6 tweaks: remove a redundant call, as there is nothing to free there
At that point, 'u->cutbuffer' will always be NULL, either from the
original creation of the INSERT undo item, or by having been freed
and set to NULL by do_redo().
2020-01-29 12:33:55 +01:00
Benno Schulenberg a692b01c04 tweaks: reshuffle two lines, to do the linking first, then the content 2020-01-29 12:33:30 +01:00
Benno Schulenberg a197ccf12d tweaks: move another function, to group the deleting ones together 2020-01-29 12:16:09 +01:00
Benno Schulenberg 67e5913edf tweaks: move another function to before the one that calls it 2020-01-29 10:54:30 +01:00
Benno Schulenberg e864107046 tweaks: move a function to right before the one that calls it 2020-01-29 10:53:05 +01:00
Benno Schulenberg 7984ea4eb6 tweaks: remove two superfluous assignments, and rename a variable
The 'prev' and 'next' links get assigned to immediately after the
call of copy_node().  And anyway, it does not make sense to link
a copied node to the predecessor and successor of its original.

Also slightly regroup some lines.
2020-01-29 10:47:09 +01:00
Benno Schulenberg f38bd5030d tweaks: add a little change that was overlooked in the previous commit
Option --showcursor applies also to the help viewer, which means that
it can do something useful in restricted mode too.
2020-01-28 12:00:05 +01:00
Benno Schulenberg a2fea9928d build: exclude option '-g' when configured without browser and help 2020-01-28 10:33:56 +01:00
Benno Schulenberg c64f506933 tweaks: reshuffle some declarations, and expand a few variable names 2020-01-28 10:21:34 +01:00