Skip to content

Commit

Permalink
Bug: History saving empty commands
Browse files Browse the repository at this point in the history
  • Loading branch information
vtortola committed Aug 8, 2014
1 parent 43cd0ec commit 7226394
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions example/content/example.css
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ body {
visibility:hidden;
}

.terminal-focused .terminal{
box-shadow: 0 0 20px rgba(217, 215, 255, 0.85) inset, 0px 0px 16px rgba(255, 255, 0, 0.5);
}

@media only screen and (max-device-width: 480px) {
.container {
width: 100%;
Expand Down
3 changes: 3 additions & 0 deletions src/vtortola.ng-terminal.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@

$scope.commandLine = '';

if (!command)
return;

if (commandHistory.length > 10) {
commandHistory.splice(0, 1);
}
Expand Down
10 changes: 10 additions & 0 deletions tests/spec/vtortola.ng-terminal.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@
scope.previousCommand();
expect(scope.commandLine).toEqual("RRR");
});
it('Can skip empty commands', function () {
scope.keypress(82);
scope.keypress(82);
scope.keypress(82);
scope.execute();
scope.execute();
expect(scope.commandLine).toEqual("");
scope.previousCommand();
expect(scope.commandLine).toEqual("RRR");
});
it('Can go forward in command history', function () {
scope.keypress(82);
scope.keypress(82);
Expand Down

0 comments on commit 7226394

Please sign in to comment.