Commit Graph

9482 Commits (76742cc1939b84afccc7367ba07c484f09e66a5b)

Author SHA1 Message Date
Benno Schulenberg 76742cc193 search: make highlighting the standard, non-changeable behavior
Highlighting an occurrence is so much clearer than just putting the
cursor on it.  People seem to like it.  So let's make this how nano
behaves by default.
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 ade2fafbd3 tweaks: remove a strangely placed warning
(After some trying, I haven't seen the warning displayed, but...
I'm not yet sure that it could never occur, so I keep the 'if'.)
2021-02-06 19:12:43 +01:00
Benno Schulenberg 53fe7ba26a tweaks: be slightly more efficient in marking lines as WOULDBE
Take two conditions that are relevant only for a rather unlikely case
(a start match without a corresponding end match) out of an inner loop.
Give the case its own, dedicated loop.
2021-02-06 17:01:02 +01:00
Benno Schulenberg 7e04fea92b painting: when finding an end match, set its multidata right away
When leaving the multidata unset (as was done until now) and the
end match is offscreen, then this could lead to miscolorings later
when jumping over this end match instead of scrolling past it.

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

Bug existed since before version 2.1.10.
2021-02-05 17:25:03 +01:00
Benno Schulenberg 1fdd23d347 display: for a large paste or insertion, recalculate the multiline cache
When a large piece of text or code is pasted or inserted, it could
contain matches for start= and end= regexes, and backtracking from
the current screen could mistake an end for a start and could thus
miscolor things.  Avoid this by recalculating the multiline cache
for pastes and insertions that cover more than a screenful.

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

Bug existed since version 2.6.0, but existed also before 2.4.3.
2021-02-03 17:00:28 +01:00
Benno Schulenberg 5ea930e25f build: detect a build from git also when building out of tree
Reported-by: Hans-Bernhard Bröker <HBBroeker@t-online.de>

Bug existed since version 2.6.0, commit ec295f5e.
2021-02-02 12:00:24 +01:00
Benno Schulenberg 45defd25f3 build: avoid a warning about duplicate symbol when building from tarball
Reported-by: Hans-Bernhard Bröker <HBBroeker@t-online.de>

Bug existed since commit 3ea2694d from last week.
2021-02-02 11:39:26 +01:00
Benno Schulenberg 0d11964503 docs: say that --minibar is modified by --constantshow and --stateflags
The previous two commits reduced what is shown by default on the minibar.
Mention which extra options are needed to show the extra information.
2021-02-02 11:10:09 +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 878bd53d11 minibar: show cursor position + character code only with --constantshow
This allows having an even leaner interface, and gives the M-C toggle
an appropriate function (instead of leaving it a "dead" keystroke).

Suggested-by: Sébastien Desreux <seb@h-k.fr>
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 d3fbc4d498 tweaks: remove an old fix that was made superfluous by a recent fix
Commit 43d94692 fixed a miscoloring bug [1] by doing proper backtracking
for multiline regexes.  But this change also solves an older miscoloring
issue [2] without needing to recalculate all the multiline data.  So...
just drop the old fix.  (This isn't perfect: it's probably possible to
cook up a replacement scheme where things get miscolored, but... until
then, this is good enough.)

  [1] https://savannah.gnu.org/bugs/?59948
  [2] https://savannah.gnu.org/bugs/?58481

Also, there is no need to set 'refresh_needed' in do_replace_loop(),
because each replacement prompt will call edit_refresh() anyway, and
the functions that call do_replace_loop() will set it afterward.
2021-01-29 16:57:11 +01:00
Benno Schulenberg a8e2a24f60 tweaks: frob a condition, to be more concise, and reshuffle another 2021-01-29 10:58:09 +01:00
Benno Schulenberg 36855544d1 tweaks: rewrap and reindent a few lines 2021-01-29 10:52:40 +01:00
Benno Schulenberg dc745c0b77 tweaks: elide a function that is now just one line 2021-01-29 10:30:05 +01:00
Benno Schulenberg a8ed1d7a9a tweaks: don't bother wiping the multidata before recomputing it
The precalc_multicolorinfo() routine will assign a value to every
element for every line without looking at any current value, so
wiping the data first is a waste of time.
2021-01-29 10:25:27 +01:00
Benno Schulenberg 94c371a38f tweaks: don't bother initializing freshly allocated multidata
After having been allocated, the multidata will get computed
immediately, in precalc_multicolorinfo() and draw_row(), so
first setting each element to -1 is a small waste of time.
2021-01-29 10:18:39 +01:00
Benno Schulenberg 36618f1dca tweaks: don't bother comparing virgin multidata with current situation
The initialization of -1 cannot possibly match with NOTHING or
WHOLELINE or the other available values.

(Also, put in a warning, as I don't think an onscreen line without
a multidata cache can occur at all.)
2021-01-29 10:06:03 +01:00
Benno Schulenberg 3ea2694d9c tweaks: rename six symbols, to be more straightforward 2021-01-28 16:11:57 +01:00
Benno Schulenberg 85cc99a2a3 tweaks: frob some comments, and reshuffle two fragments of code 2021-01-28 15:44:54 +01:00
Benno Schulenberg befe4ea5de tweaks: frob some comments, and adjust indentation after previous change 2021-01-28 11:57:33 +01:00
Benno Schulenberg 43d94692ce painting: always do backtracking for the first row of the screen
Backtracking from the first row is needed in case a start match was
added recently somewhere offscreen and the user jumped to the current
location (instead of scrolling) so that the CWOULDBE markings did not
reach the current lines.

Also, search for an end match only for the first screen row.  For the
other rows, rely on the CENDAFTER, CWHOLELINE, and CWOULDBE values to
indicate whether there *is* an end match (the first two values) or not.
This saves considerable time when there is no end match in the large
remainder of a buffer: it will search in vain for the end match just
once, instead of for every row of the screen.

This fixes https://savannah.gnu.org/bugs/?59948,
and addresses https://savannah.gnu.org/bugs/?59945.

Bug existed since version 2.7.5, commit b3bcc8ee.
2021-01-27 17:01:17 +01:00
Benno Schulenberg 1364b41dc9 debug: add timing instruments to cache precalculation and screen refresh 2021-01-26 16:06:31 +01:00
Benno Schulenberg 7d3a555464 tweaks: avoid the vague possibility of advancing beyond end-of-line
Like the other two fragments that advance over a zero-length match,
also this fragment should avoid the possibility of stepping beyond
the end of the line.
2021-01-24 17:19:44 +01:00
Benno Schulenberg 0508520b47 tweaks: reshuffle three conditions into a better order
When a zero-length match is beyond the width of the screen, there
is no point in continuing evaluating the rule, so the check for
"offscreen to the right" needs to come first.  The check for a
zero-width match needs to come second because otherwise we would
get stuck on such a match when it is offscreen to the left.
2021-01-24 17:19:37 +01:00
Benno Schulenberg 6cbb7bc443 tweaks: frob two fragments of code, to be more readable 2021-01-24 16:44:38 +01:00
Benno Schulenberg 055e262b56 tweaks: stop evaluating a rule when the match is offscreen to the right
When the match of a coloring regex is beyond the width of the screen,
there is no point in continuing to evaluate the regex for the rest of
the line, because any other matches will be offscreen too.

This will save some time when there are several overlong lines.
2021-01-24 12:40:34 +01:00
Benno Schulenberg 9d8388e836 tweaks: call wattron()/wattroff() only when actually painting something
A syntax has on average a dozen coloring rules, but on average maybe
three or four pieces of text (rough estimate) in a line get painted.
So, on average, it is cheaper to call wattron() and wattroff() only
when actually coloring a piece of text, instead of calling wattron()
before starting to evaluate each rule and wattroff() after finishing
its evaluation.
2021-01-23 19:28:08 +01:00
Benno Schulenberg 895de17a58 color: do not look for another 'end' match after already finding one
When reaching end-of-line after having found a zero-width end match,
nano should not continue at 'seek-an-end' but instead at 'step_two':
going on to seek a start match in the current line.

(There is no bug report, because I cannot figure out how to trigger
this issue and cause nano to misbehave.  The problem was found while
reviewing the comments.)

Bug existed since commit 9a4a5454 from four years ago,
but the behavior was poorer before that commit.
2021-01-22 16:40:53 +01:00
Benno Schulenberg b202966d30 tweaks: correct a comment, improve another, and trim some verbosity 2021-01-22 11:58:53 +01:00
Benno Schulenberg a19a7820f9 color: recompile the file-probing regexes a little faster with REG_NOSUB
When the filename, header-line, and magic regexes are first compiled
while reading in the rc files (to check their validity), REG_NOSUB is
used, but for some reason this wasn't done when each of these regexes
gets recompiled in order to be used.  Fix this oversight.  It shaves
some twenty percent off of each of these regexes' compiling time.
2021-01-21 12:35:16 +01:00
Benno Schulenberg 0122119a44 docs: correct the word order for Alt+D in the cheat sheet -- it changed 2021-01-20 19:25:29 +01:00
Benno Schulenberg 64bf03b0d9 docs: correct the formatting of a comment in the sample nanorc 2021-01-15 10:05:04 +01:00
Benno Schulenberg 4bc6d67052 po: update translations and regenerate POT file and PO files 2021-01-14 11:21:21 +01:00
Benno Schulenberg 7519a458b2 bump version numbers and add a news item for the 5.5 release 2021-01-14 11:08:05 +01:00
Benno Schulenberg bc36813349 memory: avoid leaking the speller or linter command string, when invoked
This fixes https://savannah.gnu.org/bugs/?59854.
Reported-by: Mike Frysinger <vapier@gentoo.org>

Bug existed probably since version 2.9.6, commit 94347f08.
2021-01-11 19:36:34 +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 71402bb7e9 feedback: wipe the status bar by default after 20 keystrokes
The 26 keystrokes inherited from Pico is a weird number, and too long.
2021-01-11 16:18:35 +01:00
Benno Schulenberg 9266fa6657 speller: do an internal spell check when --speller is an empty string
This fixes https://savannah.gnu.org/bugs/?59855.
Indirectly-reported-by: Mike Frysinger <vapier@gentoo.org>

Bug existed since version 2.9.6, commit 94347f08.
2021-01-11 16:05:54 +01:00
Benno Schulenberg 6360e4170a copyright: update the years for the FSF 2021-01-11 14:22:51 +01:00
Benno Schulenberg dcb072d04b build: fix compilation for --enable-{tiny,help,multibuffer}
The mark is not available in the tiny version,
nor can the cursor get hidden by --markmatch.
2021-01-11 13:24:10 +01:00
Benno Schulenberg 4c6ce3c39d minibar: when the overnext character has zero width too, show its code
Requested-by: Peter Passchier <peter@passchier.net>
2021-01-09 12:44:10 +01:00
Benno Schulenberg 41fd09706d minibar: when the next character has zero width, show its code too
This allows seeing that an accented character is not a single code point
but composed from a base character plus a combining character.
2021-01-09 12:44:10 +01:00
Benno Schulenberg 24e5f956d0 build: fix compilation when configured with --disable-utf8
This fixes https://savannah.gnu.org/bugs/?59842.
Reported-by: Ruben van Wyk <admin@knwip.com>

Bug existed since commit 5129e718 from two days ago.
2021-01-08 12:05:55 +01:00
Benno Schulenberg f602613a9a tweaks: avoid compilation warnings on 32-bit machine plus newer compiler 2021-01-07 16:17:17 +01:00
Benno Schulenberg ba124ffa5d gnulib: update to its current upstream state 2021-01-07 15:20:45 +01:00
Benno Schulenberg d30ddf0add tweaks: correct a translator hint 2021-01-07 15:18:57 +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