Mercurial > vim
comparison src/window.c @ 28375:e466fdbe0699 v8.2.4713
patch 8.2.4713: plugins cannot track text scrolling
Commit: https://github.com/vim/vim/commit/0937182d49fa8db50cec42785f22f1031760a0bd
Author: LemonBoy <thatlemon@gmail.com>
Date: Fri Apr 8 15:18:45 2022 +0100
patch 8.2.4713: plugins cannot track text scrolling
Problem: Plugins cannot track text scrolling.
Solution: Add the WinScrolled event. (closes https://github.com/vim/vim/issues/10102)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 08 Apr 2022 16:30:03 +0200 |
parents | 68c36f734b10 |
children | aa9720c76412 |
comparison
equal
deleted
inserted
replaced
28374:14d6f5ebf810 | 28375:e466fdbe0699 |
---|---|
2777 char_u winid[NUMBUFLEN]; | 2777 char_u winid[NUMBUFLEN]; |
2778 | 2778 |
2779 if (recursive) | 2779 if (recursive) |
2780 return; | 2780 return; |
2781 recursive = TRUE; | 2781 recursive = TRUE; |
2782 vim_snprintf((char *)winid, sizeof(winid), "%i", win->w_id); | 2782 vim_snprintf((char *)winid, sizeof(winid), "%d", win->w_id); |
2783 apply_autocmds(EVENT_WINCLOSED, winid, winid, FALSE, win->w_buffer); | 2783 apply_autocmds(EVENT_WINCLOSED, winid, winid, FALSE, win->w_buffer); |
2784 recursive = FALSE; | 2784 recursive = FALSE; |
2785 } | |
2786 | |
2787 void | |
2788 may_trigger_winscrolled(win_T *wp) | |
2789 { | |
2790 static int recursive = FALSE; | |
2791 char_u winid[NUMBUFLEN]; | |
2792 | |
2793 if (recursive || !has_winscrolled()) | |
2794 return; | |
2795 | |
2796 if (wp->w_last_topline != wp->w_topline | |
2797 || wp->w_last_leftcol != wp->w_leftcol | |
2798 || wp->w_last_width != wp->w_width | |
2799 || wp->w_last_height != wp->w_height) | |
2800 { | |
2801 vim_snprintf((char *)winid, sizeof(winid), "%d", wp->w_id); | |
2802 | |
2803 recursive = TRUE; | |
2804 apply_autocmds(EVENT_WINSCROLLED, winid, winid, FALSE, wp->w_buffer); | |
2805 recursive = FALSE; | |
2806 | |
2807 wp->w_last_topline = wp->w_topline; | |
2808 wp->w_last_leftcol = wp->w_leftcol; | |
2809 wp->w_last_width = wp->w_width; | |
2810 wp->w_last_height = wp->w_height; | |
2811 } | |
2785 } | 2812 } |
2786 | 2813 |
2787 /* | 2814 /* |
2788 * Close window "win" in tab page "tp", which is not the current tab page. | 2815 * Close window "win" in tab page "tp", which is not the current tab page. |
2789 * This may be the last window in that tab page and result in closing the tab, | 2816 * This may be the last window in that tab page and result in closing the tab, |