Commit Graph

6472 Commits (5907f8801b55582b8e338fa2429bb190dbd9944c)

Author SHA1 Message Date
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 a9c4682c25 tweaks: rename another function, to better describe what it does
Also, reshuffle two initializations to go sit with the other ones.
2017-05-01 17:54:48 +02:00
Benno Schulenberg 6566177743 tweaks: add a warning for a condition that should never occur 2017-05-01 17:42:55 +02:00
Benno Schulenberg 443e1484e5 tweaks: reshuffle help-text initialization, to elide a save-and-restore 2017-05-01 17:32:50 +02:00
Benno Schulenberg ac9550d4c2 tweaks: remove two superfluous calls of wnoutrefresh()
The bottomwin has just been refreshed by update_the_statusbar(),
and it should not be the responsibility of the prompt routines
to keep the edit window up to date, as they don't write anything
there.
2017-05-01 17:14:20 +02:00
Benno Schulenberg 1423e57199 tweaks: rename a function, to better suit what it does
Things have morphed over time and display_buffer() no longer actually
displays the buffer -- it just displays the title bar, precalculates
the multiline color info, and schedules a refresh of the edit window.
2017-05-01 16:53:13 +02:00
Benno Schulenberg c095ece497 gnulib: update to its current state in git 2017-05-01 15:07:33 +02:00
Benno Schulenberg 9366131c51 tweaks: reshuffle some more stuff, and rename two more variables 2017-05-01 13:22:37 +02:00
Benno Schulenberg 009cd30695 tweaks: rename three variables, elide another, and reshuffle some stuff
Also, avoid an unused-variable warning when configured with
--enable-tiny --enable-help --enable-multibuffer.
2017-05-01 12:10:17 +02:00
Benno Schulenberg c42d6d378a tweaks: check for an empty needle in a central place
Searching for an empty string should be impossible, it should never
happen, but it is bit too hard to verify this at the moment.
2017-04-30 20:32:01 +02:00
Benno Schulenberg 1a79b3d514 tweaks: remove a superfluous strlen() call from the reverse searches
If the length of the haystack is smaller than the length of the needle,
this means that also the length of the tail will be smaller -- because
pointer will be bigger than or equal to haystack -- so the pointer gets
readjusted to be a needle length before the end of the haystack, which
means that it ends up /before/ the haystack: thus the while loop will
never run.

On average, this saves some 200 nanoseconds per line.
2017-04-30 19:51:36 +02:00
Benno Schulenberg 7d3d3dec9a tweaks: use the logic from revstrstr() also in mbrevstrcasestr()
Because it is slightly faster.
2017-04-30 19:51:14 +02:00
Benno Schulenberg 6240805c41 tweaks: rename one variable again
It is not an index, it is not an offset from anything,
it is a direct pointer.
2017-04-30 17:50:12 +02:00
Benno Schulenberg 17cf7d1c62 syntax: nanohelp: change the hue of the keystrokes to match sample.nanorc
And because I think it looks slightly better.
2017-04-30 17:37:07 +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 395c8e9e25 help: allocate enough space for the descriptions, so we don't crash
We should measure the length of each /translated/ shortcut description,
not of the original English one.

This fixes https://savannah.gnu.org/bugs/?50899.
2017-04-30 13:00:02 +02:00
Benno Schulenberg a8a60b29e6 startup: warn about a strange character size only in the UTF-8 case
This addresses https://savannah.gnu.org/bugs/?50897.
Reported-by: Hannu Nyman <hannu.nyman@iki.fi>
2017-04-30 11:15:03 +02:00
Benno Schulenberg c1ebfa04ae docs: in the FAQ, extend the answer to the pasting problem 2017-04-28 22:13:02 +02:00
Benno Schulenberg 6967fae35d tweaks: use the logic from revstrstr() also in revstrcasestr()
This elides a counter and a comparison from the central loop,
and thus makes the search a tiny bit faster.
2017-04-28 22:12:53 +02:00
Benno Schulenberg a37435141a tweaks: rename some more of these 'rev_start' variables 2017-04-28 22:09:38 +02:00
Benno Schulenberg 329021e24a tweaks: rename two variables, because this 'rev_start' is irksome
And one-letter variables I cannot "see" -- they are too small.
2017-04-28 21:02:24 +02:00
Benno Schulenberg b06407fbd7 tweaks: drop a bunch of asserts 2017-04-28 16:07:27 +02:00
Benno Schulenberg 8edaa38a1e tweaks: condense two bits of code, and drop two asserts 2017-04-28 15:57:51 +02:00
Benno Schulenberg 1f55c8819b tweaks: swap the names of two variables, to make more sense
An iterator should not be called "start_col", because it is only the
starting column at the very beginning.

Also, start_col (after the rename) can never be /larger/ than column.
2017-04-28 15:48:50 +02:00
Benno Schulenberg 03ecbf3d55 tweaks: remove a superfluous check
The mbwidth() function itself checks whether UTF-8 is being used
and does the right thing.
2017-04-28 15:47:53 +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 7b442ea4cb tweaks: be more precise about what --disable-extra does
Also, harmonize some configure-option descriptions,
add a slash after a subdir, and fix a typo.
2017-04-26 13:54:48 +02:00
Benno Schulenberg a846a2c19f docs: add an item to the FAQ, about pasting from Windows to a remote nano
Also, add two missing configure options, and frob some other things.
2017-04-26 12:49:10 +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 26fe2118c4 docs: update the list of who authored what
Also, mention that help texts can now be searched through, update
a copyright notice, and update and simplify a copyright year.
2017-04-25 20:32:05 +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
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 d6313c2f8c tweaks: fix two typos 2017-04-24 20:29:41 +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