comparison src/terminal.c @ 20599:d571231175b4 v8.2.0853

patch 8.2.0853: ml_delete() often called with FALSE argument Commit: https://github.com/vim/vim/commit/ca70c07b72c24aae3d141e67d08f50361f051af5 Author: Bram Moolenaar <Bram@vim.org> Date: Sat May 30 20:30:46 2020 +0200 patch 8.2.0853: ml_delete() often called with FALSE argument Problem: ml_delete() often called with FALSE argument. Solution: Use ml_delete_flags(x, ML_DEL_MESSAGE) when argument is TRUE.
author Bram Moolenaar <Bram@vim.org>
date Sat, 30 May 2020 20:45:03 +0200
parents 5995db0fe84a
children c81f61e3b508
comparison
equal deleted inserted replaced
20598:d14c5a4a8dfa 20599:d571231175b4
1607 ml_append_buf(term->tl_buffer, lnum, text, len + 1, FALSE); 1607 ml_append_buf(term->tl_buffer, lnum, text, len + 1, FALSE);
1608 if (empty) 1608 if (empty)
1609 { 1609 {
1610 // Delete the empty line that was in the empty buffer. 1610 // Delete the empty line that was in the empty buffer.
1611 curbuf = buf; 1611 curbuf = buf;
1612 ml_delete(1, FALSE); 1612 ml_delete(1);
1613 curbuf = curwin->w_buffer; 1613 curbuf = curwin->w_buffer;
1614 } 1614 }
1615 } 1615 }
1616 1616
1617 static void 1617 static void
1681 curbuf = term->tl_buffer; 1681 curbuf = term->tl_buffer;
1682 gap = &term->tl_scrollback; 1682 gap = &term->tl_scrollback;
1683 while (curbuf->b_ml.ml_line_count > term->tl_scrollback_scrolled 1683 while (curbuf->b_ml.ml_line_count > term->tl_scrollback_scrolled
1684 && gap->ga_len > 0) 1684 && gap->ga_len > 0)
1685 { 1685 {
1686 ml_delete(curbuf->b_ml.ml_line_count, FALSE); 1686 ml_delete(curbuf->b_ml.ml_line_count);
1687 line = (sb_line_T *)gap->ga_data + gap->ga_len - 1; 1687 line = (sb_line_T *)gap->ga_data + gap->ga_len - 1;
1688 vim_free(line->sb_cells); 1688 vim_free(line->sb_cells);
1689 --gap->ga_len; 1689 --gap->ga_len;
1690 } 1690 }
1691 curbuf = curwin->w_buffer; 1691 curbuf = curwin->w_buffer;
3140 curbuf = term->tl_buffer; 3140 curbuf = term->tl_buffer;
3141 for (i = 0; i < todo; ++i) 3141 for (i = 0; i < todo; ++i)
3142 { 3142 {
3143 vim_free(((sb_line_T *)gap->ga_data + i)->sb_cells); 3143 vim_free(((sb_line_T *)gap->ga_data + i)->sb_cells);
3144 if (update_buffer) 3144 if (update_buffer)
3145 ml_delete(1, FALSE); 3145 ml_delete(1);
3146 } 3146 }
3147 curbuf = curwin->w_buffer; 3147 curbuf = curwin->w_buffer;
3148 3148
3149 gap->ga_len -= todo; 3149 gap->ga_len -= todo;
3150 mch_memmove(gap->ga_data, 3150 mch_memmove(gap->ga_data,
5146 semsg(_(e_invarg2), "bufnr"); 5146 semsg(_(e_invarg2), "bufnr");
5147 else 5147 else
5148 { 5148 {
5149 buf = curbuf; 5149 buf = curbuf;
5150 while (!(curbuf->b_ml.ml_flags & ML_EMPTY)) 5150 while (!(curbuf->b_ml.ml_flags & ML_EMPTY))
5151 ml_delete((linenr_T)1, FALSE); 5151 ml_delete((linenr_T)1);
5152 free_scrollback(curbuf->b_term); 5152 free_scrollback(curbuf->b_term);
5153 redraw_later(NOT_VALID); 5153 redraw_later(NOT_VALID);
5154 } 5154 }
5155 } 5155 }
5156 else 5156 else
5181 curwin->w_cursor.lnum = cursor_pos1.row + 1; 5181 curwin->w_cursor.lnum = cursor_pos1.row + 1;
5182 coladvance(cursor_pos1.col); 5182 coladvance(cursor_pos1.col);
5183 } 5183 }
5184 5184
5185 // Delete the empty line that was in the empty buffer. 5185 // Delete the empty line that was in the empty buffer.
5186 ml_delete(1, FALSE); 5186 ml_delete(1);
5187 5187
5188 // For term_dumpload() we are done here. 5188 // For term_dumpload() we are done here.
5189 if (!do_diff) 5189 if (!do_diff)
5190 goto theend; 5190 goto theend;
5191 5191
5372 { 5372 {
5373 p = vim_strsave(ml_get(1)); 5373 p = vim_strsave(ml_get(1));
5374 if (p == NULL) 5374 if (p == NULL)
5375 return OK; 5375 return OK;
5376 ml_append(bot_start, p, 0, FALSE); 5376 ml_append(bot_start, p, 0, FALSE);
5377 ml_delete(1, FALSE); 5377 ml_delete(1);
5378 vim_free(p); 5378 vim_free(p);
5379 } 5379 }
5380 5380
5381 // move lines from bottom to the top 5381 // move lines from bottom to the top
5382 for (lnum = 1; lnum <= bot_rows; ++lnum) 5382 for (lnum = 1; lnum <= bot_rows; ++lnum)
5383 { 5383 {
5384 p = vim_strsave(ml_get(bot_start + lnum)); 5384 p = vim_strsave(ml_get(bot_start + lnum));
5385 if (p == NULL) 5385 if (p == NULL)
5386 return OK; 5386 return OK;
5387 ml_delete(bot_start + lnum, FALSE); 5387 ml_delete(bot_start + lnum);
5388 ml_append(lnum - 1, p, 0, FALSE); 5388 ml_append(lnum - 1, p, 0, FALSE);
5389 vim_free(p); 5389 vim_free(p);
5390 } 5390 }
5391 5391
5392 // move top title to bottom 5392 // move top title to bottom
5393 p = vim_strsave(ml_get(bot_rows + 1)); 5393 p = vim_strsave(ml_get(bot_rows + 1));
5394 if (p == NULL) 5394 if (p == NULL)
5395 return OK; 5395 return OK;
5396 ml_append(line_count - top_rows - 1, p, 0, FALSE); 5396 ml_append(line_count - top_rows - 1, p, 0, FALSE);
5397 ml_delete(bot_rows + 1, FALSE); 5397 ml_delete(bot_rows + 1);
5398 vim_free(p); 5398 vim_free(p);
5399 5399
5400 // move bottom title to top 5400 // move bottom title to top
5401 p = vim_strsave(ml_get(line_count - top_rows)); 5401 p = vim_strsave(ml_get(line_count - top_rows));
5402 if (p == NULL) 5402 if (p == NULL)
5403 return OK; 5403 return OK;
5404 ml_delete(line_count - top_rows, FALSE); 5404 ml_delete(line_count - top_rows);
5405 ml_append(bot_rows, p, 0, FALSE); 5405 ml_append(bot_rows, p, 0, FALSE);
5406 vim_free(p); 5406 vim_free(p);
5407 5407
5408 if (top_rows == bot_rows) 5408 if (top_rows == bot_rows)
5409 { 5409 {