You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using the below function to insert the text at the current selection ( current cursor position is enough for me, though)
func insertText(_ text:String, at range:Range<String.Index>, in string:String)->String{varnewString= string
newString.replaceSubrange(range, with: text)return newString
}
With the help of the selection binding, the text insertion is quite easy ( thanks for that), however, the cursor stays at the beginning of the inserted text ( the one that replaced the text of the range).
In the usual approach, on the other hand, the cursor must be placed at the end of newly inserted text ( when the range size is 0)
If I select a range more than the cursor position, this time, there is no cursor but only a selection that has the same size of the replaced text. I was expecting that the selection after the text inserts keep the size of the replaced part.
Ok, this may be the expected behavior since we may just be replacing the text that the editor's string with a new value.
Is there a way to achieve the text insertion so that the cursor moved to the end of the inserted string? This is necessary for me. Maybe there is a workaround for this one can move the cursor to the x position.
P.S. Overall, it is a great CodeEditor.
The text was updated successfully, but these errors were encountered:
As far as I remember, system's copy past works flawlessly on the editor ( tested now to make sure that). I needed this to insert/replace some text within my application.
I don't think that the CodeEditor need such internal functionality, or am I missing something?
I'm using the below function to insert the text at the current selection ( current cursor position is enough for me, though)
With the help of the selection binding, the text insertion is quite easy ( thanks for that), however, the cursor stays at the beginning of the inserted text ( the one that replaced the text of the range).
In the usual approach, on the other hand, the cursor must be placed at the end of newly inserted text ( when the range size is 0)
If I select a range more than the cursor position, this time, there is no cursor but only a selection that has the same size of the replaced text. I was expecting that the selection after the text inserts keep the size of the replaced part.
Ok, this may be the expected behavior since we may just be replacing the text that the editor's string with a new value.
Is there a way to achieve the text insertion so that the cursor moved to the end of the inserted string? This is necessary for me. Maybe there is a workaround for this one can move the cursor to the x position.
P.S. Overall, it is a great CodeEditor.
The text was updated successfully, but these errors were encountered: