From 12fe95497c5c27062189781af6fbc52f2518c47c Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Mon, 4 Nov 2024 12:53:14 -0500 Subject: [PATCH] fix(ansi): param should return -1 if missing --- ansi/parser_decode.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ansi/parser_decode.go b/ansi/parser_decode.go index ba6ebd2a..0ed802cb 100644 --- a/ansi/parser_decode.go +++ b/ansi/parser_decode.go @@ -437,7 +437,11 @@ type Param int // Param returns the parameter at the given index. // It returns -1 if the parameter does not exist. func (s Param) Param() int { - return int(s) & parser.ParamMask + p := int(s) & parser.ParamMask + if p == parser.MissingParam { + return -1 + } + return p } // HasMore returns true if the parameter has more sub-parameters.