mojira.dev
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.

Attachments

Comments 2

What is the impact on vanilla? If there's no impact on the base game, mojang doesn't accept the report.

Clicking within the comment box on the chat report screen will not move the cursor.
It has some weird behaviour with the selection logic, but it fails to jump the cursor properly when simply left clicking.
Attached a video to the issue

How it works properly in 1.19.2

[media]

Broken behaviour in 1.19.4

[media]

migrated

gegy

Plausible

Platform

Important

UI

1.19.4

1.20.2 Pre-release 2

Retrieved