Commit Graph

574 Commits (84ff9ebb91b775b84567f02cc5e0e6428bdf7b3e)

Author SHA1 Message Date
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