File tree 1 file changed +9
-4
lines changed
src/main/java/com/refinedmods/refinedstorage/screen/widget
1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -47,17 +47,22 @@ private boolean canSyncFromJEINow() {
47
47
48
48
@ Override
49
49
public boolean mouseClicked (double mouseX , double mouseY , int mouseButton ) {
50
- boolean wasFocused = isFocused ();
51
-
52
50
boolean result = super .mouseClicked (mouseX , mouseY , mouseButton );
53
-
54
51
boolean clickedWidget = mouseX >= this .getX () && mouseX < this .getX () + this .width && mouseY >= this .getY () && mouseY < this .getY () + this .height ;
55
52
56
53
if (clickedWidget && mouseButton == 1 ) {
54
+ // On right click, clear the widget and focus, save history if necessary.
55
+ if (isFocused ()) {
56
+ saveHistory ()
57
+ }
57
58
setValue ("" );
58
59
setFocused (true );
59
- } else if (wasFocused != isFocused ()) {
60
+ }
61
+
62
+ if (!clickedWidget && isFocused ()) {
63
+ // If we are focused, and we click outside the search box, lose focus.
60
64
saveHistory ();
65
+ setFocused (false );
61
66
}
62
67
63
68
return result ;
You can’t perform that action at this time.
0 commit comments