Skip to content

Instantly share code, notes, and snippets.

@cyphre
Last active August 29, 2015 13:57
Show Gist options
  • Save cyphre/9600416 to your computer and use it in GitHub Desktop.
Save cyphre/9600416 to your computer and use it in GitHub Desktop.
REBOL [
title: "test script for Android text bug"
author: "Richard Smolak"
]
load-gui
log-metrics: does [
foreach w [screen-dpi unit-size screen-size][
append log rejoin [mold w ": " gui-metric w newline]
]
]
log: copy ""
log-metrics
dpi: gui-metric 'screen-dpi
gui-metric/set 'unit-size sc: dpi / 96
scr: (gui-metric 'work-size) - gui-metric 'title-size
log-metrics
caret-test: funct [
face [object!]
][
text-gob: sub-gob? face
c: face/state/caret/caret
cto: caret-to-oft text-gob c/1 back c/2
res: unless empty? otc: oft-to-caret text-gob cto [
equal? cto caret-to-oft text-gob otc otc/1
]
set-face t res: rejoin [
cto " :: " mold otc " :: " res newline
]
append log res
]
view/options [
tb: text-box "some text here" on-click [
res: do-actor/style face 'on-click arg 'text-box
if arg/type = 'down [
caret-test face
]
res
]
on-key [
res: do-actor/style face 'on-key arg 'text-box
if arg/type = 'key [
caret-test face
]
res
]
t: text 200x24
button "save droid-test.log" on-action [
write %droid-test.log log
]
][
offset: 0x0
init-hint: scr
max-hint: scr
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment