Blink attribute support

openid
Marcin Kulik 13 years ago
parent 5fdd43306d
commit fe349c9394

@ -5,7 +5,7 @@ class AsciiIo.Brush
@cache = {}
@hash: (brush) ->
"#{brush.fg}_#{brush.bg}_#{brush.bright}_#{brush.underline}_#{brush.italic}"
"#{brush.fg}_#{brush.bg}_#{brush.bright}_#{brush.underline}_#{brush.italic}_#{brush.blink}"
@create: (options) ->
options ||= {}
@ -25,3 +25,4 @@ class AsciiIo.Brush
@bright = options.bright
@underline = options.underline
@italic = options.italic
@blink = options.blink

@ -85,6 +85,11 @@ class AsciiIo.TerminalView extends Backbone.View
fg += 8 if fg < 8 and brush.bright
span += " fg" + fg
if brush.bg isnt undefined
bg = brush.bg
bg += 8 if bg < 8 and brush.blink
span += " bg" + bg
if brush.bright
span += " bright"
@ -94,7 +99,6 @@ class AsciiIo.TerminalView extends Backbone.View
if brush.italic
span += " italic"
span += " bg" + brush.bg if brush.bg isnt undefined
span += " cursor visible" if hasCursor
span += "\">"

@ -269,10 +269,14 @@ class AsciiIo.VT
@italic = true
else if n is 4
@underline = true
else if n is 5
@blink = true
else if n is 23
@italic = false
else if n is 24
@underline = false
else if n is 25
@blink = false
else if n >= 30 and n <= 37
@fg = n - 30
else if n is 38
@ -291,11 +295,12 @@ class AsciiIo.VT
i++
props = {}
props.fg = @fg if @fg
props.bg = @bg if @bg
props.fg = @fg if @fg isnt undefined
props.bg = @bg if @bg isnt undefined
props.bright = true if @bright
props.underline = true if @underline
props.italic = true if @italic
props.blink = true if @blink
@setBrush AsciiIo.Brush.create(props)

Loading…
Cancel
Save