Flávio Etrusco wrote: > On Wed, Mar 4, 2009 at 8:04 PM, Martin Friebe <laza...@mfriebe.de> wrote: > >> To avoid any misunderstanding: >> >> *If* / *Once* BeginUpdate works, then you can insert a batch of say 100 >> lines (with Lines.Add or Lines.Insert). It will scan 101 lines (because >> yes, 1 line needs to be rescanned) >> I do not think we need to worry about the performance between 100 or 101 >> Lines? (Not saying this may not be "fixed", but it would have a very low >> priority "post 1.2") >> >> If you insert a single line, it will scan 2 Lines. True that is not good >> neither. But it will still be so fast that no human can tell the difference. >> >> So I will fix BeginUpdate, *if* it is broken (and I will try to get that >> done for 0.9.28) >> >> But making the changes according to the original description will be >> deferred for later (unless a nice clean patch comes along). >> It may also be that it will become unnecessary due to other changes that >> may be made in future. >> >> >> Do you think fixing BeginUpdate will improve the Situation enough for now? >> >> Best Regards >> Martin >> > > IMO this is pretty good enough, yes. (Not sure it's possible, though) > The important thing is to fix the paste performance; I didn't mean to > be pedantic with the code ;-) > >
There is another way to avoid double scanning of the last line. - Allow the (current/old) last line to be scanned, if a line is appended - But Do not scan the last line of the text, on normal Scans (since the result is not used anyway) From ScanFrom fHighlighter.SetLine(FTheLinesView[Result], Result); fHighlighter.NextToEol; inc(Result); if Result = FTheLinesView.Count then break; As you can see if Result hits Count, the result of NextToEOL is never used fHighlighter.SetLine(FTheLinesView[Result], Result); inc(Result); if Result = FTheLinesView.Count then break; fHighlighter.NextToEol; There are still cases where this is less good than, storing the EndRange instead of the StartRange. but anyway ... Best Regards Martin _______________________________________________ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus