Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions build/sh.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,18 +422,17 @@ Terminal.prototype.open = function (parent) {
button = button === 1 ? 0 : button === 4 ? 1 : button;
}

// If user select text
if (utils.getSelection()) return;

// Not right button
if (button !== 2) return that.focus();
if (button !== 2) return;

that.element.contentEditable = true;
that.element.focus();
setTimeout(function() {
that.inputElement.focus();
that.element.contentEditable = 'inherit'; // 'false';
}, 1);
var selection = utils.getSelection();
// If user doesn't select text or ignore one space selection on mac
if (!selection || (Terminal.isMac && selection === ' '))
that.inputElement.focus();
}, Terminal.isMac ? 1 : 400);
}, !0);
events.on(this.inputElement, "paste", function (c) {
setTimeout(function () {
Expand Down Expand Up @@ -475,6 +474,8 @@ Terminal.prototype.sizeToFit = function () {

c.parentNode.removeChild(c);
a.parentNode.removeChild(a);

console.log('sizeToFit:', v, k)
this.resize(v, k)
};

Expand Down
4 changes: 2 additions & 2 deletions build/sh.min.js

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions public/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ body {
line-height: 18px;
}
.terminal-container .terminal-input {
position: absolute;
top: 0;
position: fixed;
left: -1000%;
background: rgba(255,255,255,0.75);
color: black;
Expand Down
13 changes: 6 additions & 7 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,18 +303,17 @@ Terminal.prototype.open = function (parent) {
button = button === 1 ? 0 : button === 4 ? 1 : button;
}

// If user select text
if (utils.getSelection()) return;

// Not right button
if (button !== 2) return that.focus();
if (button !== 2) return;

that.element.contentEditable = true;
that.element.focus();
setTimeout(function() {
that.inputElement.focus();
that.element.contentEditable = 'inherit'; // 'false';
}, 1);
var selection = utils.getSelection();
// If user doesn't select text or ignore one space selection on mac
if (!selection || (Terminal.isMac && selection === ' '))
that.inputElement.focus();
}, Terminal.isMac ? 1 : 400);
}, !0);
events.on(this.inputElement, "paste", function (c) {
setTimeout(function () {
Expand Down