Skip to content

Commit

Permalink
Merge branch 'wincent/control-characters'
Browse files Browse the repository at this point in the history
* wincent/control-characters:
  docs: update HISTORY section
  fix: don't let control characters mess up the display
  • Loading branch information
wincent committed Aug 31, 2022
2 parents 005b695 + 3d7b0e3 commit 5919c2f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions doc/command-t.txt
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,8 @@ main (not yet released) ~
(https://github.com/wincent/command-t/commit/9e8c790ca718b40f2).
- refactor: hide standard error output from `find`, `git` and `rg`
(https://github.com/wincent/command-t/commit/b229d929ae2a55a7b).
- fix: don't let control characters mess up the display
(https://github.com/wincent/command-t/issues/402).

6.0.0-a.2 (29 August 2022) ~

Expand Down
10 changes: 10 additions & 0 deletions lua/wincent/commandt/private/match_listing.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ end
local format_line = function(line, width, selected)
local prefix = selected and '> ' or ' '

-- Sanitize some control characters, plus blackslashes.
line = line
:gsub('\\', '\\\\')
:gsub('\b', '\\b')
:gsub('\f', '\\f')
:gsub('\n', '\\n')
:gsub('\r', '\\r')
:gsub('\t', '\\t')
:gsub('\v', '\\v')

-- Right pad so that selection highlighting is shown across full width.
if width < 104 then
if #line > 99 then
Expand Down

0 comments on commit 5919c2f

Please sign in to comment.