Skip to content

Commit 185a2d7

Browse files
committed
Merge pull request #192 from parallaxinc/console-tab
Implement tab in console store
2 parents 7aa7c3e + 04c5456 commit 185a2d7

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/stores/console.js

Lines changed: 13 additions & 0 deletions
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

@@ -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)