|
10 | 10 |
|
11 | 11 | #include "vim.h" |
12 | 12 |
|
13 | | -#if defined(FEAT_BEVAL) || defined(PROTO) |
14 | | - |
15 | | -/* |
16 | | - * Get the text and position to be evaluated for "beval". |
17 | | - * If "getword" is TRUE the returned text is not the whole line but the |
18 | | - * relevant word in allocated memory. |
19 | | - * Returns OK or FAIL. |
20 | | - */ |
21 | | - int |
22 | | -get_beval_info( |
23 | | - BalloonEval *beval, |
24 | | - int getword, |
25 | | - win_T **winp, |
26 | | - linenr_T *lnump, |
27 | | - char_u **textp, |
28 | | - int *colp) |
29 | | -{ |
30 | | - int row, col; |
31 | | - |
32 | | -# ifdef FEAT_BEVAL_TERM |
33 | | -# ifdef FEAT_GUI |
34 | | - if (!gui.in_use) |
35 | | -# endif |
36 | | - { |
37 | | - row = mouse_row; |
38 | | - col = mouse_col; |
39 | | - } |
40 | | -# endif |
41 | | -# ifdef FEAT_GUI |
42 | | - if (gui.in_use) |
43 | | - { |
44 | | - row = Y_2_ROW(beval->y); |
45 | | - col = X_2_COL(beval->x); |
46 | | - } |
47 | | -#endif |
48 | | - if (find_word_under_cursor(row, col, getword, |
49 | | - FIND_IDENT + FIND_STRING + FIND_EVAL, |
50 | | - winp, lnump, textp, colp) == OK) |
51 | | - { |
52 | | -#ifdef FEAT_VARTABS |
53 | | - vim_free(beval->vts); |
54 | | - beval->vts = tabstop_copy((*winp)->w_buffer->b_p_vts_array); |
55 | | - if ((*winp)->w_buffer->b_p_vts_array != NULL && beval->vts == NULL) |
56 | | - { |
57 | | - if (getword) |
58 | | - vim_free(*textp); |
59 | | - return FAIL; |
60 | | - } |
61 | | -#endif |
62 | | - beval->ts = (*winp)->w_buffer->b_p_ts; |
63 | | - return OK; |
64 | | - } |
65 | | - |
66 | | - return FAIL; |
67 | | -} |
68 | | - |
| 13 | +#if defined(FEAT_BEVAL) || defined(FEAT_TEXT_PROP) || defined(PROT) |
69 | 14 | /* |
70 | 15 | * Find text under the mouse position "row" / "col". |
71 | 16 | * If "getword" is TRUE the returned text in "*textp" is not the whole line but |
@@ -174,6 +119,63 @@ find_word_under_cursor( |
174 | 119 | } |
175 | 120 | return FAIL; |
176 | 121 | } |
| 122 | +#endif |
| 123 | + |
| 124 | +#if defined(FEAT_BEVAL) || defined(PROTO) |
| 125 | + |
| 126 | +/* |
| 127 | + * Get the text and position to be evaluated for "beval". |
| 128 | + * If "getword" is TRUE the returned text is not the whole line but the |
| 129 | + * relevant word in allocated memory. |
| 130 | + * Returns OK or FAIL. |
| 131 | + */ |
| 132 | + int |
| 133 | +get_beval_info( |
| 134 | + BalloonEval *beval, |
| 135 | + int getword, |
| 136 | + win_T **winp, |
| 137 | + linenr_T *lnump, |
| 138 | + char_u **textp, |
| 139 | + int *colp) |
| 140 | +{ |
| 141 | + int row, col; |
| 142 | + |
| 143 | +# ifdef FEAT_BEVAL_TERM |
| 144 | +# ifdef FEAT_GUI |
| 145 | + if (!gui.in_use) |
| 146 | +# endif |
| 147 | + { |
| 148 | + row = mouse_row; |
| 149 | + col = mouse_col; |
| 150 | + } |
| 151 | +# endif |
| 152 | +# ifdef FEAT_GUI |
| 153 | + if (gui.in_use) |
| 154 | + { |
| 155 | + row = Y_2_ROW(beval->y); |
| 156 | + col = X_2_COL(beval->x); |
| 157 | + } |
| 158 | +#endif |
| 159 | + if (find_word_under_cursor(row, col, getword, |
| 160 | + FIND_IDENT + FIND_STRING + FIND_EVAL, |
| 161 | + winp, lnump, textp, colp) == OK) |
| 162 | + { |
| 163 | +#ifdef FEAT_VARTABS |
| 164 | + vim_free(beval->vts); |
| 165 | + beval->vts = tabstop_copy((*winp)->w_buffer->b_p_vts_array); |
| 166 | + if ((*winp)->w_buffer->b_p_vts_array != NULL && beval->vts == NULL) |
| 167 | + { |
| 168 | + if (getword) |
| 169 | + vim_free(*textp); |
| 170 | + return FAIL; |
| 171 | + } |
| 172 | +#endif |
| 173 | + beval->ts = (*winp)->w_buffer->b_p_ts; |
| 174 | + return OK; |
| 175 | + } |
| 176 | + |
| 177 | + return FAIL; |
| 178 | +} |
177 | 179 |
|
178 | 180 | /* |
179 | 181 | * Show a balloon with "mesg" or "list". |
|
0 commit comments