Mojira Archive
MC-262754

Change in AbstractScrollWidget breaks MultiLineEditBox click-to-move-cursor behaviour

AbstractScrollWidget.java has changed since 1.19.2

   public boolean mouseClicked(double pMouseX, double pMouseY, int pButton) {
      if (!this.visible) {
         return false;
      } else {
         boolean flag = this.withinContentAreaPoint(pMouseX, pMouseY);
         boolean flag1 = this.scrollbarVisible() && pMouseX >= (double)(this.getX() + this.width) && pMouseX <= (double)(this.getX() + this.width + 8) && pMouseY >= (double)this.getY() && pMouseY < (double)(this.getY() + this.height);
         if (flag1 && pButton == 0) {
            this.scrolling = true;
            return true;
         } else {
            return flag || flag1; // this used to return false here
            // now it returns true if the click was in the content area
         }
      }
   }

This change in return value has broken the click-to-move-cursor behaviour of MultiLineEditBox.java

   public boolean mouseClicked(double pMouseX, double pMouseY, int pButton) {
      if (super.mouseClicked(pMouseX, pMouseY, pButton)) {
         // this is now always true when clicking inside the content area
         // which means we never execute the below logic to move the cursor
         return true;
      } else if (this.withinContentAreaPoint(pMouseX, pMouseY) && pButton == 0) {
         this.textField.setSelecting(Screen.hasShiftDown());
         this.seekCursorScreen(pMouseX, pMouseY);
         return true;
      } else {
         return false;
      }
   }

From what I can tell, the MultiLineEditBox is only used in the ChatReportScreen.

I noticed this issue since I use the MultiLineEditBox in my mod.

Fixed

TeamDman

[Mojang] Gegy

2023-05-19, 04:57 AM

2023-09-07, 11:19 AM

2023-09-07, 11:19 AM

3

3

Plausible

Important

Platform

UI

1.19.4

1.20.2 Pre-release 2