/*
** JumpToBookmark.ced
**
** $VER: JumpToBookmark.ced 1.1.0 (27.05.93)
**
** This script jumps the cursor to the selected bookmark.  If no
** bookmark exists for the selected mark, then the cursor will not move.
**
** This script requires CygnusEd Professional v3.5 (or later) to run.
**
** Copyright © 1993 ASDG, Incorporated  All Rights Reserved
*/


OPTIONS RESULTS


NL = '0A'X
TRUE = 1
FALSE = 0

/*
** Select the bookmark to jump to.
*/

CEDTOFRONT
GETSTRING "1" '"Jump to which bookmark?"'
IF (RESULT = "") THEN
	EXIT 0
ELSE NewBookmark = RESULT

/*
** If it's one of the menu-selectable bookmarks or the auto-mark, get
** the current bookmark's position.
*/

IF (NewBookmark = 1) THEN DO
	STATUS MARKX1
	CurrCursorCol = RESULT + 1
	STATUS MARKY1
	CurrCursorLine = RESULT + 1
END
ELSE IF (NewBookmark = 2) THEN DO
	STATUS MARKX2
	CurrCursorCol = RESULT + 1
	STATUS MARKY2
	CurrCursorLine = RESULT + 1
END
ELSE IF (NewBookmark = 3) THEN DO
	STATUS MARKX3
	CurrCursorCol = RESULT + 1
	STATUS MARKY3
	CurrCursorLine = RESULT + 1
END
ELSE IF (NewBookmark = 4) THEN DO
	STATUS AUTOMARKX
	CurrCursorCol = RESULT + 1
	STATUS AUTOMARKY
	CurrCursorLine = RESULT + 1
END
ELSE DO
	/*
	** If not a menu-selectable bookmark, just get the bookmark's
	** cursor position.
	*/

	BookmarkID = "CEDBookmark" || NewBookmark
	BookmarkValue = GETCLIP( BookmarkID )

	IF (BookmarkValue = "") THEN DO
		STATUS CURSORLINE
		CurrCursorLine = RESULT + 1
		STATUS CURSORCOLUMN
		CurrCursorCol = RESULT + 1
	END
	ELSE
		PARSE VAR BookmarkValue CurrCursorLine "," CurrCursorCol
END

/*
** Jump the cursor to the bookmark.
*/

JUMPTO CurrCursorLine CurrCursorCol

EXIT 0
