Skip to content
Myr

Fix #155 - Empty ANSI color code to reset color state

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 eae5357 · Browse files · 2 files+11 added−0 removed
This commit

State

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

Diff stats

2 files+11 added−0 removed

  • other:+11 added−0 removed

2 files+11 added−0 removed

modified:src/ansi_test.go+8 added
43 unmodified lines
44 }45 assert(offsets[0], 0, 11, -1, -1, true)46 })4748 src = "\x1b[1mhello \x1b[mworld"49 check(func(offsets []ansiOffset) {50 if len(offsets) != 1 {51 t.Fail()52 }53 assert(offsets[0], 0, 6, -1, -1, true)54 })5556 src = "hello \x1b[34;45;1mworld"57 check(func(offsets []ansiOffset) {58 if len(offsets) != 1 {59 t.Fail()
40 unmodified lines
modified:src/ansi.go+3 added
97 unmodified lines
98 state256 = 099 }100101 ansiCode = ansiCode[2 : len(ansiCode)-1]102 if len(ansiCode) == 0 {103 init()104 }105 for _, code := range strings.Split(ansiCode, ";") {106 if num, err := strconv.Atoi(code); err == nil {107 switch state256 {108 case 0:
37 unmodified lines