Skip to content
Myr

Refactor ANSI parser

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Junegunn Choi · committed by Junegunn Choi · parent 4811e52 · Browse files · 1 file+8 added−9 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+8 added−9 removed

  • other:+8 added−9 removed

1 file+8 added−9 removed

modified:src/ansi.go+8 added-9 removed
397 unmodified lines
398 }399 return state400 }401402 if len(ansiCode) <= 3 {402 reset := func() {403 state.fg = -1404 state.bg = -1405 state.attr = 0406 state.lbg = -1407 }408409 if len(ansiCode) <= 3 {410 reset()411 return state412 }413 ansiCode = ansiCode[2 : len(ansiCode)-1]414
45 unmodified lines
460 state.attr = state.attr &^ tui.Reverse461 case 29:462 state.attr = state.attr &^ tui.StrikeThrough463 case 0:459 state.fg = -1460 state.bg = -1461 state.attr = 0462 state.lbg = -1464 reset()465 state256 = 0466 default:467 if num >= 30 && num <= 37 {468 state.fg = tui.Color(num - 30)
31 unmodified lines
500 }501502 // Empty sequence: reset503 if count == 0 {502 state.fg = -1503 state.bg = -1504 state.attr = 0505 state.lbg = -1504 reset()505 }506507 if state256 > 0 {508 *ptr = -1
3 unmodified lines