Skip to content
This repository has been archived by the owner on May 21, 2019. It is now read-only.

Commit

Permalink
Show cursor by default. Fixes #426.
Browse files Browse the repository at this point in the history
  • Loading branch information
vlad-shatskyi committed May 31, 2016
1 parent 32747c8 commit 110f4ad
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/Buffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ export default class Buffer extends events.EventEmitter {
this._attributes = attributesFlyweight(Object.assign({}, this._attributes, attributes));
}

toRenderable(fromStorage = this.storage): List<List<Char>> {
toRenderable(status: e.Status, fromStorage = this.storage): List<List<Char>> {
let storage = fromStorage;

if (this.cursor.show || this.cursor.blink) {
if (status === e.Status.InProgress && (this.cursor.show || this.cursor.blink)) {
const coordinates = [this.cursorPosition.row, this.cursorPosition.column];

if (!storage.get(this.cursorPosition.row)) {
Expand All @@ -103,8 +103,8 @@ export default class Buffer extends events.EventEmitter {
return storage;
}

toCutRenderable(): List<List<Char>> {
return this.toRenderable(<List<List<Char>>>(this.storage.takeLast(Buffer.hugeOutputThreshold)));
toCutRenderable(status: e.Status): List<List<Char>> {
return this.toRenderable(status, <List<List<Char>>>(this.storage.takeLast(Buffer.hugeOutputThreshold)));
}

toLines(): string[] {
Expand Down
2 changes: 1 addition & 1 deletion src/Cursor.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default class Cursor {
private _show = false;
private _show = true;
private _blink = false;

constructor(private position: RowColumn = { row: 0, column: 0 }) {
Expand Down
2 changes: 0 additions & 2 deletions src/Job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export default class Job extends EmitterWithUniqueID {
try {
await CommandExecutor.execute(this);

this.buffer.showCursor(false);
// Need to check the status here because it's
// executed even after the process was interrupted.
if (this.status === Status.InProgress) {
Expand All @@ -61,7 +60,6 @@ export default class Job extends EmitterWithUniqueID {
}

handleError(message: string): void {
this.buffer.showCursor(false);
this.setStatus(Status.Failure);
if (message) {
this._buffer.writeMany(message);
Expand Down
2 changes: 1 addition & 1 deletion src/views/BufferComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,6 @@ export default class BufferComponent extends React.Component<Props, State> {
};

private get renderableRows(): List<List<Char>> {
return this.shouldCutOutput ? this.props.job.buffer.toCutRenderable() : this.props.job.buffer.toRenderable();
return this.shouldCutOutput ? this.props.job.buffer.toCutRenderable(this.props.job.status) : this.props.job.buffer.toRenderable(this.props.job.status);
}
}

0 comments on commit 110f4ad

Please sign in to comment.