Skip to content
Snippets Groups Projects
Commit 64a02f34 authored by rswindell's avatar rswindell
Browse files

Added line.clear/insert/remove methods and allow screen.clear() to have the portion specified

parent 0617f39b
Branches
Tags
No related merge requests found
...@@ -50,6 +50,11 @@ const defs = { ...@@ -50,6 +50,11 @@ const defs = {
up: 'S', up: 'S',
down: 'T', down: 'T',
}, },
portion: {
to_end: 0,
to_start: 1,
entire: 2,
},
}; };
function attr(atr, curatr, color) function attr(atr, curatr, color)
...@@ -170,7 +175,13 @@ var cursor_position = { ...@@ -170,7 +175,13 @@ var cursor_position = {
var screen = { var screen = {
scroll: function(dir,n) { return format("\x1b[%s%s", n ? n : "", defs.scroll_dir[dir]); }, scroll: function(dir,n) { return format("\x1b[%s%s", n ? n : "", defs.scroll_dir[dir]); },
clear: function() { return "\x1b[2J"; } clear: function(p) { return format("\x1b[%uJ", p ? defs.portion[p] : defs.portion.entire); }
}
var line = {
clear: function(p) { return format("\x1b[%uK", p ? defs.portion[p] : defs.portion.entire); },
insert: function(n) { return format("\x1b[%sL", n ? n : ""); },
remove: function(n) { return format("\x1b[%sM", n ? n : ""); }
} }
var attributes = { var attributes = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment