Commit Graph

951 Commits (b5448615b952aced295da1f401430a6c97ded7f0)

Author SHA1 Message Date
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
Benno Schulenberg 3bac3c4c78 rcfile: reject things like "M-Del" and "^{" as invalid key names
This fixes https://savannah.gnu.org/bugs/?54274.
2018-07-11 14:42:10 +02:00
Benno Schulenberg 0c455155ad prompt: concentrate manipulations of 'statusbar_x' into a single file 2018-07-11 10:45:58 +02:00
Benno Schulenberg 2e1e157967 copyright: update the years for significantly changed files 2018-06-01 10:18:32 +02:00
Benno Schulenberg dc3261b685 tweaks: avoid a warning with --enable-{tiny,help,multibuffer}
This also places the Pipe toggle among the other, similar togglles,
which makes more sense.
2018-05-29 09:07:39 +02:00
Benno Schulenberg 59eb01b403 build: fix compilation with --enable-{tiny,help,multibuffer} 2018-05-28 11:31:30 +02:00
David Lawrence Ramsey a6c0212158 bindings: add the "flippipe" bindable function
So the toggle for piping to an external command can be rebound.

This fixes https://savannah.gnu.org/bugs/?53987.
2018-05-27 10:36:33 +02:00
Benno Schulenberg 408d9b8708 build: fix compilation failure when configured with --enable-tiny 2018-05-23 11:57:55 +02:00
Marco Diego Aurélio Mesquita f304b9aee1 new feature: allow piping (selected) text to an external command
When executing a command, it is now possible to pipe the entire buffer
(or the marked region, if anything is marked) to the external command.
The output from the command replaces the buffer (or the marked region),
or goes to a new buffer.

This fulfills https://savannah.gnu.org/bugs/?28993,
and fulfills https://savannah.gnu.org/bugs/?53041.

Signed-off-by: Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2018-05-22 19:36:21 +02:00
Benno Schulenberg 4d92dffb3a bindings: rename constupdate to constantshow, cuttoend to cutfromcursor
This makes the names of these bindable functions equal to the names of
their corresponding options -- like for all the other toggles that have
a corresponding option.
2018-04-28 12:01:23 +02:00
Benno Schulenberg 4c1c425bbb bindings: add the 'linenumbers' bindable function
This makes the line-numbers toggle rebindable, like all the others.
2018-04-28 11:44:53 +02:00
Benno Schulenberg 544d426d86 tweaks: group some more of the empty functions together 2018-04-17 10:34:57 +02:00
Benno Schulenberg 7c5d099c6f tweaks: frob a couple of comments 2018-04-01 21:07:18 +02:00
Benno Schulenberg 152cc24d1f tweaks: reshuffle two declarations 2018-04-01 20:08:57 +02:00
Benno Schulenberg a865c25eea build: fix compilation when configured with --disable-help
This fixes https://savannah.gnu.org/bugs/?53532.
2018-03-31 16:52:22 +02:00
Benno Schulenberg eff2e0e291 help: describe the Scroll-Up and Scroll-Down commands more precisely
An "if possible" would have been nice, but there is no room for that.
2018-03-23 11:10:19 +01:00
Benno Schulenberg bf1a080923 build: exclude more things when configured with --disable-multibuffer
This will make the tiny version slightly smaller.
2018-03-23 11:09:37 +01:00
Benno Schulenberg b7f8d4819b tweaks: frob some comments plus miscellaneous other stuff 2018-03-22 19:54:20 +01:00
Benno Schulenberg 93318b972d tweaks: elide two parameters and thus a pair of wrapper functions
When just scrolling and the cursor does not need to change position
(that is: it is not on the first or last row of the edit window),
then edit_scroll() has handled everything and there is no need to
additionally redraw anything or update 'placewewant'.
2018-03-17 14:07:42 +01:00
Benno Schulenberg 8f1a657a37 bindings: revert the ^/ changes, as ^/ is not always Go-To-Line
On a Linux console, ^/ produces Backspace, making it unrebindable.

This fixes https://savannah.gnu.org/bugs/?53248.
2018-03-01 09:50:54 +01:00
Benno Schulenberg 3b8c898880 help: tweak the descriptions of ^X and ^R
It is not a problem to say that ^X closes the current buffer
even when nano is compiled without multibuffer support.
2018-02-27 18:11:16 +01:00
Benno Schulenberg 5eccaa7633 tweaks: refactor the implanting of a key expansion 2018-02-27 13:34:32 +01:00
Benno Schulenberg ffebd31cbb tweaks: shorten the name of two record elements
Exclude the confusing, pleonastic 'sc' abbreviation from their names.
2018-02-24 19:31:11 +01:00
Benno Schulenberg 1a926d79c5 help: mention that some keys work on a region when the mark is on
This fixes https://savannah.gnu.org/bugs/?53188.
Reported-by: Ken Tyler <kent@werple.net.au>
2018-02-23 12:35:12 +01:00
Benno Schulenberg c79fe1a160 bindings: show ^/ instead of ^_ for Go-To-Line
The slash is easier to read than the underscore (which almost
disappears at the bottom of the screen), and easier to type
(no Shift needed on a US keyboard), and it kind of harmonizes
with the ^\ for Replace and the M-/ for End-of-buffer.
2018-02-23 12:26:30 +01:00
Benno Schulenberg 0cf455bc48 build: fix compilation when configured with --enable-tiny
And when configured with --enable-tiny --enable-nanorc.
2018-02-14 19:29:29 +01:00
David Lawrence Ramsey 8f6ee22b41 tweaks: fix typo in rebindable function name
This fixes https://savannah.gnu.org/bugs/?53062.
2018-02-04 18:31:24 +01:00
Benno Schulenberg a083d7f1e1 tweaks: rename a variable to be more distinct and greppable 2018-02-04 18:25:10 +01:00
Benno Schulenberg 467cc8edf3 tweaks: remove two deprecated options and six rebindable function names
This addresses https://savannah.gnu.org/bugs/?48992.
2018-02-04 13:51:13 +01:00
Benno Schulenberg 6d111c9343 new feature: allow binding a key to a string (in a nanorc file)
In this way a single keystroke can produce a fragment of text or a
series of commands, or a mix of the two.  It is like a prerecorded
macro.

