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

Legacy formatting symbol in book misplaces cursor

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.15.2, 20w18a, 1.16 Pre-release 2, 21w03a, 1.21.1
    • None
    • Confirmed
    • UI

      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).

        1. ao0t9o4.png
          12 kB
          [Mod] Nassim Jahnke

            Unassigned Unassigned
            KennyTV [Mod] Nassim Jahnke
            Votes:
            5 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              CHK: