Commit Graph

5384 Commits

Author SHA1 Message Date
Benno Schulenberg
f813fd0f4d rcfile: allow binding also F17...F24
For historical reasons the rebinding code allows binding F13...F16,
which on most terminals are typable with Shift plus F1...F4.  But,
at least on an Xfce Terminal, Shift plus F1...F12 produce F13...F24.
On a Linux console, Shift plus F1...F8 produce F13...F20.  So: allow
to bind the full shifted F13...F24 range.  It costs no extra code
and makes things more rounded.
2019-10-07 16:23:40 +02:00
Benno Schulenberg
ff0e01a69e bindings: don't hard-bind ^H in the help viewer or the file browser
Hard-binding the ^H control code prevents the user from rebinding
the keystroke.

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

Bug existed since version 4.0, commit 72a49dbb.
2019-10-05 12:43:46 +02:00
Benno Schulenberg
b480e7fc9c tweaks: remove some timing code that has served its purpose 2019-10-03 19:00:50 +02:00
Benno Schulenberg
3e33d1eba6 tweaks: rewrap a line, reshuffle a declaration, and improve some comments 2019-10-03 17:22:55 +02:00
Benno Schulenberg
31ff7ead73 tweaks: move a function to before its callers and next to its kind
Also, improve the indentation of two random lines.
2019-10-03 11:24:01 +02:00
Benno Schulenberg
5398d986ef tweaks: speed up determining the width of plain ASCII characters 2019-10-03 11:09:21 +02:00
Benno Schulenberg
b02dccc51f tweaks: elide a function from a non-UTF8 build
In a non-UTF8 build, mbwidth() returns always 1, so it is pointless
to call that function and compare its result to zero then.

Also, don't bother special-casing the function for a non-UTF8 locale.
2019-10-03 10:48:10 +02:00
Benno Schulenberg
3158133edd tweaks: rename three variables, for contrast and more sense 2019-10-03 10:12:30 +02:00
Benno Schulenberg
acf50ae26d tweaks: improve a handful of comments, and reduce the needed padding
Reshuffle a few struct elements so they will require less padding.
2019-10-02 19:33:03 +02:00
Benno Schulenberg
01b840890d tweaks: rename another type, again to better fit the general pattern 2019-10-02 19:32:41 +02:00
Benno Schulenberg
9bd60e7d5d tweaks: frob a few comments 2019-10-02 17:46:20 +02:00
Benno Schulenberg
c5e46101b1 tweaks: reshuffle some lines, to elide an unneeded assignment 2019-10-02 17:39:45 +02:00
Benno Schulenberg
53b77cb4c6 tweaks: rename another type, to also better fit the general pattern 2019-10-02 17:18:51 +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
23c8ef70aa tweaks: reshuffle some lines, to have the same order as elsewhere 2019-10-02 15:20:49 +02:00
Benno Schulenberg
2a4d338d97 tweaks: reshuffle a fragment, to group some toggles together 2019-10-02 15:07:04 +02:00
Benno Schulenberg
9c202198a3 tweaks: simplify a calculation, as done elsewhere 2019-10-01 15:03:40 +02:00
Benno Schulenberg
c8dc67717b tweaks: mark as 'const' a parameter that takes fixed strings [coverity] 2019-10-01 15:02:08 +02:00
Benno Schulenberg
4df2f81295 tweaks: avoid recomputing a maximum value every time round the loop 2019-10-01 13:28:50 +02:00
Benno Schulenberg
78def852d1 mouse: make the clickable width of menu items more consistent
When there are fewer than four menu items, act as if there are four:
make their clickable width half the width of the screen.

Until now, when there were two menu items, their clickable width would
be the full width of the screen, which was overwide.  But when there
was just one menu item, its clickable width would suddenly be as small
as when the menu had the maximum number of items (12 for an 80-column
screen).  This was odd.

Also, slightly simplify another computation.
2019-10-01 12:46:31 +02:00
Benno Schulenberg
a4933873c9 tweaks: avoid leaking memory when finding an invalid string [coverity] 2019-09-30 19:42:27 +02:00
Benno Schulenberg
1861052234 tweaks: avoid a comparison between signed and unsigned [coverity] 2019-09-30 19:30:54 +02:00
Benno Schulenberg
2307b31887 tweaks: use 'void' in prototypes of parameterless functions [coverity] 2019-09-30 19:06:25 +02:00
Benno Schulenberg
e0d9b7a8af tweaks: add a translator hint, and correct two others 2019-09-29 15:08:57 +02:00
Benno Schulenberg
b3ace4d8f6 tweaks: don't burden all menus with something meant for the WriteOut menu
The first_sc_for() function is somewhat costly, so avoid calling it
when it is not necessary.

