Created
April 3, 2010 05:19
-
-
Save tmpvar/354146 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
index 67d2bf8..b52c6b8 100644 | |
--- a/index.html | |
+++ b/index.html | |
@@ -4,6 +4,7 @@ | |
<head> | |
<title>Cider: Canvas Text Editor</title> | |
<script type="text/javascript" src="lib/cider.js"></script> | |
+ <script type="text/javascript" src="lib/cursor.js"></script> | |
<script type="text/javascript"> | |
window.onload = function() { | |
cider(); | |
@@ -13,4 +14,4 @@ | |
<body> | |
<p>asdf</p> | |
</body> | |
-</html> | |
\ No newline at end of file | |
+</html> | |
diff --git a/lib/cider.js b/lib/cider.js | |
index 5e8a812..0406404 100644 | |
--- a/lib/cider.js | |
+++ b/lib/cider.js | |
@@ -14,6 +14,8 @@ | |
cider.fn.init(); | |
}; | |
+var pos = {col: 0, row: 0}; | |
+ | |
// setup global scope of cider | |
window.cider = cider; | |
@@ -54,12 +56,15 @@ | |
store : function(char) | |
{ | |
- var pos = {col: 0, row: 0}; | |
+ | |
if(!this.lines[pos.row]) { | |
this.lines[pos.row] = char; | |
- } else { | |
+ } else if (this.lines[pos.row].length + 1 < 10) { | |
this.lines[pos.row] += char; | |
+ } else { | |
+ pos.row++; | |
+ this.lines[pos.row] = char; | |
} | |
console.log(this.lines); | |
console.log(this.lines[pos.row]); | |
@@ -147,4 +152,4 @@ | |
}, false); | |
}*/ | |
}; | |
-})(); | |
\ No newline at end of file | |
+})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment