Skip to content

Small colour/filtering related bug #2962

@bewinter

Description

@bewinter




Describe the bug
A function's colour parameter is not used as intended.

See internal/color/colorize.go:

// Highlight colorize bytes at given indices.
func Highlight(bb []byte, ii []int, c int) []byte {                       // <----(!)
	b := make([]byte, 0, len(bb))
	for i, j := 0, 0; i < len(bb); i++ {
		if j < len(ii) && ii[j] == i {
			b = append(b, colorizeByte(bb[i], 209)...)        // <----(!)
			j++
		} else {
			b = append(b, bb[i])
		}
	}

	return b
}

The third parameter for colour c is not used but instead the colour value 209 is hardcoded.

To Reproduce
Just noticed the issue during code analysis as preparation for a potential enhancement.

Historical Documents
n/a

Expected behavior
The requested highlighting colour should be applied, not a fixed value.

Screenshots
n/a

Versions (please complete the following information):
Branch master 9984e3f

Additional context
n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingin-progressMark issue as being worked on

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions