From c295649280b2684dcb9f9900497d48229e5df74e Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Wed, 1 Jun 2022 20:52:35 +0800 Subject: [PATCH] - fix: errors in the calculation of cut limit --- NEWS.md | 1 + RedPandaIDE/editor.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index 554e0ed4..c0975b1b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,6 +5,7 @@ Red Panda C++ Version 1.0.10 - fix: #define followed by tab not correctly parsed - enhancement: don't auto add () when completing C++ io manipulators ( std::endl, std::fixed, etc.) - fix: can't goto to definition of std::endl + - fix: errors in the calculation of cut limit Red Panda C++ Version 1.0.9 - fix: selection in column mode not correctly drawn when has wide chars in it diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index a818eaae..430feab0 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -1305,12 +1305,14 @@ void Editor::copyToClipboard() void Editor::cutToClipboard() { if (pSettings->editor().copySizeLimit()) { - if (document()->count() > pSettings->editor().copyLineLimits()) { + int startLine = blockBegin().Line; + int endLine = blockEnd().Line; + if ((endLine-startLine+1) > pSettings->editor().copyLineLimits()) { QMessageBox::critical(pMainWindow,tr("Error"), tr("The text to be cut exceeds count limit!")); return; } - if (document()->getTextLength() > pSettings->editor().copyCharLimits() * 1000) { + if ((selText().length()) > pSettings->editor().copyCharLimits() * 1000) { QMessageBox::critical(pMainWindow,tr("Error"), tr("The text to be cut exceeds character limit!")); return;