comparison src/fileio.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 05b4efb062a7
children c2beb6baa42c
comparison
equal deleted inserted replaced
20598:d14c5a4a8dfa 20599:d571231175b4
860 error = TRUE; 860 error = TRUE;
861 goto failed; 861 goto failed;
862 } 862 }
863 // Delete the previously read lines. 863 // Delete the previously read lines.
864 while (lnum > from) 864 while (lnum > from)
865 ml_delete(lnum--, FALSE); 865 ml_delete(lnum--);
866 file_rewind = FALSE; 866 file_rewind = FALSE;
867 if (set_options) 867 if (set_options)
868 { 868 {
869 curbuf->b_p_bomb = FALSE; 869 curbuf->b_p_bomb = FALSE;
870 curbuf->b_start_bomb = FALSE; 870 curbuf->b_start_bomb = FALSE;
2290 if (newfile && wasempty && !(curbuf->b_ml.ml_flags & ML_EMPTY)) 2290 if (newfile && wasempty && !(curbuf->b_ml.ml_flags & ML_EMPTY))
2291 { 2291 {
2292 #ifdef FEAT_NETBEANS_INTG 2292 #ifdef FEAT_NETBEANS_INTG
2293 netbeansFireChanges = 0; 2293 netbeansFireChanges = 0;
2294 #endif 2294 #endif
2295 ml_delete(curbuf->b_ml.ml_line_count, FALSE); 2295 ml_delete(curbuf->b_ml.ml_line_count);
2296 #ifdef FEAT_NETBEANS_INTG 2296 #ifdef FEAT_NETBEANS_INTG
2297 netbeansFireChanges = 1; 2297 netbeansFireChanges = 1;
2298 #endif 2298 #endif
2299 --linecnt; 2299 --linecnt;
2300 } 2300 }
3931 // Delete all the lines in "frombuf". 3931 // Delete all the lines in "frombuf".
3932 if (retval != FAIL) 3932 if (retval != FAIL)
3933 { 3933 {
3934 curbuf = frombuf; 3934 curbuf = frombuf;
3935 for (lnum = curbuf->b_ml.ml_line_count; lnum > 0; --lnum) 3935 for (lnum = curbuf->b_ml.ml_line_count; lnum > 0; --lnum)
3936 if (ml_delete(lnum, FALSE) == FAIL) 3936 if (ml_delete(lnum) == FAIL)
3937 { 3937 {
3938 // Oops! We could try putting back the saved lines, but that 3938 // Oops! We could try putting back the saved lines, but that
3939 // might fail again... 3939 // might fail again...
3940 retval = FAIL; 3940 retval = FAIL;
3941 break; 3941 break;
4327 if (savebuf != NULL && bufref_valid(&bufref) && buf == curbuf) 4327 if (savebuf != NULL && bufref_valid(&bufref) && buf == curbuf)
4328 { 4328 {
4329 // Put the text back from the save buffer. First 4329 // Put the text back from the save buffer. First
4330 // delete any lines that readfile() added. 4330 // delete any lines that readfile() added.
4331 while (!BUFEMPTY()) 4331 while (!BUFEMPTY())
4332 if (ml_delete(buf->b_ml.ml_line_count, FALSE) == FAIL) 4332 if (ml_delete(buf->b_ml.ml_line_count) == FAIL)
4333 break; 4333 break;
4334 (void)move_lines(savebuf, buf); 4334 (void)move_lines(savebuf, buf);
4335 } 4335 }
4336 } 4336 }
4337 else if (buf == curbuf) // "buf" still valid 4337 else if (buf == curbuf) // "buf" still valid