[Oberon] HOW2 get Token at cursor?
eas lab
lab.eas at gmail.com
Mon Jan 28 09:44:46 CET 2013
Please follow and correct my exposed reasoning:
Getting the tokens at the cursor is exactly what must happen with:
Oberon.Call(S.s, Oberon.Par, FALSE, res);
which is repeated often in severa; *.Mod
Let's morph this to
Oberon.CaT(TokenAtCursor, ParList, New, Res);
Using 3 colours, which you can't see in the mail, shows, eg :
Texts.OpenScanner(S, Oberon.Par.text, Oberon.Par.pos); Texts.Scan(S);
COPY(S.s, cmd); Oberon.Call(cmd, Oberon.Par, FALSE, res)
Which shows the <signalFlow> as:
cmd <- S.s <- ?? Texts.*
But the <TextScanner> does NOT read the cursor co-ordinates;
which are exported from Oberon.* via
TYPE
Cursor* = RECORD
marker*: Marker; (** Cursor marker. *)
on*: BOOLEAN; (** Is cursor shown? *)
X*, Y*: INTEGER (** Absolute cursor position. *)
END;
So is Cursor.X continually updated, if the mouse moves?
But <Variable:Text> is a list of chars
and <Cursor Position> is an OrderedPair.
So, TextScanner only sees a list of chars.
And It's not clear where the pixelGeometry/OrderedPair
maps to the corresponding char, except at the very low-level
of the display-driver.
Actually I don't want the token at the cursor, which I've
tried to trace above. I want the more primitive CharAtCursor.
NB. distinguish between cursor and caret.
I'd like to see:
WHILE CharAtCursorChanges(Ch) DO
Out.Char(Ch);Out.Ln() END;
or better:
REPEAT
Ch:=CharAtCursorChanges;
Out.Char(Ch);Out.Ln()
UNTIL Ch="Q"
So the ChangingCharAtTheCursor would scroll in the System.Log
Please advise.
== Chris Glur.
PS. Since Texts does not IMPORT Oberon, it can't
know Oberon.Cursor.X
PSS. Perhaps more is seem from:-
Arrow*, Star*: Marker;
(** Normal Oberon arrow, and the star marker. *)
No, because the star-marker is not concerned with
displayedChars.
More information about the Oberon
mailing list