I'm struggling a lot coming from R2 and dealing with faces. get-facet seems extremely unintuitive to me.
Let's say I have an area:
view [c: area "hello"] print get-facet c 'text-edit
get-facet
always returns "hello"
even if I type something else in the area. What is going on with this? The 'caret
and 'state
facet objects contain the correct text, but I cannot find a way to access them.
The correct command is get-face
. Get facet should be used for
For the example above, it is fixed by:
view [c: area "hello"] print get-face c
From an explanation from Cyphre: get-face
is intended for the application programmers but get-facet
is intended for style developers because it directly accesses the style internals. If styles are updated it may break code if get-face
is not used. One should avoid using refinements such as /text or /data on faces as it was easy to do in R2
AREA's facet TEXT-EDIT looks like it just stores the initialization, and the state/caret facet objects contain run-time data