Clear selection on "reset mode" sequence (#172)

This commit is contained in:
nikitar020 2019-01-25 18:17:04 +00:00 committed by Liam Galvin
parent 04bcd68a1c
commit 3ea8a70874
3 changed files with 10 additions and 1 deletions

View File

@ -282,6 +282,14 @@ func (buffer *Buffer) EndSelection(col uint16, viewRow uint16, complete bool) {
} }
} }
func (buffer *Buffer) ClearSelection() {
buffer.selectionStart = nil
buffer.selectionEnd = nil
buffer.selectionComplete = true
buffer.emitDisplayChange()
}
func (buffer *Buffer) InSelection(col uint16, row uint16) bool { func (buffer *Buffer) InSelection(col uint16, row uint16) bool {
if buffer.selectionStart == nil || buffer.selectionEnd == nil { if buffer.selectionStart == nil || buffer.selectionEnd == nil {

View File

@ -422,6 +422,7 @@ func csiEraseCharactersHandler(params []string, terminal *Terminal) error {
} }
func csiResetModeHandler(params []string, terminal *Terminal) error { func csiResetModeHandler(params []string, terminal *Terminal) error {
terminal.ActiveBuffer().ClearSelection()
return csiSetMode(strings.Join(params, ""), false, terminal) return csiSetMode(strings.Join(params, ""), false, terminal)
} }

View File

@ -89,7 +89,7 @@ func New(pty platform.Pty, logger *zap.SugaredLogger, config *config.Config) *Te
}, },
platformDependentSettings: pty.GetPlatformDependentSettings(), platformDependentSettings: pty.GetPlatformDependentSettings(),
} }
t.activeBuffer = t.buffers[0] t.activeBuffer = t.buffers[MainBuffer]
return t return t
} }