Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-262754

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 1.20.2 Pre-release 2
    • 1.19.4
    • None
    • Plausible
    • UI
    • Important
    • Platform

      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.

            gegy1000 [Mojang] Gegy
            TeamDman TeamDman
            Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: