Compare commits
3 Commits
adb758bd53
...
e04021425a
| Author | SHA1 | Date | |
|---|---|---|---|
|
e04021425a
|
|||
|
d89956a626
|
|||
|
dd146d1caf
|
@@ -1,5 +1,6 @@
|
||||
package bin;
|
||||
|
||||
import lib.MathI;
|
||||
import kernel.EndOfLoop;
|
||||
import lua.NativeStringTools;
|
||||
import kernel.binstore.BinStore;
|
||||
@@ -25,6 +26,8 @@ class Terminal implements IProcess {
|
||||
private var history:Array<String> = [];
|
||||
private var historyIndex:Int = 0;
|
||||
|
||||
private var scrollBack = 0;
|
||||
|
||||
private var runningPID:PID = -1;
|
||||
|
||||
public function new() {}
|
||||
@@ -61,6 +64,7 @@ class Terminal implements IProcess {
|
||||
this.backlog.push("> " + this.input);
|
||||
var command = this.input;
|
||||
this.input = "";
|
||||
this.scrollBack = 0;
|
||||
this.requestRender();
|
||||
this.historyIndex = 0;
|
||||
this.invokeCommand(command);
|
||||
@@ -72,6 +76,12 @@ class Terminal implements IProcess {
|
||||
this.input = this.history[this.history.length - this.historyIndex];
|
||||
this.requestRender();
|
||||
}
|
||||
case 266: // PAGE UP
|
||||
this.scrollBack = MathI.min(scrollBack + 1, this.backlog.length - 1);
|
||||
this.requestRender();
|
||||
case 267: // PAGE DOWN
|
||||
this.scrollBack = MathI.max(scrollBack - 1, 0);
|
||||
this.requestRender();
|
||||
}
|
||||
}));
|
||||
|
||||
@@ -99,7 +109,8 @@ class Terminal implements IProcess {
|
||||
var size = this.ctx.getSize();
|
||||
var linesAvailable = size.y - 1;
|
||||
|
||||
var start:Int = this.backlog.length - linesAvailable;
|
||||
var withoutScrollBack = (this.backlog.length - linesAvailable);
|
||||
var start:Int = withoutScrollBack - scrollBack;
|
||||
|
||||
for (i in 0...linesAvailable) {
|
||||
var line = this.backlog[start + i];
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package kernel.peripherals;
|
||||
|
||||
import kernel.log.Log;
|
||||
import kernel.peripherals.Modem;
|
||||
import kernel.peripherals.Screen;
|
||||
|
||||
@@ -50,12 +51,7 @@ class Peripheral {
|
||||
}
|
||||
|
||||
var types = getTypes(addr);
|
||||
var methodsMap = cc.Peripheral.getMethods(addr).toMap();
|
||||
var methods:Array<String> = [];
|
||||
|
||||
for (k => v in methodsMap) {
|
||||
methods.push(k);
|
||||
}
|
||||
var methods = cc.Peripheral.getMethods(addr).toArray();
|
||||
|
||||
return {
|
||||
types: types,
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
package lib;
|
||||
|
||||
import haxe.Serializer;
|
||||
import haxe.Unserializer;
|
||||
import kernel.fs.FS;
|
||||
import haxe.ds.StringMap;
|
||||
#if kv_use_native
|
||||
import cc.TextUtils;
|
||||
#else
|
||||
import haxe.Unserializer;
|
||||
import haxe.Serializer;
|
||||
#end
|
||||
|
||||
/**
|
||||
Key value store with persistence.
|
||||
Use flag kv_use_native to use the cc serialization.
|
||||
**/
|
||||
class KVStore {
|
||||
private var kvStore:StringMap<Dynamic> = new StringMap();
|
||||
@@ -43,14 +48,21 @@ class KVStore {
|
||||
public function save() {
|
||||
var handle = FS.openWrite(getNamespaceFile(this.namespace));
|
||||
|
||||
#if kv_use_native
|
||||
handle.write(TextUtils.serialize(this.kvStore));
|
||||
#else
|
||||
handle.write(Serializer.run(this.kvStore));
|
||||
|
||||
#end
|
||||
handle.close();
|
||||
}
|
||||
|
||||
private function parseFile(content:String) {
|
||||
#if kv_use_native
|
||||
this.kvStore = TextUtils.unserialize(content);
|
||||
#else
|
||||
var unserializer = new Unserializer(content);
|
||||
this.kvStore = unserializer.unserialize();
|
||||
#end
|
||||
}
|
||||
|
||||
public inline function set(key:String, value:Dynamic) {
|
||||
|
||||
Reference in New Issue
Block a user