From 12ee636729730e03e9999729994cc2c0cc5c4d26 Mon Sep 17 00:00:00 2001 From: Ravi Pina Date: Tue, 16 Jun 2026 13:15:50 -0700 Subject: [PATCH] fix: sort by real cell value, not emphasis marker getStringField fed BOLD_TEXT:/GREEN_TEXT: prefixes into the sort key, so emphasized rows clustered by the marker instead of their name. Strip the markers before comparing. --- internal/formatter/sort.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/formatter/sort.go b/internal/formatter/sort.go index 474806f..80fb2b0 100644 --- a/internal/formatter/sort.go +++ b/internal/formatter/sort.go @@ -98,7 +98,9 @@ func SortTableDataBy(data []GenericTableData, fields ...string) { // getStringField safely extracts a string field from GenericTableData func getStringField(data GenericTableData, field string) string { if val, ok := data[field]; ok { - return fmt.Sprintf("%v", val) + // Strip table-only emphasis prefixes (BOLD_TEXT:, GREEN_TEXT:) so a + // styled cell sorts by its real value, not the marker. + return stripDisplayMarkers(fmt.Sprintf("%v", val)) } return "" }