Commit Graph

829 Commits (27127853dbf7cfc83cd2690445cae953c1a73989)

Author SHA1 Message Date
Benno Schulenberg 6896d8df47 tweaks: reduce the scope of two constants and of four variables 2020-01-14 10:35:54 +01:00
Benno Schulenberg 99f0265d34 tweaks: condense a fragment of code 2020-01-12 12:32:20 +01:00
Brand Huntsman f705a9674b input: recognize the start and stop sequences of a bracketed paste
Also, tell the terminal to switch on bracketed-paste mode, and toggle
a boolean when the start and stop sequences of such a paste are seen.
This boolean can later be used to suppress auto-indent and such.

Signed-off-by: Brand Huntsman <alpha@qzx.com>
2020-01-12 11:18:51 +01:00
Benno Schulenberg 5a98a51173 bindings: do not show the Full-Justify keystroke when in View mode
The file may not be modified when in View mode, so it makes no sense
to prominently show the M-J keystroke in the Search menu when in that
mode, especially since the keystroke does not really belong there.

This addresses https://savannah.gnu.org/bugs/?57574.
2020-01-10 17:24:29 +01:00
Benno Schulenberg 413b9cb774 tweaks: rename a function, to get rid of a useless suffix 2019-12-15 19:47:05 +01:00
Benno Schulenberg 4e8afb2877 tweaks: drop M-Space and ^Space from the browser's key list
The 'prevword' and 'nextword' functions do not exist in the browser.

The mistake was made in commit a8c13d79 from five years ago.
2019-12-13 19:29:15 +01:00
Benno Schulenberg a7e11495bd tweaks: move three functions to the file where they are used
Also move the corresponding two arrays.
2019-12-13 18:57:42 +01:00
Benno Schulenberg 2a73b4a050 tweaks: reshuffle a fragment of code, for efficiency
First comparing each keystring that starts with "^" against "^Space"
was a waste of time when only one out of fifty such strings actually
is "^Space".
2019-12-12 19:00:52 +01:00
Benno Schulenberg ef7c78910c tweaks: reshuffle a few lines, for brevity or speed or consistency
Also, don't compare case-insensitively where it is not needed.
2019-12-12 12:34:56 +01:00
Benno Schulenberg 772f1029e5 tweaks: avoid using strlen() where it is not needed 2019-12-12 12:14:38 +01:00
Benno Schulenberg 3251a216cd tweaks: unwrap a few lines, and move some strings to among their peers 2019-12-12 11:41:04 +01:00
Benno Schulenberg 2a97cb9f41 bindings: allow to rebind ^/, even though it is synonymous with ^_
This fixes https://savannah.gnu.org/bugs/?57302.
Reported-by: Tiago Almeida <tjamadeira@gmail.com>
2019-11-26 19:25:24 +01:00
Benno Schulenberg 3ffefbfddc build: fix compilation for --enable-tiny --enable-histories 2019-11-25 19:17:41 +01:00
Benno Schulenberg 4aa1678f3b bindings: the 'all' keyword should encompass the browser menu too
This fixes https://savannah.gnu.org/bugs/?57280.
Reported-by: Tiago Almeida <tjamadeira@gmail.com>

Bug existed since version 3.2, commit cc01bc3e.
2019-11-22 12:44:28 +01:00
Benno Schulenberg 4281b6becb commands: rename 'fixer' to 'formatter', to be less misleading
The word "fixer" sounds too much as if the command would be able
to fix mistakes or correct errors.  Especially when seen next to
"linter", it sounds as if one does a syntax check and the other
fixes the found mistakes.  (Although the command might in theory
be used for this, it is not its intended purpose.)
2019-10-25 17:24:28 +02:00
Benno Schulenberg 95ae124891 history: don't wait when there is something wrong with the history files
Do not wait for the user to press a key when there is some problem
with any of the history files.  Just start and indicate the problem
on the status bar.  The precise error message is stored and will be
shown on the terminal when exiting from nano.

This addresses https://savannah.gnu.org/bugs/?56524.
2019-10-20 14:30:04 +02:00
Benno Schulenberg 34170611d3 restored feature: a per-syntax 'fixer' command that processes the buffer
The command can be used to run some kind of formatter or corrector or
arranging tool on the buffer.  By default the command is bound to M-F.
The formatter/corrector/arranging program must be non-interactive.

This addresses https://savannah.gnu.org/bugs/?55365,
and addresses https://savannah.gnu.org/bugs/?54651.
2019-10-14 10:28:45 +02:00
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 3e33d1eba6 tweaks: rewrap a line, reshuffle a declaration, and improve some comments 2019-10-03 17:22:55 +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 1861052234 tweaks: avoid a comparison between signed and unsigned [coverity] 2019-09-30 19:30:54 +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 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 44d38815cc display: clear the remainder of a row only when there actually is some
Make display_string() report back (via a global variable) whether the
just converted string has room to spare within the allotted span, so
that draw_row() can avoid trying to clear the remainder when there is
nothing to clear.

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

Bug existed since commit 699cacf7 from three days ago.
2019-06-28 20:45:47 +02:00
Benno Schulenberg 9ea1cd947c tweaks: add a translator hint, to clarify four short words 2019-06-19 19:14:47 +02:00
Benno Schulenberg ea1016efdb feedback: make an error check work also when curses hasn't started yet
Add a temporary boolean for this, because isendwin() returns TRUE
only when curses mode has actually been started with initscr() and
then exited with endwin().
2019-06-03 13:38:21 +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 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 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 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 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 11aa191bdc tweaks: rename a variable, to distinguish it from a browser function 2019-04-22 19:58:43 +02:00
Benno Schulenberg f1e5da6cdd help: don't doubly list toggles that have two keys assigned to them 2019-04-09 19:48:41 +02:00
Benno Schulenberg d79b9823ae bindings: add easier keystrokes for the linenumber and softwrap toggles
For most people, M-N and M-S are simpler to type than M-# and M-$,
and more mnemonic.
2019-04-09 17:48:26 +02:00
Benno Schulenberg 82f1ce8ebf bindings: remove the jumpy-scrolling toggle entirely
It is still possible to use --jumpyscrolling on the command line or
'set jumpyscrolling' in a nanorc file, but a user will have to restart
nano when they decide they want chunky instead of smooth scrolling,
a decision that should be rather rare.

This frees up the M-S keystroke to be reused for toggling softwrap.
2019-04-09 17:46:21 +02:00
Benno Schulenberg 4399b734db bindings: disallow executing an external command when in view mode
Otherwise the user could do something like

  ^R^X  sed -i 's/a/surprise!/g' name-of-current-file  <Enter>

and the file being viewed would be modified anyway.
2019-04-06 17:41:44 +02:00