Skip to content

Commit fe9dafb

Browse files
Update lua/partial-diff.lua
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent b4ec0c1 commit fe9dafb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lua/partial-diff.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ M.apply_diff_highlights = function(lines_from, lines_to)
245245
return byte_idx
246246
else
247247
-- Fallback if character position is out of range
248-
return #line_str
248+
return math.min(#line_str, (char_pos > 1) and #line_str or 0)
249249
end
250250
end
251251

0 commit comments

Comments
 (0)