Mercurial > vim
comparison src/getchar.c @ 18354:9f51d0cef8da v8.1.2171
patch 8.1.2171: mouse support not always available
Commit: https://github.com/vim/vim/commit/a1cb1d1dce14dd005797590721f1bcd0e7c3b35f
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Oct 17 23:00:07 2019 +0200
patch 8.1.2171: mouse support not always available
Problem: Mouse support not always available.
Solution: Enable mouse support also in tiny version. Do not define
FEAT_MOUSE_XTERM on MS-Windows (didn't really work).
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 17 Oct 2019 23:15:04 +0200 |
parents | 506bf60a30a0 |
children | 084b28fb3d22 |
comparison
equal
deleted
inserted
replaced
18353:c3a0f5d3c9d4 | 18354:9f51d0cef8da |
---|---|
1323 return OK; | 1323 return OK; |
1324 } | 1324 } |
1325 | 1325 |
1326 static int old_char = -1; /* character put back by vungetc() */ | 1326 static int old_char = -1; /* character put back by vungetc() */ |
1327 static int old_mod_mask; /* mod_mask for ungotten character */ | 1327 static int old_mod_mask; /* mod_mask for ungotten character */ |
1328 #ifdef FEAT_MOUSE | |
1329 static int old_mouse_row; /* mouse_row related to old_char */ | 1328 static int old_mouse_row; /* mouse_row related to old_char */ |
1330 static int old_mouse_col; /* mouse_col related to old_char */ | 1329 static int old_mouse_col; /* mouse_col related to old_char */ |
1331 #endif | |
1332 | 1330 |
1333 /* | 1331 /* |
1334 * Save all three kinds of typeahead, so that the user must type at a prompt. | 1332 * Save all three kinds of typeahead, so that the user must type at a prompt. |
1335 */ | 1333 */ |
1336 void | 1334 void |
1557 if (old_char != -1) | 1555 if (old_char != -1) |
1558 { | 1556 { |
1559 c = old_char; | 1557 c = old_char; |
1560 old_char = -1; | 1558 old_char = -1; |
1561 mod_mask = old_mod_mask; | 1559 mod_mask = old_mod_mask; |
1562 #ifdef FEAT_MOUSE | |
1563 mouse_row = old_mouse_row; | 1560 mouse_row = old_mouse_row; |
1564 mouse_col = old_mouse_col; | 1561 mouse_col = old_mouse_col; |
1565 #endif | |
1566 } | 1562 } |
1567 else | 1563 else |
1568 { | 1564 { |
1569 mod_mask = 0x0; | 1565 mod_mask = 0x0; |
1570 last_recorded_len = 0; | 1566 last_recorded_len = 0; |
2005 temp[i++] = n; | 2001 temp[i++] = n; |
2006 temp[i++] = NUL; | 2002 temp[i++] = NUL; |
2007 rettv->v_type = VAR_STRING; | 2003 rettv->v_type = VAR_STRING; |
2008 rettv->vval.v_string = vim_strsave(temp); | 2004 rettv->vval.v_string = vim_strsave(temp); |
2009 | 2005 |
2010 #ifdef FEAT_MOUSE | |
2011 if (is_mouse_key(n)) | 2006 if (is_mouse_key(n)) |
2012 { | 2007 { |
2013 int row = mouse_row; | 2008 int row = mouse_row; |
2014 int col = mouse_col; | 2009 int col = mouse_col; |
2015 win_T *win; | 2010 win_T *win; |
2023 * text position. */ | 2018 * text position. */ |
2024 win = mouse_find_win(&row, &col, FIND_POPUP); | 2019 win = mouse_find_win(&row, &col, FIND_POPUP); |
2025 if (win == NULL) | 2020 if (win == NULL) |
2026 return; | 2021 return; |
2027 (void)mouse_comp_pos(win, &row, &col, &lnum, NULL); | 2022 (void)mouse_comp_pos(win, &row, &col, &lnum, NULL); |
2028 # ifdef FEAT_TEXT_PROP | 2023 #ifdef FEAT_TEXT_PROP |
2029 if (WIN_IS_POPUP(win)) | 2024 if (WIN_IS_POPUP(win)) |
2030 winnr = 0; | 2025 winnr = 0; |
2031 else | 2026 else |
2032 # endif | 2027 #endif |
2033 for (wp = firstwin; wp != win && wp != NULL; | 2028 for (wp = firstwin; wp != win && wp != NULL; |
2034 wp = wp->w_next) | 2029 wp = wp->w_next) |
2035 ++winnr; | 2030 ++winnr; |
2036 set_vim_var_nr(VV_MOUSE_WIN, winnr); | 2031 set_vim_var_nr(VV_MOUSE_WIN, winnr); |
2037 set_vim_var_nr(VV_MOUSE_WINID, win->w_id); | 2032 set_vim_var_nr(VV_MOUSE_WINID, win->w_id); |
2038 set_vim_var_nr(VV_MOUSE_LNUM, lnum); | 2033 set_vim_var_nr(VV_MOUSE_LNUM, lnum); |
2039 set_vim_var_nr(VV_MOUSE_COL, col + 1); | 2034 set_vim_var_nr(VV_MOUSE_COL, col + 1); |
2040 } | 2035 } |
2041 } | 2036 } |
2042 #endif | |
2043 } | 2037 } |
2044 } | 2038 } |
2045 | 2039 |
2046 /* | 2040 /* |
2047 * "getcharmod()" function | 2041 * "getcharmod()" function |
2634 void | 2628 void |
2635 vungetc(int c) | 2629 vungetc(int c) |
2636 { | 2630 { |
2637 old_char = c; | 2631 old_char = c; |
2638 old_mod_mask = mod_mask; | 2632 old_mod_mask = mod_mask; |
2639 #ifdef FEAT_MOUSE | |
2640 old_mouse_row = mouse_row; | 2633 old_mouse_row = mouse_row; |
2641 old_mouse_col = mouse_col; | 2634 old_mouse_col = mouse_col; |
2642 #endif | |
2643 } | 2635 } |
2644 | 2636 |
2645 /* | 2637 /* |
2646 * Get a byte: | 2638 * Get a byte: |
2647 * 1. from the stuffbuffer | 2639 * 1. from the stuffbuffer |