Commit Graph

9877 Commits

Author SHA1 Message Date
Benno Schulenberg
d93a5594cd tabbing: also with --zero, stay one row away from the prompt bar
When <Tab> at a prompt shows a list of filenames, this list should
not "sit" on the prompt bar but float one row above it.

This addresses the third issue mentioned in commit 03637030.
2021-11-15 10:44:06 +01:00
Benno Schulenberg
a2a00577cd search: with --zero, do not obscure an occurrence on the bottom row
If there is a status-bar message and the cursor happens to be on the
bottom row of the screen (in hidden-interface mode), then scroll the
viewport one row down, to keep the cursor in view.

This addresses the second issue mentioned in commit 03637030.

(The issue was rereported in https://savannah.gnu.org/bugs/?61464.)
2021-11-15 10:44:06 +01:00
Benno Schulenberg
b92b9e5cac browser: with --zero, do not use the bottom row for displaying filenames
Otherwise the prompt bar or status bar could hide the highlighted item.

This addresses the first issue mentioned in commit 03637030.
2021-11-15 10:44:06 +01:00
Benno Schulenberg
d19842ed73 tweaks: add an auxiliary variable, to prepare for handling --zero 2021-11-15 10:44:06 +01:00
Benno Schulenberg
0655c8aa6c tweaks: rename a variable, to be distinctive and less confusing
Also rewrap three lines, to keep related things closer together.
2021-11-15 10:44:06 +01:00
Benno Schulenberg
30595dd2bb tweaks: frob a couple of comments, and drop two, for conciseness 2021-11-15 10:44:06 +01:00
Benno Schulenberg
b76b5b9967 tweaks: use a few fewer capitals, and drop an unneeded synonym 2021-11-13 16:33:47 +01:00
Benno Schulenberg
1007ca5af8 docs: mention M-Z (for toggling the interface) among the Feature Toggles
And rephrase the M-Y description a bit, for shortness and variety.
2021-11-13 16:30:38 +01:00
Benno Schulenberg
f3fab1440f tweaks: shorten two comments, and fold two statements together 2021-11-11 16:06:43 +01:00
Benno Schulenberg
affca9b523 statusbar: overwrite a message also when using --constant with --zero
This needlessly wipes the status bar when --constantshow is active,
but it already needlessly wiped it when --minibar is active, so...
It is not a performance issue.  It was just a small optimization.
(Plus, with --zero, nano does a full edit_refresh() when in fact
only the bottom row needs to be redrawn, but there is no easy way
to do that when --softwrap is active, so...)

(Using --constantshow with --zero doesn't make sense, but the user
might want to have the --constantshow when they toggle --zero off.)
2021-11-11 16:02:58 +01:00
Benno Schulenberg
2f53760689 bindings: let ^T in the tiny version invoke spell checker (when included)
This fixes https://savannah.gnu.org/bugs/?61460.

Bug existed since version 5.0, commit d3954901, since in the normal
version ^T was repurposed to give direct access to the Execute menu.
2021-11-10 16:42:51 +01:00
Benno Schulenberg
3409cb2b77 files: allow inserting also when started with the --noread option
The --noread option should apply only to the files listed on the
command line, but once nano has started, it should be possible to
insert other files into the current buffer or into a new buffer.

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

Bug existed since version 2.3.3, since --noread was introduced.
2021-11-10 16:24:23 +01:00
Benno Schulenberg
be6860b33e tweaks: remove two unneeded unsettings
Before version 4.3, commit 3eab405e, nano would write a help text to
a temporary file and then read this file into a buffer.  The NOREAD
flag interfered with the latter, so needed to be reset for showing
help.  But since the mentioned commit nano writes a help text directly
into a buffer and the unsetting of the NOREAD flag is superfluous.

The display code never references the LINE_NUMBERS flag -- the trigger
for displaying line numbers in front of the text is 'margin > 0'.  So,
since commit 90bd25c1 that put help texts into a "normal" buffer, the
unsetting of the LINE_NUMBERS flag has been superfluous.
2021-11-10 16:05:40 +01:00
Benno Schulenberg
3a94a0bb89 bindings: allow toggling line numbers (when enabled) also in tiny version
As a special case, and because it doesn't need any feedback on the
status bar nor other calls, add a special function and key binding
to allow the user to flip the LINE_NUMBERS flag also in a tiny nano.

This fixes https://savannah.gnu.org/bugs/?61441.
Reported-by: Hannu Nyman <hannu.nyman@iki.fi>
2021-11-10 09:32:00 +01:00
Benno Schulenberg
8234c22c1e tweaks: avoid a compiler warning with --enable-tiny --enable-linenumbers 2021-11-10 09:11:04 +01:00
Benno Schulenberg
496dad696c build: fix compilation with --enable-tiny --enable-wrapping
Problem existed since commit 50106266 from three weeks ago.
2021-11-10 09:07:23 +01:00
Benno Schulenberg
a623f5836c docs: explain the effect of --zero / -0 / 'set zero'
Also, colorize 'set zero' as valid option in a nanorc file.
2021-11-09 16:31:04 +01:00
Benno Schulenberg
f42821293e feedback: refuse the --constantshow toggle (M-C) on a one-row terminal
When the terminal has just one row, there is no room to constantly show
the position of the cursor, so do not allow the user to switch it on.

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

Bug existed since version 5.8, commit 36ffb5f0.
2021-11-09 12:29:51 +01:00
Benno Schulenberg
0363703073 new feature: option --zero for an interface without bars
With --zero or 'set zero', nano will hide the title bar or the minibar
(whichever is active) and will use all rows of the terminal for showing
the text of the buffer.  Only when there is an important message will
it be shown on the bottom row -- until the next keystroke.

This feature can be toggled with M-Z.

The feedback at startup ("Read nnn lines") is suppressed with --zero,
because it disrupts the fullscreen experience (and is hardly useful).
The "Reading..." message then needs to be suppressed too, otherwise
it creates an annoying little flash.

There are still some issues that need to be addressed:

* In the browser, when the highlighted item is on the bottom row, it
  will get obscured by the prompt bar or the "Search Wrapped" message.

* In the edit window, when the search occurrence is on the bottom row,
  it can get obscured by the "This is the only occurrence" message.

* When tabbing at a prompt shows possible completions, they are shown
  a row too low.
2021-11-09 11:50:40 +01:00
Benno Schulenberg
dfbe3ce6dc docs: clarify that --enable options do not fully counteract --enable-tiny
This addresses https://savannah.gnu.org/bugs/?61441.
Reported-by: Hannu Nyman <hannu.nyman@iki.fi>
2021-11-09 10:50:29 +01:00
Benno Schulenberg
e4a247f7c9 tweaks: rename three functions, to better fit the general scheme 2021-11-09 10:39:31 +01:00
Benno Schulenberg
69b2467a9a tweaks: rename two more functions, to lose a senseless suffix 2021-11-09 10:18:03 +01:00
Benno Schulenberg
cc24e8b86b docs: give more examples of things that --enable-tiny excludes 2021-11-08 17:20:15 +01:00
Benno Schulenberg
27f170815f tweaks: rename two functions, to get rid of one more senseless suffix 2021-11-08 16:54:18 +01:00
Benno Schulenberg
d3c7e9d2f6 tweaks: rename two functions, to get rid of another senseless suffix 2021-11-08 16:41:44 +01:00
Benno Schulenberg
ea4bbf4285 tweaks: rename two functions, to get rid of the senseless suffix of one 2021-11-08 16:16:35 +01:00
Benno Schulenberg
308d6e73e3 tweaks: normalize whitespace, drop unneeded prototype, condense comment 2021-11-07 15:51:32 +01:00
Benno Schulenberg
167c93b85c justify: correctly determine whether top-of-buffer has been reached
The text to be justified has been excised from the buffer and is now
in the cutbuffer, so we cannot compare any of its lines to 'filetop'.

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

Bug existed since version 4.0, commit 14c08589.
2021-11-07 15:20:18 +01:00
Benno Schulenberg
13c5bcb4d8 tweaks: improve a comment, and drop two cluttering compile conditions 2021-11-07 11:33:02 +01:00
Benno Schulenberg
c692a6ca70 tweaks: reshuffle a line into its proper order, and improve two comments 2021-11-07 11:23:45 +01:00
Benno Schulenberg
0346e63c20 build: fix compilation when configured with --enable-tiny
Problem existed since commit 50106266 from two weeks ago.
2021-11-05 16:00:34 +01:00
Benno Schulenberg
9e982f3283 tweaks: rename a function, for some contrast and to get rid of a suffix 2021-11-05 15:59:32 +01:00
Benno Schulenberg
11fec6f63c feedback: when the user types ^Z, say they can suspend nano with ^T^Z
Inspired-by: Sébastien Desreux <seb@h-k.fr>
2021-11-05 15:25:03 +01:00
Benno Schulenberg
d0c2c1e6b9 suspension: leave ^Z unbound by default -- just ^T^Z will suspend nano
Suggest in the documentation how to get a one-keystroke Suspend.
2021-11-05 15:24:45 +01:00
Benno Schulenberg
fab4d0afcb tweaks: reshuffle a coloring rule, to have related ones together
(We don't want the rule for control codes after the rule for comments,
because then control codes in commented-out binds would stand out.)
2021-11-03 17:35:52 +01:00
Benno Schulenberg
d9e42cb274 syntax: nanorc: require whitespace before the start= and end= keywords
Also, drop the unneeded and mistaken 'end=' in the first regex, as
a coloring rule with just end="something" is not valid.  And drop
the requirement for having trailing whitespace or nothing at all,
as it does not constitute a useful restriction.

Also, fold two regexes together, for economy.
2021-11-03 17:33:45 +01:00
Benno Schulenberg
4d9be13316 syntax: nanorc: add 'execute' menu for unbind, and drop a bad constraint
The coloring rule for 'unbind' still checked for the old 'extcmd' and
'externalcmd' menu names.  And not coloring binds and unbinds as valid
when followed by something other than a comment was overrestrictive,
because the bind or unbind command would work just fine.

(Nano silently allows trailing garbage on any line without a regex.)

Also, take the opportunity to order the menu names in the bind and
unbind rules in the same way.

This fixes https://savannah.gnu.org/bugs/?61419,
and fixes https://savannah.gnu.org/bugs/?61420.

First bug existed since version 5.0, commit d9106abf.
Second bug existed since version 2.3.3, commit 9c11ba93.
2021-11-03 16:57:27 +01:00
Benno Schulenberg
7365ef4092 docs: mention "grey" also at the other place where color names are listed
And harmonize the wrapping of the phrase.

Indirectly-reported-by: Brad Town <brad@bradtown.com>
2021-11-03 11:21:39 +01:00
Benno Schulenberg
13edbedc79 tweaks: replace a verbose condition with a simpler early return 2021-11-01 18:17:47 +01:00
Benno Schulenberg
fc5d58ad97 tweaks: add two spaces and two comments, and drop an internal check 2021-10-31 16:45:43 +01:00
Benno Schulenberg
a373fa500a docs: add a suggested rebind and three suggested unbinds to the sample rc 2021-10-31 11:14:09 +01:00
Benno Schulenberg
8da098f5e0 help: group the now lone mouse toggle with the "behavioral" ones 2021-10-31 10:55:07 +01:00
Benno Schulenberg
52d4b96639 docs: mark options -z, --suspendable, and 'set suspendable' as obsolete 2021-10-31 10:55:07 +01:00
Benno Schulenberg
83f94a88df suspension: enable ^Z by default -- ignore -z option and drop M-Z toggle
In the beginning, the goal for nano was to be a drop-in replacement for
Pico.  Pico did not know a Suspend command, so the ^Z keystroke needed
to be conditionalized on an option (-z or --suspend or the toggle M-Z),
just like the ^S and ^Q keystrokes (for stopping and resuming terminal
output) were conditionalized on --preserve.

But nano has abandoned full Pico compatibility since version 4.0.  It
is time to unconditionalize ^Z as well.  This should not be a problem:
Debian and Ubuntu have had 'set suspend' in their /etc/nanorc for years,
so a considerable portion of nano users have had ^Z enabled by default
for a long time, and no one seems to have complained.

If the keystroke bothers some user, they can unbind it in their nanorc.
They will still be able to suspend nano through the Execute menu: ^T^Z.

This addresses https://savannah.gnu.org/bugs/?61372.
2021-10-31 10:55:07 +01:00
Benno Schulenberg
8762e04631 replacing: keep the spotlighting, also after toggling the help lines
The spotlighting should only be dropped when in the main menu, like in
the code thirty lines up, where 'timed' became TRUE only for MMAIN.

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

Bug existed since version 5.8, commit 3f340836.
2021-10-29 10:28:00 +02:00
Benno Schulenberg
256a0d670e replacing: keep centering the occurrence, also after toggling help lines
Normally, returning to the main loop will set 'focusing' back to TRUE,
but the replacement loop doesn't return until replacing is finished.

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

Bug existed since version 5.0, commit d8249917.
2021-10-29 09:35:38 +02:00
Benno Schulenberg
50106266bc pasting: when less than a line is pasted, allow automatic hard-wrapping
When --breaklonglines is in effect and the user pasted just a few words
(anything without a linebreak), then act as if this short text had been
typed by the user and hard-wrap the line when it became overlong.

This fulfills https://savannah.gnu.org/bugs/?61353.
2021-10-27 16:42:07 +02:00
Benno Schulenberg
ba093b0b48 tweaks: elide two parameters, as they are now always the same 2021-10-27 16:30:23 +02:00
Benno Schulenberg
33041d0ad5 statusbar: count words in the way that matches how Ctrl+Right moves
When --wordbounds (-W) is active, nano considers punctuation as
word-forming characters and will thus count words the same way
as 'wc -w' does.  This is how nano counted words until now.

But when --wordbounds is not active (the default), only letters
and digits will be considered word-forming and thus lone groups
of lines and dashes and other punctuation will not be counted
as words, which is more like how a human would count words.

This addresses https://savannah.gnu.org/bugs/?61367.
2021-10-27 16:23:29 +02:00
Benno Schulenberg
b46c8c586b build: include the YAML syntax file among the distributed files
(It would be much better if the build rules automatically included
any *.nanorc files in the syntax/ directory into the tarball...)

This fixes https://savannah.gnu.org/bugs/?61391.
Reported-by: John Prokos <jprokos@gmail.com>

Bug existed since version 5.9, commit c2790a8a.
2021-10-27 11:58:52 +02:00