Skip to content

Commit

Permalink
add ctrl+c ctrl+x and esc to mobile terminal ui
Browse files Browse the repository at this point in the history
Signed-off-by: si458 <simonsmith5521@gmail.com>
  • Loading branch information
si458 committed Sep 24, 2024
1 parent bc34f14 commit 61fb689
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
3 changes: 3 additions & 0 deletions translate/translate.json
Original file line number Diff line number Diff line change
Expand Up @@ -21564,6 +21564,7 @@
"zh-cht": "Ctl-C",
"uk": "Ctl-C",
"xloc": [
"default-mobile.handlebars->container->page_content->column_l->p10->p10terminal->termTable->termarea4->1->3",
"default.handlebars->container->column_l->p12->termTable->1->1->4->1->3",
"sharing.handlebars->p12->9->3"
]
Expand Down Expand Up @@ -21594,6 +21595,7 @@
"zh-cht": "Ctl-X",
"uk": "Ctl-X",
"xloc": [
"default-mobile.handlebars->container->page_content->column_l->p10->p10terminal->termTable->termarea4->1->3",
"default.handlebars->container->column_l->p12->termTable->1->1->4->1->3",
"sharing.handlebars->p12->9->3"
]
Expand Down Expand Up @@ -28451,6 +28453,7 @@
"zh-cht": "ESC",
"uk": "ESC",
"xloc": [
"default-mobile.handlebars->container->page_content->column_l->p10->p10terminal->termTable->termarea4->1->3",
"default.handlebars->container->column_l->p11->deskarea0->deskarea4->5",
"default.handlebars->container->column_l->p12->termTable->1->1->4->1->3",
"sharing.handlebars->p12->9->3"
Expand Down
26 changes: 26 additions & 0 deletions views/default-mobile.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,9 @@
<div class="toright2"></div>
<div style="height:28px">
<input id="termActionsBtn" style="margin-left:3px;height:28px" type=button title="Perform power actions on the device" onkeypress="return false" onkeydown="return false" value=Actions onclick=deviceActionFunction() />
<input id="ctrlcbutton" style="margin-left:3px;height:28px" type=button onkeypress="return false" onkeydown="return false" value="Ctl-C" onclick="termSendKey(3,'ctrlcbutton')" />
<input id="ctrlxbutton" style="margin-left:3px;height:28px" type=button onkeypress="return false" onkeydown="return false" value="Ctl-X" onclick="termSendKey(24,'ctrlxbutton')" />
<input id="escbutton" style="margin-left:3px;height:28px" type=button onkeypress="return false" onkeydown="return false" value="ESC" onclick="termSendKey(27,'escbutton')" />
</div>
</div>
</div>
Expand Down Expand Up @@ -5148,6 +5151,9 @@

// Enable action button if mesh type is not "local devices"
QV('termActionsBtn', terminalNode.mtype != 3);
QE('ctrlcbutton', termState);
QE('ctrlxbutton', termState);
QE('escbutton', termState);
if (((termState == true) && (terminal.contype != 3)) || (terminalNode.agent == null) || (terminalNode.agent.id == 3) || (terminalNode.agent.id == 4)) {
QH('terminalCustomUpperRight', '');
} else {
Expand Down Expand Up @@ -5467,6 +5473,26 @@
Q('connectbutton2').blur(); // Deselect the connect button so the button does not get key presses.
}

function termSendKey(key, id) {
if (!terminal || xxdialogMode) return;
if (xterm != null) {
if (terminal.urlname == 'sshterminalrelay.ashx') {
// SSH
terminal.socket.send('~' + String.fromCharCode(key));
} else if (terminal.sendText) {
// MeshAgent
terminal.sendText(String.fromCharCode(key));
} else {
// CIRA
terminal.send(String.fromCharCode(key));
}
xterm.focus();
} else if (terminal != null) {
terminal.m.TermSendKey(key);
Q(id).blur(); // Deselect the connect button so the button does not get key presses.
}
}

//
// Terminal Shortcut Keys
//
Expand Down

0 comments on commit 61fb689

Please sign in to comment.