Handbook
Glossary
make-preedit-underlines ( gadget text range -- underlines )
Vocabulary
ui
.
backend
.
cocoa
.
views
.
private
Inputs
gadget
an
object
text
an
object
range
an
object
Outputs
underlines
an
object
Definition
USING:
accessors
alien
alien.c-types
arrays
cocoa.application
cocoa.messages
cocoa.runtime
cocoa.types
core-foundation.strings
io.encodings.string
io.encodings.utf16
kernel
math
sequences
;
IN:
ui.backend.cocoa.views.private
::
make-preedit-underlines
( gadget text range -- underlines )
f
gadget
preedit-selection-mode?<<
{
}
clone
:>
underlines! text
{
ulong
{
id
SEL
}
}
"length"
send
:>
text-length 0 0
<NSRange>
:>
effective-range text
{
id
{
id
SEL
}
}
"string"
send
CF>string
:>
str str
utf16n
encode
:>
byte-16n 0
:>
cp-loc!
"NSMarkedClauseSegment"
<NSString>
:>
segment-attr
[
effective-range
[
location>>
]
[
length>>
]
bi
+
text-length
<
]
[
text segment-attr effective-range
[
location>>
]
[
length>>
]
bi
+
effective-range
>c-ptr
{
id
{
id
SEL
id
ulong
void*
}
}
"attribute:atIndex:effectiveRange:"
send
drop
1
:>
thickness! range
location>>
effective-range
location>>
=
[
2 thickness!
t
gadget
preedit-selection-mode?<<
]
when
underlines effective-range
[
location>>
]
[
length>>
]
bi
over
+
[
str
swap
>codepoint-index
]
bi@
swap
-
:>
len cp-loc cp-loc len
+
dup
cp-loc!
2array
thickness
2array
suffix
underlines!
]
while
underlines
length
1
=
[
underlines
first
first
2
2array
1array
]
[
underlines
]
if
;