OpenRCT2 icon indicating copy to clipboard operation
OpenRCT2 copied to clipboard

Console caret does not update when pasting

Open mrmbernardi opened this issue 2 years ago • 4 comments

Operating System

Any

OpenRCT2 build

OpenRCT2, v0.4.5-107 (97427743a on develop, DEBUG)

Base game

RollerCoaster Tycoon 2

Area(s) with this issue?

No response

Describe the issue

When you paste something into the console, the caret does not update. This is similar to #20484.

Fixing this issue properly might require some work. The code to handle pasting is here: https://github.com/OpenRCT2/OpenRCT2/blob/8c0a931403e87b86ee4a2bf212fc7efe70e8e5a1/src/openrct2-ui/TextComposition.cpp#L183

However, the InGameConsole is not properly integrated with the TextComposition class. Other windows set global variables like gCurrentTextBox and gUsingWidgetTextBox to be notified about changes from the TextComposition class via the Window class. The console does not do this and instead the TextComposition class is simply hardcoded to call console.RefreshCaret() when changes happen. This is called whenever you edit any text box even if the console isn't open.

The quick fix for this issue would be to add another one of these calls to the code that handles pasting linked above. A proper fix would involve integrating the console properly --- maybe start with setting the global variables in InGameConsole::Open() and Close()

Steps to reproduce

  1. Open the console.
  2. Paste something in.
  3. Observe the position of the caret.

Attachments

No response

mrmbernardi avatar Jul 17 '23 20:07 mrmbernardi

I have just been trying to replicate this but cant seem to see any issue. I have been pasting multiple times in text boxes and the caret seems to move correctly each time I paste.

I might be testing in the wrong text box or there is an in game console I dont know how to open.

  • Thought I would have a look as I have been spending some time in this code recently.

wstagg avatar Feb 03 '24 15:02 wstagg

It's the same console you can see in the video posted in #20484

You open it with tilde but I think you also need to turn on the debug tools setting or something

mrmbernardi avatar Feb 03 '24 19:02 mrmbernardi

Okay thanks I'll dig deeper

wstagg avatar Feb 03 '24 19:02 wstagg

Got it thanks, I will work on this. Do you want to assign to me?

wstagg avatar Feb 04 '24 10:02 wstagg