This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-04-04
Channels
- # announcements (1)
- # babashka (7)
- # beginners (25)
- # calva (38)
- # cider (2)
- # clerk (54)
- # clojure (21)
- # clojure-austin (1)
- # clojure-europe (11)
- # clojure-nl (1)
- # clojure-norway (5)
- # clojure-uk (2)
- # clr (16)
- # conjure (2)
- # cursive (15)
- # datalevin (1)
- # datomic (2)
- # emacs (3)
- # fulcro (1)
- # hoplon (14)
- # humbleui (9)
- # hyperfiddle (31)
- # improve-getting-started (12)
- # jobs (7)
- # off-topic (15)
- # reitit (3)
- # releases (1)
- # spacemacs (22)
- # squint (16)
- # tools-deps (8)
- # vim (50)
- # xtdb (33)
Here's a little gist for a Label that can text-wrap based on a fixed input width. https://gist.github.com/Quezion/74ff0685a92e54dc5eaf58f185214192
You can achieve the 'auto-wrapping' behavior in this gif by pulling the :window
out of a dynamic's ctx and passing it along.
(ui/dynamic
ctx
[window-rect (window/window-rect (:window ctx))
width (-> (- (._right window-rect) (._left window-rect))
(* 0.99)
(int))]
(ui/center
(ui/column
(ui/wrap-label {:wrap-width width} (->> (cycle ["Foo" "Bar" "Baz"])
(take 100)
(interpose " ")
(apply str))))))
The code isn't PR ready; besides being inefficient, there's probably some better way of specifying this behavior. Might involve extending :stretch to support floats and auto-set width of child elements? [:stretch 0.95 ...]
Either way it'll be some weeks until I touch this again, so posting it here for the recordNice! I think real implementation would require going into the depths of Skia and ICU, but this could do for now. Multi-line text is kind of a must, and I’ve been postponing it long enough. I might actually do a quick-and-dirty version for now based on your idea, if you don’t mind
Done! https://github.com/HumbleUI/HumbleUI/commit/4632e2c6f559e63977b7a0f116d4b61e1e7d7645

Thanks Niki, this really makes my morning! 🙂
• paragraph
confirmed working as a drop-in replacement for wrap-label
• I had to update local JWM/HumbleUI, I see you've been busy
• Nice layout
code, haven't seen loopr
macro before
Looking forward to more, but I'll be out for a couple weeks. (Still need to PR Win32 impl of SetTitlebarVisible, find a real fix for (dynamic (text-field ...))
, & x-platform bring-to-front
)
A second thanks for all the help over the last weeks & back soon 🙏
That's awesome but no pressure. Knocking out paragraph
in < 1 day is already some fantastic support 😉
I expected this fix would take me several days to really grok what was happening in the library. I noticed that ctx :hui/focused? true
was being inappropriately dropped by parent window/focusables but couldn't figure out why.
Anyway, I'll keep an eye out for a PR; interested in knowing the mechanics happening here
If you are curious, I’m taking notes as I’m trying to figure it out. Peek here https://tonsky.notion.site/State-Management-d45ce7c481fa4c0fa1c82accbcbfc166
Good notes. Humble UI's Endgame
mentions should leverage Clojure macros
; are you thinking akin to Membrane's defui
(providing references and handling incidental state?)