ยง General enough special cases
- Also, I feel thanks to thinking about combinatorial objects for a while I've gained some kind of "confidence", where I check a special case which I am confident generalizes well.
void editor_state_backspace_char(EditorState& s) {
assert(s.loc.line <= s.contents.size());
if (s.loc.line == s.contents.size()) { return; }
std::string& curline = s.contents[s.loc.line];
assert(s.loc.col <= curline.size());
if (s.loc.col == 0) { return; }
std::string tafter(curline.begin() + s.loc.col, curline.end());
curline.resize(s.loc.col - 1);
curline += tafter;
s.loc.col--;
}