This fulfills https://savannah.gnu.org/bugs/?52931.
2018-02-04 12:44:12 +01:00
Benno Schulenberg bb667beb5a bindings: rename the bindable function 'gototext' to 'flipgoto'
This brings it in line with the other three "flip" toggles.
2018-02-04 10:34:39 +01:00
Benno Schulenberg f72fecee9b copyright: update the years for the FSF
And one for me, for the much changed keyboard stuff.
2018-01-24 10:14:43 +01:00
Benno Schulenberg 704a7d7b4f tweaks: rename two variables, for preciseness and shortness
Also remove an unneeded nulling.
2018-01-15 16:38:13 +01:00
Brand Huntsman 4b24ce1c11 startup: parse interface colors when they are read, not when initialized
When the palette is getting initialized, it is too late to send any
error messages about the rcfile options to standard error.

This fixes https://savannah.gnu.org/bugs/?52871.
Reported-by: Brand Huntsman <alpha@qzx.com>

Signed-off-by: Brand Huntsman <alpha@qzx.com>
2018-01-15 13:04:55 +01:00
Benno Schulenberg 0bb6c0234f tweaks: condense the conditional compilation of shortcut reassignments
These three functions are needed only when both linter and speller
are available.
2018-01-09 13:31:58 +01:00
Benno Schulenberg c9ccb39752 tweaks: fully include Savefile and Wherewas in the tiny version
If help is enabled, those functions should be described too,
and if nanorc is enabled, they should both be rebindable.
2018-01-09 11:49:21 +01:00
Benno Schulenberg 17429d7f38 tweaks: fix some whitespace errors, and convert alignment tabs to spaces 2017-12-29 21:35:14 +01:00
Benno Schulenberg 87206c0607 tweaks: convert the indentation to use only tabs
Each leading tab is converted to two tabs, and any leading four spaces
is converted to one tab.  The intended tab size (for keeping most lines
within 80 columns) is now four.
2017-12-29 20:06:50 +01:00
Benno Schulenberg 440a128d25 indenting: keep affecting last line of marked region if it was at first
When unindenting/uncommenting affected the bottom line of the marked
region, keep affecting this line also during subsequent consecutive
indenting/commenting.

This fixes https://savannah.gnu.org/bugs/?52718.
2017-12-29 16:52:17 +01:00
Benno Schulenberg 4c20135749 help: swap the order of the Complete and Comment functions
So that Commenting comes closer to the somewhat related Indenting
and Unindenting functions.
2017-12-26 21:36:29 +01:00
Benno Schulenberg f9ebf038e0 tweaks: slightly rename four functions, for aptness and variety 2017-12-26 14:15:49 +01:00
Benno Schulenberg a10fdc3fb1 help: show that "Tab" will indent, just like "Sh-Tab" will unindent
Also, make the descriptions for indenting/unindenting more precise.
2017-12-26 13:46:34 +01:00
Benno Schulenberg 8581e702d6 tweaks: move some frequently-used keystrokes to the top of the list
So they will be found quicker.

Also fold two assignments into one.
2017-12-26 13:31:50 +01:00
Benno Schulenberg 7ad5afb935 tweaks: remove some unneeded parentheses, and shorten two function calls 2017-12-17 20:32:17 +01:00
David Lawrence Ramsey f66432e999 input: support backtab when Slang and/or --rebindkeypad is used
The escape sequence "Esc [ Z" is a backtab on most supported terminals,
so make sure convert_sequence() treats it as such.
2017-12-17 12:11:35 +01:00
Benno Schulenberg 09958ebdff input: allow using <Tab> and <Shift+Tab> to (un)indent selected region
When the mark is on, instead of letting a <Tab> simply insert a Tab
character at the cursor position, let it indent the marked region.

