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:
What is supposed to happen:
Code analysis
Code analysis by @unknown in this comment.
Linked issues
is duplicated by
relates to
Attachments
Comments


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:
Here is what is happening now in 1.14:
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!

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

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

Still in 1.14.1 Release

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

1.14.2 pre4

Confirmed for 1.14.3-pre4

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

Also present in every 1.14.4 snapshot to date

Confirmed for 19w34a.


Confirmed for 19w35a.

Confirmed for 19w36a.

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.

19w40a

Confirmed for 19w41a.

In 1.15.1 there is the same bug...

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.

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

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.

Confirmed for 1.16-pre4

This happens when you scroll to the left too

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.

Can confirm in 1.17 Pre-release 4.

Can confirm in 1.17 and 1.17.1 Pre-release 1.

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.

Can confirm in 21w39a.

Can confirm in 21w40a.

Can confirm in 21w42a.

Can confirm in 1.18 Pre-release 1.

Can confirm in 1.18 and 1.18.1 Pre-release 1.

Can confirm in 1.18.1.

Can confirm in 1.18.2.

Can confirm in 22w18a.

Can confirm in 1.19.2.

Can confirm in 1.19.3.
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.