Mercurial > vim
annotate src/beval.c @ 32936:c517845bd10e v9.0.1776
patch 9.0.1776: No support for stable Python 3 ABI
Commit: https://github.com/vim/vim/commit/c13b3d1350b60b94fe87f0761ea31c0e7fb6ebf3
Author: Yee Cheng Chin <ychin.git@gmail.com>
Date: Sun Aug 20 21:18:38 2023 +0200
patch 9.0.1776: No support for stable Python 3 ABI
Problem: No support for stable Python 3 ABI
Solution: Support Python 3 stable ABI
Commits:
1) Support Python 3 stable ABI to allow mixed version interoperatbility
Vim currently supports embedding Python for use with plugins, and the
"dynamic" linking option allows the user to specify a locally installed
version of Python by setting `pythonthreedll`. However, one caveat is
that the Python 3 libs are not binary compatible across minor versions,
and mixing versions can potentially be dangerous (e.g. let's say Vim was
linked against the Python 3.10 SDK, but the user sets `pythonthreedll`
to a 3.11 lib). Usually, nothing bad happens, but in theory this could
lead to crashes, memory corruption, and other unpredictable behaviors.
It's also difficult for the user to tell something is wrong because Vim
has no way of reporting what Python 3 version Vim was linked with.
For Vim installed via a package manager, this usually isn't an issue
because all the dependencies would already be figured out. For prebuilt
Vim binaries like MacVim (my motivation for working on this), AppImage,
and Win32 installer this could potentially be an issue as usually a
single binary is distributed. This is more tricky when a new Python
version is released, as there's a chicken-and-egg issue with deciding
what Python version to build against and hard to keep in sync when a new
Python version just drops and we have a mix of users of different Python
versions, and a user just blindly upgrading to a new Python could lead to
bad interactions with Vim.
Python 3 does have a solution for this problem: stable ABI / limited API
(see https://docs.python.org/3/c-api/stable.html). The C SDK limits the
API to a set of functions that are promised to be stable across
versions. This pull request adds an ifdef config that allows us to turn
it on when building Vim. Vim binaries built with this option should be
safe to freely link with any Python 3 libraies without having the
constraint of having to use the same minor version.
Note: Python 2 has no such concept and this doesn't change how Python 2
integration works (not that there is going to be a new version of Python
2 that would cause compatibility issues in the future anyway).
---
Technical details:
======
The stable ABI can be accessed when we compile with the Python 3 limited
API (by defining `Py_LIMITED_API`). The Python 3 code (in `if_python3.c`
and `if_py_both.h`) would now handle this and switch to limited API
mode. Without it set, Vim will still use the full API as before so this
is an opt-in change.
The main difference is that `PyType_Object` is now an opaque struct that
we can't directly create "static types" out of, and we have to create
type objects as "heap types" instead. This is because the struct is not
stable and changes from version to version (e.g. 3.8 added a
`tp_vectorcall` field to it). I had to change all the types to be
allocated on the heap instead with just a pointer to them.
Other functions are also simply missing in limited API, or they are
introduced too late (e.g. `PyUnicode_AsUTF8AndSize` in 3.10) to it that
we need some other ways to do the same thing, so I had to abstract a few
things into macros, and sometimes re-implement functions like
`PyObject_NEW`.
One caveat is that in limited API, `OutputType` (used for replacing
`sys.stdout`) no longer inherits from `PyStdPrinter_Type` which I don't
think has any real issue other than minor differences in how they
convert to a string and missing a couple functions like `mode()` and
`fileno()`.
Also fixed an existing bug where `tp_basicsize` was set incorrectly for
`BufferObject`, `TabListObject, `WinListObject`.
Technically, there could be a small performance drop, there is a little
more indirection with accessing type objects, and some APIs like
`PyUnicode_AsUTF8AndSize` are missing, but in practice I didn't see any
difference, and any well-written Python plugin should try to avoid
excessing callbacks to the `vim` module in Python anyway.
I only tested limited API mode down to Python 3.7, which seemes to
compile and work fine. I haven't tried earlier Python versions.
2) Fix PyIter_Check on older Python vers / type##Ptr unused warning
For PyIter_Check, older versions exposed them as either macros (used in
full API), or a function (for use in limited API). A previous change
exposed PyIter_Check to the dynamic build because Python just moved it
to function-only in 3.10 anyway. Because of that, just make sure we
always grab the function in dynamic builds in earlier versions since
that's what Python eventually did anyway.
3) Move Py_LIMITED_API define to configure script
Can now use --with-python-stable-abi flag to customize what stable ABI
version to target. Can also use an env var to do so as well.
4) Show +python/dyn-stable in :version, and allow has() feature query
Not sure if the "/dyn-stable" suffix would break things, or whether we
should do it another way. Or just don't show it in version and rely on
has() feature checking.
5) Documentation first draft. Still need to implement v:python3_version
6) Fix PyIter_Check build breaks when compiling against Python 3.8
7) Add CI coverage stable ABI on Linux/Windows / make configurable on Windows
This adds configurable options for Windows make files (both MinGW and
MSVC). CI will also now exercise both traditional full API and stable
ABI for Linux and Windows in the matrix for coverage.
Also added a "dynamic" option to Linux matrix as a drive-by change to
make other scripting languages like Ruby / Perl testable under both
static and dynamic builds.
8) Fix inaccuracy in Windows docs
Python's own docs are confusing but you don't actually want to use
`python3.dll` for the dynamic linkage.
9) Add generated autoconf file
10) Add v:python3_version support
This variable indicates the version of Python3 that Vim was built
against (PY_VERSION_HEX), and will be useful to check whether the Python
library you are loading in dynamically actually fits it. When built with
stable ABI, it will be the limited ABI version instead
(`Py_LIMITED_API`), which indicates the minimum version of Python 3 the
user should have, rather than the exact match. When stable ABI is used,
we won't be exposing PY_VERSION_HEX in this var because it just doesn't
seem necessary to do so (the whole point of stable ABI is the promise
that it will work across versions), and I don't want to confuse the user
with too many variables.
Also, cleaned up some documentation, and added help tags.
11) Fix Python 3.7 compat issues
Fix a couple issues when using limited API < 3.8
- Crash on exit: In Python 3.7, if a heap-allocated type is destroyed
before all instances are, it would cause a crash later. This happens
when we destroyed `OptionsType` before calling `Py_Finalize` when
using the limited API. To make it worse, later versions changed the
semantics and now each instance has a strong reference to its own type
and the recommendation has changed to have each instance de-ref its
own type and have its type in GC traversal. To avoid dealing with
these cross-version variations, we just don't free the heap type. They
are static types in non-limited-API anyway and are designed to last
through the entirety of the app, and we also don't restart the Python
runtime and therefore do not need it to have absolutely 0 leaks.
See:
- https://docs.python.org/3/whatsnew/3.8.html#changes-in-the-c-api
- https://docs.python.org/3/whatsnew/3.9.html#changes-in-the-c-api
- PyIter_Check: This function is not provided in limited APIs older than
3.8. Previously I was trying to mock it out using manual
PyType_GetSlot() but it was brittle and also does not actually work
properly for static types (it will generate a Python error). Just
return false. It does mean using limited API < 3.8 is not recommended
as you lose the functionality to handle iterators, but from playing
with plugins I couldn't find it to be an issue.
- Fix loading of PyIter_Check so it will be done when limited API < 3.8.
Otherwise loading a 3.7 Python lib will fail even if limited API was
specified to use it.
12) Make sure to only load `PyUnicode_AsUTF8AndSize` in needed in limited API
We don't use this function unless limited API >= 3.10, but we were
loading it regardless. Usually it's ok in Unix-like systems where Python
just has a single lib that we load from, but in Windows where there is a
separate python3.dll this would not work as the symbol would not have
been exposed in this more limited DLL file. This makes it much clearer
under what condition is this function needed.
closes: #12032
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 20 Aug 2023 21:30:04 +0200 |
parents | bea4ebf594c6 |
children | 8fc442c731ca |
rev | line source |
---|---|
12871
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 /* vi:set ts=8 sts=4 sw=4 noet: |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 * |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 * VIM - Vi IMproved by Bram Moolenaar |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 * Visual Workshop integration by Gordon Prieur |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 * |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 * Do ":help uganda" in Vim to read copying and usage conditions. |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 * Do ":help credits" in Vim to see a list of people who contributed. |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 * See README.txt for an overview of the Vim source code. |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 */ |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 #include "vim.h" |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18757
diff
changeset
|
13 #if defined(FEAT_BEVAL) || defined(FEAT_PROP_POPUP) || defined(PROTO) |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
14 /* |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
15 * Find text under the mouse position "row" / "col". |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
16 * If "getword" is TRUE the returned text in "*textp" is not the whole line but |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
17 * the relevant word in allocated memory. |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
18 * Return OK if found. |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
19 * Return FAIL if not found, no text at the mouse position. |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
20 */ |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
21 int |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
22 find_word_under_cursor( |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
23 int mouserow, |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
24 int mousecol, |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
25 int getword, |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
26 int flags, // flags for find_ident_at_pos() |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
27 win_T **winp, // can be NULL |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
28 linenr_T *lnump, // can be NULL |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
29 char_u **textp, |
17316
8813e1626e0a
patch 8.1.1657: Terminal: screen updates from 'balloonexpr' are not displayed
Bram Moolenaar <Bram@vim.org>
parents:
17310
diff
changeset
|
30 int *colp, // column where mouse hovers, can be NULL |
8813e1626e0a
patch 8.1.1657: Terminal: screen updates from 'balloonexpr' are not displayed
Bram Moolenaar <Bram@vim.org>
parents:
17310
diff
changeset
|
31 int *startcolp) // column where text starts, can be NULL |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
32 { |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
33 int row = mouserow; |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
34 int col = mousecol; |
17316
8813e1626e0a
patch 8.1.1657: Terminal: screen updates from 'balloonexpr' are not displayed
Bram Moolenaar <Bram@vim.org>
parents:
17310
diff
changeset
|
35 int scol; |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
36 win_T *wp; |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
37 char_u *lbuf; |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
38 linenr_T lnum; |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
39 |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
40 *textp = NULL; |
17041
5ed4965ebc7b
patch 8.1.1520: popup windows are ignored when dealing with mouse position
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
41 wp = mouse_find_win(&row, &col, FAIL_POPUP); |
30531
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
42 if (wp == NULL || row < 0 || row >= wp->w_height || col >= wp->w_width) |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
43 return FAIL; |
12871
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 |
30531
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
45 // Found a window and the cursor is in the text. Now find the line |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
46 // number. |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
47 if (mouse_comp_pos(wp, &row, &col, &lnum, NULL)) |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
48 return FAIL; // position is below the last line |
12871
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 |
30531
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
50 // Not past end of the file. |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
51 lbuf = ml_get_buf(wp->w_buffer, lnum, FALSE); |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
52 if (col > win_linetabsize(wp, lnum, lbuf, (colnr_T)MAXCOL)) |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
53 return FAIL; // past end of line |
12871
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
54 |
30531
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
55 // Not past end of line. |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
56 if (getword) |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
57 { |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
58 // For Netbeans we get the relevant part of the line |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
59 // instead of the whole line. |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
60 int len; |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
61 pos_T *spos = NULL, *epos = NULL; |
12871
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
62 |
30531
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
63 if (VIsual_active) |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
64 { |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
65 if (LT_POS(VIsual, curwin->w_cursor)) |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
66 { |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
67 spos = &VIsual; |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
68 epos = &curwin->w_cursor; |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
69 } |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
70 else |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
71 { |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
72 spos = &curwin->w_cursor; |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
73 epos = &VIsual; |
12871
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
74 } |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
75 } |
30531
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
76 |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
77 col = vcol2col(wp, lnum, col); |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
78 scol = col; |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
79 |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
80 if (VIsual_active |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
81 && wp->w_buffer == curwin->w_buffer |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
82 && (lnum == spos->lnum |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
83 ? col >= (int)spos->col |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
84 : lnum > spos->lnum) |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
85 && (lnum == epos->lnum |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
86 ? col <= (int)epos->col |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
87 : lnum < epos->lnum)) |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
88 { |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
89 // Visual mode and pointing to the line with the |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
90 // Visual selection: return selected text, with a |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
91 // maximum of one line. |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
92 if (spos->lnum != epos->lnum || spos->col == epos->col) |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
93 return FAIL; |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
94 |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
95 lbuf = ml_get_buf(curwin->w_buffer, VIsual.lnum, FALSE); |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
96 len = epos->col - spos->col; |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
97 if (*p_sel != 'e') |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
98 len += mb_ptr2len(lbuf + epos->col); |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
99 lbuf = vim_strnsave(lbuf + spos->col, len); |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
100 lnum = spos->lnum; |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
101 col = spos->col; |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
102 scol = col; |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
103 } |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
104 else |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
105 { |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
106 // Find the word under the cursor. |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
107 ++emsg_off; |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
108 len = find_ident_at_pos(wp, lnum, (colnr_T)col, |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
109 &lbuf, &scol, flags); |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
110 --emsg_off; |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
111 if (len == 0) |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
112 return FAIL; |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
113 lbuf = vim_strnsave(lbuf, len); |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
114 } |
12871
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
115 } |
30531
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
116 else |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
117 scol = col; |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
118 |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
119 if (winp != NULL) |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
120 *winp = wp; |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
121 if (lnump != NULL) |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
122 *lnump = lnum; |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
123 *textp = lbuf; |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
124 if (colp != NULL) |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
125 *colp = col; |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
126 if (startcolp != NULL) |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
127 *startcolp = scol; |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
128 |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
129 return OK; |
12871
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
130 } |
17298
3d90ae62deca
patch 8.1.1648: MS-Windows: build error with normal feaures
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
131 #endif |
3d90ae62deca
patch 8.1.1648: MS-Windows: build error with normal feaures
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
132 |
3d90ae62deca
patch 8.1.1648: MS-Windows: build error with normal feaures
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
133 #if defined(FEAT_BEVAL) || defined(PROTO) |
3d90ae62deca
patch 8.1.1648: MS-Windows: build error with normal feaures
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
134 |
3d90ae62deca
patch 8.1.1648: MS-Windows: build error with normal feaures
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
135 /* |
3d90ae62deca
patch 8.1.1648: MS-Windows: build error with normal feaures
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
136 * Get the text and position to be evaluated for "beval". |
3d90ae62deca
patch 8.1.1648: MS-Windows: build error with normal feaures
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
137 * If "getword" is TRUE the returned text is not the whole line but the |
3d90ae62deca
patch 8.1.1648: MS-Windows: build error with normal feaures
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
138 * relevant word in allocated memory. |
3d90ae62deca
patch 8.1.1648: MS-Windows: build error with normal feaures
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
139 * Returns OK or FAIL. |
3d90ae62deca
patch 8.1.1648: MS-Windows: build error with normal feaures
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
140 */ |
3d90ae62deca
patch 8.1.1648: MS-Windows: build error with normal feaures
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
141 int |
3d90ae62deca
patch 8.1.1648: MS-Windows: build error with normal feaures
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
142 get_beval_info( |
17302
e0d727872758
patch 8.1.1650: warning for using uninitialized variable
Bram Moolenaar <Bram@vim.org>
parents:
17298
diff
changeset
|
143 BalloonEval *beval, |
e0d727872758
patch 8.1.1650: warning for using uninitialized variable
Bram Moolenaar <Bram@vim.org>
parents:
17298
diff
changeset
|
144 int getword, |
e0d727872758
patch 8.1.1650: warning for using uninitialized variable
Bram Moolenaar <Bram@vim.org>
parents:
17298
diff
changeset
|
145 win_T **winp, |
e0d727872758
patch 8.1.1650: warning for using uninitialized variable
Bram Moolenaar <Bram@vim.org>
parents:
17298
diff
changeset
|
146 linenr_T *lnump, |
e0d727872758
patch 8.1.1650: warning for using uninitialized variable
Bram Moolenaar <Bram@vim.org>
parents:
17298
diff
changeset
|
147 char_u **textp, |
e0d727872758
patch 8.1.1650: warning for using uninitialized variable
Bram Moolenaar <Bram@vim.org>
parents:
17298
diff
changeset
|
148 int *colp) |
17298
3d90ae62deca
patch 8.1.1648: MS-Windows: build error with normal feaures
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
149 { |
17302
e0d727872758
patch 8.1.1650: warning for using uninitialized variable
Bram Moolenaar <Bram@vim.org>
parents:
17298
diff
changeset
|
150 int row = mouse_row; |
e0d727872758
patch 8.1.1650: warning for using uninitialized variable
Bram Moolenaar <Bram@vim.org>
parents:
17298
diff
changeset
|
151 int col = mouse_col; |
17298
3d90ae62deca
patch 8.1.1648: MS-Windows: build error with normal feaures
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
152 |
26443
fee1e854e183
patch 8.2.3752: build error when using Photon GUI
Bram Moolenaar <Bram@vim.org>
parents:
20996
diff
changeset
|
153 # ifdef FEAT_BEVAL_GUI |
17298
3d90ae62deca
patch 8.1.1648: MS-Windows: build error with normal feaures
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
154 if (gui.in_use) |
3d90ae62deca
patch 8.1.1648: MS-Windows: build error with normal feaures
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
155 { |
3d90ae62deca
patch 8.1.1648: MS-Windows: build error with normal feaures
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
156 row = Y_2_ROW(beval->y); |
3d90ae62deca
patch 8.1.1648: MS-Windows: build error with normal feaures
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
157 col = X_2_COL(beval->x); |
3d90ae62deca
patch 8.1.1648: MS-Windows: build error with normal feaures
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
158 } |
26443
fee1e854e183
patch 8.2.3752: build error when using Photon GUI
Bram Moolenaar <Bram@vim.org>
parents:
20996
diff
changeset
|
159 # endif |
17298
3d90ae62deca
patch 8.1.1648: MS-Windows: build error with normal feaures
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
160 if (find_word_under_cursor(row, col, getword, |
3d90ae62deca
patch 8.1.1648: MS-Windows: build error with normal feaures
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
161 FIND_IDENT + FIND_STRING + FIND_EVAL, |
17316
8813e1626e0a
patch 8.1.1657: Terminal: screen updates from 'balloonexpr' are not displayed
Bram Moolenaar <Bram@vim.org>
parents:
17310
diff
changeset
|
162 winp, lnump, textp, colp, NULL) == OK) |
17298
3d90ae62deca
patch 8.1.1648: MS-Windows: build error with normal feaures
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
163 { |
26443
fee1e854e183
patch 8.2.3752: build error when using Photon GUI
Bram Moolenaar <Bram@vim.org>
parents:
20996
diff
changeset
|
164 # ifdef FEAT_VARTABS |
17298
3d90ae62deca
patch 8.1.1648: MS-Windows: build error with normal feaures
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
165 vim_free(beval->vts); |
3d90ae62deca
patch 8.1.1648: MS-Windows: build error with normal feaures
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
166 beval->vts = tabstop_copy((*winp)->w_buffer->b_p_vts_array); |
3d90ae62deca
patch 8.1.1648: MS-Windows: build error with normal feaures
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
167 if ((*winp)->w_buffer->b_p_vts_array != NULL && beval->vts == NULL) |
3d90ae62deca
patch 8.1.1648: MS-Windows: build error with normal feaures
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
168 { |
3d90ae62deca
patch 8.1.1648: MS-Windows: build error with normal feaures
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
169 if (getword) |
3d90ae62deca
patch 8.1.1648: MS-Windows: build error with normal feaures
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
170 vim_free(*textp); |
3d90ae62deca
patch 8.1.1648: MS-Windows: build error with normal feaures
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
171 return FAIL; |
3d90ae62deca
patch 8.1.1648: MS-Windows: build error with normal feaures
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
172 } |
26443
fee1e854e183
patch 8.2.3752: build error when using Photon GUI
Bram Moolenaar <Bram@vim.org>
parents:
20996
diff
changeset
|
173 # endif |
17298
3d90ae62deca
patch 8.1.1648: MS-Windows: build error with normal feaures
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
174 beval->ts = (*winp)->w_buffer->b_p_ts; |
3d90ae62deca
patch 8.1.1648: MS-Windows: build error with normal feaures
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
175 return OK; |
3d90ae62deca
patch 8.1.1648: MS-Windows: build error with normal feaures
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
176 } |
3d90ae62deca
patch 8.1.1648: MS-Windows: build error with normal feaures
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
177 |
3d90ae62deca
patch 8.1.1648: MS-Windows: build error with normal feaures
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
178 return FAIL; |
3d90ae62deca
patch 8.1.1648: MS-Windows: build error with normal feaures
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
179 } |
12871
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
180 |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
181 /* |
12883
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12871
diff
changeset
|
182 * Show a balloon with "mesg" or "list". |
17041
5ed4965ebc7b
patch 8.1.1520: popup windows are ignored when dealing with mouse position
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
183 * Hide the balloon when both are NULL. |
12871
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
184 */ |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
185 void |
13353
8412df1479a3
patch 8.0.1550: various small problems in source files
Christian Brabandt <cb@256bit.org>
parents:
12981
diff
changeset
|
186 post_balloon(BalloonEval *beval UNUSED, char_u *mesg, list_T *list UNUSED) |
12871
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
187 { |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
188 # ifdef FEAT_BEVAL_TERM |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
189 # ifdef FEAT_GUI |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
190 if (!gui.in_use) |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
191 # endif |
12883
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12871
diff
changeset
|
192 ui_post_balloon(mesg, list); |
12871
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
193 # endif |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
194 # ifdef FEAT_BEVAL_GUI |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
195 if (gui.in_use) |
17041
5ed4965ebc7b
patch 8.1.1520: popup windows are ignored when dealing with mouse position
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
196 // GUI can't handle a list |
12871
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
197 gui_mch_post_balloon(beval, mesg); |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
198 # endif |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
199 } |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
200 |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
201 /* |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
202 * Returns TRUE if the balloon eval has been enabled: |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
203 * 'ballooneval' for the GUI and 'balloonevalterm' for the terminal. |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
204 * Also checks if the screen isn't scrolled up. |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
205 */ |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
206 int |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
207 can_use_beval(void) |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
208 { |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
209 return (0 |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
210 #ifdef FEAT_BEVAL_GUI |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
211 || (gui.in_use && p_beval) |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
212 #endif |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
213 #ifdef FEAT_BEVAL_TERM |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
214 || ( |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
215 # ifdef FEAT_GUI |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
216 !gui.in_use && |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
217 # endif |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
218 p_bevalterm) |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
219 #endif |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
220 ) && msg_scrolled == 0; |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
221 } |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
222 |
30531
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
223 # ifdef FEAT_EVAL |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
224 /* |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
225 * Evaluate the expression 'bexpr' and set the text in the balloon 'beval'. |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
226 */ |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
227 static void |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
228 bexpr_eval( |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
229 BalloonEval *beval, |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
230 char_u *bexpr, |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
231 win_T *wp, |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
232 linenr_T lnum, |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
233 int col, |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
234 char_u *text) |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
235 { |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
236 win_T *cw; |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
237 long winnr = 0; |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
238 buf_T *save_curbuf; |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
239 int use_sandbox; |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
240 static char_u *result = NULL; |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
241 size_t len; |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
242 |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
243 sctx_T save_sctx = current_sctx; |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
244 |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
245 // Convert window pointer to number. |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
246 for (cw = firstwin; cw != wp; cw = cw->w_next) |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
247 ++winnr; |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
248 |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
249 set_vim_var_nr(VV_BEVAL_BUFNR, (long)wp->w_buffer->b_fnum); |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
250 set_vim_var_nr(VV_BEVAL_WINNR, winnr); |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
251 set_vim_var_nr(VV_BEVAL_WINID, wp->w_id); |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
252 set_vim_var_nr(VV_BEVAL_LNUM, (long)lnum); |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
253 set_vim_var_nr(VV_BEVAL_COL, (long)(col + 1)); |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
254 set_vim_var_string(VV_BEVAL_TEXT, text, -1); |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
255 vim_free(text); |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
256 |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
257 /* |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
258 * Temporarily change the curbuf, so that we can determine whether |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
259 * the buffer-local balloonexpr option was set insecurely. |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
260 */ |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
261 save_curbuf = curbuf; |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
262 curbuf = wp->w_buffer; |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
263 use_sandbox = was_set_insecurely((char_u *)"balloonexpr", |
32295
bea4ebf594c6
patch 9.0.1479: small source file problems; outdated list of distrib. files
Bram Moolenaar <Bram@vim.org>
parents:
30598
diff
changeset
|
264 *curbuf->b_p_bexpr == NUL ? 0 : OPT_LOCAL); |
30531
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
265 curbuf = save_curbuf; |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
266 if (use_sandbox) |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
267 ++sandbox; |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
268 ++textlock; |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
269 |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
270 if (bexpr == p_bexpr) |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
271 { |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
272 sctx_T *sp = get_option_sctx("balloonexpr"); |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
273 |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
274 if (sp != NULL) |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
275 current_sctx = *sp; |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
276 } |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
277 else |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
278 current_sctx = curbuf->b_p_script_ctx[BV_BEXPR]; |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
279 |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
280 vim_free(result); |
30598
37aa9fd2ed72
patch 9.0.0634: evaluating "expr" options has more overhead than needed
Bram Moolenaar <Bram@vim.org>
parents:
30531
diff
changeset
|
281 result = eval_to_string(bexpr, TRUE, TRUE); |
30531
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
282 |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
283 // Remove one trailing newline, it is added when the result was a |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
284 // list and it's hardly ever useful. If the user really wants a |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
285 // trailing newline he can add two and one remains. |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
286 if (result != NULL) |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
287 { |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
288 len = STRLEN(result); |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
289 if (len > 0 && result[len - 1] == NL) |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
290 result[len - 1] = NUL; |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
291 } |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
292 |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
293 if (use_sandbox) |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
294 --sandbox; |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
295 --textlock; |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
296 current_sctx = save_sctx; |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
297 |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
298 set_vim_var_string(VV_BEVAL_TEXT, NULL, -1); |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
299 if (result != NULL && result[0] != NUL) |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
300 post_balloon(beval, result, NULL); |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
301 |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
302 // The 'balloonexpr' evaluation may show something on the screen |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
303 // that requires a screen update. |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
304 if (must_redraw) |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
305 redraw_after_callback(FALSE, FALSE); |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
306 } |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
307 # endif |
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
308 |
12871
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
309 /* |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
310 * Common code, invoked when the mouse is resting for a moment. |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
311 */ |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
312 void |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
313 general_beval_cb(BalloonEval *beval, int state UNUSED) |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
314 { |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
315 #ifdef FEAT_EVAL |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
316 win_T *wp; |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
317 int col; |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
318 linenr_T lnum; |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
319 char_u *text; |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
320 char_u *bexpr; |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
321 #endif |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
322 static int recursive = FALSE; |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
323 |
18757
c469e1930456
patch 8.1.2368: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18251
diff
changeset
|
324 // Don't do anything when 'ballooneval' is off, messages scrolled the |
c469e1930456
patch 8.1.2368: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18251
diff
changeset
|
325 // windows up or we have no beval area. |
12871
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
326 if (!can_use_beval() || beval == NULL) |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
327 return; |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
328 |
18757
c469e1930456
patch 8.1.2368: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18251
diff
changeset
|
329 // Don't do this recursively. Happens when the expression evaluation |
c469e1930456
patch 8.1.2368: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18251
diff
changeset
|
330 // takes a long time and invokes something that checks for CTRL-C typed. |
12871
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
331 if (recursive) |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
332 return; |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
333 recursive = TRUE; |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
334 |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
335 #ifdef FEAT_EVAL |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
336 if (get_beval_info(beval, TRUE, &wp, &lnum, &text, &col) == OK) |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
337 { |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
338 bexpr = (*wp->w_buffer->b_p_bexpr == NUL) ? p_bexpr |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
339 : wp->w_buffer->b_p_bexpr; |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
340 if (*bexpr != NUL) |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
341 { |
30531
2650a01b8bbc
patch 9.0.0601: too much indent
Bram Moolenaar <Bram@vim.org>
parents:
29451
diff
changeset
|
342 bexpr_eval(beval, bexpr, wp, lnum, col, text); |
17310
1b0b90f1d95e
patch 8.1.1654: GUI: screen updates from 'balloonexpr' are not displayed
Bram Moolenaar <Bram@vim.org>
parents:
17302
diff
changeset
|
343 recursive = FALSE; |
1b0b90f1d95e
patch 8.1.1654: GUI: screen updates from 'balloonexpr' are not displayed
Bram Moolenaar <Bram@vim.org>
parents:
17302
diff
changeset
|
344 return; |
12871
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
345 } |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
346 } |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
347 #endif |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
348 #ifdef FEAT_NETBEANS_INTG |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
349 if (bevalServers & BEVAL_NETBEANS) |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
350 netbeans_beval_cb(beval, state); |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
351 #endif |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
352 |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
353 recursive = FALSE; |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
354 } |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
355 |
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
356 #endif |