godotengine / godotengine/godot

caret on LineEdit is sometimes invisible when app is scaled, solution of caret size=2 looks ugly as width keeps changing

Open
#95,026 2 comments 0 reactions 0 assignees View on GitHub
bug confirmed topic:2d topic:gui topic:rendering
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

- Reproducible in v4.2.2.stable.official [15073afe3]

### System information

Godot v4.2.2.stable - Windows 10.0.19045 - GLES3 (Compatibility) - AMD Radeon RX 6600 (Advanced Micro Devices, Inc.; 31.0.24033.1003) - Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz (8 Threads)

### Issue description

My project has the following settings:
Viewport Width: 1920
Wiewport Height: 1080
Stretch Mode: canvas_items
Stretch Aspect: keep
Scale: 1

When I run the project, it's scaled to my monitor: 1680x1050
The problem is that in a LineEdit the cursor is sometimes invisible, as the scale is <1

The workaround I found elsewhere (https://github.com/godotengine/godot/issues/58133) was to make the caret width = 2.
This does indeed fix the problem, but I find it ugly that the cursor changes width while typing.

![godot caret issue](https://github.com/user-attachments/assets/8ff04969-271d-4cc2-bcb1-1d6899ea1923)

A better solution would be for Godot to always show the cursor as at least 1 pixel wide.

### Steps to reproduce

Create a project and set project settings to:
* Viewport Width: 1920
* Wiewport Height: 1080
* Stretch Mode: canvas_items
* Stretch Aspect: keep
* Scale: 1

Create a LineEdit
Run project and resize screen to be smaller than project Width/Height
Type a line of "i" and at some point the cursor will disappear.
Change the default theme so the caret width = 2
Run project again, resize screen again, type "i"s and at some point the cursor will become thinner.

### Minimal reproduction project (MRP)

N/A

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.