Hi Andrew,
Those were the words of [EMAIL PROTECTED]:
> pekr wrote:
> > print "^(1B)[10CHi!"
> >
> > in opposite to:
> >
> > cursor: func [parm [string!]][join "^(1B)[" parm]
> > print ["How are you" cursor "7D" cursor "K"]
> >
> > which one print is more readable?
>
> Um, neither? What about:
> print ["How are you" Cursor-function]
> where 'Cursor-function is replaced with a word that actually describes
> what the cursor sequence does, and when evaluated, produces the
> corresponding escape sequence? I thought that would be more readable
> and easier to understand.
have you thought about something like this?
cursor: func [ "Positions the cursor"
/home
/kill
/clear
/up cnt1
/down cnt2
/right cnt3
/left cnt4
/pos row col
/del cnt5
/space cnt6
/get-pos
/get-screen
/local pre ret
] [
pre: copy "^(1B)["
any [
all [home ret: join pre "H" ]
all [kill ret: join pre "K" ]
all [clear ret: join pre "J" ]
all [up ret: join pre [cnt1 "A" ]]
all [down ret: join pre [cnt2 "B" ]]
all [right ret: join pre [cnt3 "C" ]]
all [left ret: join pre [cnt4 "D" ]]
all [pos ret: join pre [row ";" col "H" ]]
all [del ret: join pre [cnt5 "P" ]]
all [space ret: join pre [ cnt6 "@" ]]
]
if any [
all [get-pos pre: join pre "6n" ]
all [get-screen pre: join pre "7n" ]
] [
cons: open/binary [scheme: 'console]
print pre ret: next next to-string copy cons
close cons
ret: parse/all ret ";R"
change at ret 1 to-integer first ret
change at ret 2 to-integer second ret
]
ret
]
regards,
Ingo
-- _ . _
ingo@)|_ /| _| _ <We ARE all ONE www._|_o _ _ ._ _
www./_|_) |o(_|(/_ We ARE all FREE> ingo@| |(_|o(_)| (_|
http://www.2b1.de/Rebol/ ._| ._|