Comments (9)
I think we have an issue in log-update
now as well (reported here sindresorhus/log-update#20). We started using wrap-ansi
but because it trims all the whitespaces, some of the use cases are now foobar. I started to look into this but couldn't come up with a good solution yet. Maybe I should just do the PR (with what I have) and we can iterate from there?
from wrap-ansi.
@bcoe we should discuss this, as adding trailing whitespace might break other implementations.
For example, take the string a b c d e
, wrapped on 3
, and for clarity we'll make *
represent white-space. We can do one of two things:
// 1. Allow overflow for white-space only
a*b*
c*d*
e
// 2. Bump the beginning of the next line with white-space:
a*b
*c*
d*e
2 above is uglier, but it won't break anything. 1 above would seem to break things as it violates the expected width of the wrap.
What do you think?
from wrap-ansi.
@dthree my gut would be that we should opt for option .2
; especially when hard
is enabled, we can never afford to overflow since tools like cliui
and yargs
use wrap-ansi
for multi-column layout (columns would start to flow into each other).
Either approach taken, it's probably best to opt for a major
bump I think?
from wrap-ansi.
Maybe we could just keep the whitespace at the beginning and the end of the block?
from wrap-ansi.
@SBoudrias this sounds reasonable 👍 if you have the time, could you send a failing test case perhaps?
I'd love to see Inquirer using this, big fan 👍
from wrap-ansi.
@bcoe I agree on both points.
@SBoudrias yeah - could you please give some examples to ensure we understand you correctly?
from wrap-ansi.
and we can iterate from there?
👍
from wrap-ansi.
Yes please make that configurable! <3 :)
from wrap-ansi.
thank you! 🙇
from wrap-ansi.
Related Issues (20)
- Indented text within input (discussion?) HOT 2
- Setting wordWrap to false does not always result in correct wrapping
- Does not wrap a series of whitespace HOT 3
- Difference in output between 2.1.0 and 3.0.1 HOT 5
- Off by one if trimming is disabled HOT 2
- Incorrect leading spaces HOT 6
- leading space removed when line starts with ansi escape HOT 7
- Add support for hyperlink HOT 2
- Space at new lines HOT 1
- URLs larger than column always begin on new line HOT 2
- Newline handling in 6.0.0 HOT 4
- Inconsistant styling for strings with background and foreground. HOT 1
- Can't install package / EEXIST HOT 1
- Use `Intl.Segmenter`
- Add a `ambiguousIsNarrow` option HOT 2
- ERR_REQUIRE_ESM HOT 4
- Multiple escape sequences not distributed to each line HOT 1
- Wrap-Ansi using vulnerable packages
- Error [ERR_REQUIRE_ESM] when starting HOT 1
- Tabs are not wrapped correctly
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wrap-ansi.