Skip to content

Commit

Permalink
lol bad find&replace
Browse files Browse the repository at this point in the history
  • Loading branch information
boatbomber committed Nov 16, 2024
1 parent 4ae4abf commit 7584e72
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions plugin/src/App/Components/StringDiffVisualizer/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -179,33 +179,33 @@ function StringDiffVisualizer:updateDiffs()
end
end

-- Filter out diffs that are just incominglines being added/removed from existing non-empty lines.
-- Filter out diffs that are just newlines being added/removed from existing non-empty lines.
-- This is done to make the diff visualization less noisy.

local currentStringLines = string.split(currentString, "\n")
local incomingStringLines = string.split(incomingString, "\n")

for lineNum, lineDiffs in currentDiffs do
if
(#lineDiffs > 1) -- Not just incomingline
or (lineDiffs[1].start ~= lineDiffs[1].stop) -- Not a incomingline at all
or (currentStringLines[lineNum] == "") -- Empty line, so the incomingline change is significant
(#lineDiffs > 1) -- Not just newline
or (lineDiffs[1].start ~= lineDiffs[1].stop) -- Not a newline at all
or (currentStringLines[lineNum] == "") -- Empty line, so the newline change is significant
then
continue
end
-- Just a noisy incomingline diff, clear it
-- Just a noisy newline diff, clear it
currentDiffs[lineNum] = nil
end

for lineNum, lineDiffs in incomingDiffs do
if
(#lineDiffs > 1) -- Not just incomingline
or (lineDiffs[1].start ~= lineDiffs[1].stop) -- Not a incomingline at all
or (incomingStringLines[lineNum] == "") -- Empty line, so the incomingline change is significant
(#lineDiffs > 1) -- Not just newline
or (lineDiffs[1].start ~= lineDiffs[1].stop) -- Not a newline at all
or (incomingStringLines[lineNum] == "") -- Empty line, so the newline change is significant
then
continue
end
-- Just a noisy incomingline diff, clear it
-- Just a noisy newline diff, clear it
incomingDiffs[lineNum] = nil
end

Expand Down

0 comments on commit 7584e72

Please sign in to comment.