git.lucas.co / cce-ui
GPU-accelerated UI toolkit (Vulkan)
git clone https://git.lucas.co/cce-ui.git

commitee2d1f4a46014d95097a373019d9dfdf67d86d12
parentf6eb035552
authorLucas Galante <[email protected]>
date2026-07-02 22:58
Aligned single-line TextBox caret vertical coordinate in all_rounded_quads method

 src/widget/input/text_box.rs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/widget/input/text_box.rs b/src/widget/input/text_box.rs
index d408e33..0f1951b 100644
--- a/src/widget/input/text_box.rs
+++ b/src/widget/input/text_box.rs
@@ -1162,7 +1162,8 @@ impl Element for TextBox {
                 if self.editing {
                     let cursor_x = self.base.x + 8.0 + (self.cursor_idx as f32 * char_width) - self.scroll_x;
                     if cursor_x >= self.base.x + 8.0 && cursor_x <= self.base.x + self.base.w - 8.0 {
-                        let cursor_y = self.base.y + top + (visual_h - caret_h) / 2.0;
+                        let text_y = crate::layout::align_text_y(self.base.y, self.base.h, self.font_size, top);
+                        let cursor_y = text_y + (self.font_size - caret_h) / 2.0;
                         quads.push((cursor_x, cursor_y, 1.5, caret_h, 0.0, cursor_color, (false, false, false, false)));
                     }
                 }