Commit Graph

3914 Commits (46430999d5e64aa6e091b2897a9508018e4f5b0a)

Author SHA1 Message Date
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
Benno Schulenberg 9cff7a1689 help: use a dedicated syntax to color shortcuts in a help text
This avoids applying the default syntax, or the syntax specified
with --syntax, to a ^G help text.
2017-04-25 17:21:46 +02:00
Benno Schulenberg ae15fc9bb2 bindings: allow using '/' to start a search in the help viewer
And allow 'N' for searching the next occurrence.  Add the
same keystrokes to the file browser too, for consistency.
2017-04-25 17:21:38 +02:00
Benno Schulenberg b3b3dd5792 help: remove the final blank line, so <End> does the same as all <Down>
Since the help text is searchable, an <End> would go to the end of the
text but would leave a blank line above the statusbar -- a blank line
that wasn't there before, and that is not reached when simply holding
down <Down> all the way from the top.
2017-04-25 17:21:33 +02:00
Benno Schulenberg 7e1648fdb0 help: set tabsize to the default width while showing a help text
So that the shortcut explanations get properly aligned.
2017-04-25 17:21:28 +02:00
Benno Schulenberg e05dfda2be help: don't cycle forward in the buffers when exiting from help
When nano has multiple files open, closing a help buffer should
not switch to the next buffer in the ring but to the preceding one,
because it was from there that the help screen was invoked.
2017-04-25 17:21:25 +02:00
Benno Schulenberg fe012dad91 help: when searching, do it forward, without case, and without regexes
Also, save and restore all the flags in a single swoop.
2017-04-25 17:21:21 +02:00
Benno Schulenberg 3787494c15 help: don't crash when nano was started with --noread
There is no need to restore NOREAD_MODE after unsetting it, because
any files mentioned on the command line have already been /not/ read.
2017-04-25 17:21:16 +02:00
Benno Schulenberg 8de4b7aaeb tweaks: rename a variable, use a faster comparison, and reshuffle a bit 2017-04-25 17:21:13 +02:00
Benno Schulenberg 9de0f158e2 help: keep the same position also after M-\ or M-/ has been used 2017-04-25 17:21:09 +02:00
Benno Schulenberg 3d62d32cbe help: keep the text at the same position when the screen is resized
However, prefer moving the starting point of the text backwards over
moving it forward, so that of the same paragraph more text is shown
instead of less.  But scroll an empty line out of view -- no text is
"lost" then.
2017-04-25 17:21:06 +02:00
Benno Schulenberg f9fea02fc5 help: suppress nano's name and number to make it clearer this is help
The top-left corner changing is far more conspicuous than the top right.
2017-04-25 17:21:02 +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 ca6d7b6a46 input: avoid crashing when resizing the window during verbatim input
This fixes https://savannah.gnu.org/bugs/?50872.
2017-04-25 13:01:21 +02:00
Benno Schulenberg 861d81edba scrolling: don't bother to limit the number of lines to step back
The go_back_chunks() function will do this clipping.

This fixes https://savannah.gnu.org/bugs/?50866.
2017-04-24 19:48:55 +02:00
Benno Schulenberg 040bd93cc4 tweaks: distinguish (in the comments) between buffers and linestructs
Call something a buffer when it refers to a linked list of linestructs,
and call something a linestruct when it is a struct that describes a
single line.
2017-04-19 17:48:52 +02:00
Benno Schulenberg e935fd4f88 tweaks: reshuffle a couple of lines to avoid a duplicate call
Trim a superfluous assert too.
2017-04-19 16:32:16 +02:00
Benno Schulenberg a43eee6aec tweaks: fix compilation with --enable-tiny --enable-color --enable-speller
Also avoid an unused-variable warning, and trim a useless assert.
2017-04-19 14:30:36 +02:00
Benno Schulenberg 1fbe7596f8 options: allow -U (--quickblank) to be used in the tiny version
It takes almost no code and is a useful little improvement over Pico.
2017-04-19 13:47:40 +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 700c5c9399 tweaks: rename a parameter, to be more imperative 2017-04-17 12:01:03 +02:00
Benno Schulenberg 74f128859b tweaks: rename a constant, to match the corresponding option 2017-04-17 11:51:48 +02:00
Benno Schulenberg 953fbf8efe tweaks: elide a function that is used just once
And in the bargain avoid a duplicate call of strlenpt(prompt).
2017-04-17 11:44:04 +02:00
Benno Schulenberg 3dc6ccbe86 tweaks: rename a function, to be more accurate
Because nothing gets reset to zero or to some initial value.
2017-04-17 11:29:29 +02:00
Benno Schulenberg b98545f455 display: push the titlebar to the screen as soon as it has been drawn
To avoid an ncurses hiccup (miscoloring) when running on musl.

