@fs - Frame store variable
@fss - Frame store scheme variable
@fs row column
@fss row column
The frame store variable @fs permits macros to obtain the character currently being drawn on the screen at the specified location. If the given value of row or column is out range, i.e. less than zero or greater than or equal to the screen size (see $frame-width(5)) then the value returned is the empty string (i.e. "").
The frame store scheme variable @fss operates in the same way as @fs but returns the hilighting scheme number as opposed to the character.
These variables cannot be set and are only updated during a screen update, this means that macros that change the cursor position need to redraw the screen before using this variable (see screen-update(2)).
The following example gets the word under the current mouse position, this may not be the current cursor position:
define-macro word-under-mouse set-variable #l0 $mouse-y set-variable #l1 $mouse-x !if ¬ &inw @fs #l0 #l1 ml-write "[mouse not over a word]" !return !endif set-variable #l2 @fs #l0 #l1 set-variable #l1 &sub #l1 1 !if &inw @fs #l0 #l1 set-variable #l2 &cat @fs #l0 #l1 #l2 !jump -3 !endif set-variable #l1 $mouse-x set-variable #l1 &add #l1 1 !if &inw @fs #l0 #l1 set-variable #l2 &cat #l2 @fs #l0 #l1 !jump -3 !endif ml-write &spr "[mouse is over the word \"%s\"]" #l2 !emacro
Knowledge of the display scheme as returned by the @fss variable is a little more obscure than the previous example. This variable is currently used to determine if there is a spelling error under the cursor position. When auto-spell(3) is enabled then spelling errors are hilighted in a different colour, return of the hilighting scheme allows the caller to determine that there is a spelling error at the current position, this could also be applied to collapsed regions etc. The following example is taken from mouseosd.emf to determine if there is a spelling error at the mouse position.
set-variable #l0 &band $mouse-pos 15 !if &equ #l0 0 ; Text window - must goto the original position or cut etc wont work - must dup the position 0 show-region set-variable #l2 $result set-variable #l0 20 osd 27 5 "D" !if &seq $buffer-input "auto-spell-input" !if &equ @fss $mouse-y $mouse-x .scheme.spell-error auto-spell-test !if &seq &lef $result 1 "E" set-position "\x83" set-variable .auto-spell-osd.word &rig $result 1 osd 27 5 "M" "Auto Spell" .osd.spell-auto auto-spell-osd set-variable #l0 &add #l0 1 !endif !endif !endif goto-position "\x82" ....
(c) Copyright JASSPA 2009
Last Modified: 2009/08/29
Generated On: 2009/10/12