Commit Graph

924 Commits (bec0cdcb5456bc1e6fd40745f7af78a7f1f31c69)

Author SHA1 Message Date
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
Benno Schulenberg 671db5e1e3 tweaks: rename an overshort type to something that makes some sense 2019-04-03 17:34:05 +02:00
Benno Schulenberg acfee2538e tweaks: rename a cryptic type to something that makes a little sense 2019-04-03 17:11:24 +02:00
Benno Schulenberg 8e302738e8 bindings: recognize the ^W^Y and ^W^V legacy keystrokes again
The keystrokes are recognized and acted upon, but they are not visible
in the menu nor in the help text, and they cannot be rebound.  They are
there just to avoid frustrating the muscle memory of long-time users.

This fixes https://savannah.gnu.org/bugs/?56002.
Reported-by: Peter Zwegat <peterzwegat@yopmail.com>
2019-04-03 15:13:47 +02:00
Benno Schulenberg b58418b32f tweaks: rename a variable, to be more distinct 2019-03-21 19:21:45 +01:00
Benno Schulenberg aac4fc46e9 tweaks: rename a type, to make more sense 2019-03-21 17:08:52 +01:00
Benno Schulenberg 15959346fb tweaks: exclude the guide-stripe code from the tiny version
The option is not available, so including the code is pointless.
2019-03-14 19:34:35 +01:00
Benno Schulenberg 4205567bb1 tweaks: add deprecation comments to the four superseded options 2019-03-10 17:05:19 +01:00
Benno Schulenberg a20340b5a8 copyright: update the years for significantly changed files 2019-03-10 17:03:42 +01:00
Benno Schulenberg 66c6eb5166 new feature: option --guidestripe that shows a vertical guiding bar
Option -J (--guidestripe) takes a column number as argument and then
shows a vertical, colored bar over the entire height of the buffer,
to aid the user in regulating the width of the text when the terminal
is wider than this desired width.

This fulfills https://bugs.debian.org/916392.
Requested-by: Arturo Borrero González <arturo@debian.org>
And fulfills https://savannah.gnu.org/bugs/?55315.
Requested-by: Bryan Christ <bryan.christ@gmail.com>
2019-03-09 09:27:08 +01:00
Benno Schulenberg c3cd0f3411 help: reword the description of ^U to avoid the impression of "Undo"
Instead of "Uncut" use the word "Paste", which is the common name for
this function.
2019-03-07 20:36:03 +01:00
Benno Schulenberg 37c8232f4d bindings: provide usable shortcuts for prevword/nextword in tiny version
In the tiny version the feature toggles are absent, so most of the
Meta-key combinations do nothing, and when --with-slang was used, the
<Ctrl+Left/Right> keystrokes do not work (as they produce truncated
escape sequences under Slang), and the <Ctrl+Space> and <Alt+Space>
keystrokes are awkward to type and make no sense.  So... use some
of the free Meta combinations to jump a word to the left or right,
since these functions *are* present in the tiny version.
2019-03-03 14:25:51 +01:00
Benno Schulenberg de47b58dc1 tweaks: move declaration of variable that does not need to be global
More importantly: searching in src/history.c will now not only find
the uses of 'position_history' but also its declaration.
2019-02-27 19:54:43 +01:00
Benno Schulenberg 79ca3ceabf copyright: update the years for the FSF 2019-02-24 19:35:56 +01:00
Benno Schulenberg b5ca8a00af tweaks: rename three functions and two symbols, to match the new wording 2019-02-24 17:32:17 +01:00
Benno Schulenberg 2c7d336711 bindings: rename 'cutwordleft' to 'chopwordleft', and similar for right
These bindable functions should not connote cutting, as they don't put
anything into the cutbuffer.
2019-02-24 17:31:40 +01:00
Benno Schulenberg 15c3e924b8 help: reword the tags for deleting a word left and right
Don't use the word "Cut", as the words are discarded and
not added to the cutbuffer.
2019-02-24 16:49:44 +01:00
Benno Schulenberg 031166c34d help: don't list the unbound <Alt+Up> and <Alt+Down> in the tiny version 2019-02-24 11:27:10 +01:00
Benno Schulenberg df4d181987 help, docs: say "Delete" when things don't go into the cutbuffer
Reported-by: Božidar Putanec <bozidarp@yahoo.com>
2019-02-24 11:00:06 +01:00
Benno Schulenberg 7fcf6e6068 menus: don't show ^S and ^Q in the help lines in the tiny version
On small terminals (80 columns or so), ^S and ^Q would be in
the last position of the help lines.  But some terminals might
intercept ^S and stop all output (until ^Q is pressed), which
could be unexpected and frustrating.  So, rearrange things for
the tiny version so that ^S appears only on very wide terminals.

