From ef5db2132e871e12c667bc2147e94c2cabf37729 Mon Sep 17 00:00:00 2001 From: whitequark Date: Wed, 13 Jan 2016 11:55:45 +0000 Subject: [PATCH] Ignore text window scroll events if edit control is visible. After commit 11f29b12, we no longer have a convenient way to indicate that the edit control should be moved without changing its contents; the old code trying to do this caused a crash, since constructing an std::string from a NULL char* is invalid. This went undetected during testing, since on Linux, recent GTK versions will munge scroll events while the edit box has a modal grab. I could've fixed the feature, but opted to remove it, since being able to scroll the edit box out of visible region is more likely to result in confusion than ever be useful. --- src/textwin.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/textwin.cpp b/src/textwin.cpp index e20d233..59e28a2 100644 --- a/src/textwin.cpp +++ b/src/textwin.cpp @@ -1042,6 +1042,9 @@ void TextWindow::MouseLeave(void) { } void TextWindow::ScrollbarEvent(int newPos) { + if(TextEditControlIsVisible()) + return; + int bottom = top[rows-1] + 2; newPos = min(newPos, bottom - halfRows); newPos = max(newPos, 0); @@ -1049,10 +1052,6 @@ void TextWindow::ScrollbarEvent(int newPos) { if(newPos != scrollPos) { scrollPos = newPos; MoveTextScrollbarTo(scrollPos, top[rows - 1] + 1, halfRows); - - if(TextEditControlIsVisible()) { - ShowEditControl(editControl.halfRow, editControl.col, NULL); - } InvalidateText(); } }