Commit Graph

366 Commits (3d6dcb956804d3e9e5ed12597596478180c35afb)

Author SHA1 Message Date
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 3c35538e8b tweaks: add Schiermonnikoog to the list of friendly islands
(The commit message is a joke, of course.  Instead, this commit just
removes some unneeded comments and corrects one bit of whitespace.)
2021-06-16 11:19:23 +02:00
Benno Schulenberg d7e3226158 memory: move the correct number of bytes, and not one too many
We want to reduce the size of the answer by one byte,
not keep the full answer (plus terminating NUL).

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

Bug existed since version 2.9.8, commit f304b9ae,
since piping text to an external command was introduced.
2021-06-10 11:34:04 +02:00
Benno Schulenberg 73067e0e16 build: include a workaround only for versions of ncurses that need it
The cursor-misplacement bug has been fixed in ncurses-6.2-20210220:

  https://lists.gnu.org/archive/html/bug-ncurses/2021-02/msg00010.html

See also https://savannah.gnu.org/bugs/?59808.
2021-02-21 12:00:28 +01:00
Benno Schulenberg 6360e4170a copyright: update the years for the FSF 2021-01-11 14:22:51 +01:00
Benno Schulenberg c53da9aa5b tweaks: fold some conditions into bitwise masks, for efficiency 2021-01-05 11:49:03 +01:00
Benno Schulenberg e7a420eca7 prompt: suppress the ">" character always when exactly at the right edge
When the tail of the answer still fits exactly on the screen, the ">"
continuation character should not be shown -- also when the start of
the answer is "scrolled off" to the left.

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

Bug existed in this form since version 4.0, commit 56181896.
2021-01-04 15:39:29 +01:00
Benno Schulenberg 1236341746 tweaks: reshuffle a condition, to probably avoid an unneeded calculation
Also frob three comments.
2021-01-04 11:37:47 +01:00
Benno Schulenberg c96c343fac tweaks: avoid computing the cursor column twice, and the "page" too 2021-01-04 11:31:07 +01:00
Benno Schulenberg 02f1fec497 prompt: restore a workaround for a cursor misplacement bug in ncurses
When making small movements in the lower right corner, ncurses can
get confused about where the cursor actually is -- a double-width
character seems to throw its calculations off.

This addresses https://savannah.gnu.org/bugs/?59808.

Bug existed since version 5.4, commit 39705c60.
2021-01-03 13:52:31 +01:00
Benno Schulenberg b87d7f69fc options: accept 'set promptcolor' for setting the color of the prompt bar
When it is not specified, it defaults to the value for 'titlecolor'.
2020-12-06 16:34:42 +01:00
Benno Schulenberg a4675acdba copyright: update to the current year for significantly changed files 2020-11-30 12:01:47 +01:00
Benno Schulenberg 39705c60df weeding: remove a workaround for VTE that is not needed
It was only ever needed when the user lied about the size
of the terminal, which should be considered a user error.

It was a workaround for https://savannah.gnu.org/bugs/?48852.
2020-11-26 20:09:23 +01:00
Benno Schulenberg 5918ca6cab tweaks: normalize the formatting after the previous two changes 2020-11-17 10:28:28 +01:00
Benno Schulenberg dc907bfe43 prompt: skip over combining characters also when editing a search string 2020-11-17 10:27:47 +01:00
Hussam al-Homsi c87bc1d55f tweaks: stop casting the return of malloc() and friends
Those casts are redundant, and sometimes ugly.  And as the types of
variables are extremely unlikely to change any more at this point,
the protection they offer against miscompilations is moot.

Signed-off-by: Hussam al-Homsi <sawuare@gmail.com>
2020-08-31 12:17:27 +02:00
Benno Schulenberg 8e226a9f28 verbatim: do not report "Invalid code" when the terminal is resized
During verbatim input at most four integers are produced (the longest
possible unicode sequence), so use the value 999 to indicate a special
condition (a screen resize) that should not enter anything into the
buffer AND should not produce any error message or beep.

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

