Commit Graph

6720 Commits (9a8d9ef4965f37402d2a5472659afd21cbb1f6ae)

Author SHA1 Message Date
Benno Schulenberg be6860b33e tweaks: remove two unneeded unsettings
Before version 4.3, commit 3eab405e, nano would write a help text to
a temporary file and then read this file into a buffer.  The NOREAD
flag interfered with the latter, so needed to be reset for showing
help.  But since the mentioned commit nano writes a help text directly
into a buffer and the unsetting of the NOREAD flag is superfluous.

The display code never references the LINE_NUMBERS flag -- the trigger
for displaying line numbers in front of the text is 'margin > 0'.  So,
since commit 90bd25c1 that put help texts into a "normal" buffer, the
unsetting of the LINE_NUMBERS flag has been superfluous.
2021-11-10 16:05:40 +01:00
Benno Schulenberg 3a94a0bb89 bindings: allow toggling line numbers (when enabled) also in tiny version
As a special case, and because it doesn't need any feedback on the
status bar nor other calls, add a special function and key binding
to allow the user to flip the LINE_NUMBERS flag also in a tiny nano.

This fixes https://savannah.gnu.org/bugs/?61441.
Reported-by: Hannu Nyman <hannu.nyman@iki.fi>
2021-11-10 09:32:00 +01:00
Benno Schulenberg 8234c22c1e tweaks: avoid a compiler warning with --enable-tiny --enable-linenumbers 2021-11-10 09:11:04 +01:00
Benno Schulenberg 496dad696c build: fix compilation with --enable-tiny --enable-wrapping
Problem existed since commit 50106266 from three weeks ago.
2021-11-10 09:07:23 +01:00
Benno Schulenberg f42821293e feedback: refuse the --constantshow toggle (M-C) on a one-row terminal
When the terminal has just one row, there is no room to constantly show
the position of the cursor, so do not allow the user to switch it on.

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

Bug existed since version 5.8, commit 36ffb5f0.
2021-11-09 12:29:51 +01:00
Benno Schulenberg 0363703073 new feature: option --zero for an interface without bars
With --zero or 'set zero', nano will hide the title bar or the minibar
(whichever is active) and will use all rows of the terminal for showing
the text of the buffer.  Only when there is an important message will
it be shown on the bottom row -- until the next keystroke.

This feature can be toggled with M-Z.

The feedback at startup ("Read nnn lines") is suppressed with --zero,
because it disrupts the fullscreen experience (and is hardly useful).
The "Reading..." message then needs to be suppressed too, otherwise
it creates an annoying little flash.

There are still some issues that need to be addressed:

* In the browser, when the highlighted item is on the bottom row, it
  will get obscured by the prompt bar or the "Search Wrapped" message.

* In the edit window, when the search occurrence is on the bottom row,
  it can get obscured by the "This is the only occurrence" message.

* When tabbing at a prompt shows possible completions, they are shown
  a row too low.
2021-11-09 11:50:40 +01:00
Benno Schulenberg e4a247f7c9 tweaks: rename three functions, to better fit the general scheme 2021-11-09 10:39:31 +01:00
Benno Schulenberg 69b2467a9a tweaks: rename two more functions, to lose a senseless suffix 2021-11-09 10:18:03 +01:00
Benno Schulenberg 27f170815f tweaks: rename two functions, to get rid of one more senseless suffix 2021-11-08 16:54:18 +01:00
Benno Schulenberg d3c7e9d2f6 tweaks: rename two functions, to get rid of another senseless suffix 2021-11-08 16:41:44 +01:00
Benno Schulenberg ea4bbf4285 tweaks: rename two functions, to get rid of the senseless suffix of one 2021-11-08 16:16:35 +01:00
Benno Schulenberg 308d6e73e3 tweaks: normalize whitespace, drop unneeded prototype, condense comment 2021-11-07 15:51:32 +01:00
Benno Schulenberg 167c93b85c justify: correctly determine whether top-of-buffer has been reached
The text to be justified has been excised from the buffer and is now
in the cutbuffer, so we cannot compare any of its lines to 'filetop'.

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

