KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q42758: Savecur and Restcur Save Relative Position in File, on Screen

Article: Q42758
Product(s): See article
Version(s): 1.00   | 1.00
Operating System(s): MS-DOS | OS2
Keyword(s): ENDUSER | | mspl13_basic
Last Modified: 17-MAY-1989

The Microsoft Editor functions Savecur and Restcur save the current
cursor position relative to the file and the screen. Therefore, the
screen will be restored exactly as it appeared when the Savecur
function was invoked.

The following macros were intended to scroll the screen up and down
while leaving the cursor position relative to the terminal screen to
be stationary:

ReposDown:=Savecur Meta Up Up Restcur
ReposDown:Ctrl+Down

ReposUp:=Savecur Meta Down Down Restcur
ReposUp:Ctrl+Up

Because Savecur and Restcur preserve and restore the cursor position
relative to the screen, the macros appear to do nothing. But actually,
each executes correctly. For example, the ReposDown does the following:

1. Savecur : saves the current position relative to the file and the
             screen

2. Meta Up : moves the cursor to the top of the screen

3. Up      : moves the cursor up one line, (thus scrolling the screen
             down one line)

4. Restcur : restores the screen to the original configuration
             (appears as if nothing had happened)

One way to achieve the desired result is to use the Mark function. The
Mark function saves the current location in the file. The relative
screen position is not preserved, whereas the Savecur and Restcur
functions do save the relative screen position.

The following macros give the desired result:

ReposDown:=Arg Arg "tag" Mark Meta Up Up Arg "tag" Mark Up
ReposDown:Ctrl+Up

ReposUp:=Arg Arg "tag" Mark Meta Down Down Arg "tag" Mark Down
ReposUp:Ctrl+Down

The word "tag" is an arbitrary tagname for the Mark function.

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.