Ticket #876 (closed enhancement: fixed)

Opened 2 years ago

Last modified 5 months ago

[PATCH] Make CInput caret more visible

Reported by: kenny Owned by: kingadami
Priority: Should Have Milestone: Alpha 13
Component: Core engine Keywords: patch
Cc:

Description

Currently the caret (data entry point) for CInput is a small line that is drawn under the character position to the right of the current insert point. A flashing vertical line would be ideal and is standard practice. At a minimum we need to thicken up the line or do something to make it more visible.

This becomes more important as we start to use CInput for things like in game messaging. The blinking cursor would provide an indication that the input area is active and make it clear where you are in the text box.

Attachments

0adTicket_876.patch (5.6 KB) - added by kingadami 6 months ago.
First pass at making the CInput cusor flashing. Also, made the console cursor flash as well for consistency
0adTicket_876_2.patch (7.2 KB) - added by kingadami 6 months ago.
Second pass at blinking the cursor

Change History

comment:1 Changed 6 months ago by kingadami

  • Owner set to kingadami

comment:2 Changed 6 months ago by kingadami

  • Status changed from new to assigned

Changed 6 months ago by kingadami

First pass at making the CInput cusor flashing. Also, made the console cursor flash as well for consistency

comment:3 Changed 6 months ago by kingadami

  • Keywords patch review added
  • Summary changed from Make CInput caret more visible to [PATCH] Make CInput caret more visible
  • Milestone changed from Backlog to Alpha 13

Attached patch to make the CInput cursor flash. There are 2 new properties for the CInput control which can be set in the xml:

  • enable_cursor_flash - Turns flashing on or off (default is set to true).
  • cursor_flash_rate - The flashing time specified in seconds (default is set to 0.5 seconds).

I also implemented cursor flashing in the Console for consistency.  The Console seems to be implemented a little cleaner than CInput, but it is simpler as well.

Let me know if you have any questions or comments.

Thanks.

comment:4 Changed 6 months ago by historic_bruno

Thanks for the patch. It seems to work well, but I'm not convinced that we want a per-object setting. Maybe a global config setting to adjust cursor blink rate (0.0 to disable)? See CFG_GET_VAL().

Last edited 6 months ago by historic_bruno (previous) (diff)

Changed 6 months ago by kingadami

Second pass at blinking the cursor

comment:5 Changed 6 months ago by kingadami

Added 0adTicket_876_2.patch which makes the cursor blink rate a global instead of a per-object setting (using historic_bruno's comments). The 2 new xml properties for CInput were removed and a global config option "gui.cursorblinkrate" was added to the default configuration file. Both CInput and CConsole use this setting. Setting this value to 0.0 disables blinking.

Let me know what you think.

Thanks.

Last edited 6 months ago by kingadami (previous) (diff)

comment:6 Changed 5 months ago by ben

  • Status changed from assigned to closed
  • Resolution set to fixed

In 13068:

Adds blinking cursors with configurable rate, based on patch by kingadami. Fixes #876

comment:7 follow-up: ↓ 8 Changed 5 months ago by historic_bruno

  • Keywords review removed

I made a few minor alterations to your patch, the most important is that a newly focused input control should always have visible cursor, regardless of the timing involved. My solution was a bit of a hack, but it works :)

One other bug I noticed but didn't fix: the cursor behavior is slightly non-standard, it shouldn't blink while the cursor is being moved. Personally I don't mind this either way and I have no idea how hard it would be to fix.

comment:8 in reply to: ↑ 7 Changed 5 months ago by kingadami

Replying to historic_bruno:

I made a few minor alterations to your patch, the most important is that a newly focused input control should always have visible cursor, regardless of the timing involved. My solution was a bit of a hack, but it works :)

One other bug I noticed but didn't fix: the cursor behavior is slightly non-standard, it shouldn't blink while the cursor is being moved. Personally I don't mind this either way and I have no idea how hard it would be to fix.

I agree with your statement that it should not flash while being moved. The CInput control should be relativly easy to chang I think. I will probably open up another ticket and make that change as well in the next week.

Note: See TracTickets for help on using tickets.