Commit Graph

1570 Commits (abd4c47acf4ec71a3eb142e44493d29ba1201465)

Author SHA1 Message Date
Benno Schulenberg abd4c47acf feedback: when reporting an unbound function key, mention its number
This makes it easier to figure out what to put in their nanorc file
when the user wants to bind the key.
2021-11-28 15:43:54 +01:00
Benno Schulenberg b5448615b9 display: redraw the screen in tiny version upon resuming from suspension
Letting the dummy key KEY_FRESH do a full refresh in the tiny version
allows a 'fg' to properly resume after an external SIGSTOP.

(Reminder: the ungetch() is needed in the normal version to prevent
the eating of a keystroke: https://savannah.gnu.org/bugs/?48331.)
2021-11-28 11:52:42 +01:00
Benno Schulenberg d14d9069cd tweaks: exclude some suspension code from the tiny version
The SIGCONT handler needs to stay, so that also in the tiny version
a 'fg' can properly resume from an external SIGTSTP.
2021-11-28 11:08:37 +01:00
Benno Schulenberg 79def643a3 options: make --zero imply --nohelp, and 'set zero' imply 'set nohelp'
This fits better with what "zero" intuitively means.
2021-11-26 10:58:17 +01:00
Benno Schulenberg 7336c28ca8 display: clear the status bar early enough, so that --zero can show text
This fixes https://savannah.gnu.org/bugs/?61554.

Bug existed since commit be61aad9 from yesterday.
2021-11-25 11:08:21 +01:00
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