SetBufSelText (hbuf, s)

Replaces the currently selected characters in the file buffer hbuf with the string s. This is useful for replacing the text of a word selection. A macro error is generated if the given file buffer is not already displayed in a source file window.

This is the simplest way to insert new text into a buffer. For example, this code inserts “new text” into the current buffer at the current insertion position:

hbuf = GetCurrentBuf()
SetBufSelText(hbuf, "new text")