mojira.dev
MC-140646

Text fields don't scroll while selecting text with Shift

The bug

If you have a text, in the chat box or in a command block or structure block or etc, that is too long and can't be showed up completely, and you try to select a part of it with holding Shift+Arrow, the selection continues beyond whats already being displayed in the text field but the text field doesn't scroll to see what you are selecting.

Examples

The bug in action:

[media]
[media]

What is supposed to happen:

[media]

Code analysis

Code analysis by @unknown in this comment.

Linked issues

MC-141536 Command block text does not scroll when holding shift MC-144715 command and chat text dont move when selecting MC-146762 Text does not scroll as the position of the cursor changes in the command block. MC-147861 Command Block Copying MC-148075 When selecting text in a command block the text does not scroll MC-148328 Command Block Selecting MC-148761 Marked text in commandblocks dosen´t show on screen MC-149814 Command Block commands can no longer be highlighted past the edge of the box with shift and arrow keys MC-151104 Unable to Scroll and Highlight in chat/command blocks at the same time MC-152594 Command Block Scrolling MC-155468 Command not scrolling when selecting MC-157264 Text does not scroll when using shift + arrow keys MC-199034 Command Line Does Not Scroll with Selection in a Command Block MC-231531 Long strings of text don't scroll while highlighting MC-264483 If you're using a command block, you can't hold down the Shift + arrow keys while skipping the text box.

Attachments

Comments

migrated

This is still a problematic bug to going into 1.14 release. I understand that most hardened creators may not come across this issue working with functions or pasting everything into command blocks but some of us like to again select text in game larger than the visible text box.

ZeNico13

I would like to provide information on the "command block" part of this bug:

The bug

When selecting text in a command block the text does not scroll.

How to reproduce

Try to make a selection of text (with Shift+Arrows) in a command block on a long command that goes beyond the frame.

Example

  • Here is what is excepted:

[media]
  • Here is what is happening now in 1.14:

[media]

Note

This bug does not occur in 1.13, 1.13.1, 1.13.2 and earlier versions. It is only a problem in 1.14. Before, everything worked fine.

This bug is really annoying for map creators so please, fix this bug before the official release of 1.14!

ZeNico13

Still in 1.14 Release! It is very bad for map creators! Especially that the bug does not have to be hard to fix...

FACS01

I want to make sure that, when you fix this bug, also look at this one. Both are related to text field and Shift key.
https://bugs.mojang.com/browse/MC-147766

ZeNico13

Still in 1.14.1 Release

ZeNico13

Still in 1.14.2 Pre-Release 1 and 1.14.2 Pre-Release 2

migrated

1.14.2 pre4

migrated

Confirmed for 1.14.3-pre4

migrated

Still in 1.14.3. Is very annoying. Please fix soon.

qmagnet

Also present in every 1.14.4 snapshot to date

migrated

Confirmed for 19w34a.

migrated

Also may I add that, MC-155958 is a duplicate of MC-121772. It has nothing to do with this bug.

migrated

Confirmed for 19w35a.

migrated

Confirmed for 19w36a.

migrated

Still in latest snapshot to date; being 19w37a
Next snapshot really needs to focus on UI fixes, no matter if they are low priority issues.
This is particularly annnoying, that is all.

migrated

19w40a

migrated

Confirmed for 19w41a.

migrated

In 1.15.1 there is the same bug...

FACS01

I'm not sure but maybe when Workflow changed from Global Mojang to Java, this bug's assigned priority got lost? Can't find it on Details.

migrated

Every time I do anything on minecraft with commands this bug annoys me. Every. Single. Time. Pleeeeeease fix asap.

migrated

can we just mention how a 16-month old bug with 45 votes hasn't even been assigned a priority by Mojang yet? I love your work, but this is beginning to suggest incompetence as a company.

migrated

Confirmed for 1.16-pre4

migrated

This happens when you scroll to the left too

DelimanCZ

Oh god, please FIX IT already! This is so annoying small bug and it takes Mojang years to fix it, like every single thing they break in their game. The game literally consists of billion small bugs, that they even had right in the game in the old better versions, but they broke it.

SoloAlguien

Can confirm in 1.17 Pre-release 4.

SoloAlguien

Can confirm in 1.17 and 1.17.1 Pre-release 1.

migrated

Code analysis based on Minecraft 1.17.1 with yarn mappings.

Note that selectionEnd is where the selection initially started, and selectionStart is where the cursor currently is. Since selectionEnd doesn't change when highlighting text, it is not updated:

net.minecraft.client.gui.widget.TextFieldWidget#setCursor(int)

this.setSelectionStart(cursor); // Move the cursor
if (!this.selecting) {
    this.setSelectionEnd(this.selectionStart); // selectionEnd does not need to be updated when selecting
}
...

The problem is that the scrolling logic is handled in setSelectionEnd, so it is skipped while selecting.

To fix this, the scrolling code should be moved to a separate method, and it should be invoked in setCursor even when selecting.

SoloAlguien

Can confirm in 21w39a.

SoloAlguien

Can confirm in 21w40a.

SoloAlguien

Can confirm in 21w42a.

SoloAlguien

Can confirm in 1.18 Pre-release 1.

SoloAlguien

Can confirm in 1.18 and 1.18.1 Pre-release 1.

SoloAlguien

Can confirm in 1.18.1.

SoloAlguien

Can confirm in 1.18.2.

SoloAlguien

Can confirm in 22w18a.

SoloAlguien

Can confirm in 1.19.2.

migrated

Can confirm in 1.19.3.

FACS01

gegy

Confirmed

Important

UI

controls, selecting, shift, text, text-field

Minecraft 18w49a, Minecraft 18w50a, Minecraft 19w02a, Minecraft 19w03b, Minecraft 19w03c, ..., 1.18.2, 22w11a, 22w18a, 1.19.2, 1.19.3

23w31a

Retrieved