Projects STRLCPY termdash Commits 66b5c11e
🤬
Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
  • ■ ■ ■ ■ ■ ■
    cell/cell.go
    skipped 28 lines
    29 29   Italic bool
    30 30   Underline bool
    31 31   Strikethrough bool
     32 + Inverse bool
     33 + Blink bool
    32 34  }
    33 35   
    34 36  // Set allows existing options to be passed as an option.
    skipped 53 lines
    88 90   })
    89 91  }
    90 92   
    91  -// Strikethrough strikes through the cell's text. Currently a no-op until tcell is updated to >= v2.0.0
     93 +// Strikethrough strikes through the cell's text. Only works when using the tcell backend.
    92 94  func Strikethrough() Option {
    93 95   return option(func(co *Options) {
    94 96   co.Strikethrough = true
    95 97   })
    96 98  }
    97 99   
     100 +// Inverse inverts the colors of the cell's text.
     101 +func Inverse() Option {
     102 + return option(func(co *Options) {
     103 + co.Inverse = true
     104 + })
     105 +}
     106 + 
     107 +// Blink makes the cell's text blink. Only works when using the tcell backend.
     108 +func Blink() Option {
     109 + return option(func(co *Options) {
     110 + co.Blink = true
     111 + })
     112 +}
     113 + 
  • ■ ■ ■ ■ ■ ■
    cell/cell_test.go
    skipped 79 lines
    80 80   Italic(),
    81 81   Underline(),
    82 82   Strikethrough(),
     83 + Inverse(),
     84 + Blink(),
    83 85   },
    84 86   want: &Options{
    85 87   Bold: true,
    86 88   Italic: true,
    87 89   Underline: true,
    88 90   Strikethrough: true,
     91 + Inverse: true,
     92 + Blink: true,
    89 93   },
    90 94   },
    91 95   }
    skipped 11 lines
  • ■ ■ ■ ■ ■
    terminal/tcell/cell_options.go
    skipped 62 lines
    63 63   fg := cellColor(colorToMode(opts.FgColor, colorMode))
    64 64   bg := cellColor(colorToMode(opts.BgColor, colorMode))
    65 65   
    66  - // FIXME: tcell doesn't have a strikethrough style option until #254 is resolved.
    67  - st = st.Foreground(fg).Background(bg).Bold(opts.Bold).Italic(opts.Italic).Underline(opts.Underline)
     66 + st = st.Foreground(fg).
     67 + Background(bg).
     68 + Bold(opts.Bold).
     69 + Italic(opts.Italic).
     70 + Underline(opts.Underline).
     71 + StrikeThrough(opts.Strikethrough).
     72 + Reverse(opts.Inverse).
     73 + Blink(opts.Blink)
    68 74   return st
    69 75  }
    70 76   
  • ■ ■ ■ ■ ■ ■
    terminal/tcell/cell_options_test.go
    skipped 309 lines
    310 310   opts: cell.Options{Underline: true},
    311 311   want: tcell.StyleDefault.Underline(true),
    312 312   },
     313 + {
     314 + colorMode: terminalapi.ColorModeNormal,
     315 + opts: cell.Options{Strikethrough: true},
     316 + want: tcell.StyleDefault.StrikeThrough(true),
     317 + },
     318 + {
     319 + colorMode: terminalapi.ColorModeNormal,
     320 + opts: cell.Options{Inverse: true},
     321 + want: tcell.StyleDefault.Reverse(true),
     322 + },
     323 + {
     324 + colorMode: terminalapi.ColorModeNormal,
     325 + opts: cell.Options{Blink: true},
     326 + want: tcell.StyleDefault.Blink(true),
     327 + },
    313 328   }
    314 329   
    315 330   for _, tc := range tests {
    skipped 11 lines
  • ■ ■ ■ ■ ■
    terminal/termbox/cell_options.go
    skipped 48 lines
    49 49   if opts.Bold {
    50 50   a |= tbx.AttrBold
    51 51   }
    52  - // FIXME: Termbox doesn't have an italics attribute
     52 + // Termbox doesn't have an italics attribute
    53 53   if opts.Italic {
    54 54   return 0, errors.New("Termbox: Unsupported attribute: Italic")
    55 55   }
    56 56   if opts.Underline {
    57 57   a |= tbx.AttrUnderline
    58 58   }
    59  - // FIXME: Termbox doesn't have a strikethrough attribute
     59 + // Termbox doesn't have a strikethrough attribute
    60 60   if opts.Strikethrough {
    61 61   return 0, errors.New("Termbox: Unsupported attribute: Strikethrough")
     62 + }
     63 + if opts.Inverse {
     64 + a |= tbx.AttrReverse
     65 + }
     66 + // Termbox doesn't have a blink attribute
     67 + if opts.Blink {
     68 + return 0, errors.New("Termbox: Unsupported attribute: Blink")
    62 69   }
    63 70   return a, nil
    64 71  }
    skipped 6 lines
  • ■ ■ ■ ■ ■ ■
    terminal/termbox/cell_options_test.go
    skipped 59 lines
    60 60   {cell.Options{Underline: true}, tbx.AttrUnderline, false},
    61 61   {cell.Options{Italic: true}, 0, true},
    62 62   {cell.Options{Strikethrough: true}, 0, true},
     63 + {cell.Options{Inverse: true}, tbx.AttrReverse, false},
     64 + {cell.Options{Blink: true}, 0, true},
    63 65   }
    64 66   
    65 67   for _, tc := range tests {
    skipped 15 lines
Please wait...
Page is in error, reload to recover