Benno Schulenberg
5390f96900
files: distinguish between read error and write error when prepending
...
This fixes https://savannah.gnu.org/bugs/?57066 .
Bug existed in this form since version 2.4.3 -- in older versions
it segfaulted.
2019-10-18 12:15:14 +02:00
Benno Schulenberg
50ed18be17
tweaks: move a call of umask() closer to where it is relevant
2019-10-17 17:29:11 +02:00
Benno Schulenberg
a6365707c0
tweaks: remove the superfluous closing of a file descriptor
...
The file itself is closed three lines earlier; this also closes the
corresponding descriptor.
2019-10-17 16:43:07 +02:00
Benno Schulenberg
6fad6a17da
tweaks: rename a variable, to be distinct and visible
2019-10-17 12:17:09 +02:00
Benno Schulenberg
eb757e7c5b
tweaks: simplify the opening of files when prepending
...
There is no need for a file descriptor: all reading and writing
is done on streams.
2019-10-17 12:12:07 +02:00
Benno Schulenberg
b554606047
tweaks: add a local variable, for clarity, to not preuse another one
2019-10-17 11:49:21 +02:00
Benno Schulenberg
e915fb1650
tweaks: adjust the indentation after the previous change, and another
2019-10-17 11:45:03 +02:00
Benno Schulenberg
4e40ec057e
tweaks: elide an unneeded check when making a backup
...
When making a backup, we can be certain that the relevant file
is not a temporary file, so 'stream' will necessarily be NULL.
2019-10-17 11:45:03 +02:00
Benno Schulenberg
bd0026be86
tweaks: elide another two calls of umask(), and rename two variables
2019-10-17 11:43:42 +02:00
Benno Schulenberg
a1bef0e953
tweaks: avoid three unneeded calls of umask() in the normal case
2019-10-16 19:17:42 +02:00
Benno Schulenberg
f5693d4151
tweaks: elide a duplicate opening of the existing file when prepending
2019-10-16 17:40:52 +02:00
Benno Schulenberg
e3807f00a2
tweaks: rename two variables, and add a third, for more contrast
2019-10-16 17:16:48 +02:00
Benno Schulenberg
022cc084a7
files: when opening a file for copying, it should NOT be created
...
Weird bug. The first occurrence is probably never hit because the
existing file has been tentatively opened fourteen lines earlier,
but that looks superfluous: double work. And the second occurrence
will not be hit because the temp file is unlikely to have disappeared.
2019-10-16 16:27:23 +02:00
Benno Schulenberg
0f98466e2f
tweaks: adjust the indentation after the previous change
...
Also, don't bother assigning the stream pointer of the existing file
to variable 'f', as it gets overwritten right away by the pointer of
the temp file.
2019-10-16 16:05:40 +02:00
Benno Schulenberg
40c067133a
tweaks: remove two superfluous conditions when prepending
...
When prepending, we cannot be writing to a temp file,
so 'stream' (and thus 'f') will necessarily be NULL.
2019-10-16 15:47:35 +02:00
Benno Schulenberg
36270748dc
tweaks: condense or improve some comments
2019-10-16 13:47:30 +02:00
Benno Schulenberg
1894c81412
tweaks: rename two parameters, for contrast and to match others
2019-10-16 13:07:41 +02:00
Benno Schulenberg
e917ef0105
tweaks: die on an impossible condition -- to be removed later
2019-10-16 12:27:27 +02:00
Benno Schulenberg
3347682fd0
tweaks: remove a pointless updating of the title bar
...
A possible change in filename won't be pushed to the screen until a
doupdate() is done, and that won't happen until nano is waiting for
a keystroke again. So... just let it be.
2019-10-16 12:22:39 +02:00
Benno Schulenberg
7c5b104859
tweaks: rename three variables, to match others elsewhere
2019-10-16 11:46:22 +02:00
Benno Schulenberg
3b9a24a7ca
tweaks: rename a local variable, to not shadow another
2019-10-16 11:11:19 +02:00
Benno Schulenberg
7d3290fb91
tweaks: rename three variables, to be consistent with other linestructs
2019-10-16 11:04:26 +02:00
Benno Schulenberg
df0ae2ace5
tweaks: reshuffle a few declarations, and reduce the scope of one
2019-10-16 10:48:14 +02:00
Benno Schulenberg
bc91af2e3c
tweaks: pass an empty string as an answer instead of a NULL pointer
...
Also, rename a parameter, to be more distinct and to avoid an abbrev.
2019-10-15 13:39:57 +02:00
Benno Schulenberg
48b94d71c7
tweaks: pass an empty string for copying instead of a non-existent one
2019-10-15 11:49:07 +02:00
Benno Schulenberg
f14be47878
tweaks: move two functions to after the one that they make use of
2019-10-15 11:23:09 +02:00
Benno Schulenberg
c51f5f4bff
docs: mention that the 'nopauses' option is obsolete
2019-10-15 11:23:05 +02:00
Benno Schulenberg
7f8851caa8
statusbar: show only the first error message, with dots to indicate more
...
The old default behavior of showing the first three messages with a
long pause after each of them was annoying, and the final "Further
messages were suppressed" hid the relevant information. So, when
there is more than one error message, just pause very briefly and
then add trailing dots to the first message.
This makes the 'nopauses' option a no-op.
This addresses https://savannah.gnu.org/bugs/?57048 .
2019-10-15 11:17:20 +02:00
Benno Schulenberg
bfdc31fbb4
docs: add the M-F and M-N keystrokes to the cheatsheet
2019-10-14 17:14:07 +02:00
Benno Schulenberg
69d2045c9f
syntax: nanorc: colorize only lowercase keywords as valid
...
Nowhere does the manual say that nanorc keywords are case-insensitive,
and none of the examples use uppercase keywords. So, simply consider
uppercase keywords to be invalid. This will later allow nano to use
case-sensitive comparisons, which are slightly faster.
2019-10-14 11:45:56 +02:00
Benno Schulenberg
c63f4c1f58
docs: remove the note about the formatter having been removed
...
The 'fixer' command has taken the place of the 'formatter' command.
(Also, normalize a double blank line before a chapter.)
2019-10-14 10:30:04 +02:00
Benno Schulenberg
b8dc8d4a37
syntax: nanorc: colorize all arguments of 'fixer' and 'linter' as valid
2019-10-14 10:28:45 +02:00
Benno Schulenberg
8749ccb469
syntax: nanorc: colorize the 'fixer' command as valid
...
Also add a default formatting command to the Go syntax.
2019-10-14 10:28:45 +02:00
Benno Schulenberg
b5c5cde0d4
docs: document the 'fixer' command, a per-syntax content arranger
2019-10-14 10:28:45 +02:00
Benno Schulenberg
d8c03cd4cd
tweaks: elide a variable, and add a condition to elide an assignment
2019-10-14 10:28:45 +02:00
Benno Schulenberg
1536a76ced
tweaks: normalize the indentation after the previous change
2019-10-14 10:28:45 +02:00
Benno Schulenberg
d2fb371fe2
feedback: say it when spell check or manipulation did not change anything
2019-10-14 10:28:45 +02:00
Benno Schulenberg
34170611d3
restored feature: a per-syntax 'fixer' command that processes the buffer
...
The command can be used to run some kind of formatter or corrector or
arranging tool on the buffer. By default the command is bound to M-F.
The formatter/corrector/arranging program must be non-interactive.
This addresses https://savannah.gnu.org/bugs/?55365 ,
and addresses https://savannah.gnu.org/bugs/?54651 .
2019-10-14 10:28:45 +02:00
Benno Schulenberg
23c36ba667
tweaks: remove two pointless re-inclusion guards
...
The nano.h file is included only by proto.h, and the proto.h file is
included just once by each src/*.c file. The include guards for these
two header files serve no purpose.
(Include guards are useful when you have bunches of header files
and several of them include others from amongst themselves.)
2019-10-13 19:14:27 +02:00
Benno Schulenberg
31d5cb1118
build: slightly speed up the compilation of the tiny version
...
Don't include header files when they won't actually be needed.
(Also, remove a superfluous #ifdef.)
2019-10-13 18:55:49 +02:00
Benno Schulenberg
f551c07e7a
tweaks: add some "fall-through" comments, and reshuffle some breaks
2019-10-13 17:35:57 +02:00
Benno Schulenberg
2656f543f4
undo: don't try to copy a string that doesn't exist
...
This fixes https://savannah.gnu.org/bugs/?57051 .
Bug existed since commit d256d0cb
from earlier today.
2019-10-13 17:31:53 +02:00
Benno Schulenberg
ba79602281
tweaks: condense two comments, and rename two parameters
...
Also use 'while' instead of 'for'.
2019-10-13 16:45:02 +02:00
Benno Schulenberg
094758be15
tweaks: reshuffle a fragment of code into two alternatives
2019-10-13 16:11:15 +02:00
Benno Schulenberg
06bbc70d4a
tweaks: use a string-copy function that checks for out-of-memory
2019-10-13 12:38:46 +02:00
Benno Schulenberg
d256d0cbc0
tweaks: add a helper function without the ubiquitous NULL argument
...
For conciseness and clarity.
2019-10-13 12:24:27 +02:00
Benno Schulenberg
ab6635c3a6
tweaks: use the given string instead of the found match, for clarity
2019-10-13 11:52:09 +02:00
Benno Schulenberg
416ad4c5fd
tweaks: use a better variable name for the argument of an option
2019-10-13 11:46:22 +02:00
Benno Schulenberg
0374708597
undo: put the cursor back on the original row for a full-buffer operation
...
When an operation that replaces the entire buffer is undone, the
position of the viewport is lost. Compensate for this by storing
the row of the cursor in the undo item, and, after executing the
undo item, arranging the viewport so that the cursor is back on
the original row -- the row where the operation was invoked.
This fixes https://savannah.gnu.org/bugs/?57039 .
2019-10-12 11:20:41 +02:00
Benno Schulenberg
101987f5c6
build: fix compilation when configured with --disable-color
2019-10-12 11:20:19 +02:00