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.

-- 
hundred-and-one symptoms of being an internet addict:
250. You've given up the search for the "perfect woman" and instead,
     sit in front of the PC until you're just too tired to care.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
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/20220313155150.D3C511C79E4%40moolenaar.net.

Raspunde prin e-mail lui