Bug existed since version 5.0, commit 5899181a.
2020-08-10 11:42:09 +02:00
Benno Schulenberg 4ec96f9f2e tweaks: reshuffle a few lines, to condense the code, and improve comment 2020-08-10 07:53:41 +02:00
Benno Schulenberg 5899181a31 verbatim: show an error message when an invalid Unicode code is entered
The codes from (for example) U+D800 to U+DFFF are invalid.  If any
such invalid code is entered at the Unicode Input prompt, nano should
not act as if the code was accepted and inserted into the buffer, and
should certainly not mark the buffer as Modified.

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

Bug existed since version 4.9, commit b3faf353.
2020-07-06 16:47:23 +02:00
Benno Schulenberg 7fa6e95ce1 tweaks: avoid a function call when a simple boolean will do 2020-06-26 19:44:19 +02:00
Benno Schulenberg 8bce70e038 tweaks: rename a variable, to better describe what it holds 2020-06-26 19:27:28 +02:00
Benno Schulenberg 0f843b007a tweaks: avoid an unnecessary refresh for zero or just one completion 2020-06-23 08:28:47 +02:00
Benno Schulenberg ff11ab6b66 files: list possible completions after just one <Tab> instead of two
This gives quicker feedback, and spares the user unnecessary beeps
and typing.  Also, now a beep after a <Tab> means just one thing:
there are NO completions.

This fulfills https://savannah.gnu.org/bugs/?58627.
2020-06-23 08:28:47 +02:00
Benno Schulenberg b086d0bad0 tweaks: elide another parameter, relevant in just three menus
The parameter was referenced in just one place.  So, simply check for
the three relevant menus (and unrestricted mode) and be done with it.

This also has the pleasant effect that the menu name is now the first
parameter of do_prompt(), thus clearly indicating what prompt it is,
instead of having an opaque TRUE or FALSE value at the beginning.
2020-06-20 17:19:23 +02:00
Benno Schulenberg 90f6342fd1 tweaks: rename two header files, to be distinct and not an abbreviation 2020-06-20 12:09:31 +02:00
Benno Schulenberg 499b926b74 tweaks: elide a parameter that is relevant for only one menu (Goto Dir)
Instead of burdening seven other calls of do_prompt() with a useless
parameter, just check for MGOTODIR in the appropriate place.  It also
saves having to pass the parameter down through three more functions.
2020-06-19 10:55:28 +02:00
Benno Schulenberg 287718cf8b tweaks: rename two parameters, to be more fitting 2020-06-18 19:12:11 +02:00
Benno Schulenberg 9faa95450b tweaks: rename two functions, and rename and reshuffle a parameter
Also, drop an unneeded nulling: the function copy_of() already
NUL-terminates the copied string.
2020-06-18 17:24:18 +02:00
Benno Schulenberg d8249917c3 bindings: allow toggling the help lines at several prompts and in browser
Now the help lines can be toggled not only while editing, but also at
the Read (^R), Write (^O), Execute (^T), Search (^W), Replace (M-R),
Goto (^/), and Yesno prompts, and also in the file browser and when
searching for a file name.  The help lines cannot be toggled in the
help viewer, nor when searching in a help text, nor in the linter,
as these three things force the help lines to be on.

Furthermore, the 'nohelp' function can be rebound in all relevant
menus (default binding: M-X).

This fulfills https://savannah.gnu.org/bugs/?58471.
2020-06-18 15:36:10 +02:00
Benno Schulenberg d729edaeda bindings: make ^L (Refresh) work at all the prompts too
(Unfortunately, this means that ^L cannot be used for the
Linter in the "Execute Command" menu.)

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

Bug existed since around version 2.1.0.
2020-06-04 09:10:48 +02:00
Benno Schulenberg 2c5045bfce feedback: skip wiping the prompt bar when the shortcut printed a message
When, at a prompt, the user chose a function shortcut instead of typing
an answer, and this function printed some message to the status bar,
then we do not want to wipe this message.  Also: the message overwrote
and cleared the prompt bar, so there is no need to wipe the latter.

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

