Skip to content

feat: calculate the width of columns based on their content - #25

Open
MatteoGauthier wants to merge 1 commit into
byawitz:masterfrom
MatteoGauthier:feat/auto-col-width
Open

feat: calculate the width of columns based on their content#25
MatteoGauthier wants to merge 1 commit into
byawitz:masterfrom
MatteoGauthier:feat/auto-col-width

Conversation

@MatteoGauthier

@MatteoGauthier MatteoGauthier commented Mar 27, 2025

Copy link
Copy Markdown

Noticed the host column in the ggh output was cropped, here is a quick fix by calculating the width of columns using rows content length.

It works in interactive and non-interactive mode

No performance loss :

hyperfine -r 20 -N -w 5 './ggh --config' 'ggh --config'
Benchmark 1: ./ggh --config
  Time (mean ± σ):       1.7 ms ±   0.1 ms    [User: 1.0 ms, System: 0.6 ms]
  Range (min … max):     1.6 ms …   1.9 ms    20 runs
 
Benchmark 2: ggh --config
  Time (mean ± σ):       1.9 ms ±   0.1 ms    [User: 0.9 ms, System: 0.5 ms]
  Range (min … max):     1.7 ms …   2.0 ms    20 runs
 
Summary
  ./ggh --config ran
    1.08 ± 0.08 times faster than ggh --config

Fix #19

@gghostman

Copy link
Copy Markdown
Collaborator

Hey there.
Please see the initial changes done in this PR #13
And then let's see how we move from that as I was about to merge that one

@jleroy-gm

Copy link
Copy Markdown

Hey ! Would love to see this MR accepted !

@gghostman

Copy link
Copy Markdown
Collaborator

Hey there,
pardon my delay,
I've done a quick check and this doesn't take into account the screen size, which means that some columns will not be displayed if the screen is small (e.g. terminal is resized)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Better host coloumn

3 participants