On 10/17/22 22:40, Joel wrote: > I have two text fields. The one on the left has the whole text, new > stuff being added to the bottom. The one on the right has text I've been > wiping as I'm reading.
I think this can be modelled as a string array and an index showing where the active part starts:
import std; struct Notes { string[] whole; size_t activeIndex; void add(string line) { whole ~= line; } string[] activeText() { return whole[activeIndex..$]; } void wipeText() { ++activeIndex; } } void main() { auto input = [ "I went for a walk and fell down a hole.", "There was a D guy on the roof.", "That was a tricky problem!", ]; Notes notes; // add() to add() input.each!(line => notes.add(line)); // activeText() will show the active part // wipeText() will move forward } Ali