Bug existed since version 4.0, since justifying started giving feedback
(or rather since version 4.1, since M-J no longer crashed).
2020-05-22 12:12:36 +02:00
Benno Schulenberg b72f3b10ba prompt: at Yes-No, do not treat a screen resize as an invalid keystroke
Commit 12cf1c99 added a beep() for every invalid keystroke at the
Yes-No prompt, but overlooked that KEY_WINCH is not invalid.

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

Bug existed since version 4.8, commit 12cf1c99.
2020-05-21 09:50:13 +02:00
Benno Schulenberg 4ce2e146ea tweaks: elide three unneeded #defines
Backspace and Tab and Carriage Return have standard backslash escapes.
2020-03-19 14:40:51 +01:00
Benno Schulenberg f6dedf3598 tweaks: rename another function, to remove the obscuring abbreviation 2020-03-12 15:54:19 +01:00
Benno Schulenberg dd6f129c3c tweaks: rename two functions, for shortness 2020-03-11 19:43:03 +01:00
Benno Schulenberg a65982bffb tweaks: relocate eleven functions to before they are called 2020-02-14 19:10:21 +01:00
Benno Schulenberg 6b8f446b52 tweaks: rename a constant, and rename and relocate a function 2020-02-14 19:00:16 +01:00
Benno Schulenberg 2b97d6563d tweaks: correct a typo, improve two indentations, and rewrap a line 2020-02-14 16:03:15 +01:00
Benno Schulenberg 68ca1732b8 prompt: insert a burst of bytes in one go instead of characterwise
There is no need to count characters, so just insert the whole batch
of bytes at once.
2020-02-13 14:42:47 +01:00
Benno Schulenberg 75f4309c1f tweaks: rename four parameters, to be more distinct and telling 2020-02-13 14:22:40 +01:00
Benno Schulenberg 78767b583d tweaks: elide an intermediate copy of a character during injection, twice 2020-02-13 14:22:23 +01:00
Benno Schulenberg 2b27df6733 tweaks: convert integers to bytes in one place instead of two 2020-02-12 17:16:27 +01:00
Benno Schulenberg f012d54a1d tweaks: make prompt-bar input more similar to edit-buffer input
In preparation for the next commit.
2020-02-12 16:59:48 +01:00
Benno Schulenberg 61dc2cab0b tweaks: rename two variables, and frob four comments 2020-02-12 16:20:20 +01:00
Benno Schulenberg 070ccf4a5b tweaks: rename two variables, and reshuffle a few things 2020-02-12 14:28:07 +01:00
Benno Schulenberg 71daa1ef6b tweaks: update several comments after the previous changes 2020-02-12 12:05:52 +01:00
Benno Schulenberg 0ed62e84de tweaks: weld two fragments together, twice, by eliding an unneeded 'if'
The get_kbinput() routine will never return ERR, so there is no need
to check for that.
2020-02-12 11:46:15 +01:00
Benno Schulenberg 0a31a9aa38 tweaks: make two conditions more direct, and thus elide two functions
Using straightforward comparisons is clearer and faster and shorter.

Again, note that this does not filter out 0x7F (DEL).  But that is
okay, as that code will never be returned from get_kbinput().
2020-02-12 11:38:33 +01:00
Benno Schulenberg 6747142cd7 tweaks: remove some redundant filtering, and thus elide a parameter
The few calls of the injection routines that had 'filtering' set to
TRUE have already filtered out ASCII control codes earlier on.  And
in the case of injecting a completion, this completion only contains
word-forming characters -- and if the user somehow added a control
code to the word-forming characters, then nano should NOT filter it
out, so in fact that setting of 'filtering' to TRUE was mistaken.

Note that this filtering did not filter out 0x7F (DEL).  But that is
fine: it should not occur in the input stream at that point anyway,
as it gets translated to either KEY_DC or KEY_BACKSPACE earlier in
the keyboard parsing routines.
2020-02-12 11:12:34 +01:00