Commit Graph

1048 Commits

Author SHA1 Message Date
Benno Schulenberg
785efc2087 tweaks: make a function do a check so its calls don't need to 2019-10-09 18:58:30 +02:00
Benno Schulenberg
557ad827f9 tweaks: condense two comments, and rewrap a line 2019-10-09 14:49:42 +02:00
Benno Schulenberg
600f81cf98 tweaks: rename three variables, and reshuffle some lines 2019-10-09 14:20:29 +02:00
Benno Schulenberg
cc4ce8d83b tweaks: rename a type, to better fit the general pattern 2019-10-02 17:09:22 +02:00
Benno Schulenberg
2a4d338d97 tweaks: reshuffle a fragment, to group some toggles together 2019-10-02 15:07:04 +02:00
Benno Schulenberg
ab6390cad0 tweaks: remove two superfluous macros, as sizeof(char) is always 1 2019-09-18 15:20:08 +02:00
Benno Schulenberg
ebd9eb346d tweaks: improve a bunch of comments, and reshuffle some declarations 2019-09-17 17:38:42 +02:00
Benno Schulenberg
413116e1b5 tweaks: rename another variable, for a better fit 2019-09-17 16:46:11 +02:00
Benno Schulenberg
69a3d39bc4 tweaks: rename three variables, for more contrast 2019-09-17 16:42:53 +02:00
Benno Schulenberg
f081fa3047 tweaks: rename two variables, to better describe what they contain
The 'tilded' variable is used for two purposes: a user's home directory,
and an intermediate user name.
2019-09-17 14:26:09 +02:00
Benno Schulenberg
4383b01b9b tweaks: adjust indentation after previous change, reshuffle declarations 2019-09-17 14:11:45 +02:00
Benno Schulenberg
b901a20a06 tweaks: use an early return when there is no tilde
Also improve a comment, and use a 'while' instead of a 'for'.
2019-09-17 14:09:40 +02:00
Benno Schulenberg
63e04ac31e tweaks: make a function name unique, to not overlap with others 2019-08-09 19:34:03 +02:00
Benno Schulenberg
bbab9e2e62 tweaks: shorten two messages that translators tend to make too long 2019-06-19 19:34:19 +02:00
Benno Schulenberg
345cf5accc files: don't close a newly-created buffer when it is the only one
This fixes https://savannah.gnu.org/bugs/?56504.
Reported-by: Liu Hao <lh_mouse@126.com>

Bug existed since commit 7e422402 from two weeks ago.
2019-06-16 19:12:52 +02:00
Benno Schulenberg
ce69d5be88 tweaks: condense two comments, and normalize the whitespace of a label 2019-06-12 11:10:27 +02:00
Benno Schulenberg
3da4240229 tweaks: rename a variable, to fit a little better 2019-06-12 11:03:03 +02:00
Benno Schulenberg
43caf7bb7b tweaks: avoid an unneeded, extra stat() for temporary files 2019-06-12 10:48:03 +02:00
Benno Schulenberg
e8e30e5197 tweaks: elide an unneeded, duplicate stat() for the FIFO check 2019-06-12 10:34:53 +02:00
Benno Schulenberg
189de5ee78 files: suppress feedback when writing an emergency or temporary file
This fixes https://savannah.gnu.org/bugs/?56474.

Bug existed since commit 47770bd3 from two weeks ago.
2019-06-12 09:51:14 +02:00
Benno Schulenberg
967f581860 tweaks: adjust some whitespace and rewrap a few lines
And remove two unneeded casts.
2019-06-09 20:03:44 +02:00
Benno Schulenberg
f63fee79e3 tweaks: merge two functions, as the first is called just once 2019-06-01 11:14:21 +02:00
Benno Schulenberg
2003413989 tweaks: move a function to the file where it is used 2019-06-01 10:52:38 +02:00
Benno Schulenberg
7e9dd385f5 tweaks: elide a parameter and a return value
As 'filepart' is a global variable, there is no need to pass it around.
Just use it directly.
2019-05-31 19:00:20 +02:00
Benno Schulenberg
122cabd3ba tweaks: elide another parameter, and rename the function to match 2019-05-31 09:33:28 +02:00
Benno Schulenberg
c5d157dd9d tweaks: close a buffer differently and elide a parameter 2019-05-31 09:15:12 +02:00
Benno Schulenberg
484523b3bb tweaks: drop two checks that were made redundant by the previous commit 2019-05-30 17:18:30 +02:00
Benno Schulenberg
5a48edc9ae tweaks: reshuffle some code to the one place that needs it
The extra things that close_buffer() did are only needed and useful
when manually closing a buffer, so move them there.  The other three
calls of close_buffer() only need to get rid of the current buffer
(making the preceding buffer the new current one) and nothing else.
2019-05-30 17:09:49 +02:00
Benno Schulenberg
7e422402d5 tweaks: change a function to void, to make things more direct 2019-05-29 20:02:50 +02:00
Benno Schulenberg
821445d284 tweaks: drop some checks that were made redundant by the previous commit
And move one to a better place.
2019-05-29 19:48:42 +02:00
Benno Schulenberg
d656b0d3b9 feedback: show an appropriate message when reading a file was cut short 2019-05-28 17:06:07 +02:00
Benno Schulenberg
b75563b88e tweaks: use a symbol instead of zero to refer to standard input 2019-05-28 12:31:16 +02:00
Benno Schulenberg
d946f38a2b files: when needed, reconnect the keyboard and reenter curses mode
When after reading a file we are not in curses mode, it means we have
read data from standard input, either from the keyboard or from a pipe.
In the latter case, we first need to reconnect standard input to the tty.
And in both cases, we then need to reenter curses mode before being able
to display the number of lines that were read (or an error message).