Most menus have either so many entries that unbinding some keys does
not reduce the number of shown entries, or they have so few entries
that each entry already has space enough and will not profit from
having more room available.  But the WriteOut menu is an edge case.
Most translators don't use --tempfile and translate the key tags for
the WriteOut menu making use of all 17 positions that are available
for each of them.  This makes that when --tempfile is used, some of
those tags get truncated.  This is not so bad, because --tempfile is
normally not used.  But when it isn't used (when the discardbuffer
function isn't bound), the WriteOut menu should make full use of the
available width to avoid truncating any translated tags.
2019-09-29 13:27:03 +02:00
Benno Schulenberg
5103bfe6b8 bindings: add a dedicated keycode for <Tab> for when a region is marked
In this way the keycode cannot be unbound from the 'indent' function,
so pressing <Tab> on a marked region will always indent the region.

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

Bug existed since the "tabbing" of a marked region was introduced,
in version 2.9.2, commit 09958ebd.
2019-09-28 12:39:42 +02:00
Benno Schulenberg
cfd17f5722 tweaks: speed up the counting of the menu entries to be shown
Instead of first counting all available entries and then capping it
at MAIN_VISIBLE, simply stop counting when MAIN_VISIBLE is reached.
2019-09-28 12:03:02 +02:00
Benno Schulenberg
43235c2f16 tweaks: rename a function, to be a bit more fitting 2019-09-27 19:07:25 +02:00
Benno Schulenberg
b14ad451a9 tweaks: rename two variables, away from single letters 2019-09-27 18:53:44 +02:00
Benno Schulenberg
cd00d0975e tweaks: move a fragment of common code into the appropriate function 2019-09-27 18:49:39 +02:00
Benno Schulenberg
40f6dbc34e tweaks: move two functions to after the ones that they call 2019-09-27 18:41:22 +02:00
Benno Schulenberg
a9fb56a8c9 tweaks: move a function to a better file, to be amongst its kind 2019-09-27 17:43:28 +02:00
Benno Schulenberg
3644d51b97 new feature: a 'tabgives' command to define what the Tab key produces
The 'tabgives' command is syntax-specific and should be followed by a
string containing the character(s) that a single press of the <Tab> key
should produce -- most likely a single TAB or a small bunch of spaces,
but any string is allowed.  This overrides the 'tabstospaces' option.

When one wants to make sure <Tab> inserts always four spaces and never
a TAB when editing a Python file, one could add to one's nanorc:

  extendsyntax python tabgives "    "

where there are four spaces between the quotes.  And when one wants
to ensure, when editing a Makefile, that <Tab> always inserts a TAB
and never spaces, independent of what tabstospaces is set to, one
could add to one's nanorc:

  extendsyntax makefile tabgives "	"

where there is a literal TAB character between the quotes.

This fulfills https://savannah.gnu.org/bugs/?53661,
Requested-by: Andrew Pennebaker <andrew.pennebaker@gmail.com>
And addresses https://savannah.gnu.org/bugs/?54760.
Requested-by: Henry van Megen <hvanmegen@gmail.com>
And addresses part of https://savannah.gnu.org/bugs/?54775.
Requested-by: Dirkjan Ochtman <dirkjan@ochtman.nl>
2019-09-25 19:35:07 +02:00
Benno Schulenberg
591d3170aa tweaks: add some translator hints, be more precise on permissible length 2019-09-24 17:15:42 +02:00
Benno Schulenberg
b5eda7f812 tweaks: reshuffle two fragments, to group things better 2019-09-23 13:03:52 +02:00
Benno Schulenberg
4d44b03fc8 tweaks: rename a variable, to be more compact 2019-09-22 17:38:22 +02:00
Benno Schulenberg
2d16c27820 tweaks: add two hints for translators, to try and help avoid mistakes 2019-09-22 17:31:27 +02:00
Benno Schulenberg
ad65b79ac7 usage: mark the -J/--guidestripe option plus argument as translatable
This fixes https://savannah.gnu.org/bugs/?56930.

Bug existed since the vertical guiding bar was introduced,
in version 4.0, commit 66c6eb51.
2019-09-21 19:50:55 +02:00
Benno Schulenberg
fe5bd8cdef usage: properly align --help output also when it has accented characters
As printf() is not UTF8-aware, we have to determine ourselves how many
columns each short and long flag take up and add the required number of
spaces (not tabs, because their size is not fixed) to fill things up.

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

Bug existed since version 4.3, commit 2f169107.
2019-09-21 19:31:48 +02:00
Benno Schulenberg
c848ec3d53 tweaks: elide two multiplications with something that is always 1 2019-09-18 15:25:42 +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
48124fdba4 tweaks: use a more effecient way to skip storing an empty file name
Position history refers only to actual files, so when the filename
is blank...  there is nothing that needs to be remembered.
2019-09-18 14:18:48 +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
d6e05d8376 tweaks: simplify the determination of a canonical path
Suggested-by: Brand Huntsman <alpha@qzx.com>
2019-09-17 13:32:15 +02:00
Benno Schulenberg
21e307e820 tweaks: rename a variable, normalize a comment, and reshuffle a free() 2019-09-16 17:25:47 +02:00