2009/4/29 Bram Moolenaar <[email protected]>: > > Dominique Pelle wrote: > >> Once in a while, I see that Vim enters an endless loop and takes 100% of >> the CPU. I've seen this bug a couple times when using the Perforce plugin: >> I try to edit file, the perforce plugin asks to checkout the file, I enter >> 'Y', >> the file gets checked-out but then Vim sometimes loops forever using >> 100% of the CPU!? > > We can use the return value of del_char() to break the loop. But I > wonder how the cursor ever ended up pointing beyond the end of the line. > I suppose some auto-indenting was done, which the loop is supposed to > remove. Either something happened in between the auto-indenting and > setting end_insert_pos, or there never was any auto-indenting.
I don't think I indented anything since I was just checking out the file (it was thus read-only before checking out). The perforce plugin (perforce-4.1.zip available at http://www.vim.org/scripts/script.php?script_id=240) did check-out the file, but Vim entered the endless loop right afterwards before I got a chance to modify it. I tried to reproduce the bug without success so far. But since I saw this bug more than once in the past, I may see it again. In the mean time, I've added the following assert in ml_get_cursor() to catch the bug if cursor happens to be beyond the end of line again (so far it does not happen): 2061 char_u * 2062 ml_get_cursor() 2063 { 2064 char_u *tmp = ml_get_buf(curbuf, curwin->w_cursor.lnum, FALSE); 2065 int len = STRLEN(tmp); 2066 assert(curwin->w_cursor.col <= len); 2067 return (tmp + curwin->w_cursor.col); 2068 } -- Dominique --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
