comparison src/terminal.c @ 13894:3969c9d3a859 v8.0.1818

patch 8.0.1818: lines remove from wrong buffer when using terminal window commit https://github.com/vim/vim/commit/3f1a53c4349a309c3f4acf358d3cf18f9c455050 Author: Bram Moolenaar <Bram@vim.org> Date: Sat May 12 16:55:14 2018 +0200 patch 8.0.1818: lines remove from wrong buffer when using terminal window Problem: Lines remove from wrong buffer when using terminal window. Solution: Make sure to use tl_buffer.
author Christian Brabandt <cb@256bit.org>
date Sat, 12 May 2018 17:00:06 +0200
parents 81e8e6181aeb
children f71ed35527eb
comparison
equal deleted inserted replaced
13893:2a15ae6c368b 13894:3969c9d3a859
1460 cleanup_scrollback(term_T *term) 1460 cleanup_scrollback(term_T *term)
1461 { 1461 {
1462 sb_line_T *line; 1462 sb_line_T *line;
1463 garray_T *gap; 1463 garray_T *gap;
1464 1464
1465 curbuf = term->tl_buffer;
1465 gap = &term->tl_scrollback; 1466 gap = &term->tl_scrollback;
1466 while (curbuf->b_ml.ml_line_count > term->tl_scrollback_scrolled 1467 while (curbuf->b_ml.ml_line_count > term->tl_scrollback_scrolled
1467 && gap->ga_len > 0) 1468 && gap->ga_len > 0)
1468 { 1469 {
1469 ml_delete(curbuf->b_ml.ml_line_count, FALSE); 1470 ml_delete(curbuf->b_ml.ml_line_count, FALSE);
1470 line = (sb_line_T *)gap->ga_data + gap->ga_len - 1; 1471 line = (sb_line_T *)gap->ga_data + gap->ga_len - 1;
1471 vim_free(line->sb_cells); 1472 vim_free(line->sb_cells);
1472 --gap->ga_len; 1473 --gap->ga_len;
1473 } 1474 }
1474 check_cursor(); 1475 curbuf = curwin->w_buffer;
1476 if (curbuf == term->tl_buffer)
1477 check_cursor();
1475 } 1478 }
1476 1479
1477 /* 1480 /*
1478 * Add the current lines of the terminal to scrollback and to the buffer. 1481 * Add the current lines of the terminal to scrollback and to the buffer.
1479 * Called after the job has ended and when switching to Terminal-Normal mode. 1482 * Called after the job has ended and when switching to Terminal-Normal mode.
1493 if (term->tl_vterm == NULL) 1496 if (term->tl_vterm == NULL)
1494 return; 1497 return;
1495 1498
1496 /* Nothing to do if the buffer already has the lines and nothing was 1499 /* Nothing to do if the buffer already has the lines and nothing was
1497 * changed. */ 1500 * changed. */
1498 if (!term->tl_dirty_snapshot 1501 if (!term->tl_dirty_snapshot && term->tl_buffer->b_ml.ml_line_count
1499 && curbuf->b_ml.ml_line_count > term->tl_scrollback_scrolled) 1502 > term->tl_scrollback_scrolled)
1500 return; 1503 return;
1501 1504
1502 ch_log(term->tl_job == NULL ? NULL : term->tl_job->jv_channel, 1505 ch_log(term->tl_job == NULL ? NULL : term->tl_job->jv_channel,
1503 "Adding terminal window snapshot to buffer"); 1506 "Adding terminal window snapshot to buffer");
1504 1507