mirror of
https://github.com/zoriya/vim.git
synced 2025-12-14 11:16:16 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c7d16dce2f | ||
|
|
0f1e643138 | ||
|
|
51b0f3701e | ||
|
|
234d16286a | ||
|
|
ae1e108caa | ||
|
|
9e27217c48 | ||
|
|
7567d0b115 | ||
|
|
d048009717 |
@@ -67,6 +67,7 @@ addons:
|
|||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
- autoconf
|
- autoconf
|
||||||
|
- clang
|
||||||
- lcov
|
- lcov
|
||||||
- libperl-dev
|
- libperl-dev
|
||||||
- python-dev
|
- python-dev
|
||||||
@@ -102,9 +103,8 @@ script:
|
|||||||
- (cd ${SRCDIR} && ./configure --with-features=$FEATURES $CONFOPT --enable-fail-if-missing && if [ "$BUILD" = "yes" ]; then make -j$NPROC; fi)
|
- (cd ${SRCDIR} && ./configure --with-features=$FEATURES $CONFOPT --enable-fail-if-missing && if [ "$BUILD" = "yes" ]; then make -j$NPROC; fi)
|
||||||
# Show Vim version and also if_xx versions.
|
# Show Vim version and also if_xx versions.
|
||||||
- if [ "$BUILD" = "yes" ]; then ${SRCDIR}/vim --version; ${SRCDIR}/vim --not-a-term -u NONE -S ${SRCDIR}/testdir/if_ver-1.vim -c quit > /dev/null; ${SRCDIR}/vim --not-a-term -u NONE -S ${SRCDIR}/testdir/if_ver-2.vim -c quit > /dev/null; cat if_ver.txt; fi
|
- if [ "$BUILD" = "yes" ]; then ${SRCDIR}/vim --version; ${SRCDIR}/vim --not-a-term -u NONE -S ${SRCDIR}/testdir/if_ver-1.vim -c quit > /dev/null; ${SRCDIR}/vim --not-a-term -u NONE -S ${SRCDIR}/testdir/if_ver-2.vim -c quit > /dev/null; cat if_ver.txt; fi
|
||||||
- if [ -n "$ASAN_OPTIONS" ]; then export PATH=/usr/lib/llvm-$(clang -v 2>&1 | sed -n 's/.*version \([1-9]\.[0-9][0-9]*\).*/\1/p')/bin:$PATH; fi
|
|
||||||
- make $SHADOWOPT $TEST
|
- make $SHADOWOPT $TEST
|
||||||
- if [ -n "$ASAN_OPTIONS" ]; then for log in $(find -type f -name 'asan.*' -size +0); do cat "$log"; err=1; done; fi
|
- if [ -n "$ASAN_OPTIONS" ]; then for log in $(find -type f -name 'asan.*' -size +0); do asan_symbolize < "$log"; err=1; done; fi
|
||||||
- if [ -n "$err" ]; then exit 1; fi
|
- if [ -n "$err" ]; then exit 1; fi
|
||||||
|
|
||||||
after_success:
|
after_success:
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
*eval.txt* For Vim version 8.0. Last change: 2017 Oct 28
|
*eval.txt* For Vim version 8.0. Last change: 2017 Nov 16
|
||||||
|
|
||||||
|
|
||||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||||
@@ -8721,7 +8721,7 @@ winwidth({nr}) *winwidth()*
|
|||||||
Examples: >
|
Examples: >
|
||||||
:echo "The current window has " . winwidth(0) . " columns."
|
:echo "The current window has " . winwidth(0) . " columns."
|
||||||
:if winwidth(0) <= 50
|
:if winwidth(0) <= 50
|
||||||
: exe "normal 50\<C-W>|"
|
: 50 wincmd |
|
||||||
:endif
|
:endif
|
||||||
< For getting the terminal or screen size, see the 'columns'
|
< For getting the terminal or screen size, see the 'columns'
|
||||||
option.
|
option.
|
||||||
@@ -8762,8 +8762,17 @@ writefile({list}, {fname} [, {flags}])
|
|||||||
appended to the file: >
|
appended to the file: >
|
||||||
:call writefile(["foo"], "event.log", "a")
|
:call writefile(["foo"], "event.log", "a")
|
||||||
:call writefile(["bar"], "event.log", "a")
|
:call writefile(["bar"], "event.log", "a")
|
||||||
|
<
|
||||||
|
When {flags} contains "s" then fsync() is called after writing
|
||||||
|
the file. This flushes the file to disk, if possible. This
|
||||||
|
takes more time but avoids losing the file if the system
|
||||||
|
crashes.
|
||||||
|
When {flags} does not contain "S" or "s" then fsync is called
|
||||||
|
if the 'fsync' option is set.
|
||||||
|
When {flags} contains "S" then fsync() is not called, even
|
||||||
|
when 'fsync' is set.
|
||||||
|
|
||||||
< All NL characters are replaced with a NUL character.
|
All NL characters are replaced with a NUL character.
|
||||||
Inserting CR characters needs to be done before passing {list}
|
Inserting CR characters needs to be done before passing {list}
|
||||||
to writefile().
|
to writefile().
|
||||||
An existing file is overwritten, if possible.
|
An existing file is overwritten, if possible.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
*options.txt* For Vim version 8.0. Last change: 2017 Nov 11
|
*options.txt* For Vim version 8.0. Last change: 2017 Nov 18
|
||||||
|
|
||||||
|
|
||||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||||
@@ -1127,7 +1127,16 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
{not in Vi}
|
{not in Vi}
|
||||||
{only available when compiled with the |+balloon_eval|
|
{only available when compiled with the |+balloon_eval|
|
||||||
feature}
|
feature}
|
||||||
Switch on the |balloon-eval| functionality.
|
Switch on the |balloon-eval| functionality for the GUI.
|
||||||
|
|
||||||
|
*'balloonevalterm'* *'bevalterm'* *'noballoonevalterm'*
|
||||||
|
*'nobevalterm'*
|
||||||
|
'balloonevalterm' 'bevalterm' boolean (default off)
|
||||||
|
global
|
||||||
|
{not in Vi}
|
||||||
|
{only available when compiled with the
|
||||||
|
|+balloon_eval_term| feature}
|
||||||
|
Switch on the |balloon-eval| functionality for the terminal.
|
||||||
|
|
||||||
*'balloonexpr'* *'bexpr'*
|
*'balloonexpr'* *'bexpr'*
|
||||||
'balloonexpr' 'bexpr' string (default "")
|
'balloonexpr' 'bexpr' string (default "")
|
||||||
@@ -3521,6 +3530,8 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
systems without an fsync() implementation, this variable is always
|
systems without an fsync() implementation, this variable is always
|
||||||
off.
|
off.
|
||||||
Also see 'swapsync' for controlling fsync() on swap files.
|
Also see 'swapsync' for controlling fsync() on swap files.
|
||||||
|
'fsync' also applies to |writefile()|, unless a flag is used to
|
||||||
|
overrule it.
|
||||||
|
|
||||||
*'gdefault'* *'gd'* *'nogdefault'* *'nogd'*
|
*'gdefault'* *'gd'* *'nogdefault'* *'nogd'*
|
||||||
'gdefault' 'gd' boolean (default off)
|
'gdefault' 'gd' boolean (default off)
|
||||||
@@ -3944,7 +3955,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
toolbar, tabline, etc. Instead, the behavior is similar to
|
toolbar, tabline, etc. Instead, the behavior is similar to
|
||||||
when the window is maximized and will adjust 'lines' and
|
when the window is maximized and will adjust 'lines' and
|
||||||
'columns' to fit to the window. Without the 'k' flag Vim will
|
'columns' to fit to the window. Without the 'k' flag Vim will
|
||||||
try to keep 'lines' and 'columns the same when adding and
|
try to keep 'lines' and 'columns' the same when adding and
|
||||||
removing GUI components.
|
removing GUI components.
|
||||||
|
|
||||||
*'guipty'* *'noguipty'*
|
*'guipty'* *'noguipty'*
|
||||||
@@ -8221,7 +8232,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
number, more intelligent detection process runs.
|
number, more intelligent detection process runs.
|
||||||
The "xterm2" value will be set if the xterm version is reported to be
|
The "xterm2" value will be set if the xterm version is reported to be
|
||||||
from 95 to 276. The "sgr" value will be set if the xterm version is
|
from 95 to 276. The "sgr" value will be set if the xterm version is
|
||||||
277 or highter.
|
277 or highter and when Vim detects Mac Terminal.app or Iterm2.
|
||||||
If you do not want 'ttymouse' to be set to "xterm2" or "sgr"
|
If you do not want 'ttymouse' to be set to "xterm2" or "sgr"
|
||||||
automatically, set t_RV to an empty string: >
|
automatically, set t_RV to an empty string: >
|
||||||
:set t_RV=
|
:set t_RV=
|
||||||
|
|||||||
@@ -69,6 +69,11 @@ func s:StartDebug(cmd)
|
|||||||
endif
|
endif
|
||||||
let pty = job_info(term_getjob(s:ptybuf))['tty_out']
|
let pty = job_info(term_getjob(s:ptybuf))['tty_out']
|
||||||
let s:ptywin = win_getid(winnr())
|
let s:ptywin = win_getid(winnr())
|
||||||
|
if vertical
|
||||||
|
" Assuming the source code window will get a signcolumn, use two more
|
||||||
|
" columns for that, thus one less for the terminal window.
|
||||||
|
exe (&columns / 2 - 1) . "wincmd |"
|
||||||
|
endif
|
||||||
|
|
||||||
" Create a hidden terminal window to communicate with gdb
|
" Create a hidden terminal window to communicate with gdb
|
||||||
let s:commbuf = term_start('NONE', {
|
let s:commbuf = term_start('NONE', {
|
||||||
@@ -121,6 +126,15 @@ func s:StartDebug(cmd)
|
|||||||
call s:InstallCommands()
|
call s:InstallCommands()
|
||||||
call win_gotoid(s:gdbwin)
|
call win_gotoid(s:gdbwin)
|
||||||
|
|
||||||
|
" Enable showing a balloon with eval info
|
||||||
|
if has("balloon_eval")
|
||||||
|
set ballooneval
|
||||||
|
set balloonexpr=TermDebugBalloonExpr()
|
||||||
|
if has("balloon_eval_term")
|
||||||
|
set balloonevalterm
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
let s:breakpoints = {}
|
let s:breakpoints = {}
|
||||||
|
|
||||||
augroup TermDebug
|
augroup TermDebug
|
||||||
@@ -144,6 +158,14 @@ func s:EndDebug(job, status)
|
|||||||
let &columns = s:save_columns
|
let &columns = s:save_columns
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if has("balloon_eval")
|
||||||
|
set noballooneval
|
||||||
|
set balloonexpr=
|
||||||
|
if has("balloon_eval_term")
|
||||||
|
set noballoonevalterm
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
au! TermDebug
|
au! TermDebug
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
@@ -279,6 +301,11 @@ func s:Run(args)
|
|||||||
call s:SendCommand('-exec-run')
|
call s:SendCommand('-exec-run')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func s:SendEval(expr)
|
||||||
|
call s:SendCommand('-data-evaluate-expression "' . a:expr . '"')
|
||||||
|
let s:evalexpr = a:expr
|
||||||
|
endfunc
|
||||||
|
|
||||||
" :Evaluate - evaluate what is under the cursor
|
" :Evaluate - evaluate what is under the cursor
|
||||||
func s:Evaluate(range, arg)
|
func s:Evaluate(range, arg)
|
||||||
if a:arg != ''
|
if a:arg != ''
|
||||||
@@ -294,25 +321,54 @@ func s:Evaluate(range, arg)
|
|||||||
else
|
else
|
||||||
let expr = expand('<cexpr>')
|
let expr = expand('<cexpr>')
|
||||||
endif
|
endif
|
||||||
call s:SendCommand('-data-evaluate-expression "' . expr . '"')
|
call s:SendEval(expr)
|
||||||
let s:evalexpr = expr
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
let s:evalFromBalloonExpr = 0
|
||||||
|
|
||||||
" Handle the result of data-evaluate-expression
|
" Handle the result of data-evaluate-expression
|
||||||
func s:HandleEvaluate(msg)
|
func s:HandleEvaluate(msg)
|
||||||
let value = substitute(a:msg, '.*value="\(.*\)"', '\1', '')
|
let value = substitute(a:msg, '.*value="\(.*\)"', '\1', '')
|
||||||
let value = substitute(value, '\\"', '"', 'g')
|
let value = substitute(value, '\\"', '"', 'g')
|
||||||
echomsg '"' . s:evalexpr . '": ' . value
|
if s:evalFromBalloonExpr
|
||||||
|
if s:evalFromBalloonExprResult == ''
|
||||||
|
let s:evalFromBalloonExprResult = s:evalexpr . ': ' . value
|
||||||
|
else
|
||||||
|
let s:evalFromBalloonExprResult .= ' = ' . value
|
||||||
|
endif
|
||||||
|
call balloon_show(s:evalFromBalloonExprResult)
|
||||||
|
else
|
||||||
|
echomsg '"' . s:evalexpr . '": ' . value
|
||||||
|
endif
|
||||||
|
|
||||||
if s:evalexpr[0] != '*' && value =~ '^0x' && value != '0x0' && value !~ '"$'
|
if s:evalexpr[0] != '*' && value =~ '^0x' && value != '0x0' && value !~ '"$'
|
||||||
" Looks like a pointer, also display what it points to.
|
" Looks like a pointer, also display what it points to.
|
||||||
let s:evalexpr = '*' . s:evalexpr
|
call s:SendEval('*' . s:evalexpr)
|
||||||
call term_sendkeys(s:commbuf, '-data-evaluate-expression "' . s:evalexpr . "\"\r")
|
else
|
||||||
|
let s:evalFromBalloonExpr = 0
|
||||||
endif
|
endif
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" Show a balloon with information of the variable under the mouse pointer,
|
||||||
|
" if there is any.
|
||||||
|
func TermDebugBalloonExpr()
|
||||||
|
if v:beval_winid != s:startwin
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
call s:SendEval(v:beval_text)
|
||||||
|
let s:evalFromBalloonExpr = 1
|
||||||
|
let s:evalFromBalloonExprResult = ''
|
||||||
|
return ''
|
||||||
|
endfunc
|
||||||
|
|
||||||
" Handle an error.
|
" Handle an error.
|
||||||
func s:HandleError(msg)
|
func s:HandleError(msg)
|
||||||
|
if a:msg =~ 'No symbol .* in current context'
|
||||||
|
\ || a:msg =~ 'Cannot access memory at address '
|
||||||
|
\ || a:msg =~ 'Attempt to use a type name as an expression'
|
||||||
|
" Result of s:SendEval() failed, ignore.
|
||||||
|
return
|
||||||
|
endif
|
||||||
echoerr substitute(a:msg, '.*msg="\(.*\)"', '\1', '')
|
echoerr substitute(a:msg, '.*msg="\(.*\)"', '\1', '')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
|||||||
@@ -1177,6 +1177,7 @@ doESCkey:
|
|||||||
case K_LEFTDRAG:
|
case K_LEFTDRAG:
|
||||||
case K_LEFTRELEASE:
|
case K_LEFTRELEASE:
|
||||||
case K_LEFTRELEASE_NM:
|
case K_LEFTRELEASE_NM:
|
||||||
|
case K_MOUSEMOVE:
|
||||||
case K_MIDDLEMOUSE:
|
case K_MIDDLEMOUSE:
|
||||||
case K_MIDDLEDRAG:
|
case K_MIDDLEDRAG:
|
||||||
case K_MIDDLERELEASE:
|
case K_MIDDLERELEASE:
|
||||||
|
|||||||
@@ -1410,7 +1410,7 @@ f_atan2(typval_T *argvars, typval_T *rettv)
|
|||||||
f_balloon_show(typval_T *argvars, typval_T *rettv UNUSED)
|
f_balloon_show(typval_T *argvars, typval_T *rettv UNUSED)
|
||||||
{
|
{
|
||||||
if (balloonEval != NULL)
|
if (balloonEval != NULL)
|
||||||
gui_mch_post_balloon(balloonEval, get_tv_string_chk(&argvars[0]));
|
post_balloon(balloonEval, get_tv_string_chk(&argvars[0]));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -5589,6 +5589,9 @@ f_has(typval_T *argvars, typval_T *rettv)
|
|||||||
"balloon_multiline",
|
"balloon_multiline",
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef FEAT_BEVALTERM
|
||||||
|
"balloon_eval_term",
|
||||||
|
#endif
|
||||||
#if defined(SOME_BUILTIN_TCAPS) || defined(ALL_BUILTIN_TCAPS)
|
#if defined(SOME_BUILTIN_TCAPS) || defined(ALL_BUILTIN_TCAPS)
|
||||||
"builtin_terms",
|
"builtin_terms",
|
||||||
# ifdef ALL_BUILTIN_TCAPS
|
# ifdef ALL_BUILTIN_TCAPS
|
||||||
@@ -13348,6 +13351,9 @@ f_writefile(typval_T *argvars, typval_T *rettv)
|
|||||||
{
|
{
|
||||||
int binary = FALSE;
|
int binary = FALSE;
|
||||||
int append = FALSE;
|
int append = FALSE;
|
||||||
|
#ifdef HAVE_FSYNC
|
||||||
|
int do_fsync = p_fs;
|
||||||
|
#endif
|
||||||
char_u *fname;
|
char_u *fname;
|
||||||
FILE *fd;
|
FILE *fd;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
@@ -13380,6 +13386,12 @@ f_writefile(typval_T *argvars, typval_T *rettv)
|
|||||||
binary = TRUE;
|
binary = TRUE;
|
||||||
if (vim_strchr(arg2, 'a') != NULL)
|
if (vim_strchr(arg2, 'a') != NULL)
|
||||||
append = TRUE;
|
append = TRUE;
|
||||||
|
#ifdef HAVE_FSYNC
|
||||||
|
if (vim_strchr(arg2, 's') != NULL)
|
||||||
|
do_fsync = TRUE;
|
||||||
|
else if (vim_strchr(arg2, 'S') != NULL)
|
||||||
|
do_fsync = FALSE;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
fname = get_tv_string_chk(&argvars[1]);
|
fname = get_tv_string_chk(&argvars[1]);
|
||||||
@@ -13398,6 +13410,10 @@ f_writefile(typval_T *argvars, typval_T *rettv)
|
|||||||
{
|
{
|
||||||
if (write_list(fd, list, binary) == FAIL)
|
if (write_list(fd, list, binary) == FAIL)
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
#ifdef HAVE_FSYNC
|
||||||
|
else if (do_fsync && fsync(fileno(fd)) != 0)
|
||||||
|
EMSG(_(e_fsync));
|
||||||
|
#endif
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1093,21 +1093,21 @@ static timer_T *first_timer = NULL;
|
|||||||
static long last_timer_id = 0;
|
static long last_timer_id = 0;
|
||||||
|
|
||||||
static long
|
static long
|
||||||
timer_time_left(timer_T *timer, proftime_T *now)
|
proftime_time_left(proftime_T *due, proftime_T *now)
|
||||||
{
|
{
|
||||||
# ifdef WIN3264
|
# ifdef WIN3264
|
||||||
LARGE_INTEGER fr;
|
LARGE_INTEGER fr;
|
||||||
|
|
||||||
if (now->QuadPart > timer->tr_due.QuadPart)
|
if (now->QuadPart > due->QuadPart)
|
||||||
return 0;
|
return 0;
|
||||||
QueryPerformanceFrequency(&fr);
|
QueryPerformanceFrequency(&fr);
|
||||||
return (long)(((double)(timer->tr_due.QuadPart - now->QuadPart)
|
return (long)(((double)(due->QuadPart - now->QuadPart)
|
||||||
/ (double)fr.QuadPart) * 1000);
|
/ (double)fr.QuadPart) * 1000);
|
||||||
# else
|
# else
|
||||||
if (now->tv_sec > timer->tr_due.tv_sec)
|
if (now->tv_sec > due->tv_sec)
|
||||||
return 0;
|
return 0;
|
||||||
return (timer->tr_due.tv_sec - now->tv_sec) * 1000
|
return (due->tv_sec - now->tv_sec) * 1000
|
||||||
+ (timer->tr_due.tv_usec - now->tv_usec) / 1000;
|
+ (due->tv_usec - now->tv_usec) / 1000;
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1219,7 +1219,7 @@ check_due_timer(void)
|
|||||||
|
|
||||||
if (timer->tr_id == -1 || timer->tr_firing || timer->tr_paused)
|
if (timer->tr_id == -1 || timer->tr_firing || timer->tr_paused)
|
||||||
continue;
|
continue;
|
||||||
this_due = timer_time_left(timer, &now);
|
this_due = proftime_time_left(&timer->tr_due, &now);
|
||||||
if (this_due <= 1)
|
if (this_due <= 1)
|
||||||
{
|
{
|
||||||
int save_timer_busy = timer_busy;
|
int save_timer_busy = timer_busy;
|
||||||
@@ -1271,7 +1271,7 @@ check_due_timer(void)
|
|||||||
&& timer->tr_emsg_count < 3)
|
&& timer->tr_emsg_count < 3)
|
||||||
{
|
{
|
||||||
profile_setlimit(timer->tr_interval, &timer->tr_due);
|
profile_setlimit(timer->tr_interval, &timer->tr_due);
|
||||||
this_due = timer_time_left(timer, &now);
|
this_due = proftime_time_left(&timer->tr_due, &now);
|
||||||
if (this_due < 1)
|
if (this_due < 1)
|
||||||
this_due = 1;
|
this_due = 1;
|
||||||
if (timer->tr_repeat > 0)
|
if (timer->tr_repeat > 0)
|
||||||
@@ -1291,6 +1291,27 @@ check_due_timer(void)
|
|||||||
if (did_one)
|
if (did_one)
|
||||||
redraw_after_callback(need_update_screen);
|
redraw_after_callback(need_update_screen);
|
||||||
|
|
||||||
|
#ifdef FEAT_BEVALTERM
|
||||||
|
if (bevalexpr_due_set)
|
||||||
|
{
|
||||||
|
this_due = proftime_time_left(&bevalexpr_due, &now);
|
||||||
|
if (this_due <= 1)
|
||||||
|
{
|
||||||
|
bevalexpr_due_set = FALSE;
|
||||||
|
|
||||||
|
if (balloonEval == NULL)
|
||||||
|
{
|
||||||
|
balloonEval = (BalloonEval *)alloc(sizeof(BalloonEval));
|
||||||
|
balloonEvalForTerm = TRUE;
|
||||||
|
}
|
||||||
|
if (balloonEval != NULL)
|
||||||
|
general_beval_cb(balloonEval, 0);
|
||||||
|
}
|
||||||
|
else if (this_due > 0 && (next_due == -1 || next_due > this_due))
|
||||||
|
next_due = this_due;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return current_id != last_timer_id ? 1 : next_due;
|
return current_id != last_timer_id ? 1 : next_due;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1358,7 +1379,7 @@ add_timer_info(typval_T *rettv, timer_T *timer)
|
|||||||
dict_add_nr_str(dict, "time", (long)timer->tr_interval, NULL);
|
dict_add_nr_str(dict, "time", (long)timer->tr_interval, NULL);
|
||||||
|
|
||||||
profile_start(&now);
|
profile_start(&now);
|
||||||
remaining = timer_time_left(timer, &now);
|
remaining = proftime_time_left(&timer->tr_due, &now);
|
||||||
dict_add_nr_str(dict, "remaining", (long)remaining, NULL);
|
dict_add_nr_str(dict, "remaining", (long)remaining, NULL);
|
||||||
|
|
||||||
dict_add_nr_str(dict, "repeat",
|
dict_add_nr_str(dict, "repeat",
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ getcmdline(
|
|||||||
pos_T match_end;
|
pos_T match_end;
|
||||||
# ifdef FEAT_DIFF
|
# ifdef FEAT_DIFF
|
||||||
int old_topfill;
|
int old_topfill;
|
||||||
int init_topfill = curwin->w_topfill;
|
int init_topfill = curwin->w_topfill;
|
||||||
# endif
|
# endif
|
||||||
linenr_T old_botline;
|
linenr_T old_botline;
|
||||||
linenr_T init_botline = curwin->w_botline;
|
linenr_T init_botline = curwin->w_botline;
|
||||||
@@ -1452,6 +1452,7 @@ getcmdline(
|
|||||||
case K_X2MOUSE:
|
case K_X2MOUSE:
|
||||||
case K_X2DRAG:
|
case K_X2DRAG:
|
||||||
case K_X2RELEASE:
|
case K_X2RELEASE:
|
||||||
|
case K_MOUSEMOVE:
|
||||||
goto cmdline_not_changed;
|
goto cmdline_not_changed;
|
||||||
|
|
||||||
#endif /* FEAT_MOUSE */
|
#endif /* FEAT_MOUSE */
|
||||||
@@ -1715,11 +1716,17 @@ getcmdline(
|
|||||||
if (p_is && !cmd_silent && (firstc == '/' || firstc == '?'))
|
if (p_is && !cmd_silent && (firstc == '/' || firstc == '?'))
|
||||||
{
|
{
|
||||||
pos_T t;
|
pos_T t;
|
||||||
|
char_u *pat;
|
||||||
int search_flags = SEARCH_NOOF;
|
int search_flags = SEARCH_NOOF;
|
||||||
|
|
||||||
if (ccline.cmdlen == 0)
|
if (ccline.cmdlen == 0)
|
||||||
goto cmdline_not_changed;
|
goto cmdline_not_changed;
|
||||||
|
|
||||||
|
if (firstc == ccline.cmdbuff[0])
|
||||||
|
pat = last_search_pattern();
|
||||||
|
else
|
||||||
|
pat = ccline.cmdbuff;
|
||||||
|
|
||||||
save_last_search_pattern();
|
save_last_search_pattern();
|
||||||
cursor_off();
|
cursor_off();
|
||||||
out_flush();
|
out_flush();
|
||||||
@@ -1739,7 +1746,7 @@ getcmdline(
|
|||||||
++emsg_off;
|
++emsg_off;
|
||||||
i = searchit(curwin, curbuf, &t,
|
i = searchit(curwin, curbuf, &t,
|
||||||
c == Ctrl_G ? FORWARD : BACKWARD,
|
c == Ctrl_G ? FORWARD : BACKWARD,
|
||||||
ccline.cmdbuff, count, search_flags,
|
pat, count, search_flags,
|
||||||
RE_SEARCH, 0, NULL, NULL);
|
RE_SEARCH, 0, NULL, NULL);
|
||||||
--emsg_off;
|
--emsg_off;
|
||||||
if (i)
|
if (i)
|
||||||
|
|||||||
@@ -1328,6 +1328,13 @@
|
|||||||
# define FEAT_BEVAL_TIP /* balloon eval used for toolbar tooltip */
|
# define FEAT_BEVAL_TIP /* balloon eval used for toolbar tooltip */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* +balloon_eval_term Allow balloon expression evaluation in the terminal.
|
||||||
|
*/
|
||||||
|
#if defined(FEAT_BEVAL) && defined(UNIX) && defined(FEAT_TIMERS)
|
||||||
|
# define FEAT_BEVALTERM
|
||||||
|
#endif
|
||||||
|
|
||||||
/* both Motif and Athena are X11 and share some code */
|
/* both Motif and Athena are X11 and share some code */
|
||||||
#if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA)
|
#if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA)
|
||||||
# define FEAT_GUI_X11
|
# define FEAT_GUI_X11
|
||||||
|
|||||||
21
src/fileio.c
21
src/fileio.c
@@ -849,17 +849,20 @@ readfile(
|
|||||||
*/
|
*/
|
||||||
if (read_stdin)
|
if (read_stdin)
|
||||||
{
|
{
|
||||||
|
if (!is_not_a_term())
|
||||||
|
{
|
||||||
#ifndef ALWAYS_USE_GUI
|
#ifndef ALWAYS_USE_GUI
|
||||||
mch_msg(_("Vim: Reading from stdin...\n"));
|
mch_msg(_("Vim: Reading from stdin...\n"));
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_GUI
|
#ifdef FEAT_GUI
|
||||||
/* Also write a message in the GUI window, if there is one. */
|
/* Also write a message in the GUI window, if there is one. */
|
||||||
if (gui.in_use && !gui.dying && !gui.starting)
|
if (gui.in_use && !gui.dying && !gui.starting)
|
||||||
{
|
{
|
||||||
p = (char_u *)_("Reading from stdin...");
|
p = (char_u *)_("Reading from stdin...");
|
||||||
gui_write(p, (int)STRLEN(p));
|
gui_write(p, (int)STRLEN(p));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (!read_buffer)
|
else if (!read_buffer)
|
||||||
filemess(curbuf, sfname, (char_u *)"", 0);
|
filemess(curbuf, sfname, (char_u *)"", 0);
|
||||||
@@ -4517,7 +4520,7 @@ restore_backup:
|
|||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_FTRUNCATE
|
#ifdef HAVE_FTRUNCATE
|
||||||
if (!append)
|
if (!append)
|
||||||
ftruncate(fd, (off_t)0);
|
ignored = ftruncate(fd, (off_t)0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(WIN3264)
|
#if defined(WIN3264)
|
||||||
@@ -4771,7 +4774,7 @@ restore_backup:
|
|||||||
*/
|
*/
|
||||||
if (p_fs && fsync(fd) != 0 && !device)
|
if (p_fs && fsync(fd) != 0 && !device)
|
||||||
{
|
{
|
||||||
errmsg = (char_u *)_("E667: Fsync failed");
|
errmsg = (char_u *)_(e_fsync);
|
||||||
end = 0;
|
end = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1792,6 +1792,14 @@ vgetc(void)
|
|||||||
*/
|
*/
|
||||||
may_garbage_collect = FALSE;
|
may_garbage_collect = FALSE;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef FEAT_BEVALTERM
|
||||||
|
if (c != K_MOUSEMOVE && c != K_IGNORE)
|
||||||
|
{
|
||||||
|
/* Don't trigger 'balloonexpr' unless only the mouse was moved. */
|
||||||
|
bevalexpr_due_set = FALSE;
|
||||||
|
ui_remove_balloon();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1231,6 +1231,7 @@ EXTERN int no_hlsearch INIT(= FALSE);
|
|||||||
|
|
||||||
#if defined(FEAT_BEVAL) && !defined(NO_X11_INCLUDES)
|
#if defined(FEAT_BEVAL) && !defined(NO_X11_INCLUDES)
|
||||||
EXTERN BalloonEval *balloonEval INIT(= NULL);
|
EXTERN BalloonEval *balloonEval INIT(= NULL);
|
||||||
|
EXTERN int balloonEvalForTerm INIT(= FALSE);
|
||||||
# if defined(FEAT_NETBEANS_INTG) || defined(FEAT_SUN_WORKSHOP)
|
# if defined(FEAT_NETBEANS_INTG) || defined(FEAT_SUN_WORKSHOP)
|
||||||
EXTERN int bevalServers INIT(= 0);
|
EXTERN int bevalServers INIT(= 0);
|
||||||
# define BEVAL_NETBEANS 0x01
|
# define BEVAL_NETBEANS 0x01
|
||||||
@@ -1449,6 +1450,9 @@ EXTERN char_u e_isadir2[] INIT(= N_("E17: \"%s\" is a directory"));
|
|||||||
#ifdef FEAT_LIBCALL
|
#ifdef FEAT_LIBCALL
|
||||||
EXTERN char_u e_libcall[] INIT(= N_("E364: Library call failed for \"%s()\""));
|
EXTERN char_u e_libcall[] INIT(= N_("E364: Library call failed for \"%s()\""));
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_FSYNC
|
||||||
|
EXTERN char_u e_fsync[] INIT(= N_("E667: Fsync failed"));
|
||||||
|
#endif
|
||||||
#if defined(DYNAMIC_PERL) \
|
#if defined(DYNAMIC_PERL) \
|
||||||
|| defined(DYNAMIC_PYTHON) || defined(DYNAMIC_PYTHON3) \
|
|| defined(DYNAMIC_PYTHON) || defined(DYNAMIC_PYTHON3) \
|
||||||
|| defined(DYNAMIC_RUBY) \
|
|| defined(DYNAMIC_RUBY) \
|
||||||
@@ -1645,6 +1649,11 @@ EXTERN int did_add_timer INIT(= FALSE);
|
|||||||
EXTERN int timer_busy INIT(= 0); /* when timer is inside vgetc() then > 0 */
|
EXTERN int timer_busy INIT(= 0); /* when timer is inside vgetc() then > 0 */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef FEAT_BEVALTERM
|
||||||
|
EXTERN int bevalexpr_due_set INIT(= FALSE);
|
||||||
|
EXTERN proftime_T bevalexpr_due;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
EXTERN time_T time_for_testing INIT(= 0);
|
EXTERN time_T time_for_testing INIT(= 0);
|
||||||
|
|
||||||
|
|||||||
@@ -740,7 +740,10 @@ gui_init(void)
|
|||||||
|
|
||||||
#ifdef FEAT_BEVAL
|
#ifdef FEAT_BEVAL
|
||||||
/* Always create the Balloon Evaluation area, but disable it when
|
/* Always create the Balloon Evaluation area, but disable it when
|
||||||
* 'ballooneval' is off */
|
* 'ballooneval' is off. */
|
||||||
|
if (balloonEval != NULL)
|
||||||
|
vim_free(balloonEval);
|
||||||
|
balloonEvalForTerm = FALSE;
|
||||||
# ifdef FEAT_GUI_GTK
|
# ifdef FEAT_GUI_GTK
|
||||||
balloonEval = gui_mch_create_beval_area(gui.drawarea, NULL,
|
balloonEval = gui_mch_create_beval_area(gui.drawarea, NULL,
|
||||||
&general_beval_cb, NULL);
|
&general_beval_cb, NULL);
|
||||||
|
|||||||
@@ -35,7 +35,11 @@ general_beval_cb(BalloonEval *beval, int state UNUSED)
|
|||||||
|
|
||||||
/* Don't do anything when 'ballooneval' is off, messages scrolled the
|
/* Don't do anything when 'ballooneval' is off, messages scrolled the
|
||||||
* windows up or we have no beval area. */
|
* windows up or we have no beval area. */
|
||||||
if (!p_beval || balloonEval == NULL || msg_scrolled > 0)
|
if (!((gui.in_use && p_beval)
|
||||||
|
# ifdef FEAT_BEVALTERM
|
||||||
|
|| (!gui.in_use && p_bevalterm)
|
||||||
|
# endif
|
||||||
|
) || beval == NULL || msg_scrolled > 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Don't do this recursively. Happens when the expression evaluation
|
/* Don't do this recursively. Happens when the expression evaluation
|
||||||
@@ -45,7 +49,7 @@ general_beval_cb(BalloonEval *beval, int state UNUSED)
|
|||||||
recursive = TRUE;
|
recursive = TRUE;
|
||||||
|
|
||||||
#ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
if (get_beval_info(balloonEval, TRUE, &wp, &lnum, &text, &col) == OK)
|
if (get_beval_info(beval, TRUE, &wp, &lnum, &text, &col) == OK)
|
||||||
{
|
{
|
||||||
bexpr = (*wp->w_buffer->b_p_bexpr == NUL) ? p_bexpr
|
bexpr = (*wp->w_buffer->b_p_bexpr == NUL) ? p_bexpr
|
||||||
: wp->w_buffer->b_p_bexpr;
|
: wp->w_buffer->b_p_bexpr;
|
||||||
@@ -96,7 +100,7 @@ general_beval_cb(BalloonEval *beval, int state UNUSED)
|
|||||||
set_vim_var_string(VV_BEVAL_TEXT, NULL, -1);
|
set_vim_var_string(VV_BEVAL_TEXT, NULL, -1);
|
||||||
if (result != NULL && result[0] != NUL)
|
if (result != NULL && result[0] != NUL)
|
||||||
{
|
{
|
||||||
gui_mch_post_balloon(beval, result);
|
post_balloon(beval, result);
|
||||||
recursive = FALSE;
|
recursive = FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -335,8 +339,18 @@ get_beval_info(
|
|||||||
linenr_T lnum;
|
linenr_T lnum;
|
||||||
|
|
||||||
*textp = NULL;
|
*textp = NULL;
|
||||||
row = Y_2_ROW(beval->y);
|
# ifdef FEAT_BEVALTERM
|
||||||
col = X_2_COL(beval->x);
|
if (!gui.in_use)
|
||||||
|
{
|
||||||
|
row = mouse_row;
|
||||||
|
col = mouse_col;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
# endif
|
||||||
|
{
|
||||||
|
row = Y_2_ROW(beval->y);
|
||||||
|
col = X_2_COL(beval->x);
|
||||||
|
}
|
||||||
wp = mouse_find_win(&row, &col);
|
wp = mouse_find_win(&row, &col);
|
||||||
if (wp != NULL && row < wp->w_height && col < wp->w_width)
|
if (wp != NULL && row < wp->w_height && col < wp->w_width)
|
||||||
{
|
{
|
||||||
@@ -421,6 +435,20 @@ get_beval_info(
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Show a balloon with "mesg".
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
post_balloon(BalloonEval *beval, char_u *mesg)
|
||||||
|
{
|
||||||
|
# ifdef FEAT_BEVALTERM
|
||||||
|
if (!gui.in_use)
|
||||||
|
ui_post_balloon(mesg);
|
||||||
|
else
|
||||||
|
# endif
|
||||||
|
gui_mch_post_balloon(beval, mesg);
|
||||||
|
}
|
||||||
|
|
||||||
# if !defined(FEAT_GUI_W32) || defined(PROTO)
|
# if !defined(FEAT_GUI_W32) || defined(PROTO)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -451,10 +479,6 @@ gui_mch_unpost_balloon(BalloonEval *beval)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_GUI_GTK
|
#ifdef FEAT_GUI_GTK
|
||||||
/*
|
|
||||||
* We can unconditionally use ANSI-style prototypes here since
|
|
||||||
* GTK+ requires an ANSI C compiler anyway.
|
|
||||||
*/
|
|
||||||
static void
|
static void
|
||||||
addEventHandler(GtkWidget *target, BalloonEval *beval)
|
addEventHandler(GtkWidget *target, BalloonEval *beval)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -269,6 +269,7 @@ enum key_extra
|
|||||||
, KE_NOP = 97 /* doesn't do something */
|
, KE_NOP = 97 /* doesn't do something */
|
||||||
, KE_FOCUSGAINED = 98 /* focus gained */
|
, KE_FOCUSGAINED = 98 /* focus gained */
|
||||||
, KE_FOCUSLOST = 99 /* focus lost */
|
, KE_FOCUSLOST = 99 /* focus lost */
|
||||||
|
, KE_MOUSEMOVE = 100 /* mouse moved with no button down */
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -437,6 +438,7 @@ enum key_extra
|
|||||||
#define K_LEFTDRAG TERMCAP2KEY(KS_EXTRA, KE_LEFTDRAG)
|
#define K_LEFTDRAG TERMCAP2KEY(KS_EXTRA, KE_LEFTDRAG)
|
||||||
#define K_LEFTRELEASE TERMCAP2KEY(KS_EXTRA, KE_LEFTRELEASE)
|
#define K_LEFTRELEASE TERMCAP2KEY(KS_EXTRA, KE_LEFTRELEASE)
|
||||||
#define K_LEFTRELEASE_NM TERMCAP2KEY(KS_EXTRA, KE_LEFTRELEASE_NM)
|
#define K_LEFTRELEASE_NM TERMCAP2KEY(KS_EXTRA, KE_LEFTRELEASE_NM)
|
||||||
|
#define K_MOUSEMOVE TERMCAP2KEY(KS_EXTRA, KE_MOUSEMOVE)
|
||||||
#define K_MIDDLEMOUSE TERMCAP2KEY(KS_EXTRA, KE_MIDDLEMOUSE)
|
#define K_MIDDLEMOUSE TERMCAP2KEY(KS_EXTRA, KE_MIDDLEMOUSE)
|
||||||
#define K_MIDDLEDRAG TERMCAP2KEY(KS_EXTRA, KE_MIDDLEDRAG)
|
#define K_MIDDLEDRAG TERMCAP2KEY(KS_EXTRA, KE_MIDDLEDRAG)
|
||||||
#define K_MIDDLERELEASE TERMCAP2KEY(KS_EXTRA, KE_MIDDLERELEASE)
|
#define K_MIDDLERELEASE TERMCAP2KEY(KS_EXTRA, KE_MIDDLERELEASE)
|
||||||
|
|||||||
@@ -1179,6 +1179,7 @@ wait_return(int redraw)
|
|||||||
|| c == K_RIGHTDRAG || c == K_RIGHTRELEASE
|
|| c == K_RIGHTDRAG || c == K_RIGHTRELEASE
|
||||||
|| c == K_MOUSELEFT || c == K_MOUSERIGHT
|
|| c == K_MOUSELEFT || c == K_MOUSERIGHT
|
||||||
|| c == K_MOUSEDOWN || c == K_MOUSEUP
|
|| c == K_MOUSEDOWN || c == K_MOUSEUP
|
||||||
|
|| c == K_MOUSEMOVE
|
||||||
|| (!mouse_has(MOUSE_RETURN)
|
|| (!mouse_has(MOUSE_RETURN)
|
||||||
&& mouse_row < msg_row
|
&& mouse_row < msg_row
|
||||||
&& (c == K_LEFTMOUSE
|
&& (c == K_LEFTMOUSE
|
||||||
|
|||||||
@@ -3345,6 +3345,7 @@ is_mouse_key(int c)
|
|||||||
|| c == K_LEFTDRAG
|
|| c == K_LEFTDRAG
|
||||||
|| c == K_LEFTRELEASE
|
|| c == K_LEFTRELEASE
|
||||||
|| c == K_LEFTRELEASE_NM
|
|| c == K_LEFTRELEASE_NM
|
||||||
|
|| c == K_MOUSEMOVE
|
||||||
|| c == K_MIDDLEMOUSE
|
|| c == K_MIDDLEMOUSE
|
||||||
|| c == K_MIDDLEDRAG
|
|| c == K_MIDDLEDRAG
|
||||||
|| c == K_MIDDLERELEASE
|
|| c == K_MIDDLERELEASE
|
||||||
|
|||||||
@@ -2453,6 +2453,7 @@ static struct key_name_entry
|
|||||||
{K_LEFTDRAG, (char_u *)"LeftDrag"},
|
{K_LEFTDRAG, (char_u *)"LeftDrag"},
|
||||||
{K_LEFTRELEASE, (char_u *)"LeftRelease"},
|
{K_LEFTRELEASE, (char_u *)"LeftRelease"},
|
||||||
{K_LEFTRELEASE_NM, (char_u *)"LeftReleaseNM"},
|
{K_LEFTRELEASE_NM, (char_u *)"LeftReleaseNM"},
|
||||||
|
{K_MOUSEMOVE, (char_u *)"MouseMove"},
|
||||||
{K_MIDDLEMOUSE, (char_u *)"MiddleMouse"},
|
{K_MIDDLEMOUSE, (char_u *)"MiddleMouse"},
|
||||||
{K_MIDDLEDRAG, (char_u *)"MiddleDrag"},
|
{K_MIDDLEDRAG, (char_u *)"MiddleDrag"},
|
||||||
{K_MIDDLERELEASE, (char_u *)"MiddleRelease"},
|
{K_MIDDLERELEASE, (char_u *)"MiddleRelease"},
|
||||||
@@ -2515,7 +2516,7 @@ static struct mousetable
|
|||||||
{(int)KE_X2DRAG, MOUSE_X2, FALSE, TRUE},
|
{(int)KE_X2DRAG, MOUSE_X2, FALSE, TRUE},
|
||||||
{(int)KE_X2RELEASE, MOUSE_X2, FALSE, FALSE},
|
{(int)KE_X2RELEASE, MOUSE_X2, FALSE, FALSE},
|
||||||
/* DRAG without CLICK */
|
/* DRAG without CLICK */
|
||||||
{(int)KE_IGNORE, MOUSE_RELEASE, FALSE, TRUE},
|
{(int)KE_MOUSEMOVE, MOUSE_RELEASE, FALSE, TRUE},
|
||||||
/* RELEASE without CLICK */
|
/* RELEASE without CLICK */
|
||||||
{(int)KE_IGNORE, MOUSE_RELEASE, FALSE, FALSE},
|
{(int)KE_IGNORE, MOUSE_RELEASE, FALSE, FALSE},
|
||||||
{0, 0, 0, 0},
|
{0, 0, 0, 0},
|
||||||
|
|||||||
18
src/normal.c
18
src/normal.c
@@ -358,6 +358,7 @@ static const struct nv_cmd
|
|||||||
{K_LEFTDRAG, nv_mouse, 0, 0},
|
{K_LEFTDRAG, nv_mouse, 0, 0},
|
||||||
{K_LEFTRELEASE, nv_mouse, 0, 0},
|
{K_LEFTRELEASE, nv_mouse, 0, 0},
|
||||||
{K_LEFTRELEASE_NM, nv_mouse, 0, 0},
|
{K_LEFTRELEASE_NM, nv_mouse, 0, 0},
|
||||||
|
{K_MOUSEMOVE, nv_mouse, 0, 0},
|
||||||
{K_MIDDLEMOUSE, nv_mouse, 0, 0},
|
{K_MIDDLEMOUSE, nv_mouse, 0, 0},
|
||||||
{K_MIDDLEDRAG, nv_mouse, 0, 0},
|
{K_MIDDLEDRAG, nv_mouse, 0, 0},
|
||||||
{K_MIDDLERELEASE, nv_mouse, 0, 0},
|
{K_MIDDLERELEASE, nv_mouse, 0, 0},
|
||||||
@@ -2396,6 +2397,20 @@ do_mouse(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (c == K_MOUSEMOVE)
|
||||||
|
{
|
||||||
|
/* Mouse moved without a button pressed. */
|
||||||
|
#ifdef FEAT_BEVALTERM
|
||||||
|
ui_may_remove_balloon();
|
||||||
|
if (p_bevalterm && !VIsual_active)
|
||||||
|
{
|
||||||
|
profile_setlimit(p_bdlay, &bevalexpr_due);
|
||||||
|
bevalexpr_due_set = TRUE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef FEAT_MOUSESHAPE
|
#ifdef FEAT_MOUSESHAPE
|
||||||
/* May have stopped dragging the status or separator line. The pointer is
|
/* May have stopped dragging the status or separator line. The pointer is
|
||||||
* most likely still on the status or separator line. */
|
* most likely still on the status or separator line. */
|
||||||
@@ -3843,7 +3858,7 @@ add_to_showcmd(int c)
|
|||||||
K_LEFTMOUSE_NM, K_LEFTRELEASE_NM,
|
K_LEFTMOUSE_NM, K_LEFTRELEASE_NM,
|
||||||
# endif
|
# endif
|
||||||
K_IGNORE, K_PS,
|
K_IGNORE, K_PS,
|
||||||
K_LEFTMOUSE, K_LEFTDRAG, K_LEFTRELEASE,
|
K_LEFTMOUSE, K_LEFTDRAG, K_LEFTRELEASE, K_MOUSEMOVE,
|
||||||
K_MIDDLEMOUSE, K_MIDDLEDRAG, K_MIDDLERELEASE,
|
K_MIDDLEMOUSE, K_MIDDLEDRAG, K_MIDDLERELEASE,
|
||||||
K_RIGHTMOUSE, K_RIGHTDRAG, K_RIGHTRELEASE,
|
K_RIGHTMOUSE, K_RIGHTDRAG, K_RIGHTRELEASE,
|
||||||
K_MOUSEDOWN, K_MOUSEUP, K_MOUSELEFT, K_MOUSERIGHT,
|
K_MOUSEDOWN, K_MOUSEUP, K_MOUSELEFT, K_MOUSERIGHT,
|
||||||
@@ -8358,6 +8373,7 @@ nv_g_cmd(cmdarg_T *cap)
|
|||||||
case K_LEFTMOUSE:
|
case K_LEFTMOUSE:
|
||||||
case K_LEFTDRAG:
|
case K_LEFTDRAG:
|
||||||
case K_LEFTRELEASE:
|
case K_LEFTRELEASE:
|
||||||
|
case K_MOUSEMOVE:
|
||||||
case K_RIGHTMOUSE:
|
case K_RIGHTMOUSE:
|
||||||
case K_RIGHTDRAG:
|
case K_RIGHTDRAG:
|
||||||
case K_RIGHTRELEASE:
|
case K_RIGHTRELEASE:
|
||||||
|
|||||||
26
src/option.c
26
src/option.c
@@ -640,6 +640,15 @@ static struct vimoption options[] =
|
|||||||
#else
|
#else
|
||||||
(char_u *)NULL, PV_NONE,
|
(char_u *)NULL, PV_NONE,
|
||||||
{(char_u *)0L, (char_u *)0L}
|
{(char_u *)0L, (char_u *)0L}
|
||||||
|
#endif
|
||||||
|
SCRIPTID_INIT},
|
||||||
|
{"balloonevalterm", "bevalterm",P_BOOL|P_VI_DEF|P_NO_MKRC,
|
||||||
|
#ifdef FEAT_BEVALTERM
|
||||||
|
(char_u *)&p_bevalterm, PV_NONE,
|
||||||
|
{(char_u *)FALSE, (char_u *)0L}
|
||||||
|
#else
|
||||||
|
(char_u *)NULL, PV_NONE,
|
||||||
|
{(char_u *)0L, (char_u *)0L}
|
||||||
#endif
|
#endif
|
||||||
SCRIPTID_INIT},
|
SCRIPTID_INIT},
|
||||||
{"balloonexpr", "bexpr", P_STRING|P_ALLOCED|P_VI_DEF|P_VIM,
|
{"balloonexpr", "bexpr", P_STRING|P_ALLOCED|P_VI_DEF|P_VIM,
|
||||||
@@ -8423,12 +8432,21 @@ set_bool_option(
|
|||||||
#ifdef FEAT_BEVAL
|
#ifdef FEAT_BEVAL
|
||||||
else if ((int *)varp == &p_beval)
|
else if ((int *)varp == &p_beval)
|
||||||
{
|
{
|
||||||
if (p_beval && !old_value)
|
if (!balloonEvalForTerm)
|
||||||
gui_mch_enable_beval_area(balloonEval);
|
{
|
||||||
else if (!p_beval && old_value)
|
if (p_beval && !old_value)
|
||||||
gui_mch_disable_beval_area(balloonEval);
|
gui_mch_enable_beval_area(balloonEval);
|
||||||
|
else if (!p_beval && old_value)
|
||||||
|
gui_mch_disable_beval_area(balloonEval);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
# ifdef FEAT_BEVALTERM
|
||||||
|
else if ((int *)varp == &p_bevalterm)
|
||||||
|
{
|
||||||
|
mch_bevalterm_changed();
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCHDIR
|
#ifdef FEAT_AUTOCHDIR
|
||||||
else if ((int *)varp == &p_acd)
|
else if ((int *)varp == &p_acd)
|
||||||
|
|||||||
@@ -382,6 +382,9 @@ EXTERN int p_beval; /* 'ballooneval' */
|
|||||||
EXTERN char_u *p_bexpr;
|
EXTERN char_u *p_bexpr;
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
# ifdef FEAT_BEVALTERM
|
||||||
|
EXTERN int p_bevalterm; /* 'balloonevalterm' */
|
||||||
|
# endif
|
||||||
#ifdef FEAT_BROWSE
|
#ifdef FEAT_BROWSE
|
||||||
EXTERN char_u *p_bsdir; /* 'browsedir' */
|
EXTERN char_u *p_bsdir; /* 'browsedir' */
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -3564,16 +3564,25 @@ get_tty_info(int fd, ttyinfo_T *info)
|
|||||||
#endif /* VMS */
|
#endif /* VMS */
|
||||||
|
|
||||||
#if defined(FEAT_MOUSE_TTY) || defined(PROTO)
|
#if defined(FEAT_MOUSE_TTY) || defined(PROTO)
|
||||||
|
static int mouse_ison = FALSE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set mouse clicks on or off.
|
* Set mouse clicks on or off.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
mch_setmouse(int on)
|
mch_setmouse(int on)
|
||||||
{
|
{
|
||||||
static int ison = FALSE;
|
# ifdef FEAT_BEVALTERM
|
||||||
|
static int bevalterm_ison = FALSE;
|
||||||
|
# endif
|
||||||
int xterm_mouse_vers;
|
int xterm_mouse_vers;
|
||||||
|
|
||||||
if (on == ison) /* return quickly if nothing to do */
|
if (on == mouse_ison
|
||||||
|
# ifdef FEAT_BEVALTERM
|
||||||
|
&& p_bevalterm == bevalterm_ison
|
||||||
|
# endif
|
||||||
|
)
|
||||||
|
/* return quickly if nothing to do */
|
||||||
return;
|
return;
|
||||||
|
|
||||||
xterm_mouse_vers = use_xterm_mouse();
|
xterm_mouse_vers = use_xterm_mouse();
|
||||||
@@ -3585,18 +3594,30 @@ mch_setmouse(int on)
|
|||||||
(on
|
(on
|
||||||
? IF_EB("\033[?1015h", ESC_STR "[?1015h")
|
? IF_EB("\033[?1015h", ESC_STR "[?1015h")
|
||||||
: IF_EB("\033[?1015l", ESC_STR "[?1015l")));
|
: IF_EB("\033[?1015l", ESC_STR "[?1015l")));
|
||||||
ison = on;
|
mouse_ison = on;
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifdef FEAT_MOUSE_SGR
|
# ifdef FEAT_MOUSE_SGR
|
||||||
if (ttym_flags == TTYM_SGR)
|
if (ttym_flags == TTYM_SGR)
|
||||||
{
|
{
|
||||||
|
/* SGR mode supports columns above 223 */
|
||||||
out_str_nf((char_u *)
|
out_str_nf((char_u *)
|
||||||
(on
|
(on
|
||||||
? IF_EB("\033[?1006h", ESC_STR "[?1006h")
|
? IF_EB("\033[?1006h", ESC_STR "[?1006h")
|
||||||
: IF_EB("\033[?1006l", ESC_STR "[?1006l")));
|
: IF_EB("\033[?1006l", ESC_STR "[?1006l")));
|
||||||
ison = on;
|
mouse_ison = on;
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef FEAT_BEVALTERM
|
||||||
|
if (bevalterm_ison != (p_bevalterm && on))
|
||||||
|
{
|
||||||
|
bevalterm_ison = (p_bevalterm && on);
|
||||||
|
if (xterm_mouse_vers > 1 && !bevalterm_ison)
|
||||||
|
/* disable mouse movement events, enabling is below */
|
||||||
|
out_str_nf((char_u *)
|
||||||
|
(IF_EB("\033[?1003l", ESC_STR "[?1003l")));
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
@@ -3605,14 +3626,19 @@ mch_setmouse(int on)
|
|||||||
if (on) /* enable mouse events, use mouse tracking if available */
|
if (on) /* enable mouse events, use mouse tracking if available */
|
||||||
out_str_nf((char_u *)
|
out_str_nf((char_u *)
|
||||||
(xterm_mouse_vers > 1
|
(xterm_mouse_vers > 1
|
||||||
? IF_EB("\033[?1002h", ESC_STR "[?1002h")
|
? (
|
||||||
|
# ifdef FEAT_BEVALTERM
|
||||||
|
bevalterm_ison
|
||||||
|
? IF_EB("\033[?1003h", ESC_STR "[?1003h") :
|
||||||
|
# endif
|
||||||
|
IF_EB("\033[?1002h", ESC_STR "[?1002h"))
|
||||||
: IF_EB("\033[?1000h", ESC_STR "[?1000h")));
|
: IF_EB("\033[?1000h", ESC_STR "[?1000h")));
|
||||||
else /* disable mouse events, could probably always send the same */
|
else /* disable mouse events, could probably always send the same */
|
||||||
out_str_nf((char_u *)
|
out_str_nf((char_u *)
|
||||||
(xterm_mouse_vers > 1
|
(xterm_mouse_vers > 1
|
||||||
? IF_EB("\033[?1002l", ESC_STR "[?1002l")
|
? IF_EB("\033[?1002l", ESC_STR "[?1002l")
|
||||||
: IF_EB("\033[?1000l", ESC_STR "[?1000l")));
|
: IF_EB("\033[?1000l", ESC_STR "[?1000l")));
|
||||||
ison = on;
|
mouse_ison = on;
|
||||||
}
|
}
|
||||||
|
|
||||||
# ifdef FEAT_MOUSE_DEC
|
# ifdef FEAT_MOUSE_DEC
|
||||||
@@ -3622,7 +3648,7 @@ mch_setmouse(int on)
|
|||||||
out_str_nf((char_u *)"\033[1;2'z\033[1;3'{");
|
out_str_nf((char_u *)"\033[1;2'z\033[1;3'{");
|
||||||
else /* disable mouse events */
|
else /* disable mouse events */
|
||||||
out_str_nf((char_u *)"\033['z");
|
out_str_nf((char_u *)"\033['z");
|
||||||
ison = on;
|
mouse_ison = on;
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
@@ -3632,12 +3658,12 @@ mch_setmouse(int on)
|
|||||||
if (on)
|
if (on)
|
||||||
{
|
{
|
||||||
if (gpm_open())
|
if (gpm_open())
|
||||||
ison = TRUE;
|
mouse_ison = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gpm_close();
|
gpm_close();
|
||||||
ison = FALSE;
|
mouse_ison = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
@@ -3648,12 +3674,12 @@ mch_setmouse(int on)
|
|||||||
if (on)
|
if (on)
|
||||||
{
|
{
|
||||||
if (sysmouse_open() == OK)
|
if (sysmouse_open() == OK)
|
||||||
ison = TRUE;
|
mouse_ison = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sysmouse_close();
|
sysmouse_close();
|
||||||
ison = FALSE;
|
mouse_ison = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
@@ -3686,13 +3712,13 @@ mch_setmouse(int on)
|
|||||||
out_str_nf((char_u *)IF_EB("\033[0~ZwLMRK+1Q\033\\",
|
out_str_nf((char_u *)IF_EB("\033[0~ZwLMRK+1Q\033\\",
|
||||||
ESC_STR "[0~ZwLMRK+1Q" ESC_STR "\\"));
|
ESC_STR "[0~ZwLMRK+1Q" ESC_STR "\\"));
|
||||||
# endif
|
# endif
|
||||||
ison = TRUE;
|
mouse_ison = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
out_str_nf((char_u *)IF_EB("\033[0~ZwQ\033\\",
|
out_str_nf((char_u *)IF_EB("\033[0~ZwQ\033\\",
|
||||||
ESC_STR "[0~ZwQ" ESC_STR "\\"));
|
ESC_STR "[0~ZwQ" ESC_STR "\\"));
|
||||||
ison = FALSE;
|
mouse_ison = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
@@ -3704,11 +3730,22 @@ mch_setmouse(int on)
|
|||||||
out_str_nf("\033[>1h\033[>6h\033[>7h\033[>1h\033[>9l");
|
out_str_nf("\033[>1h\033[>6h\033[>7h\033[>1h\033[>9l");
|
||||||
else
|
else
|
||||||
out_str_nf("\033[>1l\033[>6l\033[>7l\033[>1l\033[>9h");
|
out_str_nf("\033[>1l\033[>6l\033[>7l\033[>1l\033[>9h");
|
||||||
ison = on;
|
mouse_ison = on;
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(FEAT_BEVALTERM) || defined(PROTO)
|
||||||
|
/*
|
||||||
|
* Called when 'balloonevalterm' changed.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
mch_bevalterm_changed(void)
|
||||||
|
{
|
||||||
|
mch_setmouse(mouse_ison);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set the mouse termcode, depending on the 'term' and 'ttymouse' options.
|
* Set the mouse termcode, depending on the 'term' and 'ttymouse' options.
|
||||||
*/
|
*/
|
||||||
|
|||||||
167
src/popupmnu.c
167
src/popupmnu.c
@@ -23,6 +23,7 @@ static int pum_height; /* nr of displayed pum items */
|
|||||||
static int pum_width; /* width of displayed pum items */
|
static int pum_width; /* width of displayed pum items */
|
||||||
static int pum_base_width; /* width of pum items base */
|
static int pum_base_width; /* width of pum items base */
|
||||||
static int pum_kind_width; /* width of pum items kind column */
|
static int pum_kind_width; /* width of pum items kind column */
|
||||||
|
static int pum_extra_width; /* width of extra stuff */
|
||||||
static int pum_scrollbar; /* TRUE when scrollbar present */
|
static int pum_scrollbar; /* TRUE when scrollbar present */
|
||||||
|
|
||||||
static int pum_row; /* top row of pum */
|
static int pum_row; /* top row of pum */
|
||||||
@@ -35,6 +36,36 @@ static int pum_set_selected(int n, int repeat);
|
|||||||
#define PUM_DEF_HEIGHT 10
|
#define PUM_DEF_HEIGHT 10
|
||||||
#define PUM_DEF_WIDTH 15
|
#define PUM_DEF_WIDTH 15
|
||||||
|
|
||||||
|
static void
|
||||||
|
pum_compute_size(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int w;
|
||||||
|
|
||||||
|
/* Compute the width of the widest match and the widest extra. */
|
||||||
|
pum_base_width = 0;
|
||||||
|
pum_kind_width = 0;
|
||||||
|
pum_extra_width = 0;
|
||||||
|
for (i = 0; i < pum_size; ++i)
|
||||||
|
{
|
||||||
|
w = vim_strsize(pum_array[i].pum_text);
|
||||||
|
if (pum_base_width < w)
|
||||||
|
pum_base_width = w;
|
||||||
|
if (pum_array[i].pum_kind != NULL)
|
||||||
|
{
|
||||||
|
w = vim_strsize(pum_array[i].pum_kind) + 1;
|
||||||
|
if (pum_kind_width < w)
|
||||||
|
pum_kind_width = w;
|
||||||
|
}
|
||||||
|
if (pum_array[i].pum_extra != NULL)
|
||||||
|
{
|
||||||
|
w = vim_strsize(pum_array[i].pum_extra) + 1;
|
||||||
|
if (pum_extra_width < w)
|
||||||
|
pum_extra_width = w;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Show the popup menu with items "array[size]".
|
* Show the popup menu with items "array[size]".
|
||||||
* "array" must remain valid until pum_undisplay() is called!
|
* "array" must remain valid until pum_undisplay() is called!
|
||||||
@@ -48,12 +79,8 @@ pum_display(
|
|||||||
int selected) /* index of initially selected item, none if
|
int selected) /* index of initially selected item, none if
|
||||||
out of range */
|
out of range */
|
||||||
{
|
{
|
||||||
int w;
|
|
||||||
int def_width;
|
int def_width;
|
||||||
int max_width;
|
int max_width;
|
||||||
int kind_width;
|
|
||||||
int extra_width;
|
|
||||||
int i;
|
|
||||||
int row;
|
int row;
|
||||||
int context_lines;
|
int context_lines;
|
||||||
int col;
|
int col;
|
||||||
@@ -67,9 +94,6 @@ pum_display(
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
def_width = PUM_DEF_WIDTH;
|
def_width = PUM_DEF_WIDTH;
|
||||||
max_width = 0;
|
|
||||||
kind_width = 0;
|
|
||||||
extra_width = 0;
|
|
||||||
above_row = 0;
|
above_row = 0;
|
||||||
below_row = cmdline_row;
|
below_row = cmdline_row;
|
||||||
|
|
||||||
@@ -107,7 +131,7 @@ pum_display(
|
|||||||
/* Put the pum below "row" if possible. If there are few lines decide
|
/* Put the pum below "row" if possible. If there are few lines decide
|
||||||
* on where there is more room. */
|
* on where there is more room. */
|
||||||
if (row + 2 >= below_row - pum_height
|
if (row + 2 >= below_row - pum_height
|
||||||
&& row - above_row > (below_row - above_row) / 2)
|
&& row - above_row > (below_row - above_row) / 2)
|
||||||
{
|
{
|
||||||
/* pum above "row" */
|
/* pum above "row" */
|
||||||
|
|
||||||
@@ -167,27 +191,10 @@ pum_display(
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Compute the width of the widest match and the widest extra. */
|
pum_array = array;
|
||||||
for (i = 0; i < size; ++i)
|
pum_size = size;
|
||||||
{
|
pum_compute_size();
|
||||||
w = vim_strsize(array[i].pum_text);
|
max_width = pum_base_width;
|
||||||
if (max_width < w)
|
|
||||||
max_width = w;
|
|
||||||
if (array[i].pum_kind != NULL)
|
|
||||||
{
|
|
||||||
w = vim_strsize(array[i].pum_kind) + 1;
|
|
||||||
if (kind_width < w)
|
|
||||||
kind_width = w;
|
|
||||||
}
|
|
||||||
if (array[i].pum_extra != NULL)
|
|
||||||
{
|
|
||||||
w = vim_strsize(array[i].pum_extra) + 1;
|
|
||||||
if (extra_width < w)
|
|
||||||
extra_width = w;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pum_base_width = max_width;
|
|
||||||
pum_kind_width = kind_width;
|
|
||||||
|
|
||||||
/* Calculate column */
|
/* Calculate column */
|
||||||
#ifdef FEAT_RIGHTLEFT
|
#ifdef FEAT_RIGHTLEFT
|
||||||
@@ -226,10 +233,10 @@ pum_display(
|
|||||||
#endif
|
#endif
|
||||||
pum_width = Columns - pum_col - pum_scrollbar;
|
pum_width = Columns - pum_col - pum_scrollbar;
|
||||||
|
|
||||||
if (pum_width > max_width + kind_width + extra_width + 1
|
if (pum_width > max_width + pum_kind_width + pum_extra_width + 1
|
||||||
&& pum_width > PUM_DEF_WIDTH)
|
&& pum_width > PUM_DEF_WIDTH)
|
||||||
{
|
{
|
||||||
pum_width = max_width + kind_width + extra_width + 1;
|
pum_width = max_width + pum_kind_width + pum_extra_width + 1;
|
||||||
if (pum_width < PUM_DEF_WIDTH)
|
if (pum_width < PUM_DEF_WIDTH)
|
||||||
pum_width = PUM_DEF_WIDTH;
|
pum_width = PUM_DEF_WIDTH;
|
||||||
}
|
}
|
||||||
@@ -258,9 +265,6 @@ pum_display(
|
|||||||
pum_width = max_width - pum_scrollbar;
|
pum_width = max_width - pum_scrollbar;
|
||||||
}
|
}
|
||||||
|
|
||||||
pum_array = array;
|
|
||||||
pum_size = size;
|
|
||||||
|
|
||||||
/* Set selected item and redraw. If the window size changed need to
|
/* Set selected item and redraw. If the window size changed need to
|
||||||
* redo the positioning. Limit this to two times, when there is not
|
* redo the positioning. Limit this to two times, when there is not
|
||||||
* much room the window size will keep changing. */
|
* much room the window size will keep changing. */
|
||||||
@@ -756,4 +760,97 @@ pum_get_height(void)
|
|||||||
return pum_height;
|
return pum_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# if defined(FEAT_BEVALTERM) || defined(PROTO)
|
||||||
|
static pumitem_T *balloon_array = NULL;
|
||||||
|
static int balloon_arraysize;
|
||||||
|
static int balloon_mouse_row = 0;
|
||||||
|
static int balloon_mouse_col = 0;
|
||||||
|
|
||||||
|
#define BALLOON_MIN_WIDTH 40
|
||||||
|
#define BALLOON_MIN_HEIGHT 10
|
||||||
|
|
||||||
|
void
|
||||||
|
ui_remove_balloon(void)
|
||||||
|
{
|
||||||
|
if (balloon_array != NULL)
|
||||||
|
{
|
||||||
|
pum_undisplay();
|
||||||
|
while (balloon_arraysize > 0)
|
||||||
|
vim_free(balloon_array[--balloon_arraysize].pum_text);
|
||||||
|
vim_free(balloon_array);
|
||||||
|
balloon_array = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Terminal version of a balloon, uses the popup menu code.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
ui_post_balloon(char_u *mesg)
|
||||||
|
{
|
||||||
|
ui_remove_balloon();
|
||||||
|
|
||||||
|
/* TODO: split the text in multiple lines. */
|
||||||
|
balloon_arraysize = 3;
|
||||||
|
balloon_array = (pumitem_T *)alloc_clear(
|
||||||
|
(unsigned)sizeof(pumitem_T) * balloon_arraysize);
|
||||||
|
if (balloon_array != NULL)
|
||||||
|
{
|
||||||
|
/* Add an empty line above and below, looks better. */
|
||||||
|
balloon_array[0].pum_text = vim_strsave((char_u *)"");
|
||||||
|
balloon_array[1].pum_text = vim_strsave(mesg);
|
||||||
|
balloon_array[2].pum_text = vim_strsave((char_u *)"");
|
||||||
|
|
||||||
|
pum_array = balloon_array;
|
||||||
|
pum_size = balloon_arraysize;
|
||||||
|
pum_compute_size();
|
||||||
|
pum_scrollbar = 0;
|
||||||
|
pum_height = balloon_arraysize;
|
||||||
|
|
||||||
|
if (Rows - mouse_row > BALLOON_MIN_HEIGHT)
|
||||||
|
{
|
||||||
|
/* Enough space below the mouse row. */
|
||||||
|
pum_row = mouse_row + 1;
|
||||||
|
if (pum_height > Rows - pum_row)
|
||||||
|
pum_height = Rows - pum_row;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Show above the mouse row, reduce height if it does not fit. */
|
||||||
|
pum_row = mouse_row - 1 - pum_size;
|
||||||
|
if (pum_row < 0)
|
||||||
|
{
|
||||||
|
pum_height += pum_row;
|
||||||
|
pum_row = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Columns - mouse_col >= pum_base_width
|
||||||
|
|| Columns - mouse_col > BALLOON_MIN_WIDTH)
|
||||||
|
/* Enough space to show at mouse column. */
|
||||||
|
pum_col = mouse_col;
|
||||||
|
else
|
||||||
|
/* Not enough space, right align with window. */
|
||||||
|
pum_col = Columns - (pum_base_width > BALLOON_MIN_WIDTH
|
||||||
|
? BALLOON_MIN_WIDTH : pum_base_width);
|
||||||
|
|
||||||
|
pum_width = Columns - pum_col;
|
||||||
|
if (pum_width > pum_base_width + 1)
|
||||||
|
pum_width = pum_base_width + 1;
|
||||||
|
|
||||||
|
pum_selected = -1;
|
||||||
|
pum_first = 0;
|
||||||
|
pum_redraw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Called when the mouse moved, may remove any displayed balloon.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
ui_may_remove_balloon(void)
|
||||||
|
{
|
||||||
|
if (mouse_row != balloon_mouse_row || mouse_col != balloon_mouse_col)
|
||||||
|
ui_remove_balloon();
|
||||||
|
}
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ void gui_mch_enable_beval_area(BalloonEval *beval);
|
|||||||
void gui_mch_disable_beval_area(BalloonEval *beval);
|
void gui_mch_disable_beval_area(BalloonEval *beval);
|
||||||
BalloonEval *gui_mch_currently_showing_beval(void);
|
BalloonEval *gui_mch_currently_showing_beval(void);
|
||||||
int get_beval_info(BalloonEval *beval, int getword, win_T **winp, linenr_T *lnump, char_u **textp, int *colp);
|
int get_beval_info(BalloonEval *beval, int getword, win_T **winp, linenr_T *lnump, char_u **textp, int *colp);
|
||||||
|
void post_balloon(BalloonEval *beval, char_u *mesg);
|
||||||
void gui_mch_post_balloon(BalloonEval *beval, char_u *mesg);
|
void gui_mch_post_balloon(BalloonEval *beval, char_u *mesg);
|
||||||
void gui_mch_unpost_balloon(BalloonEval *beval);
|
void gui_mch_unpost_balloon(BalloonEval *beval);
|
||||||
/* vim: set ft=c : */
|
/* vim: set ft=c : */
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ void mch_settmode(int tmode);
|
|||||||
void get_stty(void);
|
void get_stty(void);
|
||||||
int get_tty_info(int fd, ttyinfo_T *info);
|
int get_tty_info(int fd, ttyinfo_T *info);
|
||||||
void mch_setmouse(int on);
|
void mch_setmouse(int on);
|
||||||
|
void mch_bevalterm_changed(void);
|
||||||
void check_mouse_termcode(void);
|
void check_mouse_termcode(void);
|
||||||
int mch_screenmode(char_u *arg);
|
int mch_screenmode(char_u *arg);
|
||||||
int mch_get_shellsize(void);
|
int mch_get_shellsize(void);
|
||||||
|
|||||||
@@ -5,4 +5,7 @@ void pum_undisplay(void);
|
|||||||
void pum_clear(void);
|
void pum_clear(void);
|
||||||
int pum_visible(void);
|
int pum_visible(void);
|
||||||
int pum_get_height(void);
|
int pum_get_height(void);
|
||||||
|
void ui_remove_balloon(void);
|
||||||
|
void ui_post_balloon(char_u *mesg);
|
||||||
|
void ui_may_remove_balloon(void);
|
||||||
/* vim: set ft=c : */
|
/* vim: set ft=c : */
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ void save_search_patterns(void);
|
|||||||
void restore_search_patterns(void);
|
void restore_search_patterns(void);
|
||||||
void save_last_search_pattern(void);
|
void save_last_search_pattern(void);
|
||||||
void restore_last_search_pattern(void);
|
void restore_last_search_pattern(void);
|
||||||
|
char_u *last_search_pattern(void);
|
||||||
void free_search_patterns(void);
|
void free_search_patterns(void);
|
||||||
int ignorecase(char_u *pat);
|
int ignorecase(char_u *pat);
|
||||||
int ignorecase_opt(char_u *pat, int ic_in, int scs);
|
int ignorecase_opt(char_u *pat, int ic_in, int scs);
|
||||||
|
|||||||
@@ -393,6 +393,12 @@ restore_last_search_pattern(void)
|
|||||||
last_idx = saved_last_idx;
|
last_idx = saved_last_idx;
|
||||||
SET_NO_HLSEARCH(saved_no_hlsearch);
|
SET_NO_HLSEARCH(saved_no_hlsearch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char_u *
|
||||||
|
last_search_pattern(void)
|
||||||
|
{
|
||||||
|
return spats[RE_SEARCH].pat;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -5625,6 +5625,7 @@ check_termcode(
|
|||||||
modifiers |= MOD_MASK_ALT;
|
modifiers |= MOD_MASK_ALT;
|
||||||
key_name[1] = (wheel_code & 1)
|
key_name[1] = (wheel_code & 1)
|
||||||
? (int)KE_MOUSEUP : (int)KE_MOUSEDOWN;
|
? (int)KE_MOUSEUP : (int)KE_MOUSEDOWN;
|
||||||
|
held_button = MOUSE_RELEASE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
key_name[1] = get_pseudo_mouse_code(current_button,
|
key_name[1] = get_pseudo_mouse_code(current_button,
|
||||||
|
|||||||
@@ -52,6 +52,7 @@
|
|||||||
* - Termdebug does not work when Vim build with mzscheme. gdb hangs.
|
* - Termdebug does not work when Vim build with mzscheme. gdb hangs.
|
||||||
* - MS-Windows GUI: WinBar has tearoff item
|
* - MS-Windows GUI: WinBar has tearoff item
|
||||||
* - MS-Windows GUI: still need to type a key after shell exits? #1924
|
* - MS-Windows GUI: still need to type a key after shell exits? #1924
|
||||||
|
* - After executing a shell command the status line isn't redraw.
|
||||||
* - What to store in a session file? Shell at the prompt would be OK to
|
* - What to store in a session file? Shell at the prompt would be OK to
|
||||||
* restore, but others may not. Open the window and let the user start the
|
* restore, but others may not. Open the window and let the user start the
|
||||||
* command?
|
* command?
|
||||||
@@ -717,7 +718,8 @@ term_send_mouse(VTerm *vterm, int button, int pressed)
|
|||||||
|
|
||||||
vterm_mouse_move(vterm, mouse_row - W_WINROW(curwin),
|
vterm_mouse_move(vterm, mouse_row - W_WINROW(curwin),
|
||||||
mouse_col - curwin->w_wincol, mod);
|
mouse_col - curwin->w_wincol, mod);
|
||||||
vterm_mouse_button(vterm, button, pressed, mod);
|
if (button != 0)
|
||||||
|
vterm_mouse_button(vterm, button, pressed, mod);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -818,6 +820,7 @@ term_convert_key(term_T *term, int c, char *buf)
|
|||||||
case K_LEFTDRAG: other = term_send_mouse(vterm, 1, 1); break;
|
case K_LEFTDRAG: other = term_send_mouse(vterm, 1, 1); break;
|
||||||
case K_LEFTRELEASE:
|
case K_LEFTRELEASE:
|
||||||
case K_LEFTRELEASE_NM: other = term_send_mouse(vterm, 1, 0); break;
|
case K_LEFTRELEASE_NM: other = term_send_mouse(vterm, 1, 0); break;
|
||||||
|
case K_MOUSEMOVE: other = term_send_mouse(vterm, 0, 0); break;
|
||||||
case K_MIDDLEMOUSE: other = term_send_mouse(vterm, 2, 1); break;
|
case K_MIDDLEMOUSE: other = term_send_mouse(vterm, 2, 1); break;
|
||||||
case K_MIDDLEDRAG: other = term_send_mouse(vterm, 2, 1); break;
|
case K_MIDDLEDRAG: other = term_send_mouse(vterm, 2, 1); break;
|
||||||
case K_MIDDLERELEASE: other = term_send_mouse(vterm, 2, 0); break;
|
case K_MIDDLERELEASE: other = term_send_mouse(vterm, 2, 0); break;
|
||||||
@@ -1284,6 +1287,7 @@ send_keys_to_term(term_T *term, int c, int typed)
|
|||||||
case K_LEFTMOUSE_NM:
|
case K_LEFTMOUSE_NM:
|
||||||
case K_LEFTRELEASE:
|
case K_LEFTRELEASE:
|
||||||
case K_LEFTRELEASE_NM:
|
case K_LEFTRELEASE_NM:
|
||||||
|
case K_MOUSEMOVE:
|
||||||
case K_MIDDLEMOUSE:
|
case K_MIDDLEMOUSE:
|
||||||
case K_MIDDLERELEASE:
|
case K_MIDDLERELEASE:
|
||||||
case K_RIGHTMOUSE:
|
case K_RIGHTMOUSE:
|
||||||
|
|||||||
@@ -1,5 +1,21 @@
|
|||||||
" Tests for various functions.
|
" Tests for various functions.
|
||||||
|
|
||||||
|
" Must be done first, since the alternate buffer must be unset.
|
||||||
|
func Test_00_bufexists()
|
||||||
|
call assert_equal(0, bufexists('does_not_exist'))
|
||||||
|
call assert_equal(1, bufexists(bufnr('%')))
|
||||||
|
call assert_equal(0, bufexists(0))
|
||||||
|
new Xfoo
|
||||||
|
let bn = bufnr('%')
|
||||||
|
call assert_equal(1, bufexists(bn))
|
||||||
|
call assert_equal(1, bufexists('Xfoo'))
|
||||||
|
call assert_equal(1, bufexists(getcwd() . '/Xfoo'))
|
||||||
|
call assert_equal(1, bufexists(0))
|
||||||
|
bw
|
||||||
|
call assert_equal(0, bufexists(bn))
|
||||||
|
call assert_equal(0, bufexists('Xfoo'))
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_empty()
|
func Test_empty()
|
||||||
call assert_equal(1, empty(''))
|
call assert_equal(1, empty(''))
|
||||||
call assert_equal(0, empty('a'))
|
call assert_equal(0, empty('a'))
|
||||||
@@ -168,6 +184,19 @@ func Test_simplify()
|
|||||||
call assert_fails('call simplify(1.2)', 'E806:')
|
call assert_fails('call simplify(1.2)', 'E806:')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_strpart()
|
||||||
|
call assert_equal('de', strpart('abcdefg', 3, 2))
|
||||||
|
call assert_equal('ab', strpart('abcdefg', -2, 4))
|
||||||
|
call assert_equal('abcdefg', strpart('abcdefg', -2))
|
||||||
|
call assert_equal('fg', strpart('abcdefg', 5, 4))
|
||||||
|
call assert_equal('defg', strpart('abcdefg', 3))
|
||||||
|
|
||||||
|
if has('multi_byte')
|
||||||
|
call assert_equal('lép', strpart('éléphant', 2, 4))
|
||||||
|
call assert_equal('léphant', strpart('éléphant', 2))
|
||||||
|
endif
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_tolower()
|
func Test_tolower()
|
||||||
call assert_equal("", tolower(""))
|
call assert_equal("", tolower(""))
|
||||||
|
|
||||||
@@ -478,21 +507,6 @@ func Test_getbufvar()
|
|||||||
set fileformats&
|
set fileformats&
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_bufexists()
|
|
||||||
call assert_equal(0, bufexists('does_not_exist'))
|
|
||||||
call assert_equal(1, bufexists(bufnr('%')))
|
|
||||||
call assert_equal(0, bufexists(0))
|
|
||||||
new Xfoo
|
|
||||||
let bn = bufnr('%')
|
|
||||||
call assert_equal(1, bufexists(bn))
|
|
||||||
call assert_equal(1, bufexists('Xfoo'))
|
|
||||||
call assert_equal(1, bufexists(getcwd() . '/Xfoo'))
|
|
||||||
call assert_equal(1, bufexists(0))
|
|
||||||
bw
|
|
||||||
call assert_equal(0, bufexists(bn))
|
|
||||||
call assert_equal(0, bufexists('Xfoo'))
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
func Test_last_buffer_nr()
|
func Test_last_buffer_nr()
|
||||||
call assert_equal(bufnr('$'), last_buffer_nr())
|
call assert_equal(bufnr('$'), last_buffer_nr())
|
||||||
endfunc
|
endfunc
|
||||||
|
|||||||
@@ -461,6 +461,15 @@ func Test_search_cmdline7()
|
|||||||
" moves to next match of previous search pattern, just like /<cr>
|
" moves to next match of previous search pattern, just like /<cr>
|
||||||
call feedkeys("/\<c-t>\<cr>", 'tx')
|
call feedkeys("/\<c-t>\<cr>", 'tx')
|
||||||
call assert_equal([0,1,7,0], getpos('.'))
|
call assert_equal([0,1,7,0], getpos('.'))
|
||||||
|
|
||||||
|
" using an offset uses the last search pattern
|
||||||
|
call cursor(1, 1)
|
||||||
|
call setline(1, ['1 bbvimb', ' 2 bbvimb'])
|
||||||
|
let @/ = 'b'
|
||||||
|
call feedkeys("//e\<c-g>\<cr>", 'tx')
|
||||||
|
call assert_equal('1 bbvimb', getline('.'))
|
||||||
|
call assert_equal(4, col('.'))
|
||||||
|
|
||||||
set noincsearch
|
set noincsearch
|
||||||
call test_override("char_avail", 0)
|
call test_override("char_avail", 0)
|
||||||
bw!
|
bw!
|
||||||
|
|||||||
@@ -93,3 +93,10 @@ func Test_nowrite_quit_split()
|
|||||||
endif
|
endif
|
||||||
bwipe Xfile
|
bwipe Xfile
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_writefile_sync_arg()
|
||||||
|
" This doesn't check if fsync() works, only that the argument is accepted.
|
||||||
|
call writefile(['one'], 'Xtest', 's')
|
||||||
|
call writefile(['two'], 'Xtest', 'S')
|
||||||
|
call delete('Xtest')
|
||||||
|
endfunc
|
||||||
|
|||||||
@@ -93,6 +93,11 @@ static char *(features[]) =
|
|||||||
#else
|
#else
|
||||||
"-balloon_eval",
|
"-balloon_eval",
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef FEAT_BEVALTERM
|
||||||
|
"+balloon_eval_term",
|
||||||
|
#else
|
||||||
|
"-balloon_eval_term",
|
||||||
|
#endif
|
||||||
#ifdef FEAT_BROWSE
|
#ifdef FEAT_BROWSE
|
||||||
"+browse",
|
"+browse",
|
||||||
#else
|
#else
|
||||||
@@ -766,6 +771,22 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1311,
|
||||||
|
/**/
|
||||||
|
1310,
|
||||||
|
/**/
|
||||||
|
1309,
|
||||||
|
/**/
|
||||||
|
1308,
|
||||||
|
/**/
|
||||||
|
1307,
|
||||||
|
/**/
|
||||||
|
1306,
|
||||||
|
/**/
|
||||||
|
1305,
|
||||||
|
/**/
|
||||||
|
1304,
|
||||||
/**/
|
/**/
|
||||||
1303,
|
1303,
|
||||||
/**/
|
/**/
|
||||||
|
|||||||
@@ -9,6 +9,11 @@
|
|||||||
#ifndef VIM__H
|
#ifndef VIM__H
|
||||||
# define VIM__H
|
# define VIM__H
|
||||||
|
|
||||||
|
#ifdef PROTO
|
||||||
|
/* cproto runs into trouble when this type is missing */
|
||||||
|
typedef double _Float128;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* use fastcall for Borland, when compiling for Win32 */
|
/* use fastcall for Borland, when compiling for Win32 */
|
||||||
#if defined(__BORLANDC__) && defined(WIN32) && !defined(DEBUG)
|
#if defined(__BORLANDC__) && defined(WIN32) && !defined(DEBUG)
|
||||||
#if defined(FEAT_PERL) || \
|
#if defined(FEAT_PERL) || \
|
||||||
|
|||||||
Reference in New Issue
Block a user