mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-13 04:28:41 -09:00
app: move to the last term with cmd+9 (#261)
This mimics the behavior of Chrome, Firefox, iTerm 2 and similar, by moving to the last possible tab when Command + 9 is pressed. Fixes #255.
This commit is contained in:
parent
f989224a20
commit
4849dfe96b
2 changed files with 7 additions and 1 deletions
|
|
@ -90,6 +90,10 @@ export default class Terms extends Component {
|
|||
return this.getTermByUid(this.props.activeSession);
|
||||
}
|
||||
|
||||
getLastTermIndex () {
|
||||
return this.props.sessions.length - 1;
|
||||
}
|
||||
|
||||
bind (fn, thisObj, uid) {
|
||||
if (!this.bound.has(fn)) {
|
||||
this.bound.set(fn, {});
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ class HyperTerm extends Component {
|
|||
const { moveTo, moveLeft, moveRight } = this.props;
|
||||
const term = this.terms.getActiveTerm();
|
||||
if (!term) return;
|
||||
const lastIndex = this.terms.getLastTermIndex();
|
||||
const document = term.getTermDocument();
|
||||
const keys = new Mousetrap(document);
|
||||
keys.bind('command+1', moveTo.bind(this, 0));
|
||||
|
|
@ -42,7 +43,8 @@ class HyperTerm extends Component {
|
|||
keys.bind('command+6', moveTo.bind(this, 5));
|
||||
keys.bind('command+7', moveTo.bind(this, 6));
|
||||
keys.bind('command+8', moveTo.bind(this, 7));
|
||||
keys.bind('command+9', moveTo.bind(this, 8));
|
||||
keys.bind('command+9', moveTo.bind(this, lastIndex));
|
||||
|
||||
keys.bind('command+shift+left', moveLeft);
|
||||
keys.bind('command+shift+right', moveRight);
|
||||
keys.bind('command+shift+[', moveLeft);
|
||||
|
|
|
|||
Loading…
Reference in a new issue