Commit Graph

7992 Commits

Author SHA1 Message Date
Benno Schulenberg
9369af77ce tweaks: elide a function that is used just once 2019-06-01 10:43:50 +02:00
Benno Schulenberg
35d2bc6b38 build: fix compilation on another system
The <signal.h> header file is needed to define 'sig_atomic_t'.
(Don't know why on my main system it compiled fine without it.)
2019-05-31 20:53:00 +02:00
Benno Schulenberg
b52d166afa tweaks: rename a type, to make more sense
The sphere, the holder, is everything *around* the partition;
it was confusing to call this holder type 'partition'.

Also correct and improve some comments.
2019-05-31 19:44:47 +02:00
Benno Schulenberg
3952dcb629 tweaks: rename a variable, reduce its scope, and use it consistently 2019-05-31 19:25:50 +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
2e81023553 tweaks: rename two variables, and reshuffle their declarations 2019-05-31 17:45:51 +02:00
Benno Schulenberg
b9f994b2c0 tweaks: elide a variable, drop a comment, and remove unneeded braces
There is no need to save, clear, and restore the mark when counting
words, lines and characters, because partitioning and unpartitioning
the buffer does not use the mark nor affect it.
2019-05-31 17:43:40 +02:00
Benno Schulenberg
e98847200e tweaks: reshuffle some lines, to reduce duplication 2019-05-31 17:42:42 +02:00
Benno Schulenberg
a77b21388a build: remove two #includes that don't seem to be needed 2019-05-31 17:16:07 +02:00
Benno Schulenberg
58ca5fb0f3 build: move an #include to where it is needed 2019-05-31 17:14:28 +02:00
Benno Schulenberg
844214b4a0 tweaks: rename two variables, to not be abbreviations
Also reshuffle two declarations.
2019-05-31 12:54:20 +02:00
Benno Schulenberg
f9dfca7d5a tweaks: rename a variable, to be shorter 2019-05-31 12:46:15 +02:00
Benno Schulenberg
fe40e8867d tweaks: rename a struct element, to be distinct
And to match the style of its sisters.
2019-05-31 12:25:15 +02:00
Benno Schulenberg
923a90cba0 tweaks: rename a type, for more contrast 2019-05-31 12:18:30 +02:00
Benno Schulenberg
5817e83e33 tweaks: be more sparing in redrawing things when exiting from help viewer
That is: don't redraw the title bar twice, don't redraw the bottom bars
twice, nor unnecessarily redraw the whole screen.
2019-05-31 10:28:23 +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
3a65c0d192 feedback: when the last line is empty, don't include it in the count
Now M-D will report 0 lines instead of 1 line for an empty buffer, and
will match the output of 'wc --lines' as long the file is a POSIX file.

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

Bug existed since before version 2.1.10.
2019-05-30 19:51:25 +02:00
Benno Schulenberg
e1c011c9a1 tweaks: rename a variable, to match the style of its brothers 2019-05-30 19:34:57 +02:00
Benno Schulenberg
477ff49f66 feedback: don't try to represent keys outside of the seven-bit range
This fixes https://savannah.gnu.org/bugs/?56415.
2019-05-30 19:06:06 +02:00
Benno Schulenberg
85eb9b9a53 tweaks: use a cheaper way to switch between buffers where possible
For this one quick switch back and forth there is no need to report
anything on the status bar nor to update colors and such.  In this
case, those things are just a waste of time.
2019-05-30 17:42:37 +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
6dc8570d55 tweaks: reshuffle a few things, partly to make two chunks more alike 2019-05-30 16:00:11 +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
5f03c20ea0 tweaks: switch to the preceding buffer in a cheaper way (when in help)
When a help-text buffer is closed while exiting from the help viewer,
the rest of the exit code takes care that the preceding buffer gets
displayed properly.  And when a help-text buffer is closed because a
SIGWINCH occurred, doing anything for the preceding buffer is a waste
of time because a new help-text buffer will be opened and displayed
instantly.
2019-05-29 19:48:42 +02:00
Benno Schulenberg
71574e7a6f tweaks: reshuffle some closing and switching to a better place
And rename the function and elide a parameter besides.
2019-05-29 19:48:42 +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
3eab405e7b help: write the text directly into a new buffer, without using a tempfile
This avoids the substantial overhead of first writing and then reading a
temporary file, and in the bargain removes two possible failure points.

This fulfills https://savannah.gnu.org/bugs/?56371.
2019-05-29 19:48:42 +02:00
Benno Schulenberg
423ed031b4 help: don't cycle through the buffers for every resizing step
Closing a buffer automatically switches to the next buffer.  But for
the help-text buffer this is not the desired behavior, so each closing
needs to be followed by a switch to the preceding buffer.

This fixes https://savannah.gnu.org/bugs/?56411.
2019-05-29 12:33:59 +02:00
Benno Schulenberg
57390cff04 tweaks: exclude another bug check from the tiny version 2019-05-29 11:24:25 +02:00
Benno Schulenberg
4e637cd1c7 tweaks: delete a now-unused function 2019-05-28 17:41:28 +02:00
Benno Schulenberg
add1159675 tweaks: don't bother checking the return value of wait()
It is not done for the external spell checker either.
2019-05-28 17:39:19 +02:00
Benno Schulenberg
dbdf38cce5 tweaks: consistently report failures to fork (and the like) as errors 2019-05-28 17:36:32 +02:00
Benno Schulenberg
47770bd321 feedback: treat statusline() being called outside of curses mode as a bug 2019-05-28 17:19:34 +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
d9deaf9f2f tweaks: reduce the scope of a variable, and let the compiler zero it
Also, rename the variable, to have a unique name.
2019-05-28 14:09:54 +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
33e1bf1435 startup: remove the now-unneeded workaround for a SIGWINCH during input
The previous commit makes that the terminal's state is only resaved
when standard input is actually reconnected to the terminal, and
leaves it unchanged otherwise.  Apparently this is enough to fix
https://savannah.gnu.org/bugs/?56394.
2019-05-28 12:19:49 +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
b53dffaeed startup: resave the terminal's state only when there were no signals
For some reason a SIGWINCH or SIGINT "corrupts" the current state of
the terminal, and magically validates the state that was saved first.

This fixes https://savannah.gnu.org/bugs/?56394 properly.
2019-05-27 19:35:46 +02:00
Benno Schulenberg
6dcfcd11ce tweaks: rename two functions, to better describe what they do 2019-05-27 17:24:35 +02:00
Benno Schulenberg
f21b094dad tweaks: condense a couple of comments, and reshuffle a line 2019-05-27 17:21:05 +02:00
Benno Schulenberg
a521ac4ae7 tweaks: exclude a bug check from the tiny version 2019-05-27 10:11:22 +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
b7e2da7434 files: don't save the state of the terminal a second time
The user will understand that changing the state of the terminal
while inputting data into nano is not the same as changing this
state before nano has started or after nano has exited.

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

Bug existed since version 2.4.2.
2019-05-26 19:16:40 +02:00