This may be beyond the scope of Geany, but it looks like `vi` was designed to 
be efficient for use on a 300 baud modem, so it loads lines on demand. It may 
be worth looking into the source code, yet is a bit hackish.  

> "Author of Scintilla here. Scintilla does not use a list of lines. The text 
> is stored in a gap buffer (the substance field in the code shown), like 
> EMACS. Line start positions (added by the InsertLine method) are also stored 
> in a gap buffer but with a 'step' which enables modifications in close 
> proximity to affect few elements."

> What is inefficient about this is if you have a giant line, Scintilla will 
> slow right down, because it goes through every character in the block to 
> determine where new lines are. So if you copy & paste from an external 
> source, you could potentially see a slow down. As a code editor though, this 
> should rarely be a problem. Like GtkTextView, Scintilla's Editor interface is 
> lacking key binding overlays to allow users to use Vi or Emacs keybindings 
> out of the box.

https://ecc-comp.blogspot.com/2015/05/a-brief-glance-at-how-5-text-editors.html

>From what I've read, the main problem has to do with dynamic line sizes, 
>Geany/Scintilla doesn't know where the next line will end so it has to scan 
>every character to keep its loaded undo buffer. I'm not sure why you guys 
>reported that it consumes twice the size of the file size. It sounds like it 
>shouldn't, but it I don't have time to test it at the moment. 

Not sure if it would be possible to improve geany to using a static line size 
setting that eliminates the scanning and possibly the dynamic undo buffer to 
ensure memory is not allocated if its not necessary. 

It would also be nice to warn the user if Geany is in danger of running out of 
memory. Then a user could commit changes as necessary and reset the undo buffer 
while not continuing to consume more memory. 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/issues/1569#issuecomment-320127293

Reply via email to