Text Editor Shifting Mechanics
- GARTHWILSON
- Forum Moderator
- Posts: 8773
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: Text Editor Shifting Mechanics
It looks like a really good resource, except that none of the diagrams show up for me, only text.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
- BigDumbDinosaur
- Posts: 9425
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: Text Editor Shifting Mechanics
GARTHWILSON wrote:
...none of the diagrams show up for me, only text.
x86? We ain't got no x86. We don't NEED no stinking x86!
Re: Text Editor Shifting Mechanics
No True Scotsman wrote:
BigDumbDinosaur wrote:
gfoot wrote:
I don't remember what it is called but it's a method where characters before the cursor are stored at the start of the block and characters after the cursor are at the end of the block, with a big gap in between to allow fast editing. When the cursor moves (or at least when an edit starts) you move a chunk of data to create this situation before inserting the new text.
Re: Text Editor Shifting Mechanics
Edit: agree, gfoot is describing a gap buffer.
It looks to me like the piece table is more fine-grained than the gap buffer (so, thanks for the pointer to that!) Also it keeps the original file in one buffer, and additions in a second (growing) buffer. It might be that it's quicker but uses more memory - depending on how big the gap might have been.
Edit to add
It looks to me like the piece table is more fine-grained than the gap buffer (so, thanks for the pointer to that!) Also it keeps the original file in one buffer, and additions in a second (growing) buffer. It might be that it's quicker but uses more memory - depending on how big the gap might have been.
Edit to add
Quote:
Undo is just a matter of keeping the right piece descriptors
around. Unlimited undoes can be easily supported.
around. Unlimited undoes can be easily supported.
-
No True Scotsman
- Posts: 127
- Joined: 22 Mar 2023
Re: Text Editor Shifting Mechanics
I found an object-oriented implementation of the piece table in JavaScript, if anybody wants to examine it.
The syntax is close enough to Java and C++ to serve as pseudocode for instructional purposes. I haven't delved into this yet myself, but I'll definitely be wanting a rudimentary text editor as a core component of my 6502 system. My preliminary research into writing a text editor herded me in the direction of the piece table. It may have even been the above referenced text that sent me down that road.
It's important to me that the application be completely decoupled from the on-screen visual presentation, as the latter will be farmed out to a serial terminal running on an ESP32 microcontroller board.
It's important to me that the application be completely decoupled from the on-screen visual presentation, as the latter will be farmed out to a serial terminal running on an ESP32 microcontroller board.