mirror of
https://github.com/verilator/verilator.git
synced 2025-01-06 06:37:45 +00:00
Internals: Expand git_untabify lines touched.
This commit is contained in:
parent
06c7d8ce3b
commit
f2028b60af
@ -87,6 +87,18 @@ sub find_edits {
|
|||||||
my $hunk = $editlines->{$lineno}{hunk};
|
my $hunk = $editlines->{$lineno}{hunk};
|
||||||
$hunk_lastlines{$hunk} ||= $lineno if $editlines->{$lineno}{user_edit};
|
$hunk_lastlines{$hunk} ||= $lineno if $editlines->{$lineno}{user_edit};
|
||||||
}
|
}
|
||||||
|
# Expand to include }'s that finish basic block
|
||||||
|
foreach my $hunk (keys %hunk_lastlines) {
|
||||||
|
while (my $lineno = $hunk_lastlines{$hunk}) {
|
||||||
|
++$lineno;
|
||||||
|
if (($editlines->{$lineno}{line} || "")
|
||||||
|
=~ /^[+ ]\s+}[ \t};]*$/) {
|
||||||
|
$hunk_lastlines{$hunk} = $lineno;
|
||||||
|
} else {
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
# Expand to always untabify at least 3 lines (so that future diff will
|
# Expand to always untabify at least 3 lines (so that future diff will
|
||||||
# have non-tabs within a edit hunk distance
|
# have non-tabs within a edit hunk distance
|
||||||
foreach my $hunk (keys %hunk_firstlines) {
|
foreach my $hunk (keys %hunk_firstlines) {
|
||||||
@ -100,7 +112,7 @@ sub find_edits {
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach my $lineno (sort {$a <=> $b} keys %$editlines) {
|
foreach my $lineno (sort {$a <=> $b} keys %$editlines) {
|
||||||
if ($editlines->{$lineno}{line} =~ /\t/) {
|
if (($editlines->{$lineno}{line}||"") =~ /\t/) {
|
||||||
my $hunk = $editlines->{$lineno}{hunk};
|
my $hunk = $editlines->{$lineno}{hunk};
|
||||||
if ($hunk_firstlines{$hunk} <= $lineno && $hunk_lastlines{$hunk} >= $lineno) {
|
if ($hunk_firstlines{$hunk} <= $lineno && $hunk_lastlines{$hunk} >= $lineno) {
|
||||||
$editlines->{$lineno}{editit} = 1;
|
$editlines->{$lineno}{editit} = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user