Hello. > >> it? Wouldn't that be O(N)? > > > > If the line joining code will always be using data that doesn't change, > > which I think Lua can't depend on, then that would be simpler. I can't > > see why J would have to deal with unexpected line lengths. > > I believe that Vim can depend on the fact that the data of the lines to > be joined won't change between the begin and the end of the join > operation. Of course, it will change after the join is finished. I don't > know how Vim handles insertion of data into a line (so that its length > increases) but I'm sure Bram has foreseen something to avoid memory > overruns.
I tried to select ~100000 lines in the middle of text to the visual block and filter them through the simple external program which joins lines. :'<,'>!./joinlines In this case, vim can't know how many lines will be on the output of the command, so theoretically it is a worse situation for vim (replacing several lines from the middle of the text with an unknown amount of lines). And it took less then one second! And I expect that an internal function (like the one doing 'J' operation) can use more of internal information like the lengths of input lines so it can be more optimized. Milan --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
