diff --git a/ChangeLog b/ChangeLog index 3524eb49..f25711a9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2023-04-04 Markus Gans + * Avoid printing scrollbar overrun on emit callback + 2023-04-02 Markus Gans * Implementation of the mouse selection in the FTextView. Can be activated by setSelectable() diff --git a/final/widget/fscrollbar.cpp b/final/widget/fscrollbar.cpp index e4003784..31afe2cc 100644 --- a/final/widget/fscrollbar.cpp +++ b/final/widget/fscrollbar.cpp @@ -763,8 +763,10 @@ void FScrollbar::avoidScrollOvershoot() //---------------------------------------------------------------------- void FScrollbar::processScroll() { + startDrawing(); // Avoid printing an overshoot on the emit callback emitCallback("change-value"); avoidScrollOvershoot(); + finishDrawing(); } //---------------------------------------------------------------------- diff --git a/final/widget/ftextview.cpp b/final/widget/ftextview.cpp index 0ac6e55b..a88d4a7e 100644 --- a/final/widget/ftextview.cpp +++ b/final/widget/ftextview.cpp @@ -121,7 +121,7 @@ auto FTextView::getSelectedText() const -> FString line = iter->text.toWString(); if ( iter == last ) - line = line.substr(0, end_col + 1); + line.resize(end_col + 1); selected_text += FString(line) + L'\n'; // Add newline character ++iter; diff --git a/test/fkeyboard-test.cpp b/test/fkeyboard-test.cpp index b0386c28..7d7a929a 100644 --- a/test/fkeyboard-test.cpp +++ b/test/fkeyboard-test.cpp @@ -3,7 +3,7 @@ * * * This file is part of the FINAL CUT widget toolkit * * * -* Copyright 2018-2023 Markus Gans * +* Copyright 2018-2024 Markus Gans * * * * FINAL CUT is free software; you can redistribute it and/or modify * * it under the terms of the GNU Lesser General Public License as * @@ -330,7 +330,8 @@ class FKeyboardTest : public CPPUNIT_NS::TestFixture // End of test suite definition CPPUNIT_TEST_SUITE_END(); void init(); - void input (std::string); + template + void input (CharT&&); void processInput(); void clear(); void keyPressed(); @@ -3183,7 +3184,8 @@ void FKeyboardTest::init() } //---------------------------------------------------------------------- -void FKeyboardTest::input (std::string s) +template +void FKeyboardTest::input (CharT&& string) { // Simulates keystrokes @@ -3191,6 +3193,7 @@ void FKeyboardTest::input (std::string s) auto stdin_no = finalcut::FTermios::getStdIn(); fflush(stdout); + std::string s = std::forward(string); std::string::const_iterator iter; iter = s.begin();