Also, having two keystrokes for saving the current buffer
(^O and ^S) in the two help lines is wasteful, more so as
in the tiny version there are no ^G help texts.

So, show the more useful M-Q and M-W instead.

This addresses https://bugs.debian.org/915017.
Reported-by: Steve McIntyre <steve@einval.com>
2019-02-21 17:42:51 +01:00
Benno Schulenberg 322a6f46fa tweaks: switch from checking SMOOTH_SCROLL to checking JUMPY_SCROLLING 2019-02-19 19:52:57 +01:00
Benno Schulenberg 54055b6174 tweaks: switch from referencing NO_WRAP to referencing BREAK_LONG_LINES 2019-02-19 19:45:55 +01:00
Benno Schulenberg 7811f3fc5a menus: put the ^T toggle in Search in the same position as in Goto-Line
So that when toggling it, the ^T in the help lines stays roughly in the
same place.
2019-02-17 10:24:03 +01:00
Benno Schulenberg 5f07b96d47 menus: move the paragraph-jumping functions from Search to Goto-Line
The start-of-paragraph and end-of-paragraph seeking functions are only
vaguely related to searching, and have nothing to do with replacing --
the functions make more sense in the Goto-Line menu.

Also, the Goto-Line menu is much less crowded, so the functions are
more likely to be noticed there.  Furthermore, this makes harmless a
typo that I sometimes make: typing ^W again when I've already done so.
2019-02-17 09:53:35 +01:00
Benno Schulenberg bc98dbcab4 menus: remove the ^Y and ^V shortcuts from the Search menus
Jumping to the first or last line of the buffer doesn't have anything
to do with searching, so these functions shouldn't be present in the
search menus.  They make perfect sense in the Goto-Line menu, though.
2019-02-17 09:52:57 +01:00
Benno Schulenberg cf634d1aff browser: show the ^G item again in the help lines
Also, prune another statement as MMOST no longer includes MBROWSER.

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

Bug existed since version 3.2, commit cc01bc3e.
2019-02-06 16:36:42 +01:00
Benno Schulenberg 4b8bd27d08 bindings: change the action of <Alt+Up>/<Alt+Down> to 'scroll linewise'
Using the cursor keys for movement-related functions makes more sense
than using them for jumping to the previous or next occurrence of the
search string.

(For searching another occurrence backward the M-Q binding has become
available, while M-W will search another occurrence always forward.)
2019-01-24 20:24:09 +01:00
Benno Schulenberg 125cc0cd74 tweaks: elide a tiny function by making a variable global
And in the bargain it makes things clearer, because the name
cutbuffer_reset() is misleading.
2018-12-30 13:36:29 +01:00
Benno Schulenberg 0946153b47 tweaks: hard-bind ASCII DEL in a slightly more economical way
And in the bargain get rid of a duplicate help-text entry for
either "Del" or "Bsp".
2018-12-28 17:20:18 +01:00
Benno Schulenberg 55c52c50d0 bindings: hard-bind ASCII code 0x08 (BS) to the backspace function
ASCII code BS should always do a backspace, also on systems where the
"^H" string gets redirected (for rebinding purposes) to KEY_BACKSPACE.

