Mercurial > vim
comparison src/memline.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 | d067be761cd7 |
children | 9064044fd4f6 |
comparison
equal
deleted
inserted
replaced
20598:d14c5a4a8dfa | 20599:d571231175b4 |
---|---|
1384 /* | 1384 /* |
1385 * Now that we are sure that the file is going to be recovered, clear the | 1385 * Now that we are sure that the file is going to be recovered, clear the |
1386 * contents of the current buffer. | 1386 * contents of the current buffer. |
1387 */ | 1387 */ |
1388 while (!(curbuf->b_ml.ml_flags & ML_EMPTY)) | 1388 while (!(curbuf->b_ml.ml_flags & ML_EMPTY)) |
1389 ml_delete((linenr_T)1, FALSE); | 1389 ml_delete((linenr_T)1); |
1390 | 1390 |
1391 /* | 1391 /* |
1392 * Try reading the original file to obtain the values of 'fileformat', | 1392 * Try reading the original file to obtain the values of 'fileformat', |
1393 * 'fileencoding', etc. Ignore errors. The text itself is not used. | 1393 * 'fileencoding', etc. Ignore errors. The text itself is not used. |
1394 * When the file is encrypted the user is asked to enter the key. | 1394 * When the file is encrypted the user is asked to enter the key. |
1662 * Delete the lines from the original file and the dummy line from the | 1662 * Delete the lines from the original file and the dummy line from the |
1663 * empty buffer. These will now be after the last line in the buffer. | 1663 * empty buffer. These will now be after the last line in the buffer. |
1664 */ | 1664 */ |
1665 while (curbuf->b_ml.ml_line_count > lnum | 1665 while (curbuf->b_ml.ml_line_count > lnum |
1666 && !(curbuf->b_ml.ml_flags & ML_EMPTY)) | 1666 && !(curbuf->b_ml.ml_flags & ML_EMPTY)) |
1667 ml_delete(curbuf->b_ml.ml_line_count, FALSE); | 1667 ml_delete(curbuf->b_ml.ml_line_count); |
1668 curbuf->b_flags |= BF_RECOVERED; | 1668 curbuf->b_flags |= BF_RECOVERED; |
1669 | 1669 |
1670 recoverymode = FALSE; | 1670 recoverymode = FALSE; |
1671 if (got_int) | 1671 if (got_int) |
1672 emsg(_("E311: Recovery Interrupted")); | 1672 emsg(_("E311: Recovery Interrupted")); |
3703 * deleted_lines() after this. | 3703 * deleted_lines() after this. |
3704 * | 3704 * |
3705 * return FAIL for failure, OK otherwise | 3705 * return FAIL for failure, OK otherwise |
3706 */ | 3706 */ |
3707 int | 3707 int |
3708 ml_delete(linenr_T lnum, int message) | 3708 ml_delete(linenr_T lnum) |
3709 { | 3709 { |
3710 return ml_delete_flags(lnum, message ? ML_DEL_MESSAGE : 0); | 3710 return ml_delete_flags(lnum, 0); |
3711 } | 3711 } |
3712 | 3712 |
3713 /* | 3713 /* |
3714 * Like ml_delete() but using flags (see ml_delete_int()). | 3714 * Like ml_delete() but using flags (see ml_delete_int()). |
3715 */ | 3715 */ |