Skip to content

Instantly share code, notes, and snippets.

@michicc
Created September 13, 2023 19:43
Show Gist options
  • Save michicc/59a204d99d0321ae4592b4b9d32ad93a to your computer and use it in GitHub Desktop.
Save michicc/59a204d99d0321ae4592b4b9d32ad93a to your computer and use it in GitHub Desktop.
diff --git a/src/textbuf.cpp b/src/textbuf.cpp
index 388e480211..59e8d69e23 100644
--- a/src/textbuf.cpp
+++ b/src/textbuf.cpp
@@ -271,8 +271,10 @@ void Textbuf::DiscardMarkedText(bool update)
{
if (this->markend == 0) return;
- this->DeleteText(this->markpos, this->markend, update);
+ uint16_t old_markpos = this->markpos;
+ uint16_t old_markend = this->markend;
this->markpos = this->markend = this->markxoffs = this->marklength = 0;
+ this->DeleteText(old_markpos, old_markend, update);
}
/**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment