Handbook
Glossary
update-marked-text ( gadget str selectedRange replacementRange -- )
Vocabulary
ui
.
backend
.
cocoa
.
views
.
private
Inputs
gadget
an
object
str
an
object
selectedRange
an
object
replacementRange
an
object
Outputs
None
Definition
USING:
accessors
arrays
cocoa.types
kernel
math
math.vectors
sequences
ui.gadgets
ui.gadgets.editors
;
IN:
ui.backend.cocoa.views.private
::
update-marked-text
( gadget str selectedRange replacementRange -- )
replacementRange
location>>
NSNotFound
=
[
gadget
editor-caret
first
dup
gadget
editor-line
[
replacementRange
location>>
>codepoint-index
2array
gadget
set-caret
]
[
replacementRange
[
location>>
]
[
length>>
]
bi
+
>codepoint-index
2array
gadget
set-mark
]
2bi
gadget
earlier-caret/mark
dup
gadget
preedit-start<<
0 1
2array
v+
gadget
preedit-end<<
]
unless
gadget
preedit?
[
gadget
remove-preedit-text
]
when
gadget
earlier-caret/mark
dup
gadget
preedit-start<<
0 str
length
2array
v+
gadget
preedit-end<<
str gadget
temp-im-input
drop
gadget
preedit-start>>
0 str selectedRange
location>>
>codepoint-index
2array
v+
dup
gadget
preedit-selected-start<<
0 selectedRange
[
location>>
]
[
length>>
]
bi
+
selectedRange
location>>
[
str
swap
>codepoint-index
]
bi@
-
2array
v+
dup
gadget
preedit-selected-end<<
dup
gadget
set-caret
gadget
set-mark
gadget
preedit-start>>
gadget
preedit-end>>
=
[
gadget
remove-preedit-info
]
when
;