This fixes https://savannah.gnu.org/bugs/?55247.
Reported-by: Norton Warner <nortonwarner@gmail.com>
2018-12-23 18:45:12 +01:00
David Lawrence Ramsey 77bd8c2630 tweaks: swap the names of the variables 'wrap_at' and 'fill'
Now 'fill' contains the original specified value,
and 'wrap_at' the column that 'fill' translates to.
2018-12-18 19:50:59 +01:00
Benno Schulenberg e8751d1d5c bindings: make the normal scrolling keystrokes work also in help viewer
There is no reason why they shouldn't work.
2018-12-17 17:05:56 +01:00
Benno Schulenberg 38ca2a41f4 tweaks: reduce the scope of two variables, and rename one of them
Also, swap the order of the 'if', and don't bother setting a freed
string pointer to NULL as it will never be used again.
2018-12-11 10:59:12 +01:00
Benno Schulenberg 3a79766da6 rcfile, docs: remove deprecated forms of two options and five bindables
This addresses https://savannah.gnu.org/bugs/?53785.
2018-12-03 10:25:55 +01:00
Benno Schulenberg 0f79a42333 browser: say "Close" instead of "Exit" for the ^X shortcut
When multiple buffers are open, the edit window says "Close" for ^X
instead of "Exit" (when one buffer is open).  In the help viewer ^X
says "Close".  Apparently the idea is that ^X should say "Exit" only
when pressing ^X leads to exiting from nano.  Pressing ^X in the file
browser does not exit from nano, so make it say "Close" instead.

(The help viewer says "Close" since version 2.8.6, commit 934a2192.)
2018-12-03 10:07:42 +01:00
Benno Schulenberg 3b79c7168e help: don't advertise ^S and ^Q when --preserve is used
When using --preserve, ^S and ^Q are "eaten" by the terminal and
do not reach nano: they have no effect in nano, so the help lines
and the help texts should not mention these shortcuts.

Also, to keep the help lines in the help viewer neatly arranged,
^L is not bound there when --preserve is used.
2018-12-03 09:50:00 +01:00
Benno Schulenberg 9a77c997e2 tweaks: remove two tag definitions that are no longer needed 2018-11-26 09:13:22 +01:00
Benno Schulenberg 2cee79fbbf tweaks: remove a variable that is no longer used
It was made superfluous by David's overhaul of the justify mechanism.
2018-11-26 09:07:22 +01:00
Benno Schulenberg 4bd423fc92 tweaks: reorder some code to put backward motion before the forward one 2018-11-07 20:48:04 +01:00
Benno Schulenberg cc01bc3edb tweaks: redefine MMOST to exclude MBROWSER, to simplify the bindings 2018-11-07 20:01:03 +01:00
Benno Schulenberg 5f6f8a8083 bindings: stop binding <Bsp> to do_backspace() in the browser menu
Further down, the <Backspace> key is bound to do_page_up() for MHELP
and MBROWSER, so this earlier binding should exclude MBROWSER.

This partially fixes https://savannah.gnu.org/bugs/?54978.
Reported-by: David Lawrence Ramsey <pooka109@gmail.com>

Bug existed since version 2.9.2, commit 8581e702.
2018-11-07 19:57:10 +01:00
David Lawrence Ramsey f55a3fabef input: recognize some escape sequences for <Shift+Delete>
Also, hard-bind <Shift+Delete> in the same way as <Backspace>.

This fixes https://savannah.gnu.org/bugs/?54948,
and fixes https://savannah.gnu.org/bugs/?54975.
2018-11-07 19:17:16 +01:00
Benno Schulenberg 9d9ae8dc76 tweaks: add two more translator hints 2018-11-05 09:54:06 +01:00
Benno Schulenberg ca6281e821 tweaks: condense a handful of comments, and drop an assert 2018-11-05 09:38:07 +01:00
Benno Schulenberg 77826c2b06 tweaks: stop setting and requiring the Meta flag for special keycodes
Set the Meta flag only for the regular Meta keystrokes: "M-" plus a
printable ASCII character.  The special keycodes are unique and do
not need any extra flags to differentiate them.
2018-11-04 20:35:15 +01:00
Brand Huntsman 252f14796e bindings: hard-bind the zap function to M-Del (Alt+Delete)
So that the function is available in a default setup.

Signed-off-by: Brand Huntsman <alpha@qzx.com>
2018-11-04 11:47:03 +01:00
Brand Huntsman 5662a38802 new feature: a bindable 'zap', to erase text without changing cutbuffer
This function allows the user to "make space": annihilating lines or
regions while keeping intact for pasting the stuff in the cutbuffer
that was cut or copied earlier.

Signed-off-by: Brand Huntsman <alpha@qzx.com>
2018-11-04 11:46:19 +01:00
Benno Schulenberg e0d9fee5d6 build: exclude scrolling functions only from tiny version without help
This fixes https://savannah.gnu.org/bugs/?54891.
2018-10-24 17:33:54 +02:00
Benno Schulenberg 95dd873205 bindings: no longer bind F13 and F14 and F15
The bindings for F1 to F12 are there for compatibility with Pico.
But Pico does not know anything about F13 to F16; for unknown reasons
they were added to nano.  They seem hardly useful: normal keyboards
do not have the F13 to F16 keys, and very few people know that they
can "produce" those keys by holding Shift with F1 to F4.  But typing
Shift plus F1 to F4 are just as "hard" as, for example, M-G and M-W,
so why anyone would want to use the first ones...?  Especially since
many other functions of nano can only be accessed through Meta and
Control combinations.

Furthermore, F13 to F15 haven't been shown in the help texts since
version 2.3.3, so for more than four years no new user will have
learned about those keystrokes.

The rare user who wants these strange bindings can easily make them
herself.
2018-10-23 19:44:22 +02:00
David Lawrence Ramsey 16a3dc90c7 wrapping: make relative fill values work again also for screen resizes
The 'wrap_at' variable, removed in commit e90b7cf4, is actually needed
to store the original value of the --fill option when it is negative.
Otherwise, changing the screen width will not update the wrapping point
properly.

This fixes https://savannah.gnu.org/bugs/?54861.
Reported-by: Brand Huntsman <alpha@qzx.com>
2018-10-18 20:35:49 +02:00
Benno Schulenberg c43177487a help: pull "Older" and "Newer" into view on an 80-column terminal
The ^P and ^N keystrokes for Older and Newer are relevant to searching
and should be visible in the help lines.  FullJustify, paragraph jumps,
and top/tail jumping are there only for compatibility with Pico but
don't make any sense there, so it's no problem if they are pushed out
of view.
2018-10-15 17:33:51 +02:00
Benno Schulenberg f442f91187 bindings: rename 'prevhistory' to 'older' and 'nexthistory' to 'newer'
Rename not only the bindable functions, but more importantly reword the
tags that are shown for ^P and ^N in the help lines: "Older" / "Newer",
because these are clearer and not awkward abbreviations.
2018-10-15 17:31:40 +02:00
Benno Schulenberg a4e7d6b80b tweaks: define a symbol to make the code itself a little simpler 2018-10-15 16:55:36 +02:00
David Lawrence Ramsey 06416e3d5c tweaks: don't define controldelete or controlshiftdelete in tiny version
The tiny version never uses them because it doesn't know word deletion.
2018-10-15 16:52:01 +02:00
Benno Schulenberg e1c8dd0091 build: fix compilation when configured with --disable-multibuffer
Commit 7ea6d6bb from five days ago caused this breakage.
2018-10-12 12:32:21 +02:00
Benno Schulenberg 8c456423e9 display: correct a mistaken label in the help lines of the browser
This was a second pasting mistake made in commit 0c263bda, a good
two months ago.
2018-10-09 21:54:54 +02:00
David Lawrence Ramsey c2e4f77594 display: do spotlighting as part of drawing the screen
When something is spotlighted, it should survive a refresh of
the screen and an excursion to a help text, so the spotlight
should get painted whenever the edit window is drawn.

This fully fixes https://savannah.gnu.org/bugs/?54721.
2018-10-09 20:03:47 +02:00
Benno Schulenberg 7ea6d6bbda bindings: in tiny version with help, don't show unfunctional M-◀ and M-▶
The code for recognizing those keystrokes is not present in the tiny
version, so there is no point in binding anything to them.
2018-10-07 15:51:21 +02:00
Benno Schulenberg e4f5848425 tweaks: move all the function keys to the end of the shortcuts list
To have them grouped together, but also so that keystrokes that are
used more commonly are found slightly quicker.
2018-10-07 14:42:42 +02:00
Benno Schulenberg 10d9742c11 display: show the cursor also in a help text (when --showcursor is used)
The cursor can function as a reading aid for people with poor vision.

