@@ -83,7 +83,8 @@ public static void Insert(char c)
83
83
_singleton . _buffer . Insert ( _singleton . _current , c ) ;
84
84
}
85
85
_singleton . _current += 1 ;
86
- _singleton . Render ( ) ;
86
+ // Renders the character (which moves the cursor forward one)
87
+ _singleton . SafeRender ( c . ToString ( ) ) ;
87
88
}
88
89
89
90
/// <summary>
@@ -105,7 +106,8 @@ public static void Insert(string s)
105
106
_singleton . _buffer . Insert ( _singleton . _current , s ) ;
106
107
}
107
108
_singleton . _current += s . Length ;
108
- _singleton . Render ( ) ;
109
+ // Renders the string (which moves the cursor forward the string's length)
110
+ _singleton . SafeRender ( s ) ;
109
111
}
110
112
111
113
/// <summary>
@@ -147,6 +149,8 @@ public static void Replace(int start, int length, string replacement, Action<Con
147
149
var str = _singleton . _buffer . ToString ( start , length ) ;
148
150
_singleton . SaveEditItem ( EditItemDelete . Create ( str , start ) ) ;
149
151
_singleton . _buffer . Remove ( start , length ) ;
152
+ // Moves cursor to start (backwards probably) and then deletes length
153
+ _singleton . SafeRender ( $ "\x1b [{ length } P", start ) ;
150
154
if ( replacement != null )
151
155
{
152
156
_singleton . SaveEditItem ( EditItemInsertString . Create ( replacement , start ) ) ;
@@ -161,7 +165,8 @@ public static void Replace(int start, int length, string replacement, Action<Con
161
165
if ( useEditGroup )
162
166
{
163
167
_singleton . EndEditGroup ( instigator , instigatorArg ) ; // Instigator is needed for VI undo
164
- _singleton . Render ( ) ;
168
+ // Renders the string (which moves the cursor forward the string's length)
169
+ _singleton . SafeRender ( replacement ) ;
165
170
}
166
171
}
167
172
0 commit comments