daa84 / neovim-gtk

gtk ui for neovim
GNU General Public License v3.0
718 stars 57 forks source link

Mouse selection on Neovim-GTK only selects full words #185

Closed baco closed 4 years ago

baco commented 5 years ago

Having set :set mouse=a on Neovim's init.vim file turns on visual selection for both Neovim and Neovim-GTK UI; but selection behaves differently when selecting on the Neovim TUI and on Neovim-GTK GUI.

For example, suppose we have the text:

Lorem ipsum dolor sit amet

on Neovim TUI, I can start a mouse selection at the first s occurrence and and end it at the second o occurrence, having effectively selected sum do.

on Neovim-GTK GUI I can not make the same selection. When starting the selection the starting point automatically displaces to the start of the word ipsum and when reaching the end of selection it is forced the end point to the end of the word dolor, having effectively selected ipsum dolor.

The desired/expected behavior is the first one, having the possibility to make arbitrary selections.

Technical information:

Kagetsuki commented 4 years ago

I don't regularly use mouse selection so I didn't even notice this; but upon testing I can confirm neovim-gtk is in fact selecting only by word when using the mouse.

hasufell commented 4 years ago

Yes, this is a show-stopper

Kagetsuki commented 4 years ago

Well, I wouldn't call it a "show-stopper", but it is definitely a little inconvenient and clumsy.

hasufell commented 4 years ago

I tried to figure out where this happens, but neither neovim-gtk, nor neovim-lib have usable documentation.

hasufell commented 4 years ago

https://github.com/daa84/neovim-gtk/blob/master/src/shell.rs#L1082 it is this line

hasufell commented 4 years ago

Fix is in PR.