nvim-telescope / telescope-live-grep-args.nvim

Live grep with args
726 stars 40 forks source link

Bug in visual selection #74

Closed Fabian-programmer closed 10 months ago

Fabian-programmer commented 11 months ago

Description

Hey, thanks for the plugin.

I just encountered the problem, I was visual selecting a text from right to left. grafik

I think here lies the problem:

  local _, ls, cs = unpack(vim.fn.getpos("v"))
  local _, le, ce = unpack(vim.fn.getpos("."))

when you select text from right to left, then cs is bigger than ce.

so there needs to be a condition:

if cs > ce
  swap(cs,ce)
  swap(ls,le)

https://github.com/nvim-telescope/telescope-live-grep-args.nvim/blob/master/lua/telescope-live-grep-args/shortcuts.lua#L8

Neovim version

nvim 0.9.4

Operating system and version

ubuntu 22

Telescope version / branch / rev

latest

Telescope live grep args version / branch / rev

latest

checkhealth telescope

.

Steps to reproduce

.

Expected behavior

No response

Actual behavior

.

Minimal config

.
weeman1337 commented 10 months ago

Thank you for reporting the issue @Fabian-programmer

This bug was already reported before https://github.com/nvim-telescope/telescope-live-grep-args.nvim/issues/63 Also a pull request exists, which should be merged soon.

weeman1337 commented 10 months ago

Duplicate of https://github.com/nvim-telescope/telescope-live-grep-args.nvim/issues/63