Skip to content

Commit 9cd27ab

Browse files
committed
fix: word edge detection
1 parent 43cc07c commit 9cd27ab

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lua/text-transform/main.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,9 @@ function TextTransform.replace_columns(transform)
226226
-- get the line of this cursor
227227
local line = vim.fn.getline(line_num)
228228
-- match the surrounding word using start_col
229-
local word = line:match("[%w%_%-%.]+", start_col)
229+
local word = line:match("[%w%_%-]+", start_col)
230230
-- replace the word with the transformed word
231-
TextTransform.replace_cursor_range(line_num, start_col, start_col + #word, transform)
231+
TextTransform.replace_cursor_range(line_num, start_col, start_col + #word - 1, transform)
232232
end
233233
end
234234

0 commit comments

Comments
 (0)