Commit Graph

8109 Commits

Author SHA1 Message Date
Benno Schulenberg
1d3a4df3b3 browser: don't show a mistaken message when exiting from help viewer
This fixes https://savannah.gnu.org/bugs/?56346.

Bug existed since version 3.0, commit 8d6b205e.
2019-05-18 19:59:54 +02:00
Benno Schulenberg
afbaf8ae2d files: give feedback while waiting for a FIFO to open up 2019-05-18 19:14:32 +02:00
Benno Schulenberg
1b2018e921 files: check for writability by the access bits, not by trying to append
Trying to append does not work on a fifo, and we'd like to be able to
open a fifo again.  Also, the append test causes a close event for the
given file at the moment of opening it, which makes using 'inotify' for
waiting for this file to be closed useless.

Commit f8f90272 added the append test, but the original request
(https://lists.gnu.org/archive/html/info-nano/2009-05/msg00000.html
by Damien Joldersma) asked only for a warning when the user did not
have enough privileges to write to the file.

So, drop the append test and just check the access bits.

This fixes https://bugs.debian.org/583196
and fixes https://savannah.gnu.org/bugs/?29312.
2019-05-18 19:13:42 +02:00
Benno Schulenberg
26642a39c3 files: allow a given file to be a special file but not a directory
The original requests (https://bugs.debian.org/551717 by Paul Wise,
and https://savannah.gnu.org/bugs/?45383 by Mike Frysinger) asked
only that specifying a directory instead of a file name should not
open a new buffer.  But commit 98ffb642 excluded everything that was
not a normal file.  This avoids a hang when the user accidentally
tries to open a pipe or a socket, but also prevents any user from
doing so on purpose.  And opening a fifo can be useful when wanting
to handle sensitive data that shouldn't be stored on disk.

This prepares the fix for https://bugs.debian.org/583196.
2019-05-18 17:24:13 +02:00
Benno Schulenberg
8723375443 tweaks: remove a superfluous and ineffective assignment
This assignment became superfluous two years ago, by David's revamping
of read_file() in commit 86f7bc18.
2019-05-18 17:21:54 +02:00
Benno Schulenberg
82aea04c79 bindings: at a Yes-No prompt, accept also ^Y for "Yes"
For symmetry with ^N for "No".

Suggested-by: Brand Huntsman <alpha@qzx.com>
2019-05-17 11:39:40 +02:00
Benno Schulenberg
341601e1a2 bindings: at a Yes-No prompt, accept also ^N and ^Q for "No"
When wanting to exit after having modified a buffer by mistake, I don't
want to politely answer a question by typing precisely an unmodified N,
I want to give a command: ^N, meaning *No!*.  Or seen another way: I
don't want to be obliged to let go of the Ctrl key before typing N.

When at startup --tempfile was used, the user can discard a modified
buffer with ^O ^Q.  It would be nice when (without --tempfile) ^X ^Q
would work too.
2019-05-17 11:31:59 +02:00
Benno Schulenberg
368f1a1c9d tweaks: elide a function that is called in just one place
Since commit b5f15cb5 from a year ago, there remains just one call
of initialize_buffer_text().
2019-05-16 16:16:52 +02:00
Benno Schulenberg
527c6c1ca0 tweaks: reshuffle a few lines, to be more straightforward 2019-05-16 16:04:12 +02:00
Benno Schulenberg
a9e8f88e77 tweaks: enforce the miminum amount of scrolling in a simpler way
This improves the fix for https://savannah.gnu.org/bugs/?56317.
2019-05-16 16:00:42 +02:00
Benno Schulenberg
0cbf1f4027 help: don't show Alt+Left and Alt+Right when running on a Linux console
On a VT, <Alt+Left> and <Alt+Right> switch between VTs and nano
does not receive those keystrokes.
2019-05-13 13:01:10 +02:00
Benno Schulenberg
96baa70cc8 tweaks: reshuffle a couple of lines and adjust a few comments
Also, compute the required space for the keystrokes more tightly:
most of those characters are plain ASCII, so that means 17 bytes
for 17 cells, and at most one of those characters is a three-byte
arrow, which means 2 bytes extra.  Adding the two newlines at the
end, the needed room besides the description is 21 bytes.
2019-05-13 12:25:39 +02:00
Benno Schulenberg
b18e2129ce bindings: bind the Alt+arrow keystrokes also in non-UTF-8 locales
Fall back to using the words "Left", "Right", "Up", and "Down",
instead of graphical arrows.

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

Bug was left to exist since the Alt+arrow keys were introduced,
in version 2.8.7, commit 1cc030f7.
2019-05-13 11:35:15 +02:00
Benno Schulenberg
e26cbdd6cd help: make the column for the first keystroke a little wider
To make room for the "M-Right" that is coming in the next commit --
seven characters are needed instead of six.
2019-05-13 11:07:21 +02:00
Benno Schulenberg
0ebfd54e17 softwrap: use smooth scrolling when softwrapping is toggled on
If the cursor is near the bottom row when softwrap gets switched on, the
screen should scroll just the amount needed to keep the cursor onscreen.

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

Bug existed since softwrapping was introduced in version 2.1.11.
2019-05-13 10:25:12 +02:00
Benno Schulenberg
8f1cd50f1e syntax: python: avoid miscoloring stuff between two empty strings
The quotes of an empty string ('' or "") should be colored just like
those of a non-empty string, because otherwise the text *between* two
empty strings on the same line gets colored.

Add an extra rule to discolor triple quotes again to not make them
look like valid by themselves.

Also, remove six superfluous backslashes.

This addresses https://savannah.gnu.org/patch/?9801.
Reported-by: Ryan Westlund <rlwestlund@gmail.com>
2019-05-11 19:05:45 +02:00
Benno Schulenberg
4fb9f298c9 tweaks: adjust some indentation after the previous change
Also reshuffle some arguments.
2019-05-08 19:35:42 +02:00
Benno Schulenberg
c338d86843 tweaks: rename some single-letter variables to the same significant word
And simply elide one of those variables.
2019-05-08 19:35:03 +02:00
Benno Schulenberg
247dd8f052 tweaks: rename a variable, reshuffle declarations, and drop an assert 2019-05-08 15:34:06 +02:00
Benno Schulenberg
71d0847b19 tweaks: merge two functions, as the one is used only by the other 2019-05-08 15:25:11 +02:00
Benno Schulenberg
c55d144748 tweaks: drop most of the remaining debugging code, and some timing code 2019-05-08 15:23:36 +02:00
Benno Schulenberg
da91a44f9e tweaks: reshuffle two #ifdefs, to avoid an unpaired brace 2019-05-08 13:56:02 +02:00
Benno Schulenberg
02d3a2c0fb tweaks: remove some unneeded braces, and reshuffle for more symmetry 2019-05-06 11:20:31 +02:00
Benno Schulenberg
5764619655 search: stay in the Search menu when trying to Replace in view mode
This fixes https://savannah.gnu.org/bugs/?56274.

Bug existed since version 3.1, commit 6cd53e7f.
2019-05-06 11:08:22 +02:00
Benno Schulenberg
3c959fd038 tweaks: drop a useless tidying-up call, as spelling does not use regexes
The integrated spell checker does not use regular expressions, and
'refresh_needed' is set to TRUE anyway, so the tidy_up_after_search()
call there is effectively a no-op.
2019-05-06 10:57:45 +02:00
Benno Schulenberg
f0bc94fd02 tweaks: move the tyding-up-after-a-search to a single exit point 2019-05-06 10:29:45 +02:00
Benno Schulenberg
8720cfcce9 tweaks: rename two more functions, to be simpler too 2019-05-04 11:21:45 +02:00
Benno Schulenberg
954c4d03ac tweaks: rename two functions, to be simpler 2019-05-04 11:21:45 +02:00
Benno Schulenberg
edf6995be4 zapping: use the 'keep_cutbuffer' logic to keep undo items apart
The 'keep_cutbuffer' variable becomes FALSE whenever there is cursor
movement or there was a marked region.  Use this variable to simplify
the condition for creating a new ZAP undo item.  But then typing the
'zap' shortcut should not cause the variable to be set to FALSE.

This fixes the first part of https://savannah.gnu.org/bugs/?56261.

Bug existed since zapping was introduced, in version 3.2.
2019-05-04 11:18:51 +02:00
Benno Schulenberg
b50d5758ef zapping: disjoin a zap command from earlier ones when the mark is set
This fixes the third part of https://savannah.gnu.org/bugs/?56261.

Bug existed since zapping was introduced, in version 3.2.
2019-05-03 12:58:17 +02:00
Benno Schulenberg
6c4d0d87f0 tweaks: remove a condition that has become superfluous
After the previous change, a copy command will break a chain of cut
commands, so there is no need any more to verify that the line number
hasn't changed.
2019-05-03 12:41:49 +02:00
Benno Schulenberg
a962bceca6 copying: let a copy command break a chain of cut or zap commands
This fixes the second part of https://savannah.gnu.org/bugs/?56261.

Bug existed since zapping was introduced, in version 3.2.
2019-05-03 12:33:42 +02:00
Benno Schulenberg
e0c5c589ad tweaks: remove a superfluous condition, in three places
When 'last_action' has a specific value, then necessarily there must
exist a corresponding current undo item.

(The condition is already absent in do_deletion(), for the BACK and DEL
undo items, and it works fine there.)
2019-05-03 12:18:04 +02:00
Benno Schulenberg
dfe87540c6 syntax: po: colorize also escaped hex and octal codes 2019-05-03 12:12:44 +02:00
Benno Schulenberg
6c4f228f6f tweaks: invert two conditions, in order to elide an extra variable 2019-05-02 14:34:05 +02:00
Benno Schulenberg
fe06ae5f48 tweaks: normalize the indentation after the previous two changes 2019-05-02 14:27:35 +02:00
Benno Schulenberg
07289f437f tweaks: invert a condition, in order to return earlier 2019-05-02 14:12:23 +02:00
Benno Schulenberg
99d155d80f tweaks: reshuffle an assignment, to be able to return earlier 2019-05-02 14:10:23 +02:00
Benno Schulenberg
3346c5395e tweaks: place a function better, and reduce some comments to a single one 2019-05-02 10:17:10 +02:00
Benno Schulenberg
083218aca5 tweaks: rename two parameters, to differentiate them from function names 2019-05-02 10:17:04 +02:00
Benno Schulenberg
fd3b3bc1d6 cutting: clear the cutbuffer when the previous operation was copying
The cut and copy operations (^K and M-6) are different operations and
one should not add to the cutbuffer created by the other.

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

Bug existed since version 3.0, commit 71f85937.
2019-05-02 09:27:37 +02:00
Benno Schulenberg
9bc6bc83c0 tweaks: rename two variables, for more contrast 2019-05-01 19:14:06 +02:00
Benno Schulenberg
d4468b2def tweaks: condense a comment and reshuffle a couple of lines 2019-05-01 19:10:56 +02:00
Benno Schulenberg
404a6862cd tweaks: really don't bother renumbering the lines in the cutbuffer
The lines from the cutbuffer will be renumbered when it matters: when
they get pasted.

The only place that used the numbering of (a copy of) the cutbuffer
(the updating of an undo item) already iterates through its lines.
Just add a counter there instead of making use of the line numbers.
2019-05-01 13:09:22 +02:00
Benno Schulenberg
85fc41470b tweaks: stop passing 'cutbuffer' and 'cutbottom' back and forth
All extractions are done into the cutbuffer, so it is pointless to pass
'cutbuffer' and 'cutbottom' in and back out as parameters all the time.
Just use those global variables directly.

Also, rename the function as there is no longer a buffer among its
parameters.
2019-05-01 11:33:37 +02:00
Benno Schulenberg
2b9dd6c574 tweaks: don't bother saving and restoring 'cutbottom' all the time
The 'cutbottom' variable is only ever used when cutting or copying
consecutive lines: for appending the current line to the already
existing lines in the cutbuffer.  As soon as some other operation
is performed, 'cutbottom' becomes irrelevant, it could be set to
anything, it doesn't matter: the pasting of the cutbuffer does not
use the value of 'cutbottom', nor does any other operation.
2019-05-01 11:19:14 +02:00
Benno Schulenberg
9e44a53be7 copying: scroll just one line when M-6 is pressed on the bottom row
This fixes https://savannah.gnu.org/bugs/?56249.

Bug existed since version 2.6.0, commit 318ed6b1.
2019-04-30 19:31:44 +02:00
Benno Schulenberg
0c561f0325 copying: make M-6 do nothing when at end of buffer 2019-04-30 19:03:18 +02:00
Benno Schulenberg
e5831f81bb tweaks: rename two variables, to be less cryptic 2019-04-30 18:41:05 +02:00
Benno Schulenberg
fa21986ecf oops: apparently the line numbers in the cutbuffer do matter
The line numbers don't matter for the cutbuffer itself, but they matter
for the copy of the cutbuffer that is stored in an undo item.

This reverts commit 14140d52 from two hours ago.

This fixes https://savannah.gnu.org/bugs/?56245.
2019-04-30 12:49:57 +02:00