Gfa_Insert, Gfa_Replace Commands

Syntax

Gfa_Insert s$

Gfa_Replace s$

Description

Gfa_Insert inserts a string at the current position as if it is pasted from the clipboard. In case of selected text, the selection is replaced.

The string may contain end of line markers (#10 (Line Feed)). A Carriage Return (#13) is ignored, so that MS-DOS typical end of line markers (#13#10) can be used.

The insertion does not take the current overwrite modus into account, Gfa_Insert always inserts the text. To do a destructive insertion, either select the text to destroy before using Gfa_Insert, or use Gfa_Replace. A disadvantage of Gfa_Replace is its limitation in that it doesn’t replace across line boundaries.

Gfa_Replace - The contents of the string s$ replaces Len(s$) characters in the text of the current line starting at Gfa_Col. When the line contains a selection, the selection is replaced.

Line boundaries can not be crossed, replacement is stopped at the first LF (or any ASCII code < 32). So, the replacement string should not contain control characters, use Gfa_Insert instead.

Gfa_Replace s$ is equivalent to

Txt$ = Gfa_Text

Mid(Txt$, Gfa_Col) = s$

Gfa_Text = Txt$

Bug: When the replacement string overwrites the length of the current line, random characters are added.

Remarks

This command has nothing to do with the Replace menu item in the Edit menu.

See Also

Gfa_Text, Gfa_DeleteLines, Gfa_InsertLines

{Created by Sjouke Hamstra; Last updated: 08/10/2014 by James Gaite}