So, move the reconnecting code from scoop_stdin() to its own function,
and call this function from read_file() when needed.

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

Bug existed since version 2.1.8 when reading from stdin was introduced.
2019-05-28 11:28:23 +02:00
Benno Schulenberg
d972c17050 build: exclude the ability to open a FIFO from the tiny version 2019-05-27 09:55:24 +02:00
Benno Schulenberg
f6e182ca72 tweaks: check in a single place for files that should not be opened 2019-05-27 09:42:41 +02:00
Benno Schulenberg
6a83bb7508 tweaks: delete a leftover 2019-05-27 09:33:36 +02:00
Benno Schulenberg
728498fde5 files: don't say "Error...: Success" when aborting after resizing
For some reason 'errno' is not EINTR but zero when a SIGINT is
produced after a SIGWINCH.
2019-05-26 19:49:23 +02:00
Brand Huntsman
05f34bbfaf files: block SIGWINCH while opening a FIFO for reading or writing
This fixes https://savannah.gnu.org/bugs/?56354.
Reported-by: Brand Huntsman <alpha@qzx.com>

Signed-off-by: Brand Huntsman <alpha@qzx.com>
2019-05-26 19:40:33 +02:00
Benno Schulenberg
308a094d8d feedback: show a more fitting message when opening a FIFO is interrupted 2019-05-26 14:17:35 +02:00
Benno Schulenberg
5757aa8a0c tweaks: reuse the install and restore functions for a signal handler 2019-05-26 13:57:29 +02:00
Benno Schulenberg
8c5b67379f tweaks: factor out the installing and restoring of the ^C signal handler
So that these two functions can be used elsewhere too.
2019-05-26 13:55:59 +02:00
Benno Schulenberg
ea11709564 files: allow to abort the reading of slow files with Ctrl+C
This addresses https://savannah.gnu.org/bugs/?44907.

Original-patch-by: Martin van Zijl <martin.vanzijl@gmail.com>
2019-05-26 13:34:38 +02:00
Benno Schulenberg
8550c6bd93 files: allow to interrupt the opening of a FIFO for writing with Ctrl+C 2019-05-26 11:45:51 +02:00
Benno Schulenberg
9a475bf2d3 speller: don't crash when the spell-checked tempfile cannot be opened
This addresses https://savannah.gnu.org/bugs/?56361.
2019-05-24 17:31:35 +02:00
Benno Schulenberg
b512e253b6 tweaks: drop an unneeded parameter from open_file()
The 'quiet' parameter is only used when opening a help-text tempfile
or a spell-checked tempfile, and these files necessarily exist, so
'quiet' will never be checked for them.  But in the weird case that
the help-text tempfile could not be opened, it is not a problem that
"New File" gets printed to the status bar because nano will crash
shortly afterwards.  And when the spell-checked tempfile could not
be opened, a "Not Found" message is appropriate, but nano will crash
in this case too.
2019-05-24 13:00:00 +02:00
Benno Schulenberg
4cacb626a0 files: allow to interrupt the opening of a FIFO with Ctrl+C
With-help-from: Brand Huntsman <alpha@qzx.com>
2019-05-24 10:51:56 +02:00
Benno Schulenberg
acd23551c3 help: don't check for confinement when opening a temporary help-text file
This fixes https://savannah.gnu.org/bugs/?56369.
2019-05-23 12:43:31 +02:00
Benno Schulenberg
d7555d071f tweaks: adjust a comment and drop two others, and reshuffle two lines 2019-05-21 19:42:08 +02:00
Benno Schulenberg
9596f7de9d tweaks: delete a now-unused function 2019-05-21 18:56:35 +02:00
Benno Schulenberg
20635b40f4 tweaks: merge two very similar functions into a single one 2019-05-21 18:56:13 +02:00