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

feat: inspect log scrolling #13

Merged
merged 4 commits into from
Mar 11, 2022
Merged

Conversation

LumaKernel
Copy link
Contributor

@LumaKernel LumaKernel commented Mar 11, 2022

notios_demo3

@changeset-bot
Copy link

changeset-bot bot commented Mar 11, 2022

🦋 Changeset detected

Latest commit: 780b1f1

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@LumaKernel
Copy link
Contributor Author

real{width, height}の安定性強化含む。

@LumaKernel LumaKernel merged commit c9c225f into frouriojs:main Mar 11, 2022
@LumaKernel LumaKernel deleted the feat-scr-log branch March 11, 2022 10:40
<Text color="gray" italic>
{left}
</Text>
<Box width={wcwidth(text) - (text.length - stringLength(text))}>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

こいつの解説。

length は Unicode 文字何個分か。wcwidth は見た目の幅。stringLength は "文字" 何個か。

  • '\x00'.length === 1
  • wcwidth('\x00') === 0
  • stringLength('\x00') === 1 // ここは疑問だがまあいい
  • 'a'.length === 1
  • wcwidth('a') === 1
  • stringLength('a') === 1
  • 'あ'.length === 1
  • wcwidth('あ') === 2 // ターミナルの表示上で2文字分
  • stringLength('あ') === 1 // "文字" としては 1 文字
  • '😁'.length === 2 // サロゲートペア使っているので Unicode文字 2 分
  • wcwidth('😁') === 2
  • stringLength('😁') === 1

ink 君は length が stringLength より多いと多めに幅を確保してしまいます。多分バグです。絵文字で問題出ます。とりえあえず width で上から抑えます。
絵文字の増えた分を吸収するには全部使ってやっと検知できます。 (制御文字は問題でますが、これは ANSI コンテキスト側で解決予定です)

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.

1 participant