Don't rely on underscore too much

openid
Marcin Kulik 12 years ago
parent 0b01d98db2
commit 3ddf5e5dce

@ -4,14 +4,6 @@ class AsciiIo.Brush
@clearCache: ->
@cache = {}
@defaultAttrs =
fg : undefined
bg : undefined
blink : false
bright : false
italic : false
underline: false
@default: ->
@_default ||= @create()
@ -29,7 +21,12 @@ class AsciiIo.Brush
brush
constructor: (options = {}) ->
_(this).extend AsciiIo.Brush.defaultAttrs, options
@fg = options.fg
@bg = options.bg
@blink = options.blink
@bright = options.bright
@italic = options.italic
@underline = options.underline
hash: ->
AsciiIo.Brush.hash this

@ -245,7 +245,11 @@ class AsciiIo.ScreenBuffer
repeatLastCharacter: (n = 1) ->
updateBrush: (changes) ->
attrs = _.extend({}, @brush.attributes(), changes)
attrs = @brush.attributes()
for attr, val of changes
attrs[attr] = val
@brush = AsciiIo.Brush.create attrs
# ----- Scroll control

@ -8,7 +8,12 @@ class AsciiIo.SgrInterpreter
n = numbers[i]
if n is 0
_(changes).extend AsciiIo.Brush.defaultAttrs
changes.fg = undefined
changes.bg = undefined
changes.blink = false
changes.bright = false
changes.italic = false
changes.underline = false
else if n is 1
changes.bright = true
else if n is 3

Loading…
Cancel
Save