rustbox / esp32c3-vgaterm

VGA Driver and Serial Terminal crates, with embedded applications in mind
MIT License
1 stars 0 forks source link

Consider a Bit Set API for the CharColor decorations #12

Open dougli1sqrd opened 1 year ago

dougli1sqrd commented 1 year ago

Hmm, decoration here feels like it might be another job for a BitSet. What do you think?

_Originally posted by @sethp in https://github.com/rustbox/esp32c3-vgaterm/pull/9#discussion_r1096142683_

sethp commented 1 year ago

Looks like it was bitflags that I was thinking of. Seems like a natural fit for the attributes, at least, something like:

bitflags! {
  struct Attr {
    const Blink = 1 << 12,
    const Strikethrough = 1 << 13,
    const Underline = 1 << 14,
  }
}

It'd be neat if we could also "pack" the lower bits with the color data. Some sort of a hybrid of a bitflag and a RegisterSpec (or whatever the hal calls it) maybe?