mirror of
https://github.com/wader/fq.git
synced 2024-11-26 21:55:57 +03:00
interp: Don't truncate last display column
Wrapping lines might be annoying but not seeing things even worse i think. Hopefully once column config is in jq it could be an option.
This commit is contained in:
parent
16dc8b417a
commit
607202bb67
@ -155,9 +155,9 @@ func (cr *CaseRun) InterruptChan() chan struct{} { return nil }
|
|||||||
|
|
||||||
func (cr *CaseRun) Environ() []string {
|
func (cr *CaseRun) Environ() []string {
|
||||||
env := []string{
|
env := []string{
|
||||||
"_STDIN_WIDTH=0",
|
"_STDIN_WIDTH=135",
|
||||||
"_STDIN_HEIGHT=25",
|
"_STDIN_HEIGHT=25",
|
||||||
"_STDOUT_WIDTH=0",
|
"_STDOUT_WIDTH=135",
|
||||||
"_STDOUT_HEIGHT=25",
|
"_STDOUT_HEIGHT=25",
|
||||||
"_STDOUT_IS_TERMINAL=1",
|
"_STDOUT_IS_TERMINAL=1",
|
||||||
"NO_COLOR=1",
|
"NO_COLOR=1",
|
||||||
|
@ -363,18 +363,6 @@ func dump(v *decode.Value, w io.Writer, opts Options) error {
|
|||||||
return nil
|
return nil
|
||||||
}))
|
}))
|
||||||
|
|
||||||
maxTreeWidth := -1
|
|
||||||
if opts.Width > 0 {
|
|
||||||
maxTreeWidth = opts.Width - (0 +
|
|
||||||
maxAddrIndentWidth +
|
|
||||||
1 +
|
|
||||||
(opts.LineBytes*3 - 1) +
|
|
||||||
1 +
|
|
||||||
opts.LineBytes +
|
|
||||||
1 +
|
|
||||||
0)
|
|
||||||
}
|
|
||||||
|
|
||||||
cw := columnwriter.New(
|
cw := columnwriter.New(
|
||||||
w,
|
w,
|
||||||
[]int{
|
[]int{
|
||||||
@ -384,7 +372,7 @@ func dump(v *decode.Value, w io.Writer, opts Options) error {
|
|||||||
1,
|
1,
|
||||||
opts.LineBytes,
|
opts.LineBytes,
|
||||||
1,
|
1,
|
||||||
maxTreeWidth,
|
-1,
|
||||||
})
|
})
|
||||||
buf := make([]byte, 32*1024)
|
buf := make([]byte, 32*1024)
|
||||||
|
|
||||||
|
2
pkg/interp/testdata/args.fqtest
vendored
2
pkg/interp/testdata/args.fqtest
vendored
@ -92,7 +92,7 @@ slurp false
|
|||||||
string_input false
|
string_input false
|
||||||
unicode false
|
unicode false
|
||||||
verbose false
|
verbose false
|
||||||
width 0
|
width 135
|
||||||
$ fq --help formats
|
$ fq --help formats
|
||||||
aac_frame Advanced Audio Coding frame
|
aac_frame Advanced Audio Coding frame
|
||||||
adts Audio Data Transport Stream
|
adts Audio Data Transport Stream
|
||||||
|
8
pkg/interp/testdata/display.fqtest
vendored
8
pkg/interp/testdata/display.fqtest
vendored
@ -43,13 +43,13 @@ mp3> display({depth: 1, line_bytes: 8})
|
|||||||
* |until 0x283.7 (end) (59| |
|
* |until 0x283.7 (end) (59| |
|
||||||
| | | footers[0:0]:
|
| | | footers[0:0]:
|
||||||
mp3> display({width: 30, depth: 1})
|
mp3> display({width: 30, depth: 1})
|
||||||
|00 01 02 03|0123|.{}: /t
|
|00 01 02 03|0123|.{}: /test.mp3 (mp3)
|
||||||
0x000|49 44 33 04|ID3.| heade
|
0x000|49 44 33 04|ID3.| headers[0:1]:
|
||||||
* |until 0x2c.| |
|
* |until 0x2c.| |
|
||||||
0x02c| ff fb 40| ..@| frame
|
0x02c| ff fb 40| ..@| frames[0:3]:
|
||||||
0x030|c0 00 00 00|....|
|
0x030|c0 00 00 00|....|
|
||||||
* |until 0x283| |
|
* |until 0x283| |
|
||||||
| | | foote
|
| | | footers[0:0]:
|
||||||
mp3> .frames[0] | dv({depth: 1, addrbase: 10})
|
mp3> .frames[0] | dv({depth: 1, addrbase: 10})
|
||||||
|00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15|0123456789012345|.frames[0]{}: frame (mp3_frame) 45-226.7 (182)
|
|00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15|0123456789012345|.frames[0]{}: frame (mp3_frame) 45-226.7 (182)
|
||||||
032| ff fb 40| ..@| header{}: 45-48.7 (4)
|
032| ff fb 40| ..@| header{}: 45-48.7 (4)
|
||||||
|
2
pkg/interp/testdata/options.fqtest
vendored
2
pkg/interp/testdata/options.fqtest
vendored
@ -84,7 +84,7 @@ $ fq -n options
|
|||||||
"string_input": false,
|
"string_input": false,
|
||||||
"unicode": false,
|
"unicode": false,
|
||||||
"verbose": false,
|
"verbose": false,
|
||||||
"width": 0
|
"width": 135
|
||||||
}
|
}
|
||||||
$ fq -o addrbase=10 -n options.addrbase
|
$ fq -o addrbase=10 -n options.addrbase
|
||||||
10
|
10
|
||||||
|
Loading…
Reference in New Issue
Block a user