Bug existed since version 4.0, commit 14c08589.
2021-11-07 15:20:18 +01:00
Benno Schulenberg 13c5bcb4d8 tweaks: improve a comment, and drop two cluttering compile conditions 2021-11-07 11:33:02 +01:00
Benno Schulenberg c692a6ca70 tweaks: reshuffle a line into its proper order, and improve two comments 2021-11-07 11:23:45 +01:00
Benno Schulenberg 0346e63c20 build: fix compilation when configured with --enable-tiny
Problem existed since commit 50106266 from two weeks ago.
2021-11-05 16:00:34 +01:00
Benno Schulenberg 9e982f3283 tweaks: rename a function, for some contrast and to get rid of a suffix 2021-11-05 15:59:32 +01:00
Benno Schulenberg 11fec6f63c feedback: when the user types ^Z, say they can suspend nano with ^T^Z
Inspired-by: Sébastien Desreux <seb@h-k.fr>
2021-11-05 15:25:03 +01:00
Benno Schulenberg d0c2c1e6b9 suspension: leave ^Z unbound by default -- just ^T^Z will suspend nano
Suggest in the documentation how to get a one-keystroke Suspend.
2021-11-05 15:24:45 +01:00
Benno Schulenberg 13edbedc79 tweaks: replace a verbose condition with a simpler early return 2021-11-01 18:17:47 +01:00
Benno Schulenberg fc5d58ad97 tweaks: add two spaces and two comments, and drop an internal check 2021-10-31 16:45:43 +01:00
Benno Schulenberg 8da098f5e0 help: group the now lone mouse toggle with the "behavioral" ones 2021-10-31 10:55:07 +01:00
Benno Schulenberg 83f94a88df suspension: enable ^Z by default -- ignore -z option and drop M-Z toggle
In the beginning, the goal for nano was to be a drop-in replacement for
Pico.  Pico did not know a Suspend command, so the ^Z keystroke needed
to be conditionalized on an option (-z or --suspend or the toggle M-Z),
just like the ^S and ^Q keystrokes (for stopping and resuming terminal
output) were conditionalized on --preserve.

But nano has abandoned full Pico compatibility since version 4.0.  It
is time to unconditionalize ^Z as well.  This should not be a problem:
Debian and Ubuntu have had 'set suspend' in their /etc/nanorc for years,
so a considerable portion of nano users have had ^Z enabled by default
for a long time, and no one seems to have complained.

If the keystroke bothers some user, they can unbind it in their nanorc.
They will still be able to suspend nano through the Execute menu: ^T^Z.

This addresses https://savannah.gnu.org/bugs/?61372.
2021-10-31 10:55:07 +01:00
Benno Schulenberg 8762e04631 replacing: keep the spotlighting, also after toggling the help lines
The spotlighting should only be dropped when in the main menu, like in
the code thirty lines up, where 'timed' became TRUE only for MMAIN.

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

Bug existed since version 5.8, commit 3f340836.
2021-10-29 10:28:00 +02:00
Benno Schulenberg 256a0d670e replacing: keep centering the occurrence, also after toggling help lines
Normally, returning to the main loop will set 'focusing' back to TRUE,
but the replacement loop doesn't return until replacing is finished.

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

Bug existed since version 5.0, commit d8249917.
2021-10-29 09:35:38 +02:00
Benno Schulenberg 50106266bc pasting: when less than a line is pasted, allow automatic hard-wrapping
When --breaklonglines is in effect and the user pasted just a few words
(anything without a linebreak), then act as if this short text had been
typed by the user and hard-wrap the line when it became overlong.

This fulfills https://savannah.gnu.org/bugs/?61353.
2021-10-27 16:42:07 +02:00
Benno Schulenberg ba093b0b48 tweaks: elide two parameters, as they are now always the same 2021-10-27 16:30:23 +02:00
Benno Schulenberg 33041d0ad5 statusbar: count words in the way that matches how Ctrl+Right moves
When --wordbounds (-W) is active, nano considers punctuation as
word-forming characters and will thus count words the same way
as 'wc -w' does.  This is how nano counted words until now.

