0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

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).
This commit is contained in:
Bram Moolenaar
2019-10-17 23:00:07 +02:00
parent 0d2c4bf171
commit a1cb1d1dce
25 changed files with 157 additions and 351 deletions

View File

@@ -190,9 +190,7 @@ update_topline(void)
int check_topline = FALSE;
int check_botline = FALSE;
long *so_ptr = curwin->w_p_so >= 0 ? &curwin->w_p_so : &p_so;
#ifdef FEAT_MOUSE
int save_so = *so_ptr;
#endif
/* If there is no valid screen and when the window height is zero just use
* the cursor line. */
@@ -209,11 +207,9 @@ update_topline(void)
if (curwin->w_valid & VALID_TOPLINE)
return;
#ifdef FEAT_MOUSE
/* When dragging with the mouse, don't scroll that quickly */
if (mouse_dragging > 0)
*so_ptr = mouse_dragging - 1;
#endif
old_topline = curwin->w_topline;
#ifdef FEAT_DIFF
@@ -418,9 +414,7 @@ update_topline(void)
validate_cursor();
}
#ifdef FEAT_MOUSE
*so_ptr = save_so;
#endif
}
/*
@@ -1751,10 +1745,8 @@ scroll_cursor_top(int min_scroll, int always)
linenr_T new_topline;
int off = get_scrolloff_value();
#ifdef FEAT_MOUSE
if (mouse_dragging > 0)
off = mouse_dragging - 1;
#endif
/*
* Decrease topline until:
@@ -2004,11 +1996,7 @@ scroll_cursor_bot(int min_scroll, int set_topbot)
/* Stop when scrolled nothing or at least "min_scroll", found "extra"
* context for 'scrolloff' and counted all lines below the window. */
if ((((scrolled <= 0 || scrolled >= min_scroll)
&& extra >= (
#ifdef FEAT_MOUSE
mouse_dragging > 0 ? mouse_dragging - 1 :
#endif
so))
&& extra >= (mouse_dragging > 0 ? mouse_dragging - 1 : so))
|| boff.lnum + 1 > curbuf->b_ml.ml_line_count)
&& loff.lnum <= curwin->w_botline
#ifdef FEAT_DIFF
@@ -2050,11 +2038,8 @@ scroll_cursor_bot(int min_scroll, int set_topbot)
used += boff.height;
if (used > curwin->w_height)
break;
if (extra < (
#ifdef FEAT_MOUSE
mouse_dragging > 0 ? mouse_dragging - 1 :
#endif
so) || scrolled < min_scroll)
if (extra < ( mouse_dragging > 0 ? mouse_dragging - 1 : so)
|| scrolled < min_scroll)
{
extra += boff.height;
if (boff.lnum >= curwin->w_botline
@@ -2230,13 +2215,11 @@ cursor_correct(void)
*/
above_wanted = so;
below_wanted = so;
#ifdef FEAT_MOUSE
if (mouse_dragging > 0)
{
above_wanted = mouse_dragging - 1;
below_wanted = mouse_dragging - 1;
}
#endif
if (curwin->w_topline == 1)
{
above_wanted = 0;
@@ -2246,10 +2229,7 @@ cursor_correct(void)
}
validate_botline();
if (curwin->w_botline == curbuf->b_ml.ml_line_count + 1
#ifdef FEAT_MOUSE
&& mouse_dragging == 0
#endif
)
&& mouse_dragging == 0)
{
below_wanted = 0;
max_off = (curwin->w_height - 1) / 2;