Skip to content

Commit

Permalink
Fix whitespace collapsed bug in io.aviso.ansi/compose
Browse files Browse the repository at this point in the history
Fixes #86
  • Loading branch information
hlship committed May 24, 2023
1 parent e7fcbde commit ff8e59c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
10 changes: 8 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
## 1.4.1 -- 5 May 2023
## 1.4.3 -- UNRELEASED

The `compose` function would collapse blank strings to empty strings.

[Closed Issues](https://github.com/AvisoNovate/pretty/milestone/33?closed=1)

## 1.4.1, 1.4.2 -- 5 May 2023

`io.aviso.ansi`: Add support for `faint`, `underlined`, and `not-underlined` text, and improvements
to docstrings.

[Closed issues](https://github.com/AvisoNovate/pretty/milestone/33?closed=1)
[Closed issues](https://github.com/AvisoNovate/pretty/milestone/34?closed=1)

## 1.4 -- 27 Mar 2023

Expand Down
8 changes: 3 additions & 5 deletions src/io/aviso/ansi.clj
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,9 @@
(defn- collect-markup
[state input]
(cond
(nil? input)
(or
(nil? input)
(= "" input))
state

(vector? input)
Expand All @@ -264,10 +266,6 @@
(sequential? input)
(reduce collect-markup state input)

(and (string? input)
(str/blank? input))
state

:else
(let [{:keys [active current]} state
state' (if (= active current)
Expand Down
7 changes: 7 additions & 0 deletions test/io/aviso/ansi_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@
"Prefix-- 0 1 2 --Suffix[CSI]m"


;; A bug caused blank strings to be omitted, this checks for the fix:
[" "
"|"
" "
"|"
" "] " | | [CSI]m"

["Notice: the "
[:yellow "shields"]
" are operating at "
Expand Down

0 comments on commit ff8e59c

Please sign in to comment.