Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
11958:052270a67371 | 11959:91a26b7a4119 |
---|---|
4258 else | 4258 else |
4259 check_cursor_col(); | 4259 check_cursor_col(); |
4260 changed_cline_bef_curs(); | 4260 changed_cline_bef_curs(); |
4261 } | 4261 } |
4262 invalidate_botline(); | 4262 invalidate_botline(); |
4263 } | |
4264 | |
4265 /* | |
4266 * Find a window that contains "buf" and switch to it. | |
4267 * If there is no such window, use the current window and change "curbuf". | |
4268 * Caller must initialize save_curbuf to NULL. | |
4269 * restore_win_for_buf() MUST be called later! | |
4270 */ | |
4271 static void | |
4272 switch_to_win_for_buf( | |
4273 buf_T *buf, | |
4274 win_T **save_curwinp, | |
4275 tabpage_T **save_curtabp, | |
4276 bufref_T *save_curbuf) | |
4277 { | |
4278 win_T *wp; | |
4279 tabpage_T *tp; | |
4280 | |
4281 if (find_win_for_buf(buf, &wp, &tp) == FAIL) | |
4282 switch_buffer(save_curbuf, buf); | |
4283 else if (switch_win(save_curwinp, save_curtabp, wp, tp, TRUE) == FAIL) | |
4284 { | |
4285 restore_win(*save_curwinp, *save_curtabp, TRUE); | |
4286 switch_buffer(save_curbuf, buf); | |
4287 } | |
4288 } | |
4289 | |
4290 static void | |
4291 restore_win_for_buf( | |
4292 win_T *save_curwin, | |
4293 tabpage_T *save_curtab, | |
4294 bufref_T *save_curbuf) | |
4295 { | |
4296 if (save_curbuf->br_buf == NULL) | |
4297 restore_win(save_curwin, save_curtab, TRUE); | |
4298 else | |
4299 restore_buffer(save_curbuf); | |
4300 } | 4263 } |
4301 | 4264 |
4302 /* | 4265 /* |
4303 * Replace a line in the specified buffer. The line number is | 4266 * Replace a line in the specified buffer. The line number is |
4304 * in Vim format (1-based). The replacement line is given as | 4267 * in Vim format (1-based). The replacement line is given as |