Re: feature request: v:mousecol and v:mouseline
On Sat, 21 Oct 2006 at 11:19am, Hari Krishna Dara wrote: > > On Sat, 21 Oct 2006 at 1:59pm, Bram Moolenaar wrote: > > > > > Hari Krishna Dara wrote: > > > > > When maps for mouse clicks are executed, can we have the location (in > > > the form of line and column number) made available through v: variables? > > > I just observed that getchar() works even with mouse clicks, but this is > > > almost useless without knowing where the user clicked. Capturing mouse > > > clicks along with maps or getchar() can do wonders if the mouse > > > click position is also available. > > > > Good point, getchar() should somehow make the position of the click > > available. > > > > It's not that easy, since the click could be in any of the windows. I > > suppose we need: > > v:mouse_window > > v:mouse_column > > v:mouse_line > > > > The position could be in screen columns and lines, or in text column and > > line. I suppose text position is more useful. You wouldn't need the > > position of a click halfway a tab, right? > > For most purposes the window and text position is all that matters, but > there can be some interesting possibilities if clicks outside any buffer > (such as at the command-line the way inputlist() works) can also be > made available (using something like v:mouse_region that can have > "window", "tab", "cmdline"). Also want to propose that these v: variables should be settable by the scripts in case the RHS of a map is a key. E.g., the following should work (note: it is just indented to show the usage, not particularly a useful example): " Make always at the center of the current window. imap CenterRightMouse() function! CenterRightMouse() let v:mouse_window = winnr() let v:mouse_line = winheight('.')/2 let v:mouse_col = winwidth('.')/2 return "\\" endfunction -- Thanks, Hari __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: feature request: v:mousecol and v:mouseline
On Sat, 21 Oct 2006 at 1:59pm, Bram Moolenaar wrote: > > Hari Krishna Dara wrote: > > > When maps for mouse clicks are executed, can we have the location (in > > the form of line and column number) made available through v: variables? > > I just observed that getchar() works even with mouse clicks, but this is > > almost useless without knowing where the user clicked. Capturing mouse > > clicks along with maps or getchar() can do wonders if the mouse > > click position is also available. > > Good point, getchar() should somehow make the position of the click > available. > > It's not that easy, since the click could be in any of the windows. I > suppose we need: > v:mouse_window > v:mouse_column > v:mouse_line > > The position could be in screen columns and lines, or in text column and > line. I suppose text position is more useful. You wouldn't need the > position of a click halfway a tab, right? For most purposes the window and text position is all that matters, but there can be some interesting possibilities if clicks outside any buffer (such as at the command-line the way inputlist() works) can also be made available (using something like v:mouse_region that can have "window", "tab", "cmdline"). -- Thank you, Hari __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: feature request: v:mousecol and v:mouseline
Hari Krishna Dara wrote: > When maps for mouse clicks are executed, can we have the location (in > the form of line and column number) made available through v: variables? > I just observed that getchar() works even with mouse clicks, but this is > almost useless without knowing where the user clicked. Capturing mouse > clicks along with maps or getchar() can do wonders if the mouse > click position is also available. Good point, getchar() should somehow make the position of the click available. It's not that easy, since the click could be in any of the windows. I suppose we need: v:mouse_window v:mouse_column v:mouse_line The position could be in screen columns and lines, or in text column and line. I suppose text position is more useful. You wouldn't need the position of a click halfway a tab, right? -- hundred-and-one symptoms of being an internet addict: 87. Everyone you know asks why your phone line is always busy ...and you tell them to send an e-mail. /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\ ///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\download, build and distribute -- http://www.A-A-P.org/// \\\help me help AIDS victims -- http://ICCF-Holland.org///
Re: feature request: v:mousecol and v:mouseline
Hari Krishna Dara wrote: When maps for mouse clicks are executed, can we have the location (in the form of line and column number) made available through v: variables? I just observed that getchar() works even with mouse clicks, but this is almost useless without knowing where the user clicked. Capturing mouse clicks along with maps or getchar() can do wonders if the mouse click position is also available. The mouse position is already available from within a 'balloonexpr' expression, but I can't find it for the general case. Maybe an additional parameter value for the line() and col() functions? Let's say col("m") and line("m")? Perhaps also some way to find out over which window the mouse is hovering or has just clicked? Best regards, Tony.
feature request: v:mousecol and v:mouseline
When maps for mouse clicks are executed, can we have the location (in the form of line and column number) made available through v: variables? I just observed that getchar() works even with mouse clicks, but this is almost useless without knowing where the user clicked. Capturing mouse clicks along with maps or getchar() can do wonders if the mouse click position is also available. -- Thank you, Hari __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com