Benno Schulenberg
e0213b1a41
tweaks: drop a pointless suffix from two function names
2020-01-26 16:36:23 +01:00
Benno Schulenberg
706f3e93f4
tweaks: in comments, reword "titlebar" and "statusbar" to two words each
...
To differentiate them from the function names.
2020-01-16 19:37:28 +01:00
Benno Schulenberg
afa4c6b9fc
copyright: update the years for the FSF
2020-01-15 11:42:38 +01:00
Benno Schulenberg
3e0bd533db
tweaks: free two strings as soon as they are no longer needed
2020-01-14 11:01:32 +01:00
Benno Schulenberg
6896d8df47
tweaks: reduce the scope of two constants and of four variables
2020-01-14 10:35:54 +01:00
Benno Schulenberg
8455251c35
files: revert the previous commit, as the extra warning is annoying
...
It also erroneously left the succeeding prompt on the screen.
This fixes https://savannah.gnu.org/bugs/?57593 .
2020-01-13 21:42:44 +01:00
Benno Schulenberg
5cf351913e
files: warn doubly when the user is about to overwrite an existing file
2020-01-13 20:05:56 +01:00
Benno Schulenberg
416386edcd
files: alert the user afterward when an overwritten file is being edited
...
(The ideal behavior would be that nano would warn the user beforehand,
before the file that is being edited by someone else gets overwritten,
but that would require many more changes. So... just give a helpful
warning -- that's already better than it was.)
2020-01-13 20:00:07 +01:00
Benno Schulenberg
497f126bb2
files: write a lock file also for a new file and when the name changed
...
(When the new or changed name is that of an existing file AND this
file is being edited by some other editor (or nano itself), then the
behavior is rather strange: nano asks whether to continue, but the
file has already been overwritten and there is nothing the user can
do to cancel or revert things. A later commit should improve this.)
This fixes https://savannah.gnu.org/bugs/?47975 ,
and fixes https://savannah.gnu.org/bugs/?53883 .
2020-01-13 20:00:07 +01:00
Benno Schulenberg
4687322398
tweaks: rewrap two lines, for consistency with similar lines
2020-01-13 20:00:07 +01:00
Benno Schulenberg
413b9cb774
tweaks: rename a function, to get rid of a useless suffix
2019-12-15 19:47:05 +01:00
Benno Schulenberg
76d90617cc
build: avoid three compiler warnings when using gcc-9.2 or newer
...
This addresses https://savannah.gnu.org/bugs/?57360 .
Reported-by: Brand Huntsman <alpha@qzx.com>
2019-12-08 11:27:06 +01:00
Benno Schulenberg
38743b0016
tweaks: reshuffle an 'if' to avoid a negation, and improve a comment
2019-11-27 11:56:35 +01:00
Benno Schulenberg
68c3aaf2df
softwrap: when switching to another buffer, re-align the starting column
...
When we switch to another buffer, the window may have been resized
since we were last in this buffer, so make sure that 'firstcolumn'
gets a fitting value.
This fixes https://savannah.gnu.org/bugs/?56991 .
Bug existed since version 2.8.0, since the softwrap overhaul.
2019-11-27 11:49:09 +01:00
Benno Schulenberg
af8ffa8c94
tweaks: silence a warning when configured with --enable-tiny
2019-11-25 19:21:03 +01:00
Benno Schulenberg
fa88fcc8f2
tweaks: rename a function, and elide a parameter that is always NULL
...
After the previous change, all remaining calls of parse_mbchar() have
NULL as their third parameter. So, drop that parameter and remove the
chunk of code that handles it. Also rename the function, as there are
already too many functions that start with "parse".
2019-10-21 12:35:14 +02:00
Benno Schulenberg
17c16a4bf5
tweaks: rename a function and elide its first parameter
2019-10-20 09:45:58 +02:00
Benno Schulenberg
f816da413a
tweaks: elide a variable that is the same as another
2019-10-18 17:12:51 +02:00
Benno Schulenberg
3a0ac428ba
tweaks: remove a redundant check for an existing emergency file
...
This case is caught (by O_EXCL) later on, at the appropriate moment:
when the file is created.
Also, this removes a superfluous lstat() for each temporary file.
2019-10-18 17:04:55 +02:00
Benno Schulenberg
97ab28a164
tweaks: exclude two fragments of code from the tiny version
...
Also improve a comment, and recorrect an indentation.
2019-10-18 14:25:55 +02:00
Benno Schulenberg
ccb739dd7d
tweaks: don't wrap calls of statusline() that slightly overshoot 80 cols
2019-10-18 14:04:15 +02:00
Benno Schulenberg
1082f2adec
files: don't mention the name of the temp file when reading goes wrong
...
When writing a temp file goes wrong, its name is not mentioned either.
2019-10-18 13:38:20 +02:00
Benno Schulenberg
042b8394a0
tweaks: use a simpler positive/negative check for after copy_file()
2019-10-18 13:25:38 +02:00
Benno Schulenberg
f2d6e6fa5e
tweaks: check the return value of copy_file() also after its other uses
2019-10-18 12:37:39 +02:00
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
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
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
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