slint icon indicating copy to clipboard operation
slint copied to clipboard

Text cursor does not support corner radius

Open NigelBreslaw opened this issue 5 months ago • 4 comments
trafficstars

Bug Description

Image Image The Material3 specs and MacOS (images attached) support flashing text-cursors that also have a corner radius applied. This doesn't seem possible with Slint right now.

Reproducible Code (if applicable)


Environment Details

  • Slint Version:
  • Platform/OS:
  • Programming Language:
  • Backend/Renderer:

Product Impact

Cannot make components that look and behave like Material, MacOS and possibly other platforms text edit.

NigelBreslaw avatar Jun 06 '25 07:06 NigelBreslaw

Is there an API that you'd propose for configuring this? Would you agree that this is a setting that's process-wide, possibly inherited from the windowing system, or do you think that this needs to be configured per text input?

tronical avatar Jun 06 '25 07:06 tronical

Just a general question, but is there an alternative to the default pattern of an every growing list of root properties. As in it would be possible to have an api like this in the future?

TextInput {
    cursor-style: {
        color: blue;
        width: 3px;
        corner-radius: 0;
    }
}

Yes that is very web like. But also its the case you often reuse certain styles over and over and being able to make several customisation objects { color: green, width: 3px } and reuse them easily across an app.

NigelBreslaw avatar Jun 06 '25 09:06 NigelBreslaw

As in it would be possible to have an api like this in the future?

It's possible to have such an API today. A property <TextCursorStyle> cursor-style property.

tronical avatar Jun 06 '25 09:06 tronical

Alternative design: make TextInput::cursor_visible property public and have something like

TextInput {
   text_cursor_width: 0;
   if self.cursor-visible: Rectangle { 
       x.parent.cursor-position.x; // Also implies a TextInput::cursor-position
       y.parent.cursor-position.y;
       height: // something with text metrics?
       // ... do whatever you want as a design ...
   }
}

ogoffart avatar Jun 06 '25 11:06 ogoffart