Skip to content

Conversation

Ph4ntomas
Copy link
Contributor

@Ph4ntomas Ph4ntomas commented Oct 5, 2025

The title say it all.

This PR adds TextInput widget, which will be useful as a building block for e.g. prompts.
On top of that, I've enabled support for key-repetition so the prompt themselves feel more natural.

TODO:

  • Basic TextInput integration
    • Transmit text in Key Events (very basic for the time being)
    • Enable key repetition
    • on_input event
    • on_submit event
  • Advanced TextInput integration
    • Styling support
      • Implements all & methods
      • Make gradient less unwieldy (add strongly typed angles & better color-stop handling)
    • Copy/Paste support -- This works. The clipboard itself is not set-up. Not sure if I'll set it up in this MR
    • cursor control from the config ?
    • Find a way to focus text input from the config
  • Rust configuration support
    • basic
    • advanced
  • Lua configuration support
    • basic
    • advanced
  • find & remove server-side except() and raw unwrap() Postponed to [API] Gracefully handle protobuf translation issues #370
    • add a TryFromApi trait so we can log error iso crashing ?
  • Documentation
    • Rust
    • Lua

@Ph4ntomas Ph4ntomas force-pushed the snowcap-add-text_input-widget branch from 33b380b to 756d3af Compare October 6, 2025 05:31
@Ph4ntomas
Copy link
Contributor Author

  • find & remove server-side except() and raw unwrap()
    • add a TryFromApi trait so we can log error iso crashing ?

@Ottatop do you have thought on that ?

Most except and unwrap are justified in the sense that the config library should always produce 'correct' value, but IMO the server should be resilient to protocol error.

The second point is only for types without a default implementation.
If a default exist, I'd assume unwrap_or_default() to be called instead (tho we might tracing::warn! when that happen if a value was expected).

The alternative is to hardcode our own default when the translation between protobuf & iced types fails.

@Ottatop
Copy link
Collaborator

Ottatop commented Oct 7, 2025

do you have thought on that ?

Agree, it would be best to crack down on these panics (especially if anyone wants to make protobuf bindings), though I strongly recommend doing this in another PR seeing as this one's already up to 2.5k lines

@Ph4ntomas
Copy link
Contributor Author

Ph4ntomas commented Oct 7, 2025

though I strongly recommend doing this in another PR seeing as this one's already up to 2.5k lines

Agree, I'll only try to remove the ones introduced by this PR and removable :)

@Ph4ntomas Ph4ntomas force-pushed the snowcap-add-text_input-widget branch 14 times, most recently from 7998627 to d4aa251 Compare October 8, 2025 16:16
@Ph4ntomas Ph4ntomas marked this pull request as ready for review October 8, 2025 16:22
@Ph4ntomas
Copy link
Contributor Author

Ph4ntomas commented Oct 8, 2025

Allright, I think that's all.

FYI, the PR is on top of #364. because I needed some of the changes from that PR, and it makes for a cleaner history that cherry-picking the commits I need (plus the eventual rebase hell if I discovered some issue in that PR).

It should rebase cleanly should you choose to first pull the other one, and then rebase + merge this one (which could also be easier to review, I guess ?)

OTOH, you can also close the other one and track everything here if you prefer.

Some widget may create multiple events at the same time. Batching them
allows the config to handle all events before calling program::view()
Surface::update can be called again after sending events while the
config is still busy handling previous ones, or the new view definition
is in-flight.

With this commit, we buffer new events until after the new view is
received.
@Ph4ntomas Ph4ntomas force-pushed the snowcap-add-text_input-widget branch from d4aa251 to 2164441 Compare October 10, 2025 05:32
@Ph4ntomas Ph4ntomas force-pushed the snowcap-add-text_input-widget branch from 2164441 to 073e8c2 Compare October 10, 2025 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants