From b935bc6bf35618ac91274882e396a156722d5da4 Mon Sep 17 00:00:00 2001 From: Udo Hoffmann Date: Thu, 25 Jun 2020 00:20:02 +0200 Subject: [PATCH] Fix URL is not clickable in certain stuation while wrapped is enabled Fix #5503, close #8467 --- .../src/ScitillaComponent/ScintillaEditView.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index fb60d7e6..879300b6 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -2257,15 +2257,12 @@ void ScintillaEditView::replaceSelWith(const char * replaceText) void ScintillaEditView::getVisibleStartAndEndPosition(int * startPos, int * endPos) { assert(startPos != NULL && endPos != NULL); + // Get the position of the 1st and last showing chars from the edit view + RECT rcEditView; + getClientRect(rcEditView); + *startPos = static_cast(execute(SCI_POSITIONFROMPOINT, 0, 0)); + *endPos = static_cast(execute(SCI_POSITIONFROMPOINT, rcEditView.right - rcEditView.left, rcEditView.bottom - rcEditView.top)); - auto firstVisibleLine = execute(SCI_GETFIRSTVISIBLELINE); - *startPos = static_cast(execute(SCI_POSITIONFROMLINE, execute(SCI_DOCLINEFROMVISIBLE, firstVisibleLine))); - auto linesOnScreen = execute(SCI_LINESONSCREEN); - auto lineCount = execute(SCI_GETLINECOUNT); - auto visibleLine = execute(SCI_DOCLINEFROMVISIBLE, firstVisibleLine + min(linesOnScreen, lineCount)); - *endPos = static_cast(execute(SCI_POSITIONFROMLINE, visibleLine)); - if (*endPos == -1) - *endPos = static_cast(execute(SCI_GETLENGTH)); } char * ScintillaEditView::getWordFromRange(char * txt, int size, int pos1, int pos2)