Skip to content

Commit

Permalink
optimized terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
0xJacky committed Jul 6, 2022
1 parent d8636b7 commit 3c56bf1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions frontend/src/views/pty/Terminal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<a-card :title="$gettext('Terminal')">
<div class="console" id="terminal"></div>
</a-card>

</template>

<script>
Expand Down Expand Up @@ -34,6 +33,7 @@ export default {
window.removeEventListener('resize', this.fit)
clearInterval(this.ping)
this.ping = null
this.term.close()
this.websocket.close()
},
methods: {
Expand All @@ -46,13 +46,16 @@ export default {
convertEol: true,
fontSize: 14,
cursorStyle: 'block',
scrollback: 30,
scrollback: 1000,
theme: {
background: 'rgba(3,14,32,0.7)'
},
})
const fitAddon = new FitAddon()
term.loadAddon(fitAddon)
this.fitAddon = fitAddon
term.open(document.getElementById('terminal'))
setTimeout(()=>{
setTimeout(() => {
fitAddon.fit()
}, 60)
window.addEventListener('resize', this.fit)
Expand All @@ -71,7 +74,7 @@ export default {
that.sendMessage({Type: 1, Data: data})
})
term.onResize(data => {
that.sendMessage({Type:2, Data:{Cols:data.cols, Rows: data.rows}})
that.sendMessage({Type: 2, Data: {Cols: data.cols, Rows: data.rows}})
})
this.term = term
},
Expand All @@ -93,6 +96,6 @@ export default {

<style lang="less" scoped>
.console {
min-height: 800px;
min-height: calc(100vh - 300px);
}
</style>
2 changes: 1 addition & 1 deletion frontend/version.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"1.4.0","build_id":4,"total_build":60}
{"version":"1.4.0","build_id":5,"total_build":61}

0 comments on commit 3c56bf1

Please sign in to comment.