Reputation: 6281
I want to insert text to the last line of current content. It just like an append operation in file. I only find the editor.insert(text)
method. This method add text right after the cursor. Is there any way just append the text to the last line?
Upvotes: 4
Views: 4272
Reputation: 24104
use editor.session.insert method to insert text at arbitrary position
var session = editor.session
session.insert({
row: session.getLength(),
column: 0
}, "\n" + text)
Upvotes: 12