Giter Site home page Giter Site logo

Support text wrapping about boxen HOT 5 CLOSED

sindresorhus avatar sindresorhus commented on May 29, 2024 2
Support text wrapping

from boxen.

Comments (5)

Areadrill avatar Areadrill commented on May 29, 2024 1

Hi there,

I'll be working on a solution for this, probably using the wrap-ansi package. If that's okay I'd like to ask a question:

Should the text wrap just enough so that there is no wrap-around, or should it default to a smaller number?

from boxen.

LitoMore avatar LitoMore commented on May 29, 2024 1

@Areadrill No wrap-around I think. Just go for it :)

Please test the CJK character cases.

Here are some sentences for your test:

Chinsese:

Apple 员工不只创造产品,他们的奇思妙想更引领着整个行业的潮流。员工多样化的背景带来了**的碰撞,从令人惊叹的科技到业界领先的环保措施,我们所做的一切都闪耀着他们的灵感与创新。加入 Apple,和我们一道让世界变得更美好。

Japanese:

Appleで働く人々は、ただ製品を作っているだけではありません。あらゆる業界に革命をもたらす、ある種の驚きを生み出しています。驚異的なテクノロジーの開発から業界をリードする環境への取り組みまで、私たちのすべての活動に革新をもたらすのは、多様な人々と彼らが生み出す多彩なアイデアです。あなたもAppleに参加し、協力してください。出会った時よりも良い世界を、未来に渡すために。

Korean:

Apple 직원들이 만드는 것은 제품만이 아닙니다. 산업 전반을 송두리째 바꾸는 기적을 창조해내죠. 놀라운 기술 개발에서 업계를 주도하는 환경 보호 노력에 이르기까지, Apple이 하는 모든 일의 이면에는 혁신이 살아 숨쉬고 있습니다. 그 혁신을 뒷받침하는 것이 바로 구성원들의 다양성과 아이디어죠. Apple의 일원이 되어, 더 살기 좋은 세상을 만드는 이 위대한 여정에 동참해보세요.

from boxen.

sindresorhus avatar sindresorhus commented on May 29, 2024

It doesn't currently support text wrapping. For now you could use wrap-ansi before passing it to Boxen. I'll leave it open as a feature request. Pull request welcome.

from boxen.

Areadrill avatar Areadrill commented on May 29, 2024

In light of issue #35, which directly impacts my solution since I'm using wrap-ansi on strings which might have ANSI styles applied, should I come up with a way to rectify the string's ANSI codes post-split?

I ask because chalk might not be the only relevant use case and if that's so, a more generic fix should probably be applied.

from boxen.

Areadrill avatar Areadrill commented on May 29, 2024

Hi again! My solution is pretty much good to go, with ANSI codes being correctly split and everything but I have one last question: How do I write tests for this?

This particular package is dependent on the size of the window it is run on. Even some of the tests that are currently implemented will fail if one makes a small enough window, so testing for a test case where the content is supposed to wrap would, again, depend on the size of the window.

from boxen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.