Skip to content

Commit 0e7d449

Browse files
committed
feat: Added the ability to prevent wrapping by artifically setting no of cols very wide
1 parent 2349964 commit 0e7d449

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codify-plugin-lib",
3-
"version": "1.0.182-beta55",
3+
"version": "1.0.182-beta57",
44
"description": "Library plugin library",
55
"main": "dist/index.js",
66
"typings": "dist/index.d.ts",

src/pty/background-pty.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export class BackgroundPty implements IPty {
2323
private historyIgnore = Utils.getShell() === Shell.ZSH ? { HISTORY_IGNORE: '*' } : { HISTIGNORE: '*' };
2424
private basePty = pty.spawn(this.getDefaultShell(), ['-i'], {
2525
env: { ...process.env, ...this.historyIgnore },
26+
cols: 10_000, // Set to a really large value to prevent wrapping
2627
name: nanoid(6),
2728
handleFlowControl: true
2829
});

src/pty/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,17 @@ export enum SpawnStatus {
2525
*
2626
* @property {boolean} [interactive] - Indicates whether the spawned process needs
2727
* to be interactive. Only works within apply (not plan). Defaults to true.
28+
*
29+
* @property {boolean} [disableWrapping] - Forces the terminal width to 10_000 to disable wrapping.
30+
* In applys, this is off by default while it is on during plans.
2831
*/
2932
export interface SpawnOptions {
3033
cwd?: string;
3134
env?: Record<string, unknown>;
3235
interactive?: boolean;
3336
requiresRoot?: boolean;
3437
stdin?: boolean;
38+
disableWrapping?: boolean;
3539
}
3640

3741
export class SpawnError extends Error {

src/pty/seqeuntial-pty.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ export class SequentialPty implements IPty {
6262
}
6363

6464
// Initial terminal dimensions
65-
const initialCols = process.stdout.columns ?? 80;
65+
// Set to a really large value to prevent wrapping
66+
const initialCols = options?.disableWrapping ? 10_000 : process.stdout.columns ?? 80
6667
const initialRows = process.stdout.rows ?? 24;
6768

6869
const args = options?.interactive ? ['-i', '-c', cmd] : ['-c', cmd]
@@ -85,7 +86,7 @@ export class SequentialPty implements IPty {
8586

8687
const resizeListener = () => {
8788
const { columns, rows } = process.stdout;
88-
mPty.resize(columns, rows);
89+
mPty.resize(columns, options?.disableWrapping ? 10_000 : rows);
8990
}
9091

9192
// Listen to resize events for the terminal window;

0 commit comments

Comments
 (0)