This fulfills https://savannah.gnu.org/bugs/?54654.
Requested-by: Ben Key <benk1976@yahoo.com>
2018-10-07 10:26:27 +02:00
Benno Schulenberg 2a894213e0 tweaks: group a series of related variables together 2018-10-07 10:24:19 +02:00
Benno Schulenberg 826be439db bindings: make the Shift+arrow keys work by default on more terminals
Ask ncurses for the codes for the Shift+arrow keys, so that also
<Shift+Up> and <Shift+Down> can be recognized, for which ncurses
doesn't have standard codes.

This fixes https://savannah.gnu.org/bugs/?54790.
Reported-by: Javier Valencia <javiervalencia80@gmail.com>
2018-10-07 10:17:10 +02:00
Benno Schulenberg 52ba76b2a2 help: show <PgUp> and <PgDn> instead of F7 and F8 for pagewise scrolling
The dedicated editing keys make sense, whereas the function keys are
bound only for compatibility with Pico.
2018-09-30 14:19:12 +02:00
Benno Schulenberg 5bb2b5c08a help: move the linter to the end, to restore pairing in the help lines
Items that are (vaguely) related should be one above the other.
2018-09-30 14:12:42 +02:00
Benno Schulenberg f4c958e810 bindings: allow using ^X to exit from the linter
One can use ^X to exit from the file browser and from the help viewer,
so...  For symmetry.
2018-09-29 09:59:30 +02:00
Benno Schulenberg b4b9e9b012 linter: allow using <Ctrl+Up> and <Ctrl+Down> to jump to other message
These are more "natural" keystrokes for jumping than <PgUp> and <PgDn>.
2018-09-29 09:42:25 +02:00
Benno Schulenberg 628eef28b3 bindings: make the linter separately accessible, through M-B by default
This allows running the speller (default binding: ^T) also on files for
which a linter has been defined.  This makes it possible to spell check
comment blocks in source files, for example.

This fulfills https://savannah.gnu.org/bugs/?54711.
Requested-by: Mike Frysinger <vapier@gentoo.org>
2018-09-28 20:08:59 +02:00
Benno Schulenberg c545438a5f bindings: drop M-| as a keystroke for 'cutwordleft' -- set it free again
The binding was made only to have *something* bound by default to the
'cutwordleft' function.  But now that <Ctrl+Shift+Delete> is available
*and* visible in the help text, the M-| binding is superfluous.
2018-09-23 20:21:57 +02:00
Benno Schulenberg e998814bbc help: show the keystroke <Ctrl+Shift+Delete> as "Sh-^Del"
And in the bargain always return a fixed code instead of searching for
a keystroke that is bound to 'cutwordleft' (which might fail).
2018-09-23 19:57:04 +02:00
Benno Schulenberg 818ee3e68c help: restore the blank line between manipulation and position stuff
This separation line was lost when the 'formatter' command was removed
in commit 975b4912.
2018-09-23 12:57:56 +02:00
Benno Schulenberg e8a5665d2c bindings: make ^H rebindable also on NetBSD, FreeBSD and macOS
So that the user can do 'bind ^H cutwordleft all' in their nanorc
to make ^H (and sometimes also <Ctrl+Backspace>) delete the word
to the left of the cursor while <Backspace> continues to delete
just one character.
2018-09-18 19:14:05 +02:00
Benno Schulenberg 65e4784eec bindings: bind ASCII DEL during startup instead of repeatedly at runtime 2018-09-18 19:14:05 +02:00
Benno Schulenberg c7affe17c0 build: fix compilation again when configured with --enable-tiny 2018-09-08 12:24:12 +02:00
Benno Schulenberg e6429e782a bindings: hard-bind <Ctrl+Shift+Delete> to 'cutwordleft'
On FreeBSD and NetBSD (when reached through ssh from a Linux machine)
this has the absurd effect of making <Ctrl+Backspace> do a 'cutwordleft'
by default, out of the box, without needing any rebindings.  Weird, but
wonderful, because the ideal behavior.

Also ensure that <Shift+Delete> always does a Backspace.

