I have the code below which inserts some text. My problem is that I insert the text before the current offset, so the originalOffset is no longer valid? How can I go around that? I tried adding the
length (indent_string (p_SyntaxIndent)) + length (inserted text), but still not any near to the original offset

. Also how could I possibly merge the insert_blank_line_below and the _insert_text into 1 transaction (1 undo operation). Thanks in advance.
// generates a field prefixed with "_" from a local variable just after the class definition
//
static _str generate_field_from_local (VS_TAG_BROWSE_INFO varInfo)
{
long originalOffset = _QROffset ();
_str lineText;
VS_TAG_BROWSE_INFO classInfo;
if (get_class_context (originalOffset, classInfo) < 0)
return null;
p_line = classInfo.scope_line_no;
get_line (lineText);
if (!endsWith (lineText, "{"))// opening { not on the same line of the class definition
p_line++; // assuming opening { is on the next line, so move to there
insert_blankline_below (); // this also indents
p_line++;
_str fieldName = "_" :+ varInfo.member_name;
_str field = "private " :+ varInfo.return_type :+ " " :+ fieldName :+ ";";
_insert_text (field);
_GoToROffset (originalOffset); // restore offset
return fieldName;
}