terminal support fixes

This commit is contained in:
Vadim Lopatin 2016-06-01 15:11:08 +03:00
parent 416d46bca5
commit dce064d1f0
2 changed files with 10 additions and 3 deletions

View File

@ -185,6 +185,8 @@ class OutputPanel : DockWindow {
//if (!term.create()) { //if (!term.create()) {
// Log.e("Cannot create terminal device"); // Log.e("Cannot create terminal device");
//} //}
_terminalWidget.write("\n\n\n\nDevice: "d ~ toUTF32(_terminalWidget.deviceName));
_terminalWidget.write("\x1b[0m\nnormal text\n"d);
return _tabs; return _tabs;
} }

View File

@ -380,7 +380,7 @@ class TerminalWidget : WidgetGroup, OnScrollHandler {
} }
/// returns terminal/tty device (or named pipe for windows) name /// returns terminal/tty device (or named pipe for windows) name
@property string deviceName() { return _device ? _device.name : null; } @property string deviceName() { return _device ? _device.deviceName : null; }
void scrollTo(int y) { void scrollTo(int y) {
_content.scrollTo(y); _content.scrollTo(y);
@ -522,6 +522,11 @@ class TerminalWidget : WidgetGroup, OnScrollHandler {
return true; return true;
} }
void handleInput(dstring chars) {
import std.utf;
_device.write(chars.toUTF8);
}
private dchar[] outputChars; private dchar[] outputChars;
// write utf32 // write utf32
void write(dstring chars) { void write(dstring chars) {
@ -709,7 +714,7 @@ class TerminalDevice : Thread {
Log.d("TerminalDevice threadProc() enter"); Log.d("TerminalDevice threadProc() enter");
version(Windows) { version(Windows) {
while (!closed) { while (!closed) {
Log.d("Waiting for TerminalDevice client"); Log.d("TerminalDevice -- Waiting for client");
if (ConnectNamedPipe(hpipe, null)) { if (ConnectNamedPipe(hpipe, null)) {
// accept client // accept client
Log.d("TerminalDevice client connected"); Log.d("TerminalDevice client connected");
@ -743,7 +748,7 @@ class TerminalDevice : Thread {
bool write(string msg) { bool write(string msg) {
if (!msg.length) if (!msg.length)
return true; return true;
if (!closed) if (closed || !started)
return false; return false;
version (Windows) { version (Windows) {
for (;;) { for (;;) {