This makes that we have the following set of "congruent" keys:

  <Tab> moves text to the right,
  <Shift+Tab> moves text to the left,
  <Delete> "eats" a character to the right,
  <Shift+Delete> "eats" a character to the left,
  <Ctrl+Delete> "eats" a word to the right,
  <Shift+Ctrl+Delete> "eats" a word to the left.
2018-09-07 19:31:38 +02:00
Mark-Weston 13615d0953 build: fix compilation when CC=tcc
Signed-off-by: Mark-Weston <markweston@cock.li>
2018-08-31 20:06:08 +02:00
Benno Schulenberg 24487d48ff tweaks: adjust one more translator hint, for removed toggles 2018-08-29 20:25:57 +02:00
Benno Schulenberg 388cd0b514 tweaks: remove two needless words, and split up a changed text further 2018-08-29 20:21:20 +02:00
Benno Schulenberg 33c4bb22d5 tweaks: adjust some translator hints for past changes, and add two more 2018-08-29 20:20:43 +02:00
Benno Schulenberg 5f00b02f7c tweaks: fix a pasting error from a month ago 2018-08-28 21:39:01 +02:00
Benno Schulenberg 63b15275bd bindings: remove the More-Space toggle entirely
It is so unlikely that a user will want to bind it that it
just clutters the help text (and the documentation).
2018-08-25 10:10:27 +02:00
Benno Schulenberg 772c324f25 bindings: remove backup and new-buffer toggles (M-B, M-F) from main menu
These are available in the menus where they are relevant: the Write-Out
and the Insert menu, respectively.  Having them duplicated in the main
menu is inconsistent and eats precious keystrokes.  (Sorry, Chris.)
2018-08-25 10:07:28 +02:00
Benno Schulenberg f1e5872e6a tweaks: reshuffle the order of the bindings, for help-line esthetics 2018-08-25 10:06:13 +02:00
Benno Schulenberg 6d62682ddb bindings: move the noconvert toggle from the main to the insert menu
Also add feedback, so that it will be clear whether a file will be
inserted unconverted or not.

This addresses https://savannah.gnu.org/bugs/?54536.
2018-08-25 10:04:03 +02:00
Benno Schulenberg 3218d8358a tweaks: remove a redundant "struct" word, and replace it in comments 2018-08-20 19:33:31 +02:00
Benno Schulenberg a3a10dfafe tweaks: don't bother having debug code that deallocates all memory
Who runs debug builds for any length of time?
2018-08-18 11:00:03 +02:00
Benno Schulenberg e40e6bbf10 tweaks: rename a function to better match its counterpart
Also rename its parameter, to describe what it ought to be.
2018-08-11 09:55:22 +02:00
Benno Schulenberg 2147e161bf rcfile: when a vital function is not mapped, mention in which menu
Add the reverse of the name-to-menu function to accomplish this.

This fixes https://savannah.gnu.org/bugs/?54449.
2018-08-11 09:46:03 +02:00
Benno Schulenberg dc079bdf31 tweaks: implement the name-to-menu function in another manner
Use arrays, to make it easy to also implement the reverse function.
2018-08-11 09:45:02 +02:00
Benno Schulenberg 975b491235 dropping a feature: remove the ability to use the 'formatter' command
Since the last version, the user can filter an entire buffer through
an external command.  This external command can also be a formatting
program, so there is no longer any need for this specific and special
formatter command.
2018-08-09 20:29:30 +02:00
Benno Schulenberg 418bd3be34 rcfile: allow to rebind the Cancel function in the yesno menu
This fixes the first part of https://savannah.gnu.org/bugs/?54447.
2018-08-05 20:01:47 +02:00
Benno Schulenberg 4170454837 tweaks: exclude a global flagging variable when it is not needed 2018-08-05 13:00:44 +02:00
Benno Schulenberg e90b7cf4aa tweaks: elide an unneeded/duplicate variable 2018-08-04 11:34:44 +02:00
Benno Schulenberg bb90de0eb4 tweaks: rename a constant, to match what it actually means
Wrapping is concerned with columns, not with number of characters.
2018-08-04 11:21:42 +02:00
Benno Schulenberg ac102a7516 tweaks: show "Space" and "Bsp" in the help text of the browser
These keys make more mnemonic sense for scrolling than F7 and F8.

