Skip to content

Commit

Permalink
Wrap as you type on multiple cell selection
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiolo committed Jan 19, 2024
1 parent cd38ec4 commit 9ae20c0
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/document.h
Original file line number Diff line number Diff line change
Expand Up @@ -972,10 +972,13 @@ struct Document {
} else if (uk >= ' ') {
if (!selected.g) return NoSel();
Cell *c = selected.ThinExpand(this);
if (!c) return OneCell();
if (!c) {
selected.Wrap(this);
c = selected.GetCell();
}
c->AddUndo(this); // FIXME: not needed for all keystrokes, or at least, merge all
// keystroke undos within same cell
ShiftToCenter(dc);
c->AddUndo(this); // FIXME: not needed for all keystrokes, or at least, merge all
// keystroke undos within same cell
c->text.Key(this, uk, selected);
ScrollIfSelectionOutOfView(dc, selected, true);
return nullptr;
Expand Down Expand Up @@ -2216,7 +2219,7 @@ struct Document {
bool LastUndoSameCellTextEdit(Cell *c) {
// hacky way to detect word boundaries to stop coalescing, but works, and
// not a big deal if selected is not actually related to this cell
return undolist.size() && !c->grid && undolist.size() != undolistsizeatfullsave &&
return undolist.size() && undolist.size() != undolistsizeatfullsave &&
undolist.last()->sel.EqLoc(c->parent->grid->FindCell(c)) &&
(!c->text.t.EndsWith(" ") || c->text.t.Len() != selected.cursor);
}
Expand Down

0 comments on commit 9ae20c0

Please sign in to comment.