Extract terminal configuration to his own function and fix null pty warning

This commit is contained in:
oupson 2023-03-03 18:33:11 +01:00
parent b91d9e66c6
commit 11a839a989
Signed by: oupson
GPG Key ID: 3BD88615552EFCB7
1 changed files with 14 additions and 13 deletions

View File

@ -31,19 +31,13 @@ namespace Footerm {
private Footerm.Model.Server? server; private Footerm.Model.Server? server;
public TerminalPane() { construct {
this.configure_terminal();
this.terminal.char_size_changed.connect(() => {
int rows = 0;
int columns = 0;
this.terminal.get_pty().get_size(out rows, out columns);
this.channel.request_pty_size(columns, rows);
});
} }
public void connect(Footerm.Model.Server server) { public void connect(Footerm.Model.Server server) {
this.server = server; this.server = server;
this.terminal.set_enable_sixel(true);
this.connect_to_server.begin((obj, res) => { this.connect_to_server.begin((obj, res) => {
try { try {
this.connect_to_server.end(res); this.connect_to_server.end(res);
@ -51,11 +45,18 @@ namespace Footerm {
warning("Failed to connect to the server : %s", e.message); warning("Failed to connect to the server : %s", e.message);
} }
}); });
}
private void configure_terminal() {
this.terminal.set_enable_sixel(true);
this.terminal.char_size_changed.connect(() => { this.terminal.char_size_changed.connect(() => {
var pty = this.terminal.get_pty();
if (pty != null && this.channel != null) {
int rows = 0; int rows = 0;
int columns = 0; int columns = 0;
this.terminal.get_pty().get_size(out rows, out columns); pty.get_size(out rows, out columns);
this.channel.request_pty_size(columns, rows); this.channel.request_pty_size(columns, rows);
}
}); });
} }