Skip to content

Commit

Permalink
fix: url not hightlight when cursor on it
Browse files Browse the repository at this point in the history
  • Loading branch information
sontungexpt committed Sep 16, 2023
1 parent 2af27e8 commit 7798f2b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lua/url-open/modules/handlers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ M.open_url = function(user_opts)
while url do
-- if the url under cursor, then break
if user_opts.open_only_when_cursor_on_url then
if cursor_col >= start_pos and cursor_col < end_pos then
if cursor_col >= start_pos - 1 and cursor_col < end_pos then
url_to_open = url
break
end
Expand Down Expand Up @@ -190,7 +190,7 @@ M.highlight_cursor_url = function(user_opts)
-- clear the other highlight url to make sure only one url is highlighted
api.nvim_buf_clear_namespace(0, cursor_url_hightlight_id, 0, -1)
if user_opts.open_only_when_cursor_on_url then
if cursor_col >= start_pos and cursor_col < end_pos then
if cursor_col >= start_pos - 1 and cursor_col < end_pos then
api.nvim_buf_add_highlight(
0,
cursor_url_hightlight_id,
Expand Down

0 comments on commit 7798f2b

Please sign in to comment.