Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3c1c80e

Browse filesBrowse files
author
Arne Claassen
committed
Merge pull request sdether#9 from sdether/issue_7_rollup
Issue 7
2 parents 129b4bf + 235d86c commit 3c1c80e
Copy full SHA for 3c1c80e

File tree

Expand file treeCollapse file tree

5 files changed

+145
-171
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+145
-171
lines changed

‎README.md

Copy file name to clipboardExpand all lines: README.md
+13-5Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,12 @@ In the below `C-x` refers to the `Ctrl-x` keystroke, while `M-x` refers to the `
9494
<dd>refresh line (clear screen in shell)</dd>
9595
<dt><code>Tab</code></dt>
9696
<dd>Invoke completion handler for text under cursor</dd>
97-
<dt><code>C-c</code> or <code>Esc</code></dt>
98-
<dd>Deactivate Readline (closes the shell)</dd>
99-
<dt><code>~</code></dt>
100-
<dd>Activate Readline (opens the shell)</dd>
97+
<dt><code>Esc</code> in reverse search</dt>
98+
<dd>Cancel search</dd>
99+
<dt><code>C-c</code></dt>
100+
<dd>call <code>onCancel</code> handler</dd>
101+
<dt><code>C-d</code> on empty line</dt>
102+
<dd>call <code>onCancel</code> handler</dd>
101103
</dl>
102104

103105
### shell.js
@@ -123,8 +125,14 @@ By implementing the functions `getNode` and `getChildNodes`, this library adds p
123125

124126
## Changelog
125127

128+
**0.2.6** --
129+
* Removed Activation/Deactivation keybindings from Readline, making it an outside concern (see: [Issue 2](https://github.com/sdether/josh.js/issues/2 )
130+
* Fixed Backspace regression introduced by 0.2.5
131+
* Fixed `M-d` not deleting last character of line
132+
* Example shell can now be resized (via jquery-ui.resizable)
133+
126134
**0.2.5** -- 2013/01/14
127-
* Implemented missing Readline behavior (see: [Issue 1](https://github.com/sdether/josh.js/issues/1)
135+
* Implemented missing Readline behavior (see: [Issue 1](https://github.com/sdether/josh.js/issues/1 )
128136
* Added scrollbar to sample implemenation (also adds scrollwheel support)
129137

130138
**0.2.4** -- 2013/01/14

‎index.html

Copy file name to clipboardExpand all lines: index.html
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1+
<!doctype html>
12
<html>
23
<head>
34
<meta charset="utf-8">
45
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
56
<title>Shell testbed</title>
67

78
<link href='http://fonts.googleapis.com/css?family=Source+Code+Pro' rel='stylesheet' type='text/css'>
8-
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
9+
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css">
10+
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
11+
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script>
912
<script src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.2/underscore-min.js"></script>
1013
<script>Josh = {Debug: true };</script>
1114
<script src="js/history.js"></script>
@@ -41,5 +44,6 @@
4144
<div>
4245
<p>Press <strong>~</strong> to activate console.</p>
4346
</div>
47+
4448
</body>
4549
</html>

‎js/example.js

Copy file name to clipboardExpand all lines: js/example.js
+24-11Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -166,24 +166,37 @@
166166
};
167167

168168
$(document).ready(function() {
169-
var consolePanel = $('#shell-panel');
170-
169+
$(document).keypress(function(event) {
170+
if(shell.isActive()) {
171+
return;
172+
}
173+
_console.log("activating shell");
174+
if(event.keyCode == 126) {
175+
event.preventDefault();
176+
shell.activate();
177+
showConsole();
178+
}
179+
});
180+
var $consolePanel = $('#shell-panel');
181+
$consolePanel.resizable({ handles: "s"});
171182
function showConsole() {
172-
consolePanel.slideDown();
173-
consolePanel.focus();
183+
$consolePanel.slideDown();
184+
$consolePanel.focus();
174185
}
175186

176187
function hideConsole() {
177-
consolePanel.slideUp();
178-
consolePanel.blur();
188+
$consolePanel.slideUp();
189+
$consolePanel.blur();
179190
}
180191

181-
shell.onActivate(function() {
182-
showConsole();
183-
});
184-
shell.onDeactivate(function() {
192+
function hideAndDeactivate() {
193+
_console.log("deactivating shell")
194+
shell.deactivate();
185195
hideConsole();
186-
});
196+
}
197+
198+
shell.onEOT(hideAndDeactivate);
199+
shell.onCancel(hideAndDeactivate);
187200
});
188201
Josh.Instance = {
189202
Tree: root,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.