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.
pull/4/head
whitequark 2016-01-13 11:55:45 +00:00
parent 5e5ef3be3e
commit ef5db2132e
1 changed files with 3 additions and 4 deletions

View File

@ -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();
}
}