Original-idea-by: Chris Allegretta <chrisa@asty.org>
2017-12-12 20:37:41 +01:00
Benno Schulenberg 1e718cec35 tweaks: reshuffle a couple of lines, to put similar things together 2017-11-26 18:01:02 +01:00
Benno Schulenberg 5239e7c52b copyright: update some years, and standardize on the dashed format 2017-11-12 10:46:20 +01:00
Benno Schulenberg 7e6bb91593 tweaks: add a translator hint, and adjust two others 2017-11-07 19:39:00 +01:00
Simon Ochsenreither c16e79b612 startup: look for nanorc and history files also in the XDG directories
When not finding a .nanorc file in the user's home directory, nano will
look for a nanorc file in $XDG_CONFIG_HOME and in the ~/.config/nano/
fallback directory.  And when not finding a .nano/ subdir in the user's
home directory, nano will look for (or create) the history files in
$XDG_DATA_HOME or in the ~/.local/share/nano/ fallback directory.

This is a partial implementation of the XDG Base Directory Specification:
https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html,
for the purpose of reducing the clutter in a user's home directory, and
to make it easier to back up just the configuration files.

Signed-off-by: Simon Ochsenreither <simon@ochsenreither.de>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2017-11-04 20:11:57 +01:00
Benno Schulenberg 1463781247 startup: when an rcfile contains errors, report this on the status bar
Suggested-by: Brand Huntsman <alpha@qzx.com>
2017-11-02 17:30:14 +01:00
Benno Schulenberg d5ac1ed395 tweaks: transform the token DISABLE_COLOR to ENABLE_COLOR 2017-11-01 19:45:50 +01:00
Benno Schulenberg 2a4fc9591f tweaks: transform the token DISABLE_SPELLER to ENABLE_SPELLER 2017-10-31 19:32:42 +01:00
Benno Schulenberg f034992ed6 tweaks: transform the token DISABLE_WRAPJUSTIFY to ENABLED_WRAPORJUSTIFY 2017-10-31 17:40:54 +01:00
Benno Schulenberg db0b849f9b tweaks: transform the token DISABLE_JUSTIFY to ENABLE_JUSTIFY 2017-10-31 17:40:44 +01:00
Benno Schulenberg 4e03a245ac tweaks: adjust two comments, and correct and a few cosmetic mistakes 2017-10-30 19:12:22 +01:00
Benno Schulenberg 028d12f4fb tweaks: transform the token DISABLE_OPERATINGDIR to ENABLE_OPERATINGDIR 2017-10-29 21:08:07 +01:00
Benno Schulenberg a5974bd1ec tweaks: transform the token DISABLE_WRAPPING to ENABLE_WRAPPING 2017-10-29 21:00:09 +01:00
Benno Schulenberg ff35a61355 tweaks: transform the token DISABLE_HISTORIES to ENABLE_HISTORIES 2017-10-29 19:43:05 +01:00
Benno Schulenberg 3f27c312c4 tweaks: get rid of some cluttering conditional compilation
In the tiny version, do_prompt() will now have an extra NULL
parameter, which will cost maybe twenty extra bytes of code.
That is acceptable when it saves thirty lines in the source.
2017-10-29 11:39:27 +01:00
Benno Schulenberg 42497f77e2 tweaks: rename some constants, to follow the same underscoreless scheme 2017-10-28 12:32:54 +02:00
Benno Schulenberg 86ef9db363 tweaks: remove a useless prefix from a hundred constants
And use a better word to describe the concise descriptions that
these constants refer to -- they are not messages.
2017-10-28 12:32:47 +02:00
Benno Schulenberg 160ababa55 tweaks: rename a macro, to make a little more sense 2017-10-28 12:32:36 +02:00
Benno Schulenberg d84fb8d209 tweaks: remove a superfluous no-op function call
Reported-by: David Lawrence Ramsey <pooka109@gmail.com>
2017-10-28 12:32:27 +02:00
David Lawrence Ramsey ddd300af5f help: allow firstline and lastline to work at the search prompt
This addresses https://savannah.gnu.org/bugs/?52257.
2017-10-25 19:35:41 +02:00
Benno Schulenberg af20d45bc1 bindings: don't allow calling help when searching in the help viewer
This fixes https://savannah.gnu.org/bugs/?52246.
2017-10-18 21:46:34 +02:00
Brand Huntsman 08b49534d5 bindings: allow exiting from the help viewer with F1, like with ^G
Signed-off-by: Brand Huntsman <alpha@qzx.com>
2017-10-18 21:10:06 +02:00
Benno Schulenberg 57899550aa tweaks: change the arrows to triangles also for searching in file browser 2017-10-18 20:55:43 +02:00
Benno Schulenberg e1e6c5f612 bindings: make the search function rebindable again in help and browser
Adjust to the changed meaning of 'whereis': it is no longer do_search()
but do_search_forward().

Hinted-at-by: Brand Huntsman <alpha@qzx.com>
2017-10-18 20:55:09 +02:00
Benno Schulenberg 58ecc034d0 tweaks: change the help-text arrows to triangles, to be more visible
Requested-by: Brand Huntsman <alpha@qzx.com>
2017-10-15 21:23:33 +02:00
Marco Diego Aurélio Mesquita 501d05c5d1 new feature: the ability to record and play back a series of keystrokes
Allow the user to record and run a single macro.  The default binding
for starting and stopping the recording is M-: (Alt + colon) and for
running the macro M-; (Alt + semicolon).

This fulfills https://savannah.gnu.org/bugs/?50314.
Requested-by: Peter Passchier <peter@passchier.net>

