mirror of
https://github.com/nuintun/command-manager.git
synced 2025-12-15 23:30:48 +08:00
update files
This commit is contained in:
32
static/js/terminal/lib/stops.js
Normal file
32
static/js/terminal/lib/stops.js
Normal file
@@ -0,0 +1,32 @@
|
||||
'use strict';
|
||||
// ignore warnings regarging == and != (coersion makes things work here appearently)
|
||||
|
||||
module.exports = function (Terminal){
|
||||
|
||||
Terminal.prototype.setupStops = function (i){
|
||||
if (i != null) {
|
||||
if (!this.tabs[i]) {
|
||||
i = this.prevStop(i);
|
||||
}
|
||||
} else {
|
||||
this.tabs = {};
|
||||
i = 0;
|
||||
}
|
||||
|
||||
for (; i < this.cols; i += 8) {
|
||||
this.tabs[i] = true;
|
||||
}
|
||||
};
|
||||
|
||||
Terminal.prototype.prevStop = function (x){
|
||||
if (x == null) x = this.x;
|
||||
while (!this.tabs[--x] && x > 0);
|
||||
return x >= this.cols ? this.cols - 1 : x < 0 ? 0 : x;
|
||||
};
|
||||
|
||||
Terminal.prototype.nextStop = function (x){
|
||||
if (x == null) x = this.x;
|
||||
while (!this.tabs[++x] && x < this.cols);
|
||||
return x >= this.cols ? this.cols - 1 : x < 0 ? 0 : x;
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user