Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong table header width when using TTY::Link #41

Open
MatheusRich opened this issue Jan 10, 2022 · 0 comments
Open

Wrong table header width when using TTY::Link #41

MatheusRich opened this issue Jan 10, 2022 · 0 comments
Labels

Comments

@MatheusRich
Copy link

Describe the problem

When tables contain a TTY::Link, the right margin is off.
It seems that header width accounts for the text size when links are not supported (which is larger).

Steps to reproduce the problem

require "bundler/inline"

gemfile do
  source "https://rubygems.org"
  gem "tty-table"
  gem "tty-link"
end

require "tty-table"
require "tty-link"

headers = ["header 1", "header 2"]
rows = [
  [TTY::Link.link_to("hello", "https://example.com"), "world"]
]

puts TTY::Table.new(headers, rows).render

Actual behaviour

Note that it fails with all rendering modes
image

Expected behaviour

In this example, the "header 1" column should be narrower.

Describe your environment

  • OS version: macOS Big Sur 11.6
  • Ruby version: ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [x86_64-darwin20]
  • TTY::Table version: 0.12.0
  • TTY::Link version: 0.1.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant