summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--index.html5
-rw-r--r--js/app.js8
-rw-r--r--js/clipboard.js3
-rw-r--r--js/matrix.js6
4 files changed, 13 insertions, 9 deletions
diff --git a/index.html b/index.html
index bfd8b27..cd33925 100644
--- a/index.html
+++ b/index.html
@@ -38,6 +38,11 @@ textarea { font-size:12pt; width: 45%; height: 300px; background: #333; color: #
canvas size: <span id="canvas_width_el" class="ed">80</span> x <span id="canvas_height_el" class="ed">24</span><br>
<br>
<span id="animate_checkbox" class="tool">_ animate</span><br>
+<!--
+ <span id="fg_checkbox" class="tool">_ fg</span><br>
+ <span id="bg_checkbox" class="tool">_ bg</span><br>
+ <span id="char_checkbox" class="tool">_ char</span><br>
+ -->
</div>
<div id="textarea_mode">
diff --git a/js/app.js b/js/app.js
index b2f1dfa..bebfec2 100644
--- a/js/app.js
+++ b/js/app.js
@@ -77,26 +77,18 @@ function bind () {
return
case 38: // up
e.preventDefault()
- direction[0] = -1
- direction[1] = 0
current_canvas.focusLex(focused.y + direction[0], focused.x + direction[1])
break
case 40: // down
e.preventDefault()
- direction[0] = 1
- direction[1] = 0
current_canvas.focusLex(focused.y + direction[0], focused.x + direction[1])
break
case 37: // left
e.preventDefault()
- direction[0] = 0
- direction[1] = -1
current_canvas.focusLex(focused.y + direction[0], focused.x + direction[1])
break
case 39: // right
e.preventDefault()
- direction[0] = 0
- direction[1] = 1
current_canvas.focusLex(focused.y + direction[0], focused.x + direction[1])
break
// default:
diff --git a/js/clipboard.js b/js/clipboard.js
index ecbdaa8..0788284 100644
--- a/js/clipboard.js
+++ b/js/clipboard.js
@@ -69,7 +69,8 @@ var clipboard = (function () {
lex.build()
}
})
- // TODO: some solution for a "selected" region
+ // TODO: some notion of a "selected" region which cuts/clones the underlying region
+
// var pasted_region = new Matrix (width, height, function(x,y){
// var lex = new Lex (x,y)
// lex.char = lines[y][x] || " "
diff --git a/js/matrix.js b/js/matrix.js
index ccd90b2..98c132d 100644
--- a/js/matrix.js
+++ b/js/matrix.js
@@ -45,6 +45,12 @@ Matrix.prototype.forEach = function(f){
})
}
Matrix.prototype.focusLex = function(y,x){
+ if (x < 0) {
+ y -= 1
+ }
+ if (x > this.aa[0].length) {
+ y += 1
+ }
this.aa[mod(y,this.h)][mod(x,this.w)].focus()
}
Matrix.prototype.clear = function(){