Skip to content

Commit

Permalink
chore: revert "feat(cellbuf): add Bubblezone support"
Browse files Browse the repository at this point in the history
This reverts commit 318a466.
  • Loading branch information
aymanbagabas committed Nov 5, 2024
1 parent f7e9704 commit d3dd734
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 36 deletions.
6 changes: 0 additions & 6 deletions cellbuf/cell.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,12 @@ type Cell struct {

// Width is the mono-space width of the grapheme cluster.
Width int

// Zone is the zone id of the cell.
Zone int
}

// Equal returns whether the cell is equal to the other cell.
func (c Cell) Equal(o Cell) bool {
return c.Width == o.Width &&
c.Content == o.Content &&
c.Zone == o.Zone &&
c.Style.Equal(o.Style) &&
c.Link.Equal(o.Link)
}
Expand All @@ -43,7 +39,6 @@ func (c Cell) Equal(o Cell) bool {
func (c Cell) Empty() bool {
return c.Content == "" &&
c.Width == 0 &&
c.Zone == 0 &&
c.Style.Empty() &&
c.Link.Empty()
}
Expand All @@ -52,7 +47,6 @@ func (c Cell) Empty() bool {
func (c *Cell) Reset() {
c.Content = ""
c.Width = 0
c.Zone = 0
c.Style.Reset()
c.Link.Reset()
}
12 changes: 0 additions & 12 deletions cellbuf/screen.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ func RenderLine(d Screen, n int) (w int, line string) {
func RenderLineWithProfile(d Screen, n int, p colorprofile.Profile) (w int, line string) {
var pen Style
var link Link
var zone int
var buf bytes.Buffer
var pendingLine string
var pendingWidth int // this ignores space cells until we hit a non-space cell
Expand Down Expand Up @@ -114,17 +113,6 @@ func RenderLineWithProfile(d Screen, n int, p colorprofile.Profile) (w int, line
link = cellLink
}

// Write the Bubblezone escape sequence
if cell.Zone != zone {
writePending()
if cell.Zone == 0 {
buf.WriteString(ansi.SetZone(zone)) //nolint:errcheck
} else {
buf.WriteString(ansi.SetZone(cell.Zone)) //nolint:errcheck
}
zone = cell.Zone
}

// We only write the cell content if it's not empty. If it is, we
// append it to the pending line and width to be evaluated later.
if cell.Equal(spaceCell) {
Expand Down
18 changes: 0 additions & 18 deletions cellbuf/screen_write.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ func setContent(
var cell Cell
var pen Style
var link Link
var zone int
var x, y int

p := ansi.GetParser()
Expand Down Expand Up @@ -57,7 +56,6 @@ func setContent(
cell.Width = width
cell.Style = pen
cell.Link = link
cell.Zone = zone

dis.SetCell(x, y, cell) //nolint:errcheck

Expand All @@ -78,8 +76,6 @@ func setContent(
switch p.Cmd {
case 'm': // SGR - Select Graphic Rendition
handleSgr(p, &pen)
case 'z': // Bubblezone
handleZone(p, &zone)
}
case ansi.HasOscPrefix(seq) && p.Cmd != 0:
switch p.Cmd {
Expand Down Expand Up @@ -222,17 +218,3 @@ func handleHyperlinks(p *ansi.Parser, link *Link) {
}
link.URL = string(params[2])
}

// handleZone handles Bubblezone escape sequences.
func handleZone(p *ansi.Parser, zone *int) {
if p.ParamsLen == 0 {
return
}

z := ansi.Param(p.Params[0]).Param()
if *zone == z {
*zone = 0
} else {
*zone = z
}
}

0 comments on commit d3dd734

Please sign in to comment.