Commit Graph

1529 Commits (fdc0b0ac2439f8ac626ec83afd3ab85f823378b7)

Author SHA1 Message Date
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
Benno Schulenberg 405c2162b5 startup: allow using a bare "+" to mean put-cursor-on-last-line
Editors like 'vim' and 'ne' and 'uemacs' know this shorthand too.

This fulfills https://savannah.gnu.org/bugs/?60663.
2021-05-25 12:18:48 +02:00
Benno Schulenberg 8797ada815 startup: do not accept stray characters after a "+" on the command line
After a "+" only c, r, C, and R are valid characters,
and only when immediately followed by / or ?.

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

Bug existed since version 4.4, commit 2326bf6,
since searching at startup with +/ or +? was introduced.
2021-05-25 12:15:52 +02:00
Benno Schulenberg b741b1c985 startup: skip drawing edit window when having message on one-row terminal
When there is just one row and there is a message, it is not a good idea
to draw the contents of the buffer as it would overwrite the message.

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

Bug existed since version 2.7.0, since nano allows very flat terminals,
and was made worse by commit 2cf28f9d from yesterday.
2021-05-12 15:47:21 +02:00
Benno Schulenberg 36ffb5f0ac statusbar: suppress --constantshow when the terminal has just one row
When there is just one row, the text to be edited needs to be shown
there, not some meta information about the cursor position.

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

Bug existed since version 2.7.0, since nano allows very flat terminals.
2021-05-09 19:16:03 +02:00
Benno Schulenberg eb3cc3a32d minibar: stay out of sight when the terminal has just one row
When there is just one row, the user wants to see text on this row,
not a bar with some meta info.

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

Bug existed since version 5.5, since the minibar was introduced
with commit d31cc373.
2021-05-03 15:52:15 +02:00
Benno Schulenberg 588022ab8c editing: prevent the pointer for the top row from becoming dangling
When undoing several actions, it is possible for the line at the top
of the screen to be removed, leaving 'edittop' pointing to a structure
that has been freed.  Soon after, 'edittop' is referenced to determine
whether the cursor is offscreen...  Prevent this invalid reference by
stepping 'edittop' one line back in that special case.  This changes
the normal centering behavior of Undo when the cursor goes offscreen,
but... so be it.

When a single node is deleted, it is always possible to step one line
back, because a buffer contains always at least one line (even though
maybe empty), so if the current line could be deleted, there must be
one before it (when at the top of the screen).

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

Bug existed since version 2.3.3, commit 60815461,
since undoing does not always center the cursor.
2021-04-23 09:35:12 +02:00
Benno Schulenberg cf0820549b tweaks: avoid calling extra_chunks_in() when not softwrapping
The function is somewhat costly; better avoid it whenever possible.
2021-04-22 12:19:09 +02:00
Benno Schulenberg 2cdff6c32c tweaks: adjust two comments, and reshuffle two fragments
Also rename two variables, to be more fitting.
2021-04-21 16:52:35 +02:00
Benno Schulenberg 49d8b99e4f softwrap: avoid time-consuming computations, to burden large files less
Whenever softwrap was toggled on or line numbers were toggled on/off or
the window was resized, the extra rows per line needed to be recomputed
for ALL the lines.  For large files with many long lines this was too
costly.

(This change causes the indicator to have an incorrect size when there
are many softwrapped chunks onscreen, but that will be addressed later.)

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

Problem existed since version 5.0, since the indicator was introduced.
2021-04-21 16:40:20 +02:00
Benno Schulenberg 5efb6836a8 options: retire the obsolete 'smooth', 'morespace', and 'nopauses' 2021-04-15 11:43:39 +02:00
Benno Schulenberg debb288115 tweaks: reduce the maximum character length from six bytes to four
In UTF-8 valid multibyte characters are at most four bytes long,
and now that we no longer make use of mblen() and mbtowc() from
the underlying system, we won't get five- or six-byte sequences
mistakenly reported as valid (by glibc).  So it is always enough
to reserve space for just four bytes per character.
2021-04-07 17:21:25 +02:00
Benno Schulenberg 20e122ef41 startup: show the helpful message only when ^G has not been rebound
(Well, it now checks that ^G is still the first shortcut that is bound
to 'do_help', but that is good enough: if the user did any rebinding,
they probably do not need any reminder about how to invoke 'Help'.)

This fixes https://savannah.gnu.org/bugs/?60315.
Reported-by: Robert Goulding <goulding.2@nd.edu>
2021-04-01 10:09:28 +02:00
Benno Schulenberg a9ccd99b90 tweaks: rename a symbol, to better match the corresponding option 2021-03-03 09:39:49 +01:00
Benno Schulenberg f0cc59bead color: use inverse video for highlighting when there are no colors
When a terminal has no colors but has the ability to hide the cursor
(like a VT320), then using --bold would make a search match too hard
to see.
2021-02-16 11:28:22 +01:00
Benno Schulenberg 87fe73ddaa color: give highlighted text its own color, to not look like marked text
Now that a search match gets highlighted, the unsuspecting user might
think that the text is selected, because it is colorized the same way
as selected text.  Avoid this by colorizing a highlighted search match
with its own specific color, black on yellow by default.
2021-02-14 12:51:09 +01:00
Benno Schulenberg c2746c0bb2 tweaks: reshuffle some code, and reduce the scope of a variable 2021-02-08 12:33:10 +01:00
Benno Schulenberg 399a024857 minibar: suppress the toggling feedback for M-C, but show it for M-Y/M-P
In addition, suppress the feedback for M-C also when --minibar
isn't used, as the feedback obscures the effect of the toggle:
showing information about the cursor position on the status bar.

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

