Mercurial > vim
diff src/if_py_both.h @ 11959:91a26b7a4119 v8.0.0860
patch 8.0.0860: side effects when channel appends to a buffer
commit https://github.com/vim/vim/commit/6b7355a30ddd294c19cd9be924d487d592ccfae1
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Aug 4 21:37:54 2017 +0200
patch 8.0.0860: side effects when channel appends to a buffer
Problem: There may be side effects when a channel appends to a buffer that
is not the current buffer.
Solution: Properly switch to another buffer before appending. (Yasuhiro
Matsumoto, closes #1926, closes #1937)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Fri, 04 Aug 2017 21:45:04 +0200 |
parents | 698ee9d4fe9f |
children | 68d7bc045dbe |
line wrap: on
line diff
--- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -4263,43 +4263,6 @@ py_fix_cursor(linenr_T lo, linenr_T hi, } /* - * Find a window that contains "buf" and switch to it. - * If there is no such window, use the current window and change "curbuf". - * Caller must initialize save_curbuf to NULL. - * restore_win_for_buf() MUST be called later! - */ - static void -switch_to_win_for_buf( - buf_T *buf, - win_T **save_curwinp, - tabpage_T **save_curtabp, - bufref_T *save_curbuf) -{ - win_T *wp; - tabpage_T *tp; - - if (find_win_for_buf(buf, &wp, &tp) == FAIL) - switch_buffer(save_curbuf, buf); - else if (switch_win(save_curwinp, save_curtabp, wp, tp, TRUE) == FAIL) - { - restore_win(*save_curwinp, *save_curtabp, TRUE); - switch_buffer(save_curbuf, buf); - } -} - - static void -restore_win_for_buf( - win_T *save_curwin, - tabpage_T *save_curtab, - bufref_T *save_curbuf) -{ - if (save_curbuf->br_buf == NULL) - restore_win(save_curwin, save_curtab, TRUE); - else - restore_buffer(save_curbuf); -} - -/* * Replace a line in the specified buffer. The line number is * in Vim format (1-based). The replacement line is given as * a Python string object. The object is checked for validity