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

Do our best to restore tab characters #722

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Dieken
Copy link
Contributor

@Dieken Dieken commented Jun 18, 2024

$ echo -e 'abc\t\t\tabc'
  # use mouse to select and copy the output, it should contain three tabs,
  # not expand to spaces.

$ touch 2024中华人民共和国
$ for i in `seq 1 20`; do touch text-text-text-text-text-text-$i; done 
$ gls
$ gls -C | cat
  # It should align correctly.

$ echo -e 'abc\t\t\tabc'
  # use mouse to select and copy the output, it should contain three tabs,
  # not expand to spaces.

$ touch 2024中华人民共和国
$ for i in `seq 1 20`; do touch text-text-text-text-text-text-$i; done
$ gls
$ gls -C | cat
  # It should align correctly.
@Sbozzolo
Copy link
Collaborator

Does this assume that any 8 consecutive spaces are always a tab?

@Dieken
Copy link
Contributor Author

Dieken commented Jun 19, 2024

Does this assume that any 8 consecutive spaces are always a tab?

No, consecutive empty cells reaching tab stop are converted to tab. Notice it doesn't have to be consecutive 8 empty cells.

Empty cell means cell.chars[0] == 0, not cell.chars[0] == ' '. Currently the master branch code converts each empty cell to a space, this is very bad, produces wrong output for copy & paste, and doesn't align text well.

@Dieken
Copy link
Contributor Author

Dieken commented Jul 25, 2024

@Sbozzolo @jixiuf could you merge this?

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.

2 participants