Skip to content

Commit

Permalink
fix: unicode characters are cutted (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
nam-hle committed May 14, 2021
1 parent d652f5c commit acadfbf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// import chalk from 'chalk';
import {
createStream,
} from './createStream';
Expand Down
5 changes: 2 additions & 3 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import slice from 'slice-ansi';
import stringWidth from 'string-width';
import stripAnsi from 'strip-ansi';
import {
getBorderCharacters,
Expand All @@ -22,9 +23,7 @@ export const normalizeString = (input: string): string => {
* @internal
*/
export const splitAnsi = (input: string): string[] => {
const lengths = stripAnsi(input).split('\n').map(({length}) => {
return length;
});
const lengths = stripAnsi(input).split('\n').map(stringWidth);

const result: string[] = [];
let startIndex = 0;
Expand Down

0 comments on commit acadfbf

Please sign in to comment.