tools
tools copied to clipboard
📎 `init` separators are too long
Description
Can we use the console width to decide how wide to make these?
I have done some research on how to implement this.
For winodws, windows_sys
crate provide GetConsoleScreenBufferInfo
method which takes HANDLE
For unix rustix
crate provide tcgetwinsize
method which takes Fd (File Descriptor)
Here are some of the github repo
- https://github.com/eminence/terminal-size (best one)
- https://github.com/softprops/termsize
- https://github.com/clap-rs/term_size-rs
- https://github.com/nicokoch/termsize-rs
- https://github.com/JohnTitor/termize
Assign this issue to me and let me know if you have any suggestions.
@DhrjArun FYI we already such logic in our code base, but it's internal to our diagnostics.
https://github.com/rome/tools/blob/main/crates/rome_diagnostics/src/v2/display.rs#L58-L176
An interesting refactor might be to make it a bit generic, so we can use it outside of a diagnostic
@DhrjArun FYI we already such logic in our code base, but it's internal to our diagnostics.
https://github.com/rome/tools/blob/main/crates/rome_diagnostics/src/v2/display.rs#L58-L176
An interesting refactor might be to make it a bit generic, so we can use it outside of a diagnostic
I would love to do this.
@ematipico CountWidth
struct counts the width of content in the header. Everytime write_str
method is called it takes content and increases its width value.
let's say width is 50, Which will be subtracted from the HEADER_WIDTH
which is a hardcoded value of 100 to produce line_width
.
but if the console width is less than 100, the horizontal line will overflow like this.
That is why we need to know the console width (which is not implemented) to replace the hardcoded 100 with the current console width.
👋 @rome/staff please triage this issue by adding one of the following labels: S-Bug: confirmed
, S-Planned
, S-Wishlist
or umbrella