diff options
author | Neil Hodgson <nyamatongwe@gmail.com> | 2023-03-02 16:46:14 +1100 |
---|---|---|
committer | Neil Hodgson <nyamatongwe@gmail.com> | 2023-03-02 16:46:14 +1100 |
commit | c61df8742a4865ac9c67f8ed017248b82fe5574e (patch) | |
tree | d6872e88601bb6dcdcc0e7b93de125fd33312ca7 /src/Editor.cxx | |
parent | e18633f14c36732d007e8c5bb742cc7d3e69d22d (diff) | |
download | scintilla-mirror-c61df8742a4865ac9c67f8ed017248b82fe5574e.tar.gz |
Cache client size when view moved or sized. That allows access to it from
secondary threads which otherwise shows warnings.
Earlier approach of caching client rectangle failed to handle scrolling.
Diffstat (limited to 'src/Editor.cxx')
-rw-r--r-- | src/Editor.cxx | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index 7144a422d..d64a09deb 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -274,6 +274,11 @@ Sci::Line Editor::TopLineOfMain() const noexcept { return topLine; } +Point Editor::ClientSize() const { + const PRectangle rcClient = GetClientRectangle(); + return Point(rcClient.Width(), rcClient.Height()); +} + PRectangle Editor::GetClientRectangle() const { return wMain.GetClientPosition(); } @@ -290,8 +295,8 @@ PRectangle Editor::GetTextRectangle() const { } Sci::Line Editor::LinesOnScreen() const { - const PRectangle rcClient = GetClientRectangle(); - const int htClient = static_cast<int>(rcClient.bottom - rcClient.top); + const Point sizeClient = ClientSize(); + const int htClient = static_cast<int>(sizeClient.y); //Platform::DebugPrintf("lines on screen = %d\n", htClient / lineHeight + 1); return htClient / vs.lineHeight; } |