chalk / slice-ansi

Slice a string with ANSI escape codes
MIT License
47 stars 21 forks source link

Lose characters when fullwidth characters exist and end is not specified #26

Closed bet4it closed 4 years ago

bet4it commented 5 years ago

Issuehunt badges

Lose characters when there are fullwidth characters in the string and the third argument end is not specified:

const str = sliceAnsi("古古test", 0);
// => '古古te'

IssueHunt Summary #### [kevva kevva](https://issuehunt.io/u/kevva) has been rewarded. ### Backers (Total: $60.00) - [issuehunt issuehunt](https://issuehunt.io/u/issuehunt) ($60.00) ### Submitted pull Requests - [#29 supports fullwidth characters & not specified end](https://issuehunt.io/r/chalk/slice-ansi/pull/29) - [#27 Adjust string length for fullwidth characters when `end` is undefined](https://issuehunt.io/r/chalk/slice-ansi/pull/27) --- ### Tips - Checkout the [Issuehunt explorer](https://issuehunt.io/r/chalk/slice-ansi/) to discover more funded issues. - Need some help from other developers? [Add your repositories](https://issuehunt.io/r/new) on IssueHunt to raise funds. --- IssueHunt has been backed by the following sponsors. [Become a sponsor](https://issuehunt.io/membership/members)
sindresorhus commented 4 years ago

I've added a failing test for this: https://github.com/chalk/slice-ansi/commit/108d0ad176da3bb797fb3037e9a838c5c00eba84

issuehunt-oss[bot] commented 4 years ago

@issuehunt has funded $60.00 to this issue.


issuehunt-oss[bot] commented 4 years ago

@sindresorhus has rewarded $54.00 to @kevva. See it on IssueHunt