Signed-off-by: Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2017-10-15 20:40:40 +02:00
Benno Schulenberg 3f735d22a1 bindings: make ^W start always a forward search (as there is ^Q now)
It would be silly for ^W to do a backward search too after using ^Q
once.
2017-10-14 20:34:51 +02:00
Benno Schulenberg ba65cd48cc bindings: make ^Q and ^S do something useful by default
^S will be the first thing people will try for saving a file,
and ^Q is somewhat mnemonic because it is to the left of ^W:
it searches backward.

Make these keystrokes available also in the tiny version.
2017-10-14 20:34:43 +02:00
Benno Schulenberg c7eecd74de new feature: a bindable function that starts always a backward search 2017-10-14 20:30:46 +02:00
Benno Schulenberg c74d2632bb tweaks: make the switching on and off of the cursor a bit more compact 2017-09-22 21:31:01 +02:00
Benno Schulenberg ae34825f58 display: rework the switching on and off of the cursor
The basic idea is that the cursor is always off, except when it needs
to be on: when waiting for text input, and in a few other cases: when
something was searched and found in the help viewer, and in the file
browser when option -g is in effect.

This fixes https://savannah.gnu.org/bugs/?51923.
Reported-by: Mike Frysinger <vapier@gentoo.org>
2017-09-20 21:35:25 +02:00
Benno Schulenberg 067a920517 tweaks: improve some comments, and rename a variable for symmetry 2017-09-17 17:16:36 +02:00
Benno Schulenberg 36e88032cb tweaks: rename two variables, to make a little more sense 2017-09-17 16:54:45 +02:00
Marco Diego Aurélio Mesquita c8363a0d0b history: remember the commands that were executed during this session
Signed-off-by: Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
2017-09-14 20:10:22 +02:00
Benno Schulenberg cbf4f77d6b titlebar: don't reshow version when dropping back to a single buffer
When multiple files were open and [x/n] was being shown in the title
bar, don't show nano's name and version number when just one buffer
remains open, but show [1/1] instead.  It is less surprising.
2017-09-13 19:29:56 +02:00
Marco Diego Aurélio Mesquita 3fc89e0853 new feature: show current and total number of open buffers in title bar
When multiple buffers are open, replace nano's name and version number
with an indication how many buffers are open preceded by the sequence
number of the current buffer.

Signed-off-by: Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2017-09-13 19:29:38 +02:00
Benno Schulenberg 98ec41b4fa tweaks: rename three functions, to be shorter or clearer 2017-08-31 22:00:53 +02:00
David Lawrence Ramsey 633343de24 browser: allow backward/forward re-searches with Alt+Up/Alt+Down
Also bind 'N' to a backward re-search, while retaining 'n' for a
forward one,  This matches the functionality in the help viewer.
2017-08-19 21:49:32 +02:00
Benno Schulenberg 873f99d96a tweaks: show "where is next" in the help lines of the file browser 2017-08-19 18:11:59 +02:00
David Lawrence Ramsey 5237a42d65 weeding: remove the unused be_clever parameter from do_home()/do_end() 2017-08-18 20:44:46 +02:00
David Lawrence Ramsey 566a2daf12 tweaks: remove unneeded parentheses and blank line and braces 2017-08-14 21:46:25 +02:00
Benno Schulenberg 4562401505 bindings: hard-bind Alt+Up and Alt+Down to findprevious and findnext
So that these functions have bindings by default, and easy bindings.
Add them to the help viewer too, so that searching backward becomes
possible there.
2017-08-14 10:34:15 +02:00
Urja Rannikko 1cc030f7c1 bindings: hard-bind Alt+Left and Alt+Right to buffer switching
This also fixes https://savannah.gnu.org/bugs/?51735.
Reported-by: Urja Rannikko <urjaman@gmail.com>

Signed-off-by: Urja Rannikko <urjaman@gmail.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2017-08-14 10:06:29 +02:00
Benno Schulenberg dd88842d5a tweaks: elide the global variable 'full_operating_dir'
There is no need to retain the (relative) path that the user
specified, so we can simply reuse that variable.
2017-08-13 10:08:37 +02:00
Benno Schulenberg 80686bb525 tweaks: remove includes that appear to be superfluous
Without them, nano still compiles for me, with everything enabled,
even when using --enable-debug, --enable-utf8, and --with-slang.
2017-08-06 09:08:30 +02:00
Rishabh Dave 829a1a5050 new feature: allow pasting at all input prompts
Include the shortcut for 'Uncut' into most menus, and add an uncut
function for the status bar, so that it becomes possible to paste
the first line of the cutbuffer at any text-input prompt.

