From 2cc4c3f08a419eb7e727b2ef4074b481c7334ac6 Mon Sep 17 00:00:00 2001 From: Tobias Predel Date: Mon, 4 Nov 2024 23:17:06 +0100 Subject: [PATCH] Only erase Selections as so much as they exist --- src/document.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/document.h b/src/document.h index 8205e26d..3f10a8df 100644 --- a/src/document.h +++ b/src/document.h @@ -507,7 +507,8 @@ struct Document { if (drawroot->grid && drawroot->grid->folded) SetSelect(drawroot->parent->grid->FindCell(drawroot)); } - while (len < drawpath.size()) drawpath.erase(drawpath.begin()); + auto diff = (int)drawpath.size() - max(0, len); + if (diff > 0) drawpath.erase(drawpath.begin(), drawpath.begin() + diff); } void Zoom(int dir, wxDC &dc, bool fromroot = false) {