diff options
| author | Jules <jules@asdf.us> | 2014-11-30 17:00:11 -0500 |
|---|---|---|
| committer | Jules <jules@asdf.us> | 2014-11-30 17:00:11 -0500 |
| commit | c1d0130e3c3b1e3c9f48e72a5566912d29d4f280 (patch) | |
| tree | 6b7590bc1b672b9866bf7e5e7f2912f95b688ede /js/clipboard.js | |
| parent | cea658bee03c9dc1843916ccd3c49bd67481e3b2 (diff) | |
| parent | 7d80be2bf7bfb65719dff6437959509e12487078 (diff) | |
Merge branch 'master' of ghghgh.us:ascii
Diffstat (limited to 'js/clipboard.js')
| -rw-r--r-- | js/clipboard.js | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/js/clipboard.js b/js/clipboard.js index 97261bc..5354771 100644 --- a/js/clipboard.js +++ b/js/clipboard.js @@ -36,14 +36,14 @@ var clipboard = (function () { focus() clipboard.importing = true import_button.style.display = "inline-block" - export_button.style.display = format_group.display = "none" + export_button.style.display = format_group.style.display = "none" import_textarea.value = "" }, export_mode: function () { focus() clipboard.importing = false import_button.style.display = "none" - export_button.style.display = format_group.display = "inline-block" + export_button.style.display = format_group.style.display = "inline-block" clipboard.export_data() }, import_data: function () { @@ -51,6 +51,30 @@ var clipboard = (function () { lines = data.split("\n") var width = lines.reduce(function(a,b){ return Math.max(a, b.length) }) var height = lines.length + if (width > 200) { + return alert("input too wide") + } + if (height > 200) { + return alert("input too tall") + } + canvas.clear() + lines.forEach(function(line, y){ + var row = canvas.aa[y] + if (! row) return + for (var x = 0; x < line.length; x++) { + var lex = row[x] + if (! lex) return + lex.char = line[x] + lex.fg = brush.bg + lex.build() + } + }) +// var pasted_region = new Matrix (width, height, function(x,y){ +// var lex = new Lex (x,y) +// lex.char = lines[y][x] || " " +// lex.build() +// return lex +// }) }, export_data: function () { var output @@ -76,4 +100,6 @@ var clipboard = (function () { return exports -})()
\ No newline at end of file +})() + + |
