Commit Graph

6329 Commits (6b5aff48780d6e87127e5d2a0347c5cbaa9366f9)

Author SHA1 Message Date
Benno Schulenberg 1194a41cdb tweaks: scrap a bunch of debugging lines -- they obscure the logic 2017-01-21 16:17:43 +01:00
Benno Schulenberg eba470a869 tweaks: normalize some paragraph formatting in the FAQ 2017-01-21 12:31:01 +01:00
Benno Schulenberg 9a4a5454f2 painting: properly look for a new start match only after the end match 2017-01-21 12:30:56 +01:00
Benno Schulenberg af7201f9a0 tweaks: reshuffle three variables 2017-01-21 12:30:51 +01:00
Benno Schulenberg 2f80193d96 tweaks: reshuffle a test to a better place 2017-01-21 12:30:44 +01:00
Benno Schulenberg 23595c8376 tweaks: differentiate single-regex matches from paired-regex matches
Don't use the 'startmatch' variable when the corresponding match is
not the start of anything but is the entire match by itself.
2017-01-21 12:30:38 +01:00
Benno Schulenberg 669453506c painting: when skipping a zero-length match, skip a character, not a byte 2017-01-21 12:29:27 +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 94907aa534 painting: do not bluntly ignore zero-length start matches -- handle them
The segmentation fault that this causes when both start and end match are
zero-length will be tackled later (https://savannah.gnu.org/bugs/?50056).

This fixes https://savannah.gnu.org/bugs/?50078.
Inspired-by: Elia Geretto <elia.f.geretto@gmail.com>
2017-01-20 14:00:14 +01:00
Benno Schulenberg 7e5524bb66 painting: do not let a match for 'end' overlap a match for 'start'
During precalculation and in step_two, we begin looking for an end
match only after the full start match, not merely one byte beyond
its starting point.  So do that too when searching backward for an
unpaired start match.

Also, index can never be zero here, because if the match was of length
zero, this piece of code will have been skipped by the preceding goto.
So we can always use REG_NOTBOL here.

(That goto is wrong, by the way: https://savannah.gnu.org/bugs/?50078,
but that will follow later.)
2017-01-20 13:17:10 +01:00
Benno Schulenberg e8c7cf2071 startup: report an error when the given line or column number is invalid
This fixes https://savannah.gnu.org/bugs/?50028.
2017-01-19 10:33:42 +01:00
Benno Schulenberg 605f031833 files: leave out the confusing "[from ./]" when prompting for a command
This fixes https://savannah.gnu.org/bugs/?49892.
2017-01-19 10:31:55 +01:00
Benno Schulenberg c88d7ce530 search: begin from where we are, to be able to find the first \B
A search should start at the place of the cursor, not one step beyond,
so that the non-word boundary between the current character and the next
will be found.  Starting one step beyond the current character, as was
done until now, would find the non-word boundary between the next and
the overnext character as the first one.
2017-01-17 11:33:57 +01:00
Benno Schulenberg 9f884810b6 tweaks: use a subtraction instead of a counter
And return a better value, so that less calculation is needed.
2017-01-13 19:33:32 +01:00
Benno Schulenberg 5d5666fba6 tweaks: swap two blocks of code to reduce the number of #ifdefs 2017-01-13 19:29:39 +01:00
Benno Schulenberg 980e334e37 tweaks: rearrange some code to separate softwrap and normal mode more
(Ignore the indentation for the moment.)
2017-01-13 19:17:59 +01:00
Benno Schulenberg 9bb64fccef tweaks: chuck some obscuring debugging stuff 2017-01-13 17:47:55 +01:00
David Lawrence Ramsey 6e3adf31b8 tweaks: let update_line() return the correct value on error
If the given line is out of range of editwinrows, we don't display it
at all, so we obviously don't display more than one line of it.  Thus,
the return value in this case should be zero, not one.
2017-01-13 17:41:26 +01:00
David Lawrence Ramsey c67c431239 tweaks: improve comments and formatting in update_line() 2017-01-13 17:36:02 +01:00
Benno Schulenberg bf0268d41d tweaks: condense a comment, rename a variable, and use a while loop 2017-01-12 21:31:08 +01:00
Benno Schulenberg b7c2513f7d tweaks: rename some variables, to better distinguish rows from lines
And columns from indexes -- columns are places on the screen, while
indexes point to characters in a line in the current buffer.
2017-01-12 19:32:21 +01:00
Benno Schulenberg 892762d99c tweaks: rename some variables, to show they refer to screen rows 2017-01-12 18:03:36 +01:00
Benno Schulenberg f7d320d932 tweaks: rename a function, to show it refers to screen rows 2017-01-12 17:48:33 +01:00
Benno Schulenberg 0208ae7149 tweaks: rename a variable -- lines refers to buffer, rows to screen 2017-01-12 17:33:46 +01:00
Benno Schulenberg 26fb907aa6 screen: ehm... no, that was wrong: page_start /is/ a column position
(The mistake becomes visible when you go to the end of a very long line
of double-width characters: the $ will be shown on the right edge, even
though you're already at line's end.)

This reverts commit 16a7fd4b from yesterday.
2017-01-12 10:29:20 +01:00
Benno Schulenberg ea40765904 tweaks: rename two variables, and always pass a valid result back
What is the point of parsing a number when you're not interested in
the result?  All callers of parse_num() pass a container for it.
2017-01-11 19:24:35 +01:00
Benno Schulenberg 16a7fd4bfc screen: don't compare a character index with a column position
This addresses part of https://savannah.gnu.org/patch/?9216.
Reported-by: David Lawrence Ramsey <pooka109@gmail.com>
2017-01-11 17:22:46 +01:00
Benno Schulenberg eca6faee5b tweaks: free an option string also when it was invalid 2017-01-11 09:49:24 +01:00
Benno Schulenberg 59edef55dc po: update translations and regenerate POT file and PO files 2017-01-10 11:35:00 +01:00
Benno Schulenberg f119a90fe5 bump version numbers and add a news item for the 2.7.4 release 2017-01-10 11:29:34 +01:00
Benno Schulenberg 4920030384 docs: snip some obsolete items from the FAQ, and normalize its dates 2017-01-09 21:43:59 +01:00
Benno Schulenberg a898fa5dcc tweaks: if there is no end match, there is nothing to paint
When there is no end match after a start, it is pointless to look
for any more starts because also they will not have any end match,
so nothing will get painted -- just cut the loop short.
2017-01-09 19:14:51 +01:00
Benno Schulenberg c0aa5ad258 tweaks: miscellaneous frobbings 2017-01-09 18:25:25 +01:00
Benno Schulenberg 58c3dd6cd0 softwrap: when typing M-/, ensure the last line is fully visible 2017-01-09 15:21:15 +01:00
Benno Schulenberg 5ca765f107 tweaks: discard some conditional compilation 2017-01-09 15:09:06 +01:00
Benno Schulenberg cf75da9888 softwrap: when pasting an overlong line, ensure it is fully visible
This fixes https://savannah.gnu.org/bugs/?50009.
2017-01-09 15:00:29 +01:00
Benno Schulenberg 14c62dbf11 build: check for GNU-style word-boundary support also in the tiny version
The tiny version can do regex searches nowadays, so the user might use
the \< and \> anchors in their regexes.

This fixes https://savannah.gnu.org/bugs/?50008.
2017-01-09 14:32:01 +01:00
Benno Schulenberg f6fbc1572d tweaks: adjust whitespace after the previous change 2017-01-09 12:01:27 +01:00
Benno Schulenberg 38d7362f20 tweaks: rename two variables to be just one as they play the same role
The renamed variable 'index' is not the start of a match (as some comment
mistakenly said), but from where in the line we start looking for a next
match.

Also, use one more goto to allow unindenting a big piece of code, and
shortcircuit two while loops for two more small unindents.
2017-01-09 11:39:37 +01:00
Benno Schulenberg 26683a9e5f tweaks: frob some comments, and transform one variable 2017-01-08 21:31:49 +01:00
David Lawrence Ramsey d35ecd02b8 weeding: remove another unnecessary setting of openfile->current_y
The setting of current_y in copy_from_filestruct() also appears to be
a holdover from the days of a more-common STATIONARY scrolling mode.

do_cut_text() uses the above function when copying text (uncutting
text again right after cutting it).  Since the text is effectively
the same afterward, current_y doesn't need to change.

do_uncut_text(), however, does need current_y up to date in one case:
when uncutting a full screen or less' worth of lines, focusing will be
FALSE, and it uses edit_refresh(), so it will use STATIONARY scrolling
mode then.  Take a cue from do_insertfile() and call reset_cursor() to
get an updated current_y.

(Note that the check for a full screen or less' worth of lines uses
incorrect values when in softwrap mode, but that's a separate problem.)

undo_cut(), do_redo(), and backup_lines() do not need set current_y
because they all result in edit_refresh() with focusing = TRUE, so
they do a CENTERING scroll which does not need current_y.
2017-01-08 17:18:28 +01:00
Benno Schulenberg 61bc248555 tweaks: chuck a couple of useless asserts 2017-01-08 15:27:48 +01:00
David Lawrence Ramsey c38f571d4b tweaks: line numbers are ssize_t, not int 2017-01-08 15:13:11 +01:00
Benno Schulenberg a89437219d tweaks: don't use a variable for two different purposes
At first paintlen was computed as a column span, and then converted
to a character count...  Confusing.
2017-01-08 13:34:10 +01:00
Benno Schulenberg aa28441071 tweaks: the starting point for painting /cannot/ be offscreen
The top_x variable has already been forced to become equal to from_x
if it was before it.  So start_col will be at least zero.
2017-01-08 13:34:04 +01:00
Benno Schulenberg 5dbd288254 tweaks: rename another variable, to show it refers to columns not chars 2017-01-08 13:12:40 +01:00
Benno Schulenberg 8f21d256fb tweaks: rename two variables, for distinguishing characters from columns 2017-01-08 13:12:36 +01:00
Benno Schulenberg 08cfdbcbdb tweaks: don't compare a character offset with a column position
It is the misuse of "x_" to mean a column position on screen, and the
misuse of "_col" to mean a character position in a string that causes
this confusion.
2017-01-08 13:12:11 +01:00
Benno Schulenberg 6103c47f1c tweaks: rename three painting variables, to be more distinct
All these different "start"s and "end"s are confusing.  Use instead
'from_x and 'till_x' to remember which part of the current line is
visible now on screen and is thus represented in 'converted'.
2017-01-08 11:35:07 +01:00
Benno Schulenberg 88cf22f804 tweaks: rearrange and reindent some lines in the painting routines
Also adjust a few comments.
2017-01-08 11:33:57 +01:00