# screen-update(2)

[Home] [Commands] [Variables] [Macro-Dev] [Glossary]

## NAME

screen-update - Force screen update

## SYNOPSIS

n screen-update (redraw)

## DESCRIPTION

screen-update updates the current screen, usually used in macros. The argument n can be used to change the behaviour of this command as follows:

negative n

Disables the next -n screen updates, i.e. if n is `-1` then the next time the screen needs to be redrawn nothing will happen.

`0`

Resets the screen update disable count to zero, useful to remember when the the disable feature has been used incorrectly.

`1`

Full screen update (default), the screen is completely cleared and redrawn (as if garbled).

`2`

Partial screen update, only the parts of the screen which require updating are redrawn.

`3`

No screen redraw, only window variables are up-dated. This feature is provided for macros which manipulate the screen view and need to know where the cursor is in the window without redrawing the screen (which may cause unwanted flickering). Note that as the screen is not redrawn not all variables may have the correct value, for example the frame store variable @fs(4) could be out of date.

## EXAMPLES

The following macro demonstrates the problems encountered when trying to use screen variables in macros after the current position has changed. The first value printed is the starting cursor Y position and the next value should be one less than the first value due to the call to backward-line(2). But it is the same as the first because the screen (and its variables) have not been updated. The subsequent call to screen-update ensures that the third value is the correct one although by giving it an argument of 3 the screen is not visibly updated thus avoiding any annoying screen flicker:

    define-macro test-screen-update
        set-variable #l0 $cursor-y
        backward-line
        set-variable #l1 $cursor-y
        3 screen-update
        set-variable #l2 $cursor-y
        forward-line
        ml-write &spr "%d %d %d" #l0 #l1 #l2
    !emacro

## NOTES

Every time the screen requires updating, MicroEmacs executes the redraw key, it is similar in mechanism to the user pressing C-l to refresh the screen. The user can therefore re-bind the redraw key to another command or macro, thereby allowing the user complete control of what is displayed. For example if redraw was bound to void(2) the screen would not be up-dated (Note: this is difficult to get out of and may require MicroEmacs to be killed).

This feature is often exploited by macros which take control of the input and output, such macros include gdiff(3), Metris(3), and Mahjongg(3).

## SEE ALSO

recenter(2), screen-poke(2).

(c) Copyright JASSPA 2009
Last Modified: 2009/08/29
Generated On: 2009/10/12

</HMTL>