Using built-in method to delete selected text.
The existing method is currently broken, but will be patched (This
commit is the correct implementation).
@@ -843,15 +843,10 @@ func NewWindow(doRestart chan bool, app *tview.Application, session *discordgo.S
}
func (window *Window) insertNewLineAtCursor(messageToSend string) {
- // Insert new line char
left := window.messageInput.internalTextView.GetRegionText("left")
right := window.messageInput.internalTextView.GetRegionText("right")
selection := window.messageInput.internalTextView.GetRegionText("selection")
- if len(selection) == 1 {
window.messageInput.InsertCharacter([]rune(left), []rune(right), []rune(selection), '\n')
- } else {
- window.messageInput.SetText(left + "\n" + right)
- }
window.app.QueueUpdateDraw(func() {
window.messageInput.triggerHeightRequestIfNeccessary()
window.messageInput.internalTextView.ScrollToHighlight()
