Commit Graph

152 Commits

Author SHA1 Message Date
Benno Schulenberg c118397a14 tweaks: update some copyright years
Reflect the significant changes in painting and regex searching
in the copyright notices.
2017-02-21 20:27:49 +01:00
Benno Schulenberg 2358badc65 painting: properly detect a change in start/end matches
The inversion of the logic in commit a6605dce was incomplete -- oops.

This fixes https://savannah.gnu.org/bugs/?50306.
2017-02-14 16:56:43 +01:00
Benno Schulenberg 8fbadecf0a tweaks: adjust whitespace after preceding changes 2017-02-13 19:47:24 +01:00
Benno Schulenberg a6605dce00 tweaks: rename two variables, to avoid double negatives 2017-02-13 19:47:20 +01:00
Benno Schulenberg 9ec546d293 tweaks: rename a function, and drop an unneeded parameter
When replacements are made, nothing needs to be reset any more
(it was done insufficiently anyway).  Just make sure the screen
is refreshed when all is done -- this may be superfluous when
doing interactive replacements, but not when replacing all.
2017-02-13 19:47:03 +01:00
Benno Schulenberg 3b86c7a190 tweaks: discard the now unused multidata-resetting routine 2017-02-13 12:14:58 +01:00
Benno Schulenberg 7ef5c53263 painting: mark an unpaired start match as CWOULDBE
The lines that come after an unpaired start have to know about this.

This fixes https://savannah.gnu.org/bugs/?50293.
2017-02-13 11:18:54 +01:00
Benno Schulenberg b3bcc8eeac painting: make use of the multidata of the preceding line
When painting a line, the multidata of the line /before/ it is valid
in most cases: it was determined just a moment ago.  And it tells us
all we need to know: whether there is an unpaired start match before
the current line or not.

The only exception is when painting the first line of the screen:
the multidata of the line before it might be stale.  So for the
first screen line we will always have to do some backtracking.
But that is left for later.

This fixes https://savannah.gnu.org/bugs/?50121.
2017-02-12 18:24:49 +01:00
Benno Schulenberg a8a70f0f29 tweaks: slightly speed up the change detection for multiline matches 2017-01-22 10:17:24 +01:00
Benno Schulenberg 775f007348 tweaks: use a cheaper way to detect an end-of-line
There is no need to compute the line length: just avoid overstepping
the terminating NUL byte when being forced to advance the index.
2017-01-21 19:44:48 +01:00
Benno Schulenberg 414a1ecc8d tweaks: and rename another variable, to keep in style 2017-01-21 19:26:43 +01:00
Benno Schulenberg e0bdf671b8 tweaks: rename another variable, to be shorter 2017-01-21 17:53:00 +01:00
Benno Schulenberg 13fbf13b85 tweaks: rename a variable, to be more general and match one elsewhere 2017-01-21 17:38:21 +01:00
Benno Schulenberg 96f50b8d55 tweaks: adjust some comments, reshuffle a line, and use a while loop 2017-01-21 17:36:52 +01:00
Benno Schulenberg 76d83070c4 tweaks: elide a variable plus its corresponding dark logic
Just assign the 'CNONE' value upfront, instead of figuring out
at the end of the line whether anything has been assigned yet.

Also, the old logic would leave unmarked a line that contains a
start match without any terminating end match.  Not serious, but
not right.
2017-01-21 16:56:50 +01:00
Benno Schulenberg 1194a41cdb tweaks: scrap a bunch of debugging lines -- they obscure the logic 2017-01-21 16:17:43 +01:00
Benno Schulenberg 9de376deed painting: stay within the line when skipping zero-length matches
Don't blithely overshoot the end of a line when both start regex and
end regex match an empty string.  Overshooting would let the matching
run on into uncharted country and thus ultimately cause a segfault.

This fixes https://savannah.gnu.org/bugs/?50056.
Reported-by: Elia Geretto <elia.f.geretto@gmail.com>
2017-01-20 17:03:10 +01:00
Benno Schulenberg 61bc248555 tweaks: chuck a couple of useless asserts 2017-01-08 15:27:48 +01:00
Benno Schulenberg 514cd9a099 update the license text to the preferred version
Mentioning "GNU nano" instead of "This program" and referring to the
website instead of to a postal address.
2016-08-29 21:27:16 +02:00
Benno Schulenberg 406e5242a3 update the copyright notices 2016-08-29 21:27:05 +02:00
Benno Schulenberg 19b6f906cc tweaks: rename another variable, for aptness 2016-07-25 10:57:33 +02:00
Benno Schulenberg c38ffdc741 tweaks: rename two variables, to match others 2016-07-25 10:53:49 +02:00
Benno Schulenberg 1e5614b31b tweaks: avoid two compiler warnings 2016-07-22 15:48:06 +02:00
Rishabh Dave 4c566c7903 tweaks: reduce the number of wattron/wattrof calls
Also, compose the coloring attributes during initialization
instead of every time when painting something.

