Skip to content

Commit

Permalink
bug fixes + doc
Browse files Browse the repository at this point in the history
  • Loading branch information
breuleux committed Feb 24, 2012
1 parent c378999 commit 2440ef3
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 10 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,32 @@ any special libraries, and it works through plain SSH as well (except
obviously for the fact that the remote filesystem is not mounted by
default - but you can do it with sshfs and config).

Useful shortcuts
----------------

`Shift-Space <letter>`: Same as `Control-<letter>`, but since most
browsers don't allow catching some shortcuts (e.g. `Control-w`) this
is the only way to send some control codes. I might change that
binding, because it's too easy to accidentally hit shift-space right
after a shifted characted.

`Control-Shift-b`: Drop all unprocessed characters in the queue. This
is handy if a program prints data faster than Terminus can handle it.

`Control-Shift-c Space`: Clear elements that are absolutely positioned
at the top, left, right and bottom of the terminal screen, if they are
present.

`Control-Shift-l`: Clear all lines in the scrollback.

`F5`: Refresh the page. This does not terminate your session and will
solve most problems, at the expense of losing the screen's contents
and the scrollback.

The list of key bindings can be found
[here](https://github.com/breuleux/terminus/blob/master/resources/settings/default.yaml).


Documentation
-------------

Expand Down
9 changes: 9 additions & 0 deletions resources/script/terminus-xy.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ function XYNest(settings) {
}
}
series.acquire(point);
self.changes = true;
// self.redraw();
}
});
Expand Down Expand Up @@ -234,11 +235,17 @@ function XYNest(settings) {
}

series = self.add_series(series_name, linker, point_handlers, classes, split[1], true);

self.changes = true;
// self.redraw();
};

self.redraw = function () {

if (!self.changes) {
return;
}

self.update_scales();

if (self.log) {
Expand Down Expand Up @@ -293,6 +300,7 @@ function XYNest(settings) {
this.appendChild(circle);
});

self.changes = false;


// // .attr("cx", function (d) { return self.x(d.x); })
Expand Down Expand Up @@ -375,6 +383,7 @@ function XYNest(settings) {

self.series = [];
self.series_idx = {};
self.changes = true;

var sel = d3.select(self.element);
var svg = sel.append('svg:svg');
Expand Down
59 changes: 57 additions & 2 deletions resources/script/terminus.js
Original file line number Diff line number Diff line change
Expand Up @@ -869,12 +869,16 @@ function Screen(term, settings) {
if (end < start)
end = start;

// self.modified[self.line] = true;
self.no_cursor_here();
var fields = 'matrix lines ext nests dirty heights modified'.split(' ')
for (var i in fields) {
var field = fields[i];
self[field] = self.push_to_end(self[field], start, end);
}
self.all_modified(self.scroll1, self.nlines);
self.cursor_here();
// self.modified[self.line] = true;

self.log_action('ins', line, n)
self.log_action('rm', self.nlines, n)
Expand All @@ -893,12 +897,16 @@ function Screen(term, settings) {
if (end > self.scroll1)
end = self.scroll1;

// self.modified[self.line] = true;
self.no_cursor_here();
var fields = 'matrix lines ext nests dirty heights modified'.split(' ')
for (var i in fields) {
var field = fields[i];
self[field] = self.push_to_end(self[field], start, end);
}
self.all_modified(self.scroll1, self.nlines);
self.cursor_here();
// self.modified[self.line] = true;

self.log_action('ins', self.nlines, n)
self.log_action('rm', line, n)
Expand All @@ -916,6 +924,12 @@ function Screen(term, settings) {
self.delete_lines(0, 1);
}

self.scroll_n = function(n) {
for (var i = 0; i < n; i++) {
self.scroll();
}
}

self.scroll_page = function() {
self.no_cursor_here();
for (var i = 0; i < self.nlines; i++) {
Expand Down Expand Up @@ -1565,16 +1579,42 @@ function Terminus(div, settings) {
self.write_all = function() {
if (self.writing) { return; }
self.writing = true;
var maxl = self.settings.processing_length;
while (self.to_write) {
var tow = self.to_write;
self.to_write = "";
self.write_string(tow);
if (tow.length > maxl) {
// alert('soooo long!');
self.to_write = tow.substring(maxl);
tow = tow.substring(0, maxl);
// self.log('test', tow.length);
self.write_string(tow);
setTimeout(self.write_all, 1);
break;
}
else {
self.to_write = "";
// self.log('test', tow.length);
self.write_string(tow);
}
}
self.writing = false;
self.display();
}

// self.write_all = function() {
// if (self.writing) { return; }
// self.writing = true;
// while (self.to_write) {
// var tow = self.to_write;
// self.to_write = "";
// self.write_string(tow);
// }
// self.writing = false;
// self.display();
// }

self.write_string = function(data) {
// console.log('-> ' + data.length);
for (var i in data) {
var s = data[i];
var c = s.charCodeAt();
Expand Down Expand Up @@ -1965,6 +2005,15 @@ Terminus.interact = function (terminal, bindings) {
return true;
},

clear_processing_backlog: function () {
var tow = terminal.to_write;
if (tow.length > 1000) {
var msg = '<< ' + (tow.length - 1000) + " CHARS DROPPED >> ";
terminal.to_write = msg + tow.substring(tow.length - 1000);
}
return true;
},

log_mode: function () {
terminal.logger.switch_state();
return "noscroll";
Expand Down Expand Up @@ -2627,6 +2676,12 @@ Terminus.csi = {
this.screen.delete_characters(this.screen.line, this.screen.column, n[0]);
},

S0: function(_) { this.screen.delete_lines(this.screen.scroll0, 1); },
S1: function(n) { this.screen.delete_lines(this.screen.scroll0, n[0]); },

T0: function(_) { this.screen.insert_lines(this.screen.scroll0, 1); },
T1: function(n) { this.screen.insert_lines(this.screen.scroll0, n[0]); },

// ">c0": function (_) { this.to_send += "\x1B[>0;0;0c"; },
">c0": function (_) { },
">c1": '>c0',
Expand Down
22 changes: 14 additions & 8 deletions resources/settings/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ ncols_sub: 2
# a multiple of the character height.
fiddle: -2

# Number of characters to process in each batch.
processing_length: 1000


## BUFFERS

Expand Down Expand Up @@ -268,17 +271,12 @@ bindings:
# inherited (and _stick is not inherited either)
_stick: true


# switch logging on or off
C-S-p: ~log_mode

# this allows to get the browser key binding for the next key
# e.g. C-S-d C-l will focus the location bar, etc.
C-S-d:
_browser: true
# handy
C-S-b: ~clear_processing_backlog

# clear stuff
C-S-c:
b: ~clear_processing_backlog
l: ~clear_log
s: ~clear_scrollback
Up: ~clear_up
Expand All @@ -287,9 +285,17 @@ bindings:
Right: ~clear_right
Space: ~clear_up ~clear_down ~clear_left ~clear_right

# this allows to get the browser key binding for the next key
# e.g. C-S-d C-l will focus the location bar, etc.
C-S-d:
_browser: true

# clear scrollback
C-S-l: ~clear_scrollback

# switch logging on or off
C-S-p: ~log_mode

# navigation
C-Left: ~word_left
C-Right: ~word_right
Expand Down

0 comments on commit 2440ef3

Please sign in to comment.