2 ms·
What about giving it all away to SQLite or similar and treat your document as a table with index, and text as rows with parent references? Then you don’t need
by punnerud 3y ago
What about giving it all away to SQLite or similar and treat your document as a table with index, and text as rows with parent references?
Then you don’t need to keep it in memory, can have unlimited undo and hand over to complexity to a solution (SQL) than you know with be there the next 20years
- jdub 3y agoSadly, no one will use your extremely slow text editor.
- thfuran 3y agoWhat happens when someone opens up a 500 MB one-line json blob or something?
- kragen 3y agosql rows don't have to be text lines
- kragen 3y agoit sounds like a reasonable approach, though some algorithms like string search may be trickier to implement than they would be with a simpler data structure, because a string may cross piece boundaries, maybe even more than once you don't even need parent references; you can just assign synthetic sequence identifiers to the pieces and rely on sql lexicographical ordering to put them in order. (sql is not really very good with parent references.) this would be handy when you want to annotate the text with things like line numbers and syntax highlighting information. you wouldn't get undo for free, though