Skip to content

Commit

Permalink
Clear output the right way
Browse files Browse the repository at this point in the history
  • Loading branch information
timweprovide committed Feb 15, 2017
1 parent 9d32517 commit ba959b5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
4 changes: 2 additions & 2 deletions _sandbox/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* eslint-disable */
const unsed = 'I am unused';

//
export default class MyComponent extends React.Component {

render() {
return <div>Hello</div>
}
}
}
8 changes: 2 additions & 6 deletions src/output.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,8 @@ class Debugger {
}

clearConsole () {
if (!this.capturing && this.enabled && process.stdout.isTTY) {
// Fill screen with blank lines. Then move to 0 (beginning of visible part) and clear it
const blank = '\n'.repeat(process.stdout.rows)
console.log(blank)
readline.cursorTo(process.stdout, 0, 0)
readline.clearScreenDown(process.stdout)
if (!this.capturing && this.enabled) {
process.stdout.write(process.platform === 'win32' ? '\x1Bc' : '\x1B[2J\x1B[3J\x1B[H');
}
}

Expand Down

0 comments on commit ba959b5

Please sign in to comment.