Skip to content

Commit

Permalink
Add support for old C1 commands: IND, NEL
Browse files Browse the repository at this point in the history
Signed-off-by: John Starks <jostarks@microsoft.com>
  • Loading branch information
jstarks committed Aug 7, 2015
1 parent 5d67ac6 commit e009e33
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
3 changes: 3 additions & 0 deletions event_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ type AnsiEventHandler interface {
// Set Top and Bottom Margins
DECSTBM(int, int) error

// Index
IND() error

// Reverse Index
RI() error

Expand Down
10 changes: 9 additions & 1 deletion parser_actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,15 @@ func (ap *AnsiParser) escDispatch() error {
logger.Infof("escDispatch: %v(%v)", cmd, intermeds)

switch cmd {
case "M":
case "D": // IND
return ap.eventHandler.IND()
case "E": // NEL, equivalent to CRLF
err := ap.eventHandler.Execute(ANSI_CARRIAGE_RETURN)
if err == nil {
err = ap.eventHandler.Execute(ANSI_LINE_FEED)
}
return err
case "M": // RI
return ap.eventHandler.RI()
}

Expand Down
5 changes: 5 additions & 0 deletions test_event_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ func (h *TestAnsiEventHandler) RI() error {
return nil
}

func (h *TestAnsiEventHandler) IND() error {
h.recordCall("IND", nil)
return nil
}

func (h *TestAnsiEventHandler) Flush() error {
return nil
}
5 changes: 5 additions & 0 deletions winterm/win_event_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,11 @@ func (h *WindowsAnsiEventHandler) RI() error {
}
}

func (h *WindowsAnsiEventHandler) IND() error {
logger.Info("IND: []")
return h.executeLF()
}

func (h *WindowsAnsiEventHandler) Flush() error {
h.curInfo = nil
if h.buffer.Len() > 0 {
Expand Down

0 comments on commit e009e33

Please sign in to comment.