But when --wordbounds is not active (the default), only letters
and digits will be considered word-forming and thus lone groups
of lines and dashes and other punctuation will not be counted
as words, which is more like how a human would count words.

This addresses https://savannah.gnu.org/bugs/?61367.
2021-10-27 16:23:29 +02:00
Benno Schulenberg 9b419d0bff tweaks: rename a function, to describe better what it does nowadays 2021-10-22 11:50:04 +02:00
Benno Schulenberg 918ce1afa3 tweaks: just let do_wrap() set 'refresh_needed' instead of returning TRUE
This gets rid of performing an action in the condition of an 'if'.
2021-10-21 11:58:43 +02:00
Benno Schulenberg 36e3284979 help: ensure there is a blank line between title bar and start of text
In olden times, each help text started with a title line in the text
window followed by a blank line.  But since version 2.8.2, since the
help texts have become almost regular buffers (and thus searchable),
the title of the help text is in the title bar, and since version 4.0,
since --morespace became the default, the text will start immediately
below it.  But a title line immediately followed by text, without a
blank line between them, does not look nice.  So, add such a blank
line back when not using --emptyline (and also when using --minibar,
because the top of the terminal window is like a title bar).
2021-10-15 11:29:44 +02:00
Benno Schulenberg f9468fa987 history: process file faster by not filtering out hypothetical duplicates
When the history file has been created by nano, it will not contain
any duplicate search or replace strings, nor duplicate commands, so
checking for such a duplicate for each read item was a waste of time.

And if the user edited the history file and created duplicates, who
are we to filter them out?  They will not cause the history mechanism
to malfunction; they just take a little extra memory.
2021-10-14 09:58:07 +02:00
Benno Schulenberg fb7c12f644 tweaks: rename a function, to make it make sense 2021-10-14 09:18:28 +02:00
Benno Schulenberg 9341c96def tweaks: rename two parameters and one variable, away from single letters 2021-10-14 09:18:05 +02:00
Benno Schulenberg 74fd78adb1 tweaks: reshuffle a few lines, and rename a variable 2021-10-13 16:45:15 +02:00
Benno Schulenberg c8ab81dd1c tweaks: rename two variables, to fit with the names of similar ones 2021-10-13 16:38:23 +02:00
Benno Schulenberg 185e4d6b12 tweaks: rename two variables, away from abbreviations
Also reshuffle a few declarations, for Christmas.
2021-10-12 18:02:24 +02:00
Benno Schulenberg 99607a5bbe tweaks: invert a condition, to get an early return instead of indentation 2021-10-12 17:52:24 +02:00
Benno Schulenberg 7e807cdd2f memory: avoid leaking the filename when dottifying it on the minibar
This fixes https://savannah.gnu.org/bugs/?61334.

Bug existed since version 5.5, since the minibar was introduced.
2021-10-12 12:49:08 +02:00
Benno Schulenberg e51f6596d4 tweaks: reassign a copy of a string to a variable more economically 2021-10-12 09:33:08 +02:00
Benno Schulenberg 42610db847 memory: avoid a tiny leak when an option with an argument is given twice
(Aaah, being able to define a keyboard macro
came in very handy when making this edit.)

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

Bug existed since before version 2.2.0.
2021-10-11 17:18:07 +02:00
Benno Schulenberg 6018de2466 tweaks: condense the definitions of all the empty functions 2021-10-11 11:21:31 +02:00
Benno Schulenberg 30abc02277 tweaks: reshuffle two conditions, re-indent, and rewrap a line
If all is programmed well, then the functions 'get_older_item' and
'get_newer_item' will only occur when a history list is passed to
acquire_an_answer().  But let's keep it certain we don't dereference
a NULL pointer.
2021-10-10 11:55:15 +02:00
Benno Schulenberg 9a9714fe0c tweaks: rename a variable, to be easier to read and to make more sense
Also update and improve five comments.
2021-10-10 10:43:00 +02:00
Benno Schulenberg 77457fa6e9 prompt: avoid resetting the history pointer when the search is cancelled
When the user immediately cancels a search (^W^C), then nothing in
the history stack has changed, so then there is no need to reset the
history pointer to the bottom.