This fulfills https://savannah.gnu.org/bugs/?48501.
Requested-by: Benno Schulenberg <bensberg@telfort.nl>
Signed-off-by: Rishabh Dave <rishabhddave@gmail.com>
2017-07-29 13:48:22 +02:00
David Lawrence Ramsey beae2da10d weeding: remove redundant casts of nmalloc()
A cast on the same line as a variable declaration is superfluous,
because it effectively defines the type of the variable twice.
2017-07-27 21:54:37 +02:00
Benno Schulenberg 1e2d9a697a tweaks: rename a constant, to match the corresponding option 2017-07-14 16:14:02 +02:00
Benno Schulenberg 6855b79267 tweaks: swap ^X and ^L in the help lines of the help viewer
I like it better that ^X stays in the same position compared to the
main screen: the lower left corner.
2017-07-13 16:47:12 +02:00
Benno Schulenberg 934a2192dc screen: retain the same help-line tags when the window is resized
This fixes https://savannah.gnu.org/bugs/?51457.
2017-07-13 11:42:49 +02:00
David Lawrence Ramsey 7e9799d42b text: remove the last usage of cols in do_indent() and do_unindent()
Since all indentation and unindentation is by a tab, or by a tab's
worth of spaces, use tabsize directly.
2017-07-12 17:23:46 +02:00
David Lawrence Ramsey 2367f3d8e6 text: make do_unindent() an exact copy of do_indent()
This is the first step toward splitting them into two dedicated
functions, instead of letting do_indent() handle both cases.
2017-07-12 16:45:41 +02:00
Benno Schulenberg 78bc8b698c tweaks: avoid a clang warning about an expression being treated as NULL
When compiling with 'clang', it would say: warning: expression which
evaluates to zero treated as a null pointer constant of type 'char *'.
2017-07-10 10:34:16 +02:00
David Lawrence Ramsey 6295cca03b tweaks: correct a parameter type, and correct two empty initializations
This avoids some warnings when compiled with -pedantic:

    ISO C forbids comparison of ‘void *’ with function pointer
    ISO C forbids empty initializer braces
2017-07-03 09:40:55 +02:00
Benno Schulenberg 16482f99b8 tweaks: unglobalize the nodelay_mode variable 2017-06-04 12:15:26 +02:00
Benno Schulenberg 621eb904b3 bindings: in the tiny version exclude word jumping from the prompts
In the tiny version, Ctrl+Left and Ctrl+Right are available only
in the editor itself and in the file browser.

This fixes https://savannah.gnu.org/bugs/?51173.
2017-06-04 11:13:03 +02:00
Benno Schulenberg 6ad3d3d6c0 display: show the cursor position also when searching took a while
Achieve this by making the suppression flag global, so that we can
just reset it instead of making an improper call of do_cursorpos().

This fixes the secondary part of https://savannah.gnu.org/bugs/?51134.
2017-05-29 22:15:38 +02:00
Benno Schulenberg f1a47a2aae tweaks: reshuffle a few things to reduce duplication
It is no longer necessary to assign up() and down() separately for
the help viewer because by now the movement keys have been sorted
in order of ascending stride also in the main menu.

The two string definitions are relocated just to reduce the number
of #ifdefs.
2017-05-19 17:57:39 +02:00
Benno Schulenberg 9ce41543ed startup: don't call delwin() with NULL, to avoid crashing on Solaris
Apparently the curses on SunOS is less forgiving than the one on GNU.
Or rather: delwin(NULL) should just return an error, it shouldn't crash.

This fixes https://savannah.gnu.org/bugs/?51053.
Reported-by: John Wiersba <jrw32982@yahoo.com>
Solved-by: John Wiersba <jrw32982@yahoo.com>
2017-05-18 10:26:11 +02:00
Benno Schulenberg 858e75e4cf tweaks: transform the token DISABLE_NANORC to ENABLE_NANORC
Also, allow rebinding the word and block jumping functions
in the tiny version when nanorc files are reenabled.
2017-05-09 11:59:34 +02:00
Benno Schulenberg 00533854c0 tweaks: fix compilation with --enable-tiny ...-help and ...-multibuffer
(This should have been part of 9ea5eef2, four commits ago.)
2017-05-08 22:01:34 +02:00
Benno Schulenberg dc3610fc8e tweaks: transform the token DISABLE_BROWSER to ENABLE_BROWSER
Also, allow Ctrl+Left/Right with --enable-tiny --enable-browser.
2017-05-08 21:56:50 +02:00
Benno Schulenberg 509b091c47 tweaks: rename three empty functions, and reshuffle some others
Also remove a superfluous check for 'do_replace' -- it never gets
bound in the Search/Replace menus.
2017-05-08 14:33:18 +02:00
Benno Schulenberg 9ea5eef200 bindings: allow toggling a new buffer when multiple buffers are enabled
When configured with --enable-tiny --enable-multibuffer,
/do/ include the new-buffer toggle in the Read-File menu.
2017-05-08 13:36:57 +02:00
Benno Schulenberg e701bb01aa tweaks: remove five dummy function definitions from the tiny version 2017-05-08 13:04:26 +02:00
David Lawrence Ramsey 03c3e2b7c0 tweaks: fix several whitespace irregularities
Add missing spaces, remove excess spaces, and
replace groups of indentation spaces with tabs.
2017-05-07 18:20:01 +02:00
Benno Schulenberg 9c2bc68847 help: after a search, show the cursor only when something was found
And hide the cursor again as soon as the user scrolls.
Achieve this through making the 'didfind' variable global.

Also, remove a superfluous call of wnoutrefresh(), as bottombars()
already does that.

