From 6891bcb06b6f21de68278991f29e53452b822d48 Mon Sep 17 00:00:00 2001 From: Liam Dyer Date: Tue, 31 Dec 2024 15:46:38 -0500 Subject: [PATCH] fix: clamp text edit end character to start character, if lines equal Closes #634 --- lua/blink/cmp/lib/text_edits.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/blink/cmp/lib/text_edits.lua b/lua/blink/cmp/lib/text_edits.lua index 63448a46..6ec29acb 100644 --- a/lua/blink/cmp/lib/text_edits.lua +++ b/lua/blink/cmp/lib/text_edits.lua @@ -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