Handle CSI P (delete character)

openid
Marcin Kulik 13 years ago
parent 196437b7af
commit 44ee71cfcc

@ -122,6 +122,8 @@ class AsciiIo.AnsiInterpreter
console.log "(TODO) reset: " + @n
when "m"
@terminal.setSGR @params
when "P" # DCH - Delete Character, from current position to end of field
@terminal.deleteCharacter @n or 1
when "r" # Set top and bottom margins (scroll region on VT100)
else
throw "no handler for CSI term: " + term

@ -242,6 +242,10 @@ class AsciiIo.Terminal
clearLineData: (n) ->
@fill n, 0, @cols, " "
deleteCharacter: (n) ->
@getLine().splice(@cursorX, n)
@updateLine()
reserveCharacters: (n) ->
line = @getLine()
@lineData[@cursorY] = line.slice(0, @cursorX).concat(" ".times(n).split(""), line.slice(@cursorX, @cols - n))

Loading…
Cancel
Save