aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDevine Lu Linvega <[email protected]>2019-06-16 14:03:05 +0900
committerDevine Lu Linvega <[email protected]>2019-06-16 14:03:07 +0900
commit3feaa524e49c9960c4d6dfef725e5243c3bafffa (patch)
tree84069cbf4eef23f1801671230e8bc7765c2507e0
parent945f5ae9912a4c12d1eda287cca9b462126cea52 (diff)
downloadOrca-3feaa524e49c9960c4d6dfef725e5243c3bafffa.tar.gz
Orca-3feaa524e49c9960c4d6dfef725e5243c3bafffa.zip
Added optional pos to inject and write
-rw-r--r--README.md6
-rw-r--r--desktop/sources/scripts/commander.js12
-rw-r--r--desktop/sources/scripts/cursor.js4
-rw-r--r--desktop/sources/scripts/terminal.js2
4 files changed, 14 insertions, 10 deletions
diff --git a/README.md b/README.md
index 6c45676..d35759c 100644
--- a/README.md
+++ b/README.md
@@ -118,9 +118,9 @@ All commands have a shorthand equivalent to their first two characters, for exam
- `color:f00;0f0;00f` Colorizes the interface.
- `graphic:123` Set the background to the local graphic `123.jpg`.
- `find:aV` Sends cursor to string `aV`.
-- `select:3;4;5;6` Move cursor to position `3,4`, and select size `5:6`.
-- `inject:pattern` Inject the local file `pattern.orca`.
-- `write:H;12;34` Writes glyph `H`, at `12,34`.
+- `select:3;4;5;6` Move cursor to position `3,4`, and select size `5:6`(optional).
+- `inject:pattern;12;34` Inject the local file `pattern.orca`, at `12,34`(optional).
+- `write:H;12;34` Writes glyph `H`, at `12,34`(optional).
### Project Mode
diff --git a/desktop/sources/scripts/commander.js b/desktop/sources/scripts/commander.js
index fad4085..4d8cf63 100644
--- a/desktop/sources/scripts/commander.js
+++ b/desktop/sources/scripts/commander.js
@@ -11,8 +11,8 @@ export default function Commander (terminal) {
this.passives = {
'find': (p) => { terminal.cursor.find(p.str) },
'select': (p) => { terminal.cursor.select(p.x, p.y, p.w, p.h) },
- 'inject': (p) => { terminal.source.inject(p.str, false) },
- 'write': (p) => { terminal.cursor.select(p.x, p.y, p.length) }
+ 'inject': (p) => { terminal.cursor.select(p._x, p._y); terminal.source.inject(p._str, false) },
+ 'write': (p) => { terminal.cursor.select(p._x, p._y, p._str.length) }
}
this.actives = {
@@ -42,8 +42,8 @@ export default function Commander (terminal) {
// Edit
'find': (p) => { terminal.cursor.find(p.str) },
'select': (p) => { terminal.cursor.select(p.x, p.y, p.w, p.h) },
- 'inject': (p) => { terminal.source.inject(p.str, true) },
- 'write': (p) => { terminal.cursor.select(p.x, p.y, p.length.length); terminal.cursor.writeBlock([p.chars]) }
+ 'inject': (p) => { terminal.cursor.select(p._x, p._y); terminal.source.inject(p._str, true) },
+ 'write': (p) => { terminal.cursor.select(p._x, p._y, p._str.length); terminal.cursor.writeBlock([p._str.split('')]) }
}
// Make shorthands
@@ -61,6 +61,10 @@ export default function Commander (terminal) {
this.y = parseInt(this.parts[1])
this.w = parseInt(this.parts[2])
this.h = parseInt(this.parts[3])
+ // Optionals Position Style
+ this._str = this.parts[0]
+ this._x = parseInt(this.parts[1])
+ this._y = parseInt(this.parts[2])
}
// Begin
diff --git a/desktop/sources/scripts/cursor.js b/desktop/sources/scripts/cursor.js
index 0de531b..e09c012 100644
--- a/desktop/sources/scripts/cursor.js
+++ b/desktop/sources/scripts/cursor.js
@@ -33,8 +33,8 @@ export default function Cursor (terminal) {
this.scaleTo = function (w, h) {
if (isNaN(w) || isNaN(h)) { return }
- this.w = clamp(parseInt(w), 0, terminal.orca.w - 1)
- this.h = clamp(parseInt(h), 0, terminal.orca.h - 1)
+ this.w = clamp(parseInt(w), 1, terminal.orca.w - 1)
+ this.h = clamp(parseInt(h), 1, terminal.orca.h - 1)
terminal.update()
}
diff --git a/desktop/sources/scripts/terminal.js b/desktop/sources/scripts/terminal.js
index e625d4c..1b0d93e 100644
--- a/desktop/sources/scripts/terminal.js
+++ b/desktop/sources/scripts/terminal.js
@@ -12,7 +12,7 @@ import Controller from './lib/controller.js'
import library from '../../core/library.js'
export default function Terminal () {
- this.version = 139
+ this.version = 141
this.library = library
this.orca = new Orca(this)