Also adjust the nanohelp syntax to cover the lone word "Space".
2018-07-31 20:36:32 +02:00
Benno Schulenberg d249233ea7 bindings: unassign the M-? keystroke, to free it up for future use
There are at least three other ways to achieve the thing that it did:
^End, M-/, and ^W^V.  No need to have a fourth way by default.

For symmetry, also unassign the corresponding binding for M-|.
2018-07-31 20:36:27 +02:00
Benno Schulenberg 33fb54c75f bindings: reassign the M-| keystroke to 'cutwordleft' by default
The 'cutwordright' function has gotten ^Delete as its default binding,
so the 'cutwordleft' function needs a default binding too -- also to
keep the items on the two help lines nicely paired.  M-| was chosen
because it is close to the Backspace key on many keyboard layouts.
2018-07-31 20:36:07 +02:00
Benno Schulenberg c231b774d7 tweaks: reshuffle some lines, in order to elide one 2018-07-30 21:03:08 +02:00
Benno Schulenberg 0c263bda7d tweaks: elide a bunch of unneeded constant strings 2018-07-30 20:45:15 +02:00
Benno Schulenberg 54a4123d4c bindings: remove the 'searchagain' function entirely
The user is obliged to make use of 'findprevious' and 'findnext' instead.

Also, adjust the description of 'wherewas' to its wider availability.
2018-07-29 11:43:13 +02:00
David Lawrence Ramsey 7a31507167 bindings: make ^Q start a backward search also in the file browser
This makes the four search keystrokes (^W/^Q/M-W/M-Q) available in
all three areas of nano: editor, help viewer, and file browser.
2018-07-29 11:43:13 +02:00
Benno Schulenberg 7f2031006a bindings: make ^Q and M-Q available also in the help viewer
As the help viewer is almost a normal buffer, commands that make sense
-- like searching backwards, and searching the previous occurrence --
should work in the help viewer too.

In addition, show all Search commands prominently in the help lines of
the help viewer, so that users are likely to notice them and will maybe
infer that they work in the editor itself too.

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

With-help-from: David Lawrence Ramsey <pooka109@gmail.com>
2018-07-29 11:43:13 +02:00
Benno Schulenberg 7e18b91ead help: move "Search Again" away from "Find Next" and "Find Previous"
Put "Where Was" in its place, to make the symmetry of ^W/M-W/^Q/M-Q
somewhat clearer.  Also, conditionally reshuffle "Save File", to try
and keep menu items nicely paired.
2018-07-29 11:43:13 +02:00
Marco Diego Aurélio Mesquita a67f6c6031 input: erase the next word when Ctrl is held while pressing Delete
Bind the until-now unbound function 'cutwordright' to <Ctrl+Delete>.
The complementary function, 'cutwordleft', is not bound by default
because on many terminals the keystroke <Ctrl+Backspace> generates
^H -- the canonical ASCII backspace character.  We cannot change the
existing action of ^H without upsetting some users.

Signed-off-by: Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2018-07-22 19:27:50 +02:00
Benno Schulenberg 8d8f5788ce rcfile: do not accept rebinding F0 nor function keys above F16
To match the documentation and to match what the nanorc.nanorc
colors as valid.

In theory it would be possible to allow rebinding also F17...F63,
but nano does not recognize escape sequences for these high-order
function keys.  As no one ever complained about unknown sequences
when pressing function keys, I am guessing that no one has these
high-order keys, or at least that no one uses them.

This fixes https://savannah.gnu.org/bugs/?54332.
2018-07-20 19:12:36 +02:00
Benno Schulenberg bfe65af6f3 bindings: bind M-Q to 'findprevious' by default, and M-W to 'findnext'
This makes things symmetrical: ^W starts a forward search, ^Q starts
a backward search, M-W searches the next occurrence forward, and M-Q
searches the next occurrence backward.

The Tabs-To-Spaces toggle is moved to M-O, and thus the More-Space
toggle is no longer bound by default.
2018-07-18 19:18:45 +02:00
Benno Schulenberg eb84205426 bindings: rename two bindable functions: copytext to copy, uncut to paste
To match the common names used for these functions, for consistency,
and because 'uncut' sounds too much like "undo the cut".
2018-07-13 19:46:56 +02:00