Commit Graph

1565 Commits (c06f7d43e9aca9fe54da1b6534a53bd93251c8cd)

Author SHA1 Message Date
Benno Schulenberg 0941185fcf tweaks: on one-row terminals, suppress the message for two toggles
Their effect is feedback enough.
2021-11-23 10:16:54 +01:00
Benno Schulenberg 8850015822 feedback: give a more accurate message when the help lines won't appear 2021-11-23 10:14:25 +01:00
Benno Schulenberg 3be4ea0dc1 tweaks: fold a special case into the general one 2021-11-23 10:10:23 +01:00
Benno Schulenberg 9c9de85afb tweaks: elide a variable that is confusing and has just one use case 2021-11-22 12:03:28 +01:00
Benno Schulenberg b228c9fe6c tweaks: untangle two case items, and shorten a message
Also, sort the case items in the order they are listed in the help text.
2021-11-21 17:00:41 +01:00
Benno Schulenberg 84f8445b7b tweaks: reshuffle some conditions, so that the ifs have similar formats 2021-11-21 11:34:42 +01:00
Benno Schulenberg 5cf412320d feedback: with --mini/--zero, suppress message when toggling whitespace
The whitespace becoming visible/invisible is feedback enough.
2021-11-21 11:24:09 +01:00
Benno Schulenberg c9fb1cf85a tweaks: don't redraw the help lines (if present), and normalize a brace 2021-11-21 11:05:59 +01:00
Benno Schulenberg bbed065fa8 tweaks: avoid redrawing the entire window when just a 'touch' will do 2021-11-21 10:47:44 +01:00
Benno Schulenberg 966da68228 tweaks: exclude some hidden-interface code from the tiny version
Also, reshuffle one call and drop another: the cursor has been placed
fifteen lines earlier (either directly or in edit_refresh()).

(Important test case: toggling softwrap.)
2021-11-20 16:48:28 +01:00
Benno Schulenberg 51a5f33b5b feedback: suppress chatty messages when --zero is active
Things like "Cancelled" and "Undid addition" are not needed.  They
are nice for discovery, but become distracting once you know nano.

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

Bug existed since commit 03637030 from last week.
2021-11-19 16:17:55 +01:00
Benno Schulenberg 931bf96c1d display: make sure there are at least as many text lines as help lines
It's an editor -- the largest element should be the text to be edited,
not some part of the interface.

(It would be better if the edit window was always the largest element,
larger than or equal to all interface elements combined.  But that is
something for another time.)
2021-11-17 17:09:29 +01:00
Benno Schulenberg c772e1cb6b tweaks: rename a function, away from using an abbreviation
Also reshuffle a tiny fragment of code.
2021-11-17 11:01:37 +01:00
Benno Schulenberg e35b6636ab tweaks: reshuffle a line and adjust indentation after previous change 2021-11-17 10:49:27 +01:00
Benno Schulenberg bd4eed9cb1 tweaks: reshuffle a fragment of code to a better place 2021-11-17 10:42:21 +01:00
Benno Schulenberg 2b0bcc7cee feedback: show a relevant message for M-O when the syntax has 'tabgives'
When the syntax contains a 'tabgives' command, toggling the conversion
of tabs-to-spaces has no effect -- not for the current file.  So, tell
the user that and don't change the flag.

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

Bug existed since version 4.5, since 'tabgives' was introduced.
2021-11-17 10:25:32 +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 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 8234c22c1e tweaks: avoid a compiler warning with --enable-tiny --enable-linenumbers 2021-11-10 09:11: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 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 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 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 13edbedc79 tweaks: replace a verbose condition with a simpler early return 2021-11-01 18:17:47 +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 918ce1afa3 tweaks: just let do_wrap() set 'refresh_needed' instead of returning TRUE
This gets rid of performing an action in the condition of an 'if'.
2021-10-21 11:58:43 +02:00
Benno Schulenberg 61b3aa6626 tweaks: use five symbolic names, to make eight function calls clearer 2021-09-29 15:35:18 +02:00
Benno Schulenberg c74fd81302 tweaks: rename a parameter and invert its logic
This makes more sense (an emergency file is not a temp file) and
avoids the constant negating.
2021-09-29 12:20:21 +02:00
Benno Schulenberg 2087c20a83 tweaks: in comments, say "buffer" instead of "file" where appropriate 2021-09-27 16:37:03 +02:00
Benno Schulenberg 5512c63bdd copyright: update to the current year for significantly changed files 2021-09-24 11:01:41 +02:00
Benno Schulenberg 46cdf8b745 startup: if TERM is unset, try falling back to VT220 instead of failing
Curses cannot function if not informed via TERM which type of terminal
is being used.  As many terminals are mostly compatible with a VT220,
falling back to "vt220" when TERM is unset has a good chance of giving
the user a usable nano, instead of simply failing.

(Falling back to "vt100" is not good as it contains padding delays.)

This partially addresses https://bugs.debian.org/991982.
2021-09-20 10:38:25 +02:00
Benno Schulenberg 189960c467 cutting: copy anchors into the cutbuffer, so that undo can restore them
When a segment of text is extracted, copy any anchors that it has
into the cutbuffer, so that they get saved in the undo item, so that
an undo will put these anchors back on the lines where they were,
instead of leaving an inherited anchor at the top of the segment.

And when text is pasted, clear any anchors in it, so that they will
not travel nor multiply.

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

Bug existed since version 5.0, since anchors were introduced.
2021-09-19 11:29:39 +02:00
Benno Schulenberg 1b5d9171f2 tweaks: try chmodding a dump file only when it was actually written 2021-07-14 10:38:02 +02:00
Benno Schulenberg 50543300d9 tweaks: reshuffle some code to elide a variable, and improve a comment 2021-07-14 10:36:15 +02:00
Benno Schulenberg d9469b894f tweaks: remove a redundant feedback message
Any error message will already have been written to the terminal by
statusline().  Also, "Buffer not written to" looked too much like
"Buffer written to"; one had to look closely to see the difference.
2021-07-14 10:21:01 +02:00
Benno Schulenberg c84a769733 memory: free any allocated strings, also in the emergency code path 2021-07-14 10:06:04 +02:00
Benno Schulenberg e3ef778756 files: when the buffer is nameless, include the PID in name of dump file
Make sure that when multiple nanos with nameless buffers die,
each of them tries saving those buffers to different files.

This addresses https://savannah.gnu.org/bugs/?60902.
Reported-by: Julian Rosen <julianrosen@gmail.com>
2021-07-14 10:02:44 +02:00
Benno Schulenberg 30aaea2d04 tweaks: rename a variable and flip its logic, to avoid two negations
Plus, it makes more sense to start in the state "not saved" than in
the state "failed".
2021-07-10 15:56:38 +02:00
Benno Schulenberg d0cb64650b usage: improve the description of the --positionlog option
And make the wording for the --historylog option similar.

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

Bug existed since version 2.3.0, commit 8e2a9307, since the
saving and restoring of the cursor position was introduced.
2021-07-01 16:45:49 +02:00
Benno Schulenberg 177e4e5805 general: prevent die() from getting recursed into
When something that is called from die() calls die() again,
there is nothing we can do any more but give up.

This would have prevented the spiralling as
seen in https://savannah.gnu.org/bugs/?60853.
2021-06-30 15:54:21 +02:00
Benno Schulenberg 3c35538e8b tweaks: add Schiermonnikoog to the list of friendly islands
(The commit message is a joke, of course.  Instead, this commit just
removes some unneeded comments and corrects one bit of whitespace.)
2021-06-16 11:19:23 +02:00
Benno Schulenberg 44a6c4963b tweaks: avoid a compiler warning when configured with --enable-tiny 2021-06-15 10:20:28 +02:00
Benno Schulenberg e2e8bf0a3e options: accept 'set minicolor' for setting the color of the minibar
When it is not specified, it defaults to the value for 'titlecolor'.

When not using --minibar, I want the title bar to be blue (as that is
how I've always had it), but with --minibar, I want this mini bar to
be grey, as otherwise it reminds me too much of the prompt bar.

Also, colorize 'set minicolor' as valid in a nanorc file.
2021-06-08 09:25:02 +02:00
Benno Schulenberg 3f340836a6 search: automatically drop the spotlighting after a few moments
Even though I know that spotlighted text is not selected, I still
regularly think for a fleeting instant that the spotlighted text
can be cut with a ^K.  Mitigate this by dropping the spotlighting
after 1.5 seconds (or 0.8 seconds when using --quick).
2021-06-03 12:02:04 +02:00
Benno Schulenberg f857959b8e startup: suppress "Search Wrapped" when using +? to search from EOF
When using +/ or +?, any minor feedback should be cleared,
to not distract from the highligted search result.

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

Bug existed since version 5.5, commit b86f7868,
since the manner of grading status-bar messages changed.
2021-05-25 14:51:03 +02:00