Skip to content

Commit c96eda5

Browse files
committed
fix(#99): enable hard wrapping for long words
1 parent d20c41f commit c96eda5

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

.changeset/purple-lions-doubt.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@clack/core': patch
3+
'@clack/prompts': patch
4+
---
5+
6+
Enable hard line-wrapping behavior for long words without spaces

packages/core/src/prompts/prompt.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,15 +205,14 @@ export default class Prompt {
205205
this.unsubscribe();
206206
}
207207

208-
// TODO: handle wrapping
209208
private restoreCursor() {
210-
const lines = wrap(this._prevFrame, process.stdout.columns).split('\n').length - 1;
209+
const lines = wrap(this._prevFrame, process.stdout.columns, { hard: true }).split('\n').length - 1;
211210
this.output.write(cursor.move(-999, lines * -1));
212211
}
213212

214213
private _prevFrame = '';
215214
private render() {
216-
const frame = wrap(this._render(this) ?? '', process.stdout.columns);
215+
const frame = wrap(this._render(this) ?? '', process.stdout.columns, { hard: true });
217216
if (frame === this._prevFrame) return;
218217

219218
if (this.state === 'initial') {

0 commit comments

Comments
 (0)