This fixes https://savannah.gnu.org/bugs/?50918.
Reported-by: David Lawrence Ramsey <pooka109@gmail.com>
2017-05-03 17:02:49 +02:00
Benno Schulenberg 3d1ef8e07f bindings: show Home and End in browser help text, instead of M-| and M-? 2017-05-02 17:56:08 +02:00
Benno Schulenberg 5033cfd81a tweaks: transform the token DISABLE_MOUSE to ENABLE_MOUSE
Also, trim some comments and avoid an unused-variable warning.
2017-05-01 20:53:07 +02:00
Benno Schulenberg 9c3a149b14 tweaks: transform the token DISABLE_MULTIBUFFER to ENABLE_MULTIBUFFER 2017-05-01 20:20:34 +02:00
Benno Schulenberg 3275c4e514 display: initialize the colors only when starting to draw the content
This avoids https://savannah.gnu.org/bugs/?49912 while at the same time
avoiding to draw the edit window twice in a row -- the first drawing
would use a wrong margin, which results in a visible and irritating
shift left or right of the content upon the second drawing.

This fixes https://savannah.gnu.org/bugs/?50877.
2017-04-30 17:29:17 +02:00
Benno Schulenberg 81aebeb2a9 bindings: allow using <Backspace> to scroll back up in the help viewer
Backspace is a more logical counterpart of Space than minus.
2017-04-26 15:14:28 +02:00
Benno Schulenberg a832fffb1f browser: make ^End work properly by fixing a paste error
It complained of "Unbound key" until now.
2017-04-26 10:05:18 +02:00
Benno Schulenberg 99fa20645c tweaks: avoid an unused-variable warning
That is: nest the conditions consistently.
And in the bargain rename the variable.
2017-04-25 20:57:22 +02:00
Benno Schulenberg 46430999d5 build: make --enable-help properly depend on --enable-multibuffer
And in the process transform the token DISABLE_HELP to ENABLE_HELP.
2017-04-25 18:27:55 +02:00
Rishabh Dave 90bd25c1bb new feature: add a search facility to the help viewer
Allow the user to search in a help text with ^W and M-W.

Achieve this by not writing the help text directly to the screen
but first writing it to a temporary file and then opening this file
in a new buffer, and treating it specially: the normal file-reading
feedback is suppressed, the titlebar shows the headline of the text,
the cursor is hidden, and the menu is limited to just the up and down
movements and searching.

This fulfills https://savannah.gnu.org/bugs/?28994.

Signed-off-by: Rishabh Dave <rishabhddave@gmail.com>
2017-04-25 17:20:34 +02:00
Benno Schulenberg 3c875f9b59 tweaks: complete the exclusion of backups and such from the tiny version
File formats, appending and prepending, and backups are not available
when --enable-tiny is used, so prevent all relevant pieces of code from
getting compiled.  And correct two misspelled ENABLE_TINY to NANO_TINY.
2017-04-19 13:30:43 +02:00
Benno Schulenberg 74f128859b tweaks: rename a constant, to match the corresponding option 2017-04-17 11:51:48 +02:00
Benno Schulenberg 5aa12a2b3d tweaks: group ^D and ^H together in the help lines
This also groups ^I and ^M together, and cutwordleft and cutwordright
(when they are bound).  It furthermore makes that less pairs are now
mixed and instead consist of either two Ctrl or two Meta combos.  In
short: it looks better in the default config.  The only sacrifice is
that Verbatim is now split off from the other "inserting" keys.
2017-04-11 13:23:43 +02:00
David Lawrence Ramsey 02376103eb bindings: use arrows instead of words for search history too
When UTF-8 is available, use actual arrows instead of untranslated words
to indicate the cursor keys in the search history, as is done elsewhere.
2017-04-10 16:19:37 +02:00
Benno Schulenberg 754c62c5cc copyright: update the years, use ranges, and explain this usage
The interval 2013-2017 for the Free Software Foundation is valid
because in those years there were releases with changes by either
Chris or David, and the GNU maintainers guide advises to mention
a new year in all files of a package, not just in the ones that
actually changed, and be done with it for the rest of the year.
2017-04-09 12:09:23 +02:00
Benno Schulenberg bf00e3f606 tweaks: put M-A before ^6, to look better above M-6 in the help lines
Also, M-A is far more mnemonic for setting the mark than ^6 or ^^,
so it's better to try and teach the user that.
2017-04-07 20:07:37 +02:00
Benno Schulenberg cb0806b2a0 bindings: make ^Home and ^End go to top and tail of buffer
On some terminal emulators, Ctrl+Home and Ctrl+End produce special
keycodes, distinct from plain Home and End.  Make the users of those
emulators (and of the Linux console) glad by making ^Home and ^End
do the obvious thing, and the combinations with Shift too.
2017-04-06 21:19:00 +02:00
Benno Schulenberg 8fc72eb32b bindings: use arrows instead of words to designate the cursor keys
When UTF-8 is available, use actual arrows instead of untranslated words
to indicate the cursor keys.  This was already done for the combinations
with Ctrl but not yet for the plain cursor keys.
2017-04-04 20:53:08 +02:00
Benno Schulenberg 6b5aff4878 tweaks: put unshifted shortcuts ^6 and M-6 first, instead of ^^ and M-^
The unshifted shortcuts are easier to type, and also less confusing in
my eyes.  Putting them first means they get shown in the help lines,
and get listed first in the ^G help text.