Bug existed since commit 7545eb5b from one week ago.
2021-02-08 10:27:29 +01:00
Benno Schulenberg 7bf253702e options: remove --markmatch and 'set markmatch', as the behavior is gone 2021-02-07 09:18:15 +01:00
Benno Schulenberg 37717baeed search: just highlight the found occurrence, instead of marking it
Requested-by: Peter Passchier <peter@passchier.net>
2021-02-07 09:18:15 +01:00
Benno Schulenberg 7545eb5bbf minibar: show the state flags only when --stateflags is used
For users who always have auto-indent or hardwrap or softwrap on
and do not need to see this continuously advertised at the bottom.
2021-02-02 11:10:09 +01:00
Benno Schulenberg e0a4ee0148 scrolling: keep centering after large paste, also when line numbers widen
If a paste (or insertion) is more than a screenful, it will not set
'focusing' to FALSE.  In that case, and when line numbers are already
active, then 'focusing' should be kept set to TRUE, despite it getting
set to FALSE by ensure_firstcolumn_is_aligned().  That latter action
is meant to cushion size changes of the edit window, but in this case
the large paste (or insertion) should trump the size change.

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

Bug existed since version 2.8.3, commit 2b385478.
2021-02-01 12:42:55 +01:00
Benno Schulenberg 9bd7d62c10 tweaks: do not change the pointer, but move the content of the string 2021-01-11 19:22:40 +01:00
Benno Schulenberg 735a608e80 speller: strip leading whitespace from command, to avoid a sneaky crash
This completes the fix for https://savannah.gnu.org/bugs/?59855.
2021-01-11 19:15:35 +01:00
Benno Schulenberg 6360e4170a copyright: update the years for the FSF 2021-01-11 14:22:51 +01:00
Benno Schulenberg e66c7d0f8d tweaks: put the new options in a consistent order in the code 2021-01-07 14:27:49 +01:00
Benno Schulenberg 7b9567719c tweaks: reshuffle an option, to have two related ones grouped together
Options --stateflags and --minibar are slightly related; it looks
better to not have them separated by an unrelated option.
2021-01-07 14:27:49 +01:00
Benno Schulenberg 04d33e7981 tweaks: reword the description of an option
Avoid using the word "state" in the description of --minibar,
as it could cause confusion with the --stateflags option.
2021-01-07 14:27:49 +01:00
Benno Schulenberg 7b48458380 minibar: suppress some elements when there is no room to show them
This fixes https://savannah.gnu.org/bugs/?59767.

Bug existed since last week, since the mini-bar code was merged.
2020-12-29 15:54:28 +01:00
Benno Schulenberg d0bceb1449 options: add --markmatch and -^ for activating the select-match behavior
And add, of course, the 'set markmatch' nanorc option.
2020-12-24 11:49:22 +01:00
Benno Schulenberg caef3128eb search: suppress the cursor when highlighting a match
Having a block cursor present when highlighting a match...
does not look nice.  So... hide the cursor until the next
keystroke, unless --showcursor or 'set showcursor' is used.
2020-12-24 11:49:22 +01:00
Benno Schulenberg b86f7868d1 feedback: differentiate between remarks, mistakes, and information
Remarks are about unsurprising things but it's good to give feedback
on them; "mistakes" are unexpected things, and get colored like an
error; and information is something that the user requested and thus
needs to stay on the status bar until the next keystroke.
2020-12-23 12:17:06 +01:00
Benno Schulenberg b89bc2cce6 minibar: show the info bar again some 0.8 seconds after a message
Instead of redisplaying the minibar only upon the next keystroke
(when some feedback message is shown on the status bar), time the
waiting for the keystroke out after four fifths of a second, then
redisplay the minibar and continue the wait.
2020-12-23 12:17:06 +01:00
Benno Schulenberg 8f24ffaaef options: add --minibar and -_ for activating basic state-information bar 2020-12-23 12:17:05 +01:00
Benno Schulenberg d31cc373de display: add code for showing minimal state-information bar at the bottom
When activated, it suppresses the title bar, and suppresses feedback
on the status bar for toggles whose effect is obvious or whose state
is already shown in the minibar.

This addresses https://savannah.gnu.org/bugs/?58152,
and addresses https://savannah.gnu.org/bugs/?58789.
2020-12-23 12:17:05 +01:00
OIX d1c412d200 mouse: update title bar (the M flag) when the click is on the cursor
Clicking on the cursor toggles the mark, meaning that the flags in
the title bar should be updated when --stateflags is active.

This fixes https://savannah.gnu.org/bugs/?59747.
Indirectly-reported-by: ObeliX <ObeliX-@gmx.de>

Signed-off-by: OIX <ObeliX-@gmx.de>
2020-12-22 14:21:28 +01:00
Benno Schulenberg 96e4fec31c tweaks: use a boolean instead of an enumeration of two values 2020-12-19 16:40:21 +01:00