Signed-off-by: Rishabh Dave <rishabhddave@gmail.com>
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2016-07-21 10:10:59 +02:00
Benno Schulenberg afb6a5b86d color: forget about aborting the precalculation for multiline regexes
This fixes https://savannah.gnu.org/bugs/?48389.
2016-07-14 14:31:14 +02:00
Benno Schulenberg 960e848cc7 tweaks: elide a typedef, as it now has just one element 2016-07-12 09:35:48 +02:00
Benno Schulenberg b4737072a6 tweaks: delete an element that is always FALSE and never used 2016-07-12 09:24:32 +02:00
Benno Schulenberg 8507dd4bd0 color: integrate the hilite attribute into the pair number
Color-pair numbers and attributes can be OR'd together -- do so,
to save an attron() call whenever the hilite is on.
2016-07-12 09:20:09 +02:00
Benno Schulenberg 500fef8314 tweaks: rename a variable -- to match others and to be more concise 2016-07-04 13:43:19 +02:00
Benno Schulenberg 29986e95a0 input: don't drop the first byte when user starts typing during loading
Precalculation of the multiline color data can be cut short when the
user is impatient and starts typing.  But this would drop the first
byte of whatever was typed -- not nice when it was just plain text,
but surprising and worse when the first keystroke was a command.

This fixes https://savannah.gnu.org/bugs/?48388.
2016-07-04 09:27:35 +02:00
Benno Schulenberg 4af1da7d95 color: push the resets further when start and end match are equal
When for a multiline syntax-coloring rule the starting regex matches at
the exact same spot as the ending regex, do a second round of resets, so
that reevaluation starts further back and gets a few more things right.

This mildly fixes https://savannah.gnu.org/bugs/?47420.
2016-07-03 16:23:54 +02:00
Benno Schulenberg ec7b20eec6 syntax: don't call getcwd() with a NULL pointer
Some platforms don't like that.
2016-06-04 12:02:49 +02:00
Benno Schulenberg cdcd365d34 tweaks: normalize some whitespace 2016-05-17 11:33:21 +02:00
Benno Schulenberg 2535f51e01 statusbar: prevent error messages from overwriting each other
If during startup there are multiple error messages, currently only the
last one remains and can be read.  To improve on that, introduce a short
pause between error messages -- even if it's not enough to read them all,
at least the user will be aware that there are multiple ones.

This also causes a few error messages to beep that currently don't beep,
such as when a file is unwritable.
2016-05-16 18:03:07 +02:00
Benno Schulenberg 53f4a9f5a8 screen: rename 'edit_refresh_needed' to 'refresh_needed'
For a little contrast with the function edit_refresh() -- it's
annoying that when you search for the latter you get to see all
the settings of the flag too.
2016-04-25 21:14:18 +02:00
Benno Schulenberg d92eb4fee3 all: eradicate SVN's $Id$ tags 2016-04-05 14:59:12 +02:00
Benno Schulenberg 2f817a6740 Checking for the existence of the REG_ENHANCED regex flag, and
using it when it's available (which it is on OS X systems).
This completes the fix for Savannah bug #47325.
Patch by Thomas Rosenau.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5759 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-22 10:42:28 +00:00
Benno Schulenberg 43040220bf Avoiding to dereference a possible NULL.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5735 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-14 16:01:44 +00:00
Benno Schulenberg 6ed6462154 Combining the regular-expression flags at compile time instead of at run time.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5732 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-13 19:37:21 +00:00
Benno Schulenberg 4e8d2d6223 Unnesting two ifs -- to put filenames, headerlines, and magic strings
on equal footing.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5724 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-12 09:18:50 +00:00
Benno Schulenberg c5fedaa043 Setting the syntax and regex pointers just once, in a single place.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5723 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-12 08:46:18 +00:00
Benno Schulenberg 04262f09a4 Turning the linked list of syntaxes upside-down, so that the last-defined one
comes first, so that a search can stop at the first match instead of always
having to run through the entire list.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5716 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-10 20:06:01 +00:00
Benno Schulenberg 6a4d3aad80 Tweaking a few things and renaming a variable.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5710 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-04 20:50:38 +00:00
Benno Schulenberg 2070d3a26f Not bothering to keep the compiled regular expression when it matched.
Stopping instead to call malloc() pointlessly.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5706 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-04 14:53:45 +00:00
Benno Schulenberg ce32cb0f6b Allowing to select an empty syntax. And selecting the last
instead of the first syntax that matches a certain magic string
(forgotten in the previous commit).


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5705 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-01 11:21:05 +00:00
Benno Schulenberg 3df1a3f0f4 Not bothering to discard a duplicate syntax -- selecting simply the
last-defined one.  This addresses Savannah bug #47303.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5704 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-01 11:06:00 +00:00
Benno Schulenberg 83975027e5 Not dereferencing symlinks, so that the syntax will be derived from the
name given on the command line, not from the name of the target file.
This fixes Savannah bug #47307.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5703 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-29 16:56:54 +00:00
Benno Schulenberg a24aee417d Renaming a struct member.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5697 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-29 09:17:03 +00:00
Benno Schulenberg 07441adb14 Renaming another struct element, because it refers not just
to file extensions, but also to header lines and magic strings.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5690 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-26 20:19:13 +00:00
Benno Schulenberg 3522751c6b Renaming a struct element for aptness and contrast.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5689 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-26 20:09:29 +00:00