X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=terminal.coffee;h=19296bf0b028c30159e927836c149756a75b4c24;hb=639264f34589d0637860ffbd47d788e03c48c76a;hp=751a53accdc55c5960b863221e0b0b94294c5694;hpb=0f402aa0d82fb36bdbd48bf29c1f20d962ac9078;p=watch-my-terminal.git diff --git a/terminal.coffee b/terminal.coffee index 751a53a..19296bf 100644 --- a/terminal.coffee +++ b/terminal.coffee @@ -83,18 +83,20 @@ class Terminal when '\x0d' # cr @x = 0 when '\x08' # backspace - if @x > 0 + if @x is 0 + @x = @width - 1 + if @y > 0 + @y -= 1 + else @x -= 1 - @text[@y][@x] = ' ' - # should this set the attribute too? when '\x0a', '\x0b' # lf, vertical tab (same thing) @wrap_to_next_line() else + if @x >= @width + @wrap_to_next_line() @text[@y][@x] = c @attributes[@y][@x] = @a @x += 1 - if @x is @width - @wrap_to_next_line() return set_attribute_bits: (mask, value) ->