mojira.dev
MC-181539

Legacy formatting symbol in book misplaces cursor

Books containing the formatting character '§' make the client mismatch the actual character length/text position when clicking the text or moving the cursor using the arrow keys.

Use the following command and right click the placed sign to get a book and reproduce the issue:

/setblock ~ ~1 ~ minecraft:oak_sign{front_text:{messages:['{"text":"Click me","clickEvent":{"action":"run_command","value":"/give @s minecraft:writable_book[minecraft:writable_book_content={pages:[\\"\\u00a7nVery cool text\\n\\u00a7r \\u00a7\\u00a7\\u00a7\\u00a7 hi\\n\\u00a75more\\n\\u00a7etext\\"]}]"}}', '""', '""', '""']}}

 

In older versions, the command would be:

/setblock ~ ~ ~ oak_sign{Text1:"{\"text\":\"Click me\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/give @p writable_book{pages:[\\\"\\u00a7nVery cool text\\n\\u00a7r \\u00a7\\u00a7\\u00a7\\u00a7 hi\\n\\u00a75more\\n\\u00a7etext\\\"]}\"}}"}

(This can also be reproduced without extra commands by having a book with the formatting character in a 1.13 world by copy-pasting text into it, and upgrading/opening that world with a 1.14+ client.)

See attached screenshot: clicking text after a formatting symbol misplaces the cursor a few characters before the click position. Moving the cursor with the arrow keys requires multiple presses to go past the formatting character (see also MC-181673).

Linked issues

Attachments

Comments 6

migrated

also a problem in bedrock

Nassim Jahnke

Created a separate issue for the character removal MC-181673

marcono1234

Thanks. I included arrow key navigation here as well, I hope that is alright.

Avoma

Can confirm in 21w03a.

Ceresjanin123

This command doesn't work anymore as of 24w36a so I cannot reproduce this.
Could you provide updated reproduction steps?

Nassim Jahnke

Added an updated command, valid in 1.21.1

Nassim Jahnke

(Unassigned)

Confirmed

UI

1.15.2, 20w18a, 1.16 Pre-release 2, 21w03a, 1.21.1

Retrieved