Skip to content

Commit 8728477

Browse files
Change handling of terminal fit/resize (#19) (#20)
1 parent 01b12b3 commit 8728477

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

index.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import {name as applicationName} from './metadata.json';
4040
/*
4141
* Creates a new Terminal connection
4242
*/
43-
const createConnection = async (core, proc, win, term) => {
43+
const createConnection = async (core, proc, win, term, fit) => {
4444
const params = {
4545
connection: {
4646
},
@@ -82,6 +82,9 @@ const createConnection = async (core, proc, win, term) => {
8282
if (!pinged) {
8383
pinged = true;
8484
pid = parseInt(ev.data, 10);
85+
86+
proc.request('/resize', {method: 'post', body: {size: params.size, pid, uuid}});
87+
fit();
8588
}
8689
});
8790

@@ -106,6 +109,8 @@ const createConnection = async (core, proc, win, term) => {
106109
ws.destroy();
107110
term.dispose();
108111
});
112+
113+
fit();
109114
};
110115

111116
/*
@@ -164,11 +169,7 @@ const createTerminal = (core, proc, index) => {
164169
.on('moved', () => term.focus())
165170
.on('focus', () => term.focus())
166171
.on('blur', () => term.blur())
167-
.on('render', (win) => {
168-
createConnection(core, proc, win, term);
169-
fitAddon.fit();
170-
win.focus();
171-
})
172+
.on('render', (win) => createConnection(core, proc, win, term, fit))
172173
.render(render);
173174
};
174175

0 commit comments

Comments
 (0)