Mercurial > vim
comparison src/gui_beval.c @ 12477:68d7bc045dbe v8.0.1118
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
commit https://github.com/vim/vim/commit/4033c55eca575777718c0701e26635a0cc47d907
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Sep 16 20:54:51 2017 +0200
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Problem: FEAT_WINDOWS adds a lot of #ifdefs while it is nearly always
enabled and only adds 7% to the binary size of the tiny build.
Solution: Graduate FEAT_WINDOWS.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 16 Sep 2017 21:00:06 +0200 |
parents | 2c020bc30f62 |
children | 972ea22c946f |
comparison
equal
deleted
inserted
replaced
12476:2516383741e6 | 12477:68d7bc045dbe |
---|---|
27 static char_u *result = NULL; | 27 static char_u *result = NULL; |
28 long winnr = 0; | 28 long winnr = 0; |
29 char_u *bexpr; | 29 char_u *bexpr; |
30 buf_T *save_curbuf; | 30 buf_T *save_curbuf; |
31 size_t len; | 31 size_t len; |
32 # ifdef FEAT_WINDOWS | |
33 win_T *cw; | 32 win_T *cw; |
34 # endif | |
35 #endif | 33 #endif |
36 static int recursive = FALSE; | 34 static int recursive = FALSE; |
37 | 35 |
38 /* Don't do anything when 'ballooneval' is off, messages scrolled the | 36 /* Don't do anything when 'ballooneval' is off, messages scrolled the |
39 * windows up or we have no beval area. */ | 37 * windows up or we have no beval area. */ |
51 { | 49 { |
52 bexpr = (*wp->w_buffer->b_p_bexpr == NUL) ? p_bexpr | 50 bexpr = (*wp->w_buffer->b_p_bexpr == NUL) ? p_bexpr |
53 : wp->w_buffer->b_p_bexpr; | 51 : wp->w_buffer->b_p_bexpr; |
54 if (*bexpr != NUL) | 52 if (*bexpr != NUL) |
55 { | 53 { |
56 # ifdef FEAT_WINDOWS | |
57 /* Convert window pointer to number. */ | 54 /* Convert window pointer to number. */ |
58 for (cw = firstwin; cw != wp; cw = cw->w_next) | 55 for (cw = firstwin; cw != wp; cw = cw->w_next) |
59 ++winnr; | 56 ++winnr; |
60 # endif | |
61 | 57 |
62 set_vim_var_nr(VV_BEVAL_BUFNR, (long)wp->w_buffer->b_fnum); | 58 set_vim_var_nr(VV_BEVAL_BUFNR, (long)wp->w_buffer->b_fnum); |
63 set_vim_var_nr(VV_BEVAL_WINNR, winnr); | 59 set_vim_var_nr(VV_BEVAL_WINNR, winnr); |
64 set_vim_var_nr(VV_BEVAL_WINID, wp->w_id); | 60 set_vim_var_nr(VV_BEVAL_WINID, wp->w_id); |
65 set_vim_var_nr(VV_BEVAL_LNUM, (long)lnum); | 61 set_vim_var_nr(VV_BEVAL_LNUM, (long)lnum); |
339 linenr_T lnum; | 335 linenr_T lnum; |
340 | 336 |
341 *textp = NULL; | 337 *textp = NULL; |
342 row = Y_2_ROW(beval->y); | 338 row = Y_2_ROW(beval->y); |
343 col = X_2_COL(beval->x); | 339 col = X_2_COL(beval->x); |
344 #ifdef FEAT_WINDOWS | |
345 wp = mouse_find_win(&row, &col); | 340 wp = mouse_find_win(&row, &col); |
346 #else | |
347 wp = firstwin; | |
348 #endif | |
349 if (wp != NULL && row < wp->w_height && col < W_WIDTH(wp)) | 341 if (wp != NULL && row < wp->w_height && col < W_WIDTH(wp)) |
350 { | 342 { |
351 /* Found a window and the cursor is in the text. Now find the line | 343 /* Found a window and the cursor is in the text. Now find the line |
352 * number. */ | 344 * number. */ |
353 if (!mouse_comp_pos(wp, &row, &col, &lnum)) | 345 if (!mouse_comp_pos(wp, &row, &col, &lnum)) |