On 3/13/22 8:51 AM, Bram Moolenaar wrote:
Ernie Rael wrote:

The problem persists: Included patches: 1-4557.

The problem seems to be that tabs are not taken into account when
calculating column.

With the line, like listmode, starts with 3 tabs
^I^I^Ix
click on the x and getmousepos return column 25
but with the cursor on 'x' "getpos('.')" returns 4


My goal is to intercept a mouse click, if it is in a special area, want
to do something special, otherwise set the cursor position to where
there there was a click, like default behavior.

def Click()
      var d = getmousepos()
      echo d['column']
      win_gotoid(d['winid'])
      cursor(d['line'], d['column'])
enddef

nnoremap <LeftMouse> :MyClick<CR>
command! -nargs=0 MyClick Click()
Hmm, reading the help text for getmousepos() again, it looks like the
intention for "column" was to actually get the byte index of where the
mouse is.  But it currently is set to the screen column.  And then
it was limited to the number of bytes, which doesn't work.  I fixed that
last problem, but that goes against what the help says.

I can change it to return the byte index, which will make it work for
you.  It is not backwards compatible, but considering that it was not
returning the correct value, I doubt that someone depended on it.

Works ok now.

There was probably use of column when screencol or wincol was intended, so there might be issues...



--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/560d3974-dc82-7cca-c5a7-69c4e34af606%40raelity.com.

Raspunde prin e-mail lui