diff options
author | Zufu Liu <unknown> | 2024-03-23 09:08:06 +1100 |
---|---|---|
committer | Zufu Liu <unknown> | 2024-03-23 09:08:06 +1100 |
commit | d8b5fc5dd9542e011974803ae5bdc0190baed774 (patch) | |
tree | dcb41393f388aacadb703cca66cc84578f7d3c5f | |
parent | 9e9569bf65242305777562263cdacffbf99d03f5 (diff) | |
download | scintilla-mirror-d8b5fc5dd9542e011974803ae5bdc0190baed774.tar.gz |
Feature [feature-requests:#1512]. Simplify ScaledVector::PushBack.
Prefer UndoActions::Length to UndoActions::lengths.ValueAt.
-rw-r--r-- | src/UndoHistory.cxx | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/UndoHistory.cxx b/src/UndoHistory.cxx index 929c8743e..c4b241103 100644 --- a/src/UndoHistory.cxx +++ b/src/UndoHistory.cxx @@ -120,7 +120,7 @@ void ScaledVector::ReSize(size_t length) { } void ScaledVector::PushBack() { - ReSize(Size() + 1); + bytes.resize(bytes.size() + element.size); } size_t ScaledVector::SizeInBytes() const noexcept { @@ -496,9 +496,9 @@ std::string_view UndoHistory::Text(int action) noexcept { position = memory->position; } for (; act < action; act++) { - position += actions.lengths.ValueAt(act); + position += actions.Length(act); } - const size_t length = actions.lengths.ValueAt(action); + const size_t length = actions.Length(action); const char *scrap = scraps->TextAt(position); memory = {action, position}; return {scrap, length}; @@ -581,7 +581,7 @@ Action UndoHistory::GetUndoStep() const noexcept { } void UndoHistory::CompletedUndoStep() noexcept { - scraps->MoveBack(actions.lengths.ValueAt(PreviousAction())); + scraps->MoveBack(actions.Length(PreviousAction())); currentAction--; } @@ -624,7 +624,7 @@ Action UndoHistory::GetRedoStep() const noexcept { } void UndoHistory::CompletedRedoStep() noexcept { - scraps->MoveForward(actions.lengths.ValueAt(currentAction)); + scraps->MoveForward(actions.Length(currentAction)); currentAction++; } |