Skip to content

Commit

Permalink
xxd color patch
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbra committed Aug 30, 2023
1 parent 1bed993 commit ae8a16f
Show file tree
Hide file tree
Showing 6 changed files with 424 additions and 28 deletions.
6 changes: 6 additions & 0 deletions runtime/doc/xxd.1
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@ to read plain hexadecimal dumps without line number information and without a
particular column layout. Additional whitespace and line breaks are allowed
anywhere.
.TP
.IR \-R " "[WHEN]
In output the hex-value and the value are both colored with the same color depending on the hex-value. Mostly helping to differentiate printable and non-printable characters.
.I WHEN
is
.BR never ", " always ", or " auto .
.TP
.I \-seek offset
When used after
.IR \-r :
Expand Down
20 changes: 20 additions & 0 deletions src/testdir/dumps/Test_xxd_color_0.dump
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
|$+0&#ffffff0| |.@1|/|x@1|d|/|x@1|d| |-|R| |n|e|v|e|r| @1|<| |X@1|D|f|i|l|e|_|c|o|l|o|r|s| @35
|0@7|:| |0@2|1| |0|2|0|3| |0|4|0|5| |0|6|0|7| |0|8|0|9| |0|a|0|b| |0|c|0|d| |0|e|0|f| @1|.@15| @7
|0@5|1|0|:| |1|0|1@1| |1|2|1|3| |1|4|1|5| |1|6|1|7| |1|8|1|9| |1|a|1|b| |1|c|1|d| |1|e|1|f| @1|.@15| @7
|0@5|2|0|:| |2|0|2|1| |2@2|3| |2|4|2|5| |2|6|0@1| |2|8|2|9| |2|a|2|b| |2|c|2|d| |2|e|2|f| @2|!|"|#|$|%|&|.|(|)|*|+|,|-|.|/| @7
|0@5|3|0|:| |3|0|3|1| |3|2|3@1| |3|4|3|5| |3|6|3|7| |3|8|3|9| |3|a|3|b| |3|c|3|d| |3|e|3|f| @1|0|1|2|3|4|5|6|7|8|9|:|;|<|=|>|?| @7
|0@5|4|0|:| |4|0|4|1| |4|2|4|3| |4@2|5| |4|6|4|7| |4|8|4|9| |4|a|4|b| |4|c|4|d| |4|e|4|f| @1|@|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O| @7
|0@5|5|0|:| |5|0|5|1| |5|2|5|3| |5|4|5@1| |5|6|5|7| |5|8|5|9| |5|a|5|b| |0@1|5|d| |5|e|5|f| @1|P|Q|R|S|T|U|V|W|X|Y|Z|[|.|]|^|_| @7
|0@5|6|0|:| |6|0|6|1| |6|2|6|3| |6|4|6|5| |6@2|7| |6|8|6|9| |6|a|6|b| |6|c|6|d| |6|e|6|f| @1|`|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o| @7
|0@5|7|0|:| |7|0|7|1| |7|2|7|3| |7|4|7|5| |7|6|7@1| |7|8|7|9| |7|a|7|b| |7|c|7|d| |7|e|7|f| @1|p|q|r|s|t|u|v|w|x|y|z|{|||}|~|.| @7
|0@5|8|0|:| |8|0|8|1| |8|2|8|3| |8|4|8|5| |8|6|8|7| |8@2|9| |8|a|8|b| |8|c|8|d| |8|e|8|f| @1|.@15| @7
|0@5|9|0|:| |9|0|9|1| |9|2|9|3| |9|4|9|5| |9|6|9|7| |9|8|9@1| |9|a|9|b| |9|c|9|d| |9|e|9|f| @1|.@15| @7
|0@5|a|0|:| |a|0|a|1| |a|2|a|3| |a|4|a|5| |a|6|a|7| |a|8|a|9| |a@2|b| |a|c|a|d| |a|e|a|f| @1|.@15| @7
|0@5|b|0|:| |b|0|b|1| |b|2|b|3| |b|4|b|5| |b|6|b|7| |b|8|b|9| |b|a|b@1| |b|c|b|d| |b|e|b|f| @1|.@15| @7
|0@5|c|0|:| |c|0|c|1| |c|2|c|3| |c|4|c|5| |c|6|c|7| |c|8|c|9| |c|a|c|b| |c@2|d| |c|e|c|f| @1|.@15| @7
|0@5|d|0|:| |d|0|d|1| |d|2|d|3| |d|4|d|5| |d|6|d|7| |d|8|d|9| |d|a|d|b| |d|c|d@1| |d|e|d|f| @1|.@15| @7
|0@5|e|0|:| |e|0|e|1| |e|2|e|3| |e|4|e|5| |e|6|e|7| |e|8|e|9| |e|a|e|b| |e|c|e|d| |e@2|f| @1|.@15| @7
|0@5|f|0|:| |f|0|f|1| |f|2|f|3| |f|4|f|5| |f|6|f|7| |f|8|f|9| |f|a|f|b| |f|c|f|d| |f|e|f@1| @1|.@15| @7
|$| > @72
@75
@75
20 changes: 20 additions & 0 deletions src/testdir/dumps/Test_xxd_color_1.dump
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
|$+0&#ffffff0| |0@7|:| |0+2#e0e0e08&@1|0+2#e000002&|1| +0#0000000&|0+2#e000002&|2|0|3| +0#0000000&|0+2#e000002&|4|0|5| +0#0000000&|0+2#e000002&|6|0|7| +0#0000000&|0+2#e000002&|8|0+2#e0e0004&|9| +0#0000000&|0+2#e0e0004&|a|0+2#e000002&|b| +0#0000000&|0+2#e000002&|c|0+2#e0e0004&|d| +0#0000000&|0+2#e000002&|e|0|f| +0#0000000&@1|.+2#e0e0e08&|.+2#e000002&@7|.+2#e0e0004&@1|.+2#e000002&@1|.+2#e0e0004&|.+2#e000002&@1| +0#0000000&@5
|0@5|1|0|:| |1+2#e000002&|0|1@1| +0#0000000&|1+2#e000002&|2|1|3| +0#0000000&|1+2#e000002&|4|1|5| +0#0000000&|1+2#e000002&|6|1|7| +0#0000000&|1+2#e000002&|8|1|9| +0#0000000&|1+2#e000002&|a|1|b| +0#0000000&|1+2#e000002&|c|1|d| +0#0000000&|1+2#e000002&|e|1|f| +0#0000000&@1|.+2#e000002&@15| +0#0000000&@7
|0@5|2|0|:| |2+2#00e0003&|0|2|1| +0#0000000&|2+2#00e0003&@2|3| +0#0000000&|2+2#00e0003&|4|2|5| +0#0000000&|2+2#00e0003&|6|0+2#e0e0e08&@1| +0#0000000&|2+2#00e0003&|8|2|9| +0#0000000&|2+2#00e0003&|a|2|b| +0#0000000&|2+2#00e0003&|c|2|d| +0#0000000&|2+2#00e0003&|e|2|f| +0#0000000&@1| +2#00e0003&|!|"|#|$|%|&|.+2#e0e0e08&|(+2#00e0003&|)|*|+|,|-|.|/| +0#0000000&@7
|0@5|3|0|:| |3+2#00e0003&|0|3|1| +0#0000000&|3+2#00e0003&|2|3@1| +0#0000000&|3+2#00e0003&|4|3|5| +0#0000000&|3+2#00e0003&|6|3|7| +0#0000000&|3+2#00e0003&|8|3|9| +0#0000000&|3+2#00e0003&|a|3|b| +0#0000000&|3+2#00e0003&|c|3|d| +0#0000000&|3+2#00e0003&|e|3|f| +0#0000000&@1|0+2#00e0003&|1|2|3|4|5|6|7|8|9|:|;|<|=|>|?| +0#0000000&@7
|0@5|4|0|:| |4+2#00e0003&|0|4|1| +0#0000000&|4+2#00e0003&|2|4|3| +0#0000000&|4+2#00e0003&@2|5| +0#0000000&|4+2#00e0003&|6|4|7| +0#0000000&|4+2#00e0003&|8|4|9| +0#0000000&|4+2#00e0003&|a|4|b| +0#0000000&|4+2#00e0003&|c|4|d| +0#0000000&|4+2#00e0003&|e|4|f| +0#0000000&@1|@+2#00e0003&|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O| +0#0000000&@7
|0@5|5|0|:| |5+2#00e0003&|0|5|1| +0#0000000&|5+2#00e0003&|2|5|3| +0#0000000&|5+2#00e0003&|4|5@1| +0#0000000&|5+2#00e0003&|6|5|7| +0#0000000&|5+2#00e0003&|8|5|9| +0#0000000&|5+2#00e0003&|a|5|b| +0#0000000&|0+2#e0e0e08&@1|5+2#00e0003&|d| +0#0000000&|5+2#00e0003&|e|5|f| +0#0000000&@1|P+2#00e0003&|Q|R|S|T|U|V|W|X|Y|Z|[|.+2#e0e0e08&|]+2#00e0003&|^|_| +0#0000000&@7
|0@5|6|0|:| |6+2#00e0003&|0|6|1| +0#0000000&|6+2#00e0003&|2|6|3| +0#0000000&|6+2#00e0003&|4|6|5| +0#0000000&|6+2#00e0003&@2|7| +0#0000000&|6+2#00e0003&|8|6|9| +0#0000000&|6+2#00e0003&|a|6|b| +0#0000000&|6+2#00e0003&|c|6|d| +0#0000000&|6+2#00e0003&|e|6|f| +0#0000000&@1|`+2#00e0003&|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o| +0#0000000&@7
|0@5|7|0|:| |7+2#00e0003&|0|7|1| +0#0000000&|7+2#00e0003&|2|7|3| +0#0000000&|7+2#00e0003&|4|7|5| +0#0000000&|7+2#00e0003&|6|7@1| +0#0000000&|7+2#00e0003&|8|7|9| +0#0000000&|7+2#00e0003&|a|7|b| +0#0000000&|7+2#00e0003&|c|7|d| +0#0000000&|7+2#00e0003&|e|7+2#e000002&|f| +0#0000000&@1|p+2#00e0003&|q|r|s|t|u|v|w|x|y|z|{|||}|~|.+2#e000002&| +0#0000000&@7
|0@5|8|0|:| |8+2#e000002&|0|8|1| +0#0000000&|8+2#e000002&|2|8|3| +0#0000000&|8+2#e000002&|4|8|5| +0#0000000&|8+2#e000002&|6|8|7| +0#0000000&|8+2#e000002&@2|9| +0#0000000&|8+2#e000002&|a|8|b| +0#0000000&|8+2#e000002&|c|8|d| +0#0000000&|8+2#e000002&|e|8|f| +0#0000000&@1|.+2#e000002&@15| +0#0000000&@7
|0@5|9|0|:| |9+2#e000002&|0|9|1| +0#0000000&|9+2#e000002&|2|9|3| +0#0000000&|9+2#e000002&|4|9|5| +0#0000000&|9+2#e000002&|6|9|7| +0#0000000&|9+2#e000002&|8|9@1| +0#0000000&|9+2#e000002&|a|9|b| +0#0000000&|9+2#e000002&|c|9|d| +0#0000000&|9+2#e000002&|e|9|f| +0#0000000&@1|.+2#e000002&@15| +0#0000000&@7
|0@5|a|0|:| |a+2#e000002&|0|a|1| +0#0000000&|a+2#e000002&|2|a|3| +0#0000000&|a+2#e000002&|4|a|5| +0#0000000&|a+2#e000002&|6|a|7| +0#0000000&|a+2#e000002&|8|a|9| +0#0000000&|a+2#e000002&@2|b| +0#0000000&|a+2#e000002&|c|a|d| +0#0000000&|a+2#e000002&|e|a|f| +0#0000000&@1|.+2#e000002&@15| +0#0000000&@7
|0@5|b|0|:| |b+2#e000002&|0|b|1| +0#0000000&|b+2#e000002&|2|b|3| +0#0000000&|b+2#e000002&|4|b|5| +0#0000000&|b+2#e000002&|6|b|7| +0#0000000&|b+2#e000002&|8|b|9| +0#0000000&|b+2#e000002&|a|b@1| +0#0000000&|b+2#e000002&|c|b|d| +0#0000000&|b+2#e000002&|e|b|f| +0#0000000&@1|.+2#e000002&@15| +0#0000000&@7
|0@5|c|0|:| |c+2#e000002&|0|c|1| +0#0000000&|c+2#e000002&|2|c|3| +0#0000000&|c+2#e000002&|4|c|5| +0#0000000&|c+2#e000002&|6|c|7| +0#0000000&|c+2#e000002&|8|c|9| +0#0000000&|c+2#e000002&|a|c|b| +0#0000000&|c+2#e000002&@2|d| +0#0000000&|c+2#e000002&|e|c|f| +0#0000000&@1|.+2#e000002&@15| +0#0000000&@7
|0@5|d|0|:| |d+2#e000002&|0|d|1| +0#0000000&|d+2#e000002&|2|d|3| +0#0000000&|d+2#e000002&|4|d|5| +0#0000000&|d+2#e000002&|6|d|7| +0#0000000&|d+2#e000002&|8|d|9| +0#0000000&|d+2#e000002&|a|d|b| +0#0000000&|d+2#e000002&|c|d@1| +0#0000000&|d+2#e000002&|e|d|f| +0#0000000&@1|.+2#e000002&@15| +0#0000000&@7
|0@5|e|0|:| |e+2#e000002&|0|e|1| +0#0000000&|e+2#e000002&|2|e|3| +0#0000000&|e+2#e000002&|4|e|5| +0#0000000&|e+2#e000002&|6|e|7| +0#0000000&|e+2#e000002&|8|e|9| +0#0000000&|e+2#e000002&|a|e|b| +0#0000000&|e+2#e000002&|c|e|d| +0#0000000&|e+2#e000002&@2|f| +0#0000000&@1|.+2#e000002&@15| +0#0000000&@7
|0@5|f|0|:| |f+2#e000002&|0|f|1| +0#0000000&|f+2#e000002&|2|f|3| +0#0000000&|f+2#e000002&|4|f|5| +0#0000000&|f+2#e000002&|6|f|7| +0#0000000&|f+2#e000002&|8|f|9| +0#0000000&|f+2#e000002&|a|f|b| +0#0000000&|f+2#e000002&|c|f|d| +0#0000000&|f+2#e000002&|e|f+2#0000e05&@1| +0#0000000&@1|.+2#e000002&@14|.+2#0000e05&| +0#0000000&@7
|$| > @72
@75
@75
@75
9 changes: 7 additions & 2 deletions src/testdir/term_util.vim
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ endfunc
" "statusoff" - number of lines the status is offset from default
" "wait_for_ruler" - if zero then don't wait for ruler to show
" "no_clean" - if non-zero then remove "--clean" from the command
" "cmd" - run any other command, e.g. "xxd" (used in xxd test)
func RunVimInTerminal(arguments, options)
" If Vim doesn't exit a swap file remains, causing other tests to fail.
" Remove it here.
Expand Down Expand Up @@ -90,7 +91,11 @@ func RunVimInTerminal(arguments, options)
let reset_u7 = ' --cmd "set t_u7=" '
endif

let cmd = GetVimCommandCleanTerm() .. reset_u7 .. a:arguments
if empty(get(a:options, 'cmd', ''))
let cmd = GetVimCommandCleanTerm() .. reset_u7 .. a:arguments
else
let cmd = get(a:options, 'cmd')
endif

if get(a:options, 'no_clean', 0)
let cmd = substitute(cmd, '--clean', '', '')
Expand Down Expand Up @@ -120,7 +125,7 @@ func RunVimInTerminal(arguments, options)

call TermWait(buf)

if get(a:options, 'wait_for_ruler', 1)
if get(a:options, 'wait_for_ruler', 1) && empty(get(a:options, 'cmd', ''))
" Wait for "All" or "Top" of the ruler to be shown in the last line or in
" the status line of the last window. This can be quite slow (e.g. when
" using valgrind).
Expand Down
Loading

0 comments on commit ae8a16f

Please sign in to comment.