aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDevine Lu Linvega <[email protected]>2019-06-03 16:10:01 +0900
committerDevine Lu Linvega <[email protected]>2019-06-03 16:10:01 +0900
commitccd7e5e82712d9a332b96f684d5e97f8418c8aa3 (patch)
tree99ed784eb71e0931100ffe0f905afb283f30c22f
parentd63e563066abaa3d26ddd3f90aca11b40be01fb9 (diff)
downloadOrca-ccd7e5e82712d9a332b96f684d5e97f8418c8aa3.tar.gz
Orca-ccd7e5e82712d9a332b96f684d5e97f8418c8aa3.zip
Fixed issue with OSC
-rw-r--r--desktop/core/io/osc.js3
-rw-r--r--desktop/core/library/_osc.js22
-rw-r--r--desktop/core/library/_udp.js11
-rw-r--r--desktop/sources/scripts/terminal.js2
4 files changed, 16 insertions, 22 deletions
diff --git a/desktop/core/io/osc.js b/desktop/core/io/osc.js
index cbc9080..5afe920 100644
--- a/desktop/core/io/osc.js
+++ b/desktop/core/io/osc.js
@@ -28,7 +28,8 @@ export default function Osc (terminal) {
}
this.play = function ({ path, msg }) {
- if (!this.client) { return }
+ if (!this.client) { console.warn('OSC', 'Unavailable client'); return }
+ if (!msg) { console.warn('OSC', 'Empty message'); return }
const oscMsg = new osc.Message(path)
for (var i = 0; i < msg.length; i++) {
oscMsg.append(terminal.orca.valueOf(msg.charAt(i)))
diff --git a/desktop/core/library/_osc.js b/desktop/core/library/_osc.js
index 51c9ed2..29216bf 100644
--- a/desktop/core/library/_osc.js
+++ b/desktop/core/library/_osc.js
@@ -11,23 +11,23 @@ export default function OperatorOsc (orca, x, y, passive) {
this.ports.path = { x: 1, y: 0 }
this.operation = function (force = false) {
- if (!this.hasNeighbor('*') && force === false) { return }
-
- this.path = this.listen(this.ports.path)
-
- if (!this.path || this.path === '.') { return }
-
- this.msg = ''
-
+ let msg = ''
for (let x = 2; x <= 36; x++) {
const g = orca.glyphAt(this.x + x, this.y)
- if (g === '.') { break }
orca.lock(this.x + x, this.y)
- this.msg += g
+ if (g === '.') { break }
+ msg += g
}
+ if (!this.hasNeighbor('*') && force === false) { return }
+ if (msg === '') { return }
+
+ const path = this.listen(this.ports.path)
+
+ if (!path || path === '.') { return }
+
this.draw = false
- terminal.io.osc.send('/' + this.path, this.msg)
+ terminal.io.osc.send('/' + path, msg)
if (force === true) {
terminal.io.osc.run()
diff --git a/desktop/core/library/_udp.js b/desktop/core/library/_udp.js
index b58bce1..a42641d 100644
--- a/desktop/core/library/_udp.js
+++ b/desktop/core/library/_udp.js
@@ -9,22 +9,15 @@ export default function OperatorUdp (orca, x, y, passive) {
this.info = 'Sends UDP message'
this.operation = function (force = false) {
-
- for (let x = 1; x <= 36; x++) {
- const g = orca.glyphAt(this.x + x, this.y)
- if (g === '.') { break }
- orca.lock(this.x + x, this.y)
- }
-
- if (!this.hasNeighbor('*') && force === false) { return }
-
let msg = ''
for (let x = 1; x <= 36; x++) {
const g = orca.glyphAt(this.x + x, this.y)
+ orca.lock(this.x + x, this.y)
if (g === '.') { break }
msg += g
}
+ if (!this.hasNeighbor('*') && force === false) { return }
if (msg === '') { return }
this.draw = false
diff --git a/desktop/sources/scripts/terminal.js b/desktop/sources/scripts/terminal.js
index a80539e..7ede449 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 = 135
+ this.version = 136
this.library = library
this.orca = new Orca(this)