(I would also like to put ^- first instead of ^_ (because the latter
is hard to see when using the default inverse video for shortcuts),
but on several terminal emulators Ctrl+- reduces the font size.)
2017-04-04 20:41:09 +02:00
Benno Schulenberg fb534bada6 bindings: make ^Up/^Down go to first/last row in the file browser
Making ^Up and ^Down go to top and bottom row in the file browser
complements and completes the behavior of ^Left and ^Right.
2017-04-04 20:26:21 +02:00
Benno Schulenberg c01d6a8f74 tweaks: reshuffle the bindings to group things more logically
Put all the movement keys together, in order of ascending stride.

Also, move the Undo/Redo keystrokes further up, so that, when the
user has a somewhat wider terminal than the usual 80 characters,
these keystrokes will be shown -- they are far more interesting
than the ^Y and ^V ones, for which PgUp and PgDn can be used.
2017-03-23 11:37:36 +01:00
David Lawrence Ramsey 812ecaeb0c weeding: remove maxlines and related code
Since all lines can be partially scrolled off the screen now
(except for edittop, which is forthcoming), the maxlines global
variable and its computation mechanism are no longer needed.
2017-03-22 10:44:05 +01:00
David Lawrence Ramsey d8189703b1 tweaks: prepare for improvements to do_home() and do_end()
These improvements will eventually make do_home() and do_end() take
parameters.  Since the global function lists can hold only functions
without parameters, preemptively add do_home_void() and do_end_void(),
and make the global function lists use them.
2017-03-22 10:44:04 +01:00
Benno Schulenberg 9b336a9d66 bindings: group the three search-again shortcuts together 2017-03-20 15:59:41 +01:00
Hans-Bernhard Broeker 636b7348a6 tweaks: make sure calls to <ctype.h> functions/macros use "unsigned char"
The platform's default char type might be signed, which could cause
problems in 8-bit locales.

This addresses https://savannah.gnu.org/bugs/?50289.
Reported-by: Hans-Bernhard Broeker <HBBroeker@T-Online.de>
2017-03-06 20:58:25 +01:00
Mike Frysinger 3deec4352b assume regex.h support is always available
Now that we pull in the gnulib regex module, we can assume it exists.
2017-03-06 12:01:08 +01:00
Benno Schulenberg 3d9a4d6257 tweaks: make WhereIsNext available in browser in tiny version
Also, avoid a warning with with --enable-tiny --enable-browser.
2017-02-27 19:22:50 +01:00
Benno Schulenberg eb67af9347 tweaks: fix compilation with --enable-tiny --enable-help 2017-02-27 19:10:39 +01:00
Benno Schulenberg 0208ae7149 tweaks: rename a variable -- lines refers to buffer, rows to screen 2017-01-12 17:33:46 +01:00
Benno Schulenberg eef7d1047a screen: display byte value 0x0A in the right places as ^@ or as ^J
In path names and file names, 0x0A means an embedded newline and
should be shown as ^J, but in anything related to the file's data,
0x0A is an encoded NUL and should be displayed as ^@.

So... switch mode at the two main entry points into the "file system"
(reading in a file, and writing out a file), and also when drawing the
titlebar.  Switch back to the default mode in the main loop.

This fixes https://savannah.gnu.org/bugs/?49893.
2016-12-23 11:00:55 +01:00
Benno Schulenberg a9b5a0e029 tweaks: rename a function to something less abbrevy
Also, swap the logic around, to use less braces.
2016-12-22 12:04:10 +01:00
Benno Schulenberg b77e6bd99d general: simplify the detection of a SIGWINCH
There is no need for a counter, nor an old counter to compare it with.
2016-12-19 10:04:01 +01:00
David Lawrence Ramsey c9f743f676 tweaks: elide two unneeded variables from line numbering mode
Instead compute directly whether we're at a softwrapped part or not.
2016-12-13 17:01:39 +01:00
Benno Schulenberg 964c10db17 tweaks: miscellaneous frobbings and rewrappings 2016-12-07 20:37:08 +01:00
Benno Schulenberg 0e01080983 binding: allow to rebind the word-completion function, and document it 2016-12-07 17:18:56 +01:00
Benno Schulenberg 68a0314500 build: add configure option --disable-wordcomp to disable word completion
(The variable 'pletion_line' is not conditionalized with this option, as
it would become messy.  The compiler will probably be able to elide it.)

When using --enable-tiny, it is not possible to use --enable-wordcomp,
because the word completion function uses the undo system.
2016-12-07 17:02:25 +01:00
Sumedh Pendurkar dca4ab5d8f new feature: complete a fragment to a longer word found in the buffer
Executing the 'complete_a_word' function will search from the start
of the current buffer for entire words that begin with the fragment
that is before the cursor, and will complete this fragment to the
first word that is found.  Each consecutive call of 'complete_a_word'
will search for the next matching word and will complete the fragment
to that.  By default the function is bound to the ^] keystroke.