This fixes https://savannah.gnu.org/bugs/?50787.
Reported-by: Avi Halachmi <avihpit@yahoo.com>
2017-04-17 10:53:38 +02:00
Benno Schulenberg 5a741a0205 tweaks: remove some superfluous placements of the cursor
The cursor needs to be placed in its proper spot in the edit window
/only/ when nano is about to accept input from the user and needs to
show where this input will go.

(This might cause a scrolling issue to appear, because reset_cursor()
does not just place the cursor, it also recomputes current_y, which
is used in several places to determine whether and how much to scroll.
If it so happens, we'll deal with that fallout later.)
2017-04-17 10:35:05 +02:00
Benno Schulenberg 6723ac6fcc tweaks: add three warnings for conditions that should never occur 2017-04-17 10:17:47 +02:00
Benno Schulenberg 9f696ef9af copyright: update the year in --version, and use the standard hyphen 2017-04-11 13:57:29 +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
Benno Schulenberg 2439e1e451 linting: treat a tab as one "column", not eight
This fixes https://savannah.gnu.org/bugs/?47131.
2017-04-10 20:32:36 +02:00
Benno Schulenberg dab70d06ed linting: when no is said to a file, remove all corresponding entries
When the user chooses not to open a file that some message refers to,
remove all messages for that file from the linting results, so the user
does not get asked about that same file again.

This fixes https://savannah.gnu.org/bugs/?47130.
2017-04-10 19:55:46 +02:00
Benno Schulenberg 8993c36366 tweaks: reduce the number of additions that actual_x() performs
Replace them by a single subtraction.
2017-04-10 19:25:40 +02:00
David Lawrence Ramsey 5c51d4ea46 tweaks: avoid a compilation warning 2017-04-10 16:26:52 +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 999d99c6e4 tweaks: delete a function that hasn't been used since 2005 2017-04-09 13:33:25 +02:00
Benno Schulenberg 6e73805a0d tweaks: delete unnecessary function prototypes
These functions are used only in the file in which they are declared,
and they are declared before they are used.
2017-04-09 13:28:27 +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 9f2c80db24 moving: when determining where we are on the screen, use placewewant
To make dynamic Home and End work properly when double-width characters
straddle a chunk boundary, use the spot where the cursor is really shown
instead of the "actual x" position of the current character, because the
latter might be on the preceding row.

This fixes https://savannah.gnu.org/bugs/?50737.
2017-04-09 11:36:39 +02:00
Benno Schulenberg 4c987bc3e0 tweaks: adjust a couple of comments 2017-04-07 21:40:33 +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
David Lawrence Ramsey 23ae7bfbbf input: support escape sequences for ^Home and ^End
Make nano recognize the escape sequences for Ctrl-Home, Ctrl-End,
Shift-Ctrl-Home, and Shift-Ctrl-End on xterm, rxvt, and Eterm.
2017-04-06 21:25:41 +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 005ee8eda6 editing: avoid creating blank lines when using autoindent
When Enter is pressed while the cursor is exactly on the current
indent width, remove the blank characters on that line to avoid
creating a line that consists only of trailing whitespace.

(When Enter is pressed somewhere in the middle of the blanks,
however, the whitespace is preserved.)

Suggested-by: Florian Zeitz <florob@babelmonkeys.de>
2017-04-06 20:34:04 +02:00
Benno Schulenberg f3e2ad945d display: with softwrap, show the cursor where the eye expects it
When a multi-column character straddles a chunk boundary, and the
preferred column (placewewant) for the cursor is zero, cheat: show
the cursor not where the character starts but on the beginning of
the next row.  This makes the cursor move smoothly in the leftmost
column of the screen when using <Up> and <Down> and such, instead
of jumping around.

In this way the scrolling logic won't get confused and the screen
will scroll properly when stepping beyond the top or bottom row.

This fixes https://savannah.gnu.org/bugs/?50687.
2017-04-06 19:51:07 +02:00
Benno Schulenberg 6ec65d5500 display: check the correct character for being double-width
This fixes https://savannah.gnu.org/bugs/?50741.
2017-04-06 17:39:58 +02:00
Benno Schulenberg de0adb8e3e tweaks: keep the help text aligned, also with the narrow arrows 2017-04-05 18:02:03 +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 b5bc1b5094 tweaks: again use memory on the stack instead of malloc() and free()
Also, don't bother copying the found bracket -- just compare it in situ
and thus elide a variable.
2017-04-04 19:20:33 +02:00