Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix block markup check bug #1301

Merged
merged 1 commit into from
Jun 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/lib/Guiguts/ErrorCheck.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1822,7 +1822,8 @@ sub unmatcheditemsrun {
if ($matchstr) { # Should always be true, since we're only passing valid items to matching subroutine
my $nest = ( defined $nestreg and $item =~ $nestreg );
my $matchidx =
::hilitematchfind( $index, $endidx, $item, $matchstr, $reverse, $nest );
::hilitematchfind( $index, $endidx, $item, $matchstr, $reverse, $nest,
substr( $regexp, 0, 1 ) eq '^' );
unless ($matchidx) { # Failed to find a match
my ( $row, $col ) = split( /\./, $index );
my $error = sprintf( "%d:%d - %s not matched", $row, $col, $item );
Expand Down
3 changes: 2 additions & 1 deletion src/lib/Guiguts/Highlight.pm
Original file line number Diff line number Diff line change
Expand Up @@ -618,11 +618,12 @@ sub hilitematchfind {
my $match = shift;
my $reverse = shift;
my $nest = shift;
my $anchor = shift; # True for strings to only match if at start of line
my $textwindow = $::textwindow;

# Regex searches for either the tag or its match, since if nested you may find the tag
# several times before finding the matches.
my $regexp = "(\Q$match\E|\Q$selection\E)";
my $regexp = ( $anchor ? "^" : "" ) . "(\Q$match\E|\Q$selection\E)";

# If an HTML tag, don't want "<b" to match "</blockquote...", for example,
# so use negative lookahead to ensure there's not an alphanumeric character
Expand Down
Loading