Signed-off-by: Sumedh Pendurkar <sumedh.pendurkar@gmail.com>
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2016-12-07 16:42:39 +01:00
Benno Schulenberg 33bc848c5b binding: properly conditionalize the UTF-8 parts
Reported-by: Sumedh Pendurkar <sumedh.pendurkar@gmail.com>
2016-10-29 10:19:28 +02:00
Faissal Bensefia de95ca68f7 new feature: the ability to show line numbers before the text
It can be activated with --linenumbers on the command line or with
'set linenumbers' in a nanorc file, and it can be toggled with M-#.

Signed-off-by: Faissal Bensefia <faissaloo@gmail.com>
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2016-10-20 16:47:52 +02:00
Benno Schulenberg 55878efe5d binding: supply the keycode for most special keys directly
Instead of figuring them out from the string.  This is possible
because those dedicated editing keys cannot be rebound anyway.
2016-10-18 20:38:27 +02:00
Benno Schulenberg c92982d60f binding: fix some duplicated carets and too restrictive menus 2016-10-15 17:18:51 +02:00
Benno Schulenberg 7a274d621a binding: use arrows instead of words to designate the cursor keys 2016-10-15 17:04:01 +02:00
Benno Schulenberg fdee0df849 input: keep the Ctrl+Arrow keys working when their synonyms are unbound
This fixes https://savannah.gnu.org/bugs/?49058 reported by Rishabh Dave.
2016-10-15 17:03:10 +02:00
Benno Schulenberg 3264d0c5be tweaks: move a variable that doesn't need to be global 2016-10-12 19:59:26 +02:00
Benno Schulenberg bc8bb7e942 screen: keep the help items nicely lined up also in the tiny version 2016-09-13 09:29:44 +02:00
Benno Schulenberg 08cd197bf1 general: include word-jumping and block-jumping into the tiny version
And also case-sensitive searches, backward searches, and searching again.
2016-09-13 09:27:04 +02:00
Benno Schulenberg ed9e5d7183 docs: mark some rebindable function names as deprecated 2016-09-03 20:12:29 +02:00
Benno Schulenberg fd6308d6d3 tweaks: reshuffle a couple of items 2016-09-03 13:42:19 +02:00
Benno Schulenberg 1dbebbcadc screen: keep the help items aligned in more configurations
This fixes https://savannah.gnu.org/bugs/?48987.
2016-09-03 13:35:19 +02:00
Benno Schulenberg 57d1755d10 tweaks: preen some comments, and reshuffle a few ifdefs 2016-09-03 12:14:08 +02:00
Benno Schulenberg bace664fbc startup: allow to rebind the RegExp toggle also in the tiny version
This fixes https://savannah.gnu.org/bugs/?48988.
2016-09-03 11:45:49 +02:00
Benno Schulenberg 7b7d2bf7c9 tweaks: make tiny nano a teeny bit smaller 2016-09-02 12:01:03 +02:00
Benno Schulenberg 514cd9a099 update the license text to the preferred version
Mentioning "GNU nano" instead of "This program" and referring to the
website instead of to a postal address.
2016-08-29 21:27:16 +02:00
Benno Schulenberg 406e5242a3 update the copyright notices 2016-08-29 21:27:05 +02:00
Benno Schulenberg 382c9d792d new feature: allow text selection by holding Shift with the cursor keys
Add the keycodes and routines to allow the user to forego setting the
mark explicitly (with M-A / ^6) and instead quickly select a few words
or lines by holding down Shift together with the movement keys.

(Some combinations with Shift are swallowed by some terminal emulators.
To work around some of those, the combinations Shift+Alt+Left/Right work
as Shift+Home/End and Shift+Alt+Up/Down work as Shift+PageUp/PageDown.)
2016-08-28 11:29:28 +02:00
Benno Schulenberg aeb49a8013 bottombar: only count help items that have a shortcut bound to them
This avoids showing a ghost item in, for example, the WriteOut menu
when not using --tempfile and the user does not bind 'discardbuffer'.
2016-08-27 12:22:59 +02:00
Benno Schulenberg c661506681 tweaks: use a separate function to ask ncurses for keycodes 2016-08-16 12:01:59 +02:00
Benno Schulenberg 928a24c204 input: look at the modifier keys only when compiled on Linux
This fixes https://savannah.gnu.org/bugs/?48751 reported by Andrew Ho.

This also fixes compilation when configured with --enable-tiny.
2016-08-14 21:42:08 +02:00
Benno Schulenberg 290d278f68 input: make the Ctrl+Arrow keys work on a Linux console
If this breaks your build, please send report or instructions or patch.
2016-08-07 18:20:34 +02:00
Rishabh Dave 1fd2354ad4 shortcuts: zero the value of 'toggle' for keys that are not toggles
This fixes http://savannah.gnu.org/bugs/?48698.

Signed-off-by: Rishabh Dave <rishabhddave@gmail.com>
2016-08-07 11:31:55 +02:00
Benno Schulenberg 90a90365a8 tweaks: rename three constants, for clarity, and hardcode two others 2016-08-01 12:56:05 +02:00
Benno Schulenberg cb10b2b908 tweaks: elide the global variable 'func_key'
There is no need to specially flag a function key or editing key --
the keycode is indication enough in itself: outside of byte range.
2016-07-31 18:13:05 +02:00
Benno Schulenberg 3930a697e8 tweaks: consistently use a parameter instead of a struct element 2016-07-30 13:05:52 +02:00