added statelessVirtualTermWriter
- changed how WindowManager handles new contexts
This commit is contained in:
@@ -18,20 +18,23 @@ class HomeContext {
|
||||
private var ctx:WindowContext = null;
|
||||
private final workspaces:Map<Int, WindowContext> = [];
|
||||
private var currentWorkspace:Int = -1;
|
||||
|
||||
private var requestRender: Void->Void;
|
||||
private var renderer:RootElement;
|
||||
|
||||
public function new() {}
|
||||
|
||||
public function run() {
|
||||
// Create main terminal context
|
||||
ctx = WindowManager.instance.createNewContext();
|
||||
var stateless = WindowManager.instance.createNewStatelessContext();
|
||||
ctx = stateless.ctx;
|
||||
requestRender = stateless.requestRender;
|
||||
WindowManager.instance.focusContextToOutput(ctx, "main");
|
||||
|
||||
renderer = new RootElement();
|
||||
|
||||
ctx.delegateEvents(renderer);
|
||||
render();
|
||||
stateless.setRenderFunc(this.render);
|
||||
requestRender();
|
||||
|
||||
// Register global key bindings to react to main terminal
|
||||
KernelEvents.instance.onKey.handle(e -> {
|
||||
@@ -71,7 +74,7 @@ class HomeContext {
|
||||
}
|
||||
|
||||
private function focusMainTerm() {
|
||||
render();
|
||||
requestRender();
|
||||
WindowManager.instance.focusContextToOutput(ctx, "main");
|
||||
currentWorkspace = -1;
|
||||
}
|
||||
@@ -80,7 +83,7 @@ class HomeContext {
|
||||
if (workspaces[contextId] != null) {
|
||||
focusContext(contextId);
|
||||
} else {
|
||||
var newContext = WindowManager.instance.createNewContext();
|
||||
var newContext = WindowManager.instance.createNewBufferedContext();
|
||||
|
||||
// Create new terminal
|
||||
var term = new Terminal();
|
||||
@@ -93,6 +96,7 @@ class HomeContext {
|
||||
|
||||
private function render() {
|
||||
ctx.clear();
|
||||
ctx.setCursorBlink(false);
|
||||
|
||||
var list = [
|
||||
for (i in 0...MAX_CONTEXT) workspaces.exists(i) ? 'Switch to context ${i}' : 'Create new Terminal on context ${i}'
|
||||
|
||||
Reference in New Issue
Block a user