summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-07-10 21:55:54 +0200
committerBram Moolenaar <Bram@vim.org>2019-07-10 21:55:54 +0200
commitb05caa782dbab51db8de60940eff7992f8cfd882 (patch)
treea209cf4819bd8aad2182aa01955110f8ca2fe899 /runtime
parent3b849af90a691f2a9999222b0e69bd161bebc5e2 (diff)
downloadvim-git-b05caa782dbab51db8de60940eff7992f8cfd882.tar.gz
patch 8.1.1659: popup window "mousemoved" values not correctv8.1.1659
Problem: Popup window "mousemoved" values not correct. Solution: Convert text column to mouse column.
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/popup.txt29
1 files changed, 20 insertions, 9 deletions
diff --git a/runtime/doc/popup.txt b/runtime/doc/popup.txt
index 13674109e..ba4dc3fc1 100644
--- a/runtime/doc/popup.txt
+++ b/runtime/doc/popup.txt
@@ -192,7 +192,7 @@ popup_beval({what}, {options}) *popup_beval()*
let pos = screenpos(v:beval_winnr, v:beval_lnum, v:beval_col)
call popup_create({what}, {
\ 'pos': 'botleft',
- \ 'line': pos.lnum - 1,
+ \ 'line': pos.row - 1,
\ 'col': pos.col,
\ 'mousemoved': 'WORD',
\ })
@@ -762,38 +762,49 @@ Example for using a popup window for 'ballooneval': >
set ballooneval balloonevalterm
set balloonexpr=BalloonExpr()
let s:winid = 0
+ let s:last_text = ''
func BalloonExpr()
- if s:winid
+ if s:winid && popup_getpos(s:winid) != {}
+ " previous popup window still shows
+ if v:beval_text == s:last_text
+ " Still the same text, keep the existing popup
+ return ''
+ endif
call popup_close(s:winid)
- let s:winid = 0
endif
- let s:winid = popup_beval([bufname(v:beval_bufnr), v:beval_text], {})
+ let s:winid = popup_beval(v:beval_text, {'mousemoved': 'word'})
+ let s:last_text = v:beval_text
return ''
endfunc
<
If the text has to be obtained asynchronously return an empty string from the
expression function and call popup_beval() once the text is available. In
-this example similated with a timer callback: >
+this example simulated with a timer callback: >
set ballooneval balloonevalterm
set balloonexpr=BalloonExpr()
let s:winid = 0
+ let s:balloonText = ''
func BalloonExpr()
- if s:winid
+ if s:winid && popup_getpos(s:winid) != {}
+ " previous popup window still shows
+ if v:beval_text == s:balloonText
+ " Still the same text, keep the existing popup
+ return ''
+ endif
call popup_close(s:winid)
let s:winid = 0
endif
" simulate an asynchronous loopup for the text to display
- let s:balloonFile = bufname(v:beval_bufnr)
- let s:balloonWord = v:beval_text
+ let s:balloonText = v:beval_text
call timer_start(100, 'ShowPopup')
return ''
endfunc
func ShowPopup(id)
- let s:winid = popup_beval([s:balloonFile, s:balloonWord], {})
+ let s:winid = popup_beval(s:balloonText, {'mousemoved': 'word'})
endfunc
<