This slightly improves the fix for https://savannah.gnu.org/bugs/?61316.
2021-10-10 10:21:24 +02:00
Benno Schulenberg 9c45b5da6c tweaks: rename a function and its parameter, to be clearer 2021-10-10 10:11:47 +02:00
Benno Schulenberg e9f0597e2e tweaks: rename two empty functions, to be more to the point
Also, move them to global.c, where all the other empty functions are.
2021-10-09 17:33:32 +02:00
Benno Schulenberg 87cde1590d tweaks: elide two functions that each were called just once
This also gets rid of an assignment in an 'if' clause (twice),
elides a local variable, and makes it clearer that a pointer
gets moved to the previous or next item (instead of hiding it
as a side effect of the function call).
2021-10-09 17:18:32 +02:00
Benno Schulenberg 65d81c60cd help: do not show ^S when --preserve is in effect
This fixes https://savannah.gnu.org/bugs/?61317.

Bug existed since version 5.0, since the Execute menu was overhauled.
2021-10-09 13:05:27 +02:00
Benno Schulenberg 3d6dcb9568 prompt: begin at bottom of history list when at secondary prompt
Whenever invoking a search prompt, calling up historical search items
should start with the newest item.

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

Bug existed since version 2.8.2, since help texts became searchable.
2021-10-09 12:15:11 +02:00
Benno Schulenberg 1ca2911b84 prompt: keep a clear answer clear also after an excursion into history
When the answer at the prompt was clear before the user went up into
the history list, the answer should be cleared again when the user
comes back down to the present.

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

Bug existed since before version 2.2.0.
2021-10-08 12:36:32 +02:00
Benno Schulenberg 8ef74b3aac tweaks: rename five empty functions, to get rid of a meaningless suffix
For consistency, these five names ought to start with "flip_", but
then the bindable functions would need to be renamed too, and that
would be annoying for the user, *and* it would create too many names
that start with "flip" -- it wouldn't be distinctive any more.
2021-10-08 10:58:47 +02:00
Benno Schulenberg aeae4fb4b9 tweaks: reshuffle some lines, one for clarity, others for conciseness 2021-10-07 19:04:20 +02:00
Benno Schulenberg bc22b3c876 files: clear original filename when the user toggles Append or Prepend
When the current filename is equal to the filename of the buffer,
then clear the filename, because the chances that the user wants
to append or prepend a file to itself are practically nil.

This fulfills https://savannah.gnu.org/bugs/?61243.
2021-10-07 12:38:04 +02:00
Benno Schulenberg 64c9d3c143 rcfile: remove the deprecated 'cutwordleft' and 'cutwordright' keywords 2021-10-07 12:24:38 +02:00
Benno Schulenberg 46b5f83601 tweaks: fold two lines into two others, for conciseness 2021-10-04 12:03:47 +02:00
Benno Schulenberg 6d5b16562f help: make the keystrokes ^W^Y and ^W^V work again
The keystrokes are not listed, but should work like
they do in a normal, editable buffer.

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

Bug existed since version 4.0, commit bc98dbca.
2021-10-04 11:54:02 +02:00
Benno Schulenberg 508301a2ef browser: make the keystrokes ^W^Y and ^W^V work again
The functions to_first_file() and to_last_file() can get called from
do_statusbar_input(), which is called indirectly from do_prompt(),
and are expected to make the corresponding adjustment.

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

Bug existed since version 5.0, commit 07c1ac90.
2021-10-04 11:38:30 +02:00
Hussam al-Homsi bb8f40989f tweaks: change 'return ++var;' to 'return var + 1;'
This avoids an unused and misleading assignment that might make
someone think the incremented variable will be used again.

Signed-off-by: Hussam al-Homsi <sawuare@gmail.com>
2021-10-02 17:41:03 +02:00
Benno Schulenberg fde86518ae tweaks: rename a function, to be more fitting
The file wasn't marked; a piece of text was marked, resulting in
a region, and it is this region that gets written out to a file.
2021-09-29 15:37:06 +02:00
Benno Schulenberg 61b3aa6626 tweaks: use five symbolic names, to make eight function calls clearer 2021-09-29 15:35:18 +02:00
Benno Schulenberg 6799bc69a6 tweaks: adjust three parameters -- two were mistaken, one superfluous
The calls of write_file() in do_spell() and do_formatter() write out
a temporary file -- such a file does not have an 'openfile' record,
so setting 'annotate' to TRUE was pointless.  Using the correct value
for this parameter allows dropping two conditions in write_file().

And when 'exiting' is TRUE and --save-on-exit is in effect, it is
slightly wasteful to stat() the written file and store the info in
its 'openfile' record as the buffer will be closed directly after.

So, now the only place where 'annotate' is TRUE is when writing out
the full buffer to a normally named file.
2021-09-29 15:04:22 +02:00
Benno Schulenberg 0c01227d86 tweaks: rename a parameter, to fit better what it is used for 2021-09-29 12:34:04 +02:00
Benno Schulenberg c74fd81302 tweaks: rename a parameter and invert its logic
This makes more sense (an emergency file is not a temp file) and
avoids the constant negating.
2021-09-29 12:20:21 +02:00
Benno Schulenberg 4b30cfb8f8 tweaks: rename a variable, to be more visible and to match others 2021-09-29 11:56:45 +02:00
Benno Schulenberg 36b6416a7b tweaks: reshuffle some lines and adjust some indentation 2021-09-29 11:52:23 +02:00
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 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 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 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 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 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 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 1b5d9171f2 tweaks: try chmodding a dump file only when it was actually written 2021-07-14 10:38:02 +02:00
Benno Schulenberg 50543300d9 tweaks: reshuffle some code to elide a variable, and improve a comment 2021-07-14 10:36:15 +02:00
Benno Schulenberg d9469b894f tweaks: remove a redundant feedback message
Any error message will already have been written to the terminal by
statusline().  Also, "Buffer not written to" looked too much like
"Buffer written to"; one had to look closely to see the difference.
2021-07-14 10:21:01 +02:00
Benno Schulenberg 6b9c24f7dd feedback: when not in curses mode, write error messages to the terminal
No errors ought to occur when not in curses mode, but when they *do*
occur, increase the chances that we can figure out what happened.
2021-07-14 10:16:31 +02:00
Benno Schulenberg 5954eeaff2 tweaks: reshuffle a fragment of code, to prepare for the next change 2021-07-14 10:08:32 +02:00
Benno Schulenberg c84a769733 memory: free any allocated strings, also in the emergency code path 2021-07-14 10:06:04 +02:00
Benno Schulenberg e3ef778756 files: when the buffer is nameless, include the PID in name of dump file
Make sure that when multiple nanos with nameless buffers die,
each of them tries saving those buffers to different files.

This addresses https://savannah.gnu.org/bugs/?60902.
Reported-by: Julian Rosen <julianrosen@gmail.com>
2021-07-14 10:02:44 +02:00
Benno Schulenberg 806e8e439f tweaks: reshuffle some lines to elide a variable
Having a local variable that gets assigned to just once looks rather
poor.  To me it makes more sense to have two separate exit points: one
for failure somewhere in the middle, and one for success at the end.
This way it is completely clear which value gets returned when.
2021-07-10 16:18:29 +02:00
Benno Schulenberg 30aaea2d04 tweaks: rename a variable and flip its logic, to avoid two negations
Plus, it makes more sense to start in the state "not saved" than in
the state "failed".
2021-07-10 15:56:38 +02:00