Skip to content

Commit

Permalink
fix: clamp text edit end character to start character, if lines equal
Browse files Browse the repository at this point in the history
Closes #634
  • Loading branch information
Saghen committed Dec 31, 2024
1 parent eb9e651 commit 6891bcb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lua/blink/cmp/lib/text_edits.lua
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,10 @@ function text_edits.clamp_range_to_bounds(range)
range.start.character = math.min(math.max(range.start.character, 0), #start_line)

local end_line = context.get_line(range['end'].line)
range['end'].character = math.min(math.max(range['end'].character, 0), #end_line)
range['end'].character = math.min(
math.max(range['end'].character, range.start.line == range['end'].line and range.start.character or 0),
#end_line
)

return range
end
Expand Down

0 comments on commit 6891bcb

Please sign in to comment.