Mode for TSGWork.Mode replace mode please initialize StringInfo with in-range value of BufferPos if you are using SGM_REPLACE mode.
Source position: intuition.pas line 3971
const SGM_REPLACE = 1;