Skip to content

Commit 9e306fd

Browse files
committed
Implement tab in console store
1 parent 83aff52 commit 9e306fd

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/stores/console.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ const _ = require('lodash');
55
const alt = require('../alt');
66
const { clearOutput, output } = require('../actions/console');
77

8+
const TAB_WIDTH = 8;
9+
810
class ConsoleStore {
911
constructor() {
1012

@@ -18,7 +20,7 @@ class ConsoleStore {
1820
length: 0,
1921
lines: [''],
2022
lineWrap: 256,
21-
maxLines: 2048,
23+
maxLines: 256,
2224
pointerLine: 0,
2325
pointerColumn: 0,
2426
refreshDelayMillis: 64,
@@ -133,6 +135,14 @@ class ConsoleStore {
133135
});
134136
}
135137

138+
tab(){
139+
const { pointerColumn } = this.state;
140+
const tabColumn = Math.floor(pointerColumn / TAB_WIDTH);
141+
this.setState({
142+
pointerColumn: (tabColumn + 1) * TAB_WIDTH
143+
});
144+
}
145+
136146
processEvent(evt){
137147
const { pointerLine, pointerColumn } = this.state;
138148
switch(evt.type){
@@ -178,6 +188,9 @@ class ConsoleStore {
178188
case 'clear-below':
179189
this.clearBelow();
180190
break;
191+
case 'tab':
192+
this.tab();
193+
break;
181194
default:
182195
console.log('Not yet implemented:', evt);
183196
break;

0 commit comments

Comments
 (0)