mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
url are now interpreted by xterm (#3507)
* url are now interpreted by xterm * no need * .DS_STORE banished * remove from reducer
This commit is contained in:
parent
9581f5d5ee
commit
d0f03f52e5
5 changed files with 2 additions and 53 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -14,3 +14,4 @@ yarn-error.log
|
|||
.hyper.js
|
||||
.hyper_plugins
|
||||
|
||||
.DS_Store
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import rpc from '../rpc';
|
||||
import isUrl from '../utils/url-command';
|
||||
import {keys} from '../utils/object';
|
||||
import findBySession from '../utils/term-groups';
|
||||
import {
|
||||
|
|
@ -13,8 +12,6 @@ import {
|
|||
SESSION_SET_ACTIVE,
|
||||
SESSION_CLEAR_ACTIVE,
|
||||
SESSION_USER_DATA,
|
||||
SESSION_URL_SET,
|
||||
SESSION_URL_UNSET,
|
||||
SESSION_SET_XTERM_TITLE
|
||||
} from '../constants/sessions';
|
||||
|
||||
|
|
@ -50,24 +47,12 @@ export function requestSession() {
|
|||
}
|
||||
|
||||
export function addSessionData(uid, data) {
|
||||
return (dispatch, getState) => {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
type: SESSION_ADD_DATA,
|
||||
data,
|
||||
effect() {
|
||||
const session = getState().sessions.sessions[uid];
|
||||
const now = Date.now();
|
||||
if (session) {
|
||||
const enterKey = data.indexOf('\n') > 0;
|
||||
const url = enterKey ? isUrl(session.shell, data) : null;
|
||||
if (url) {
|
||||
return dispatch({
|
||||
type: SESSION_URL_SET,
|
||||
uid,
|
||||
url
|
||||
});
|
||||
}
|
||||
}
|
||||
dispatch({
|
||||
type: SESSION_PTY_DATA,
|
||||
uid,
|
||||
|
|
@ -160,10 +145,3 @@ export function sendSessionData(uid, data, escaped) {
|
|||
});
|
||||
};
|
||||
}
|
||||
|
||||
export function exitSessionBrowser(uid) {
|
||||
return {
|
||||
type: SESSION_URL_UNSET,
|
||||
uid
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@ import {
|
|||
SESSION_PTY_DATA,
|
||||
SESSION_SET_ACTIVE,
|
||||
SESSION_CLEAR_ACTIVE,
|
||||
SESSION_URL_SET,
|
||||
SESSION_URL_UNSET,
|
||||
SESSION_RESIZE,
|
||||
SESSION_SET_XTERM_TITLE,
|
||||
SESSION_SET_CWD
|
||||
|
|
@ -46,12 +44,6 @@ const reducer = (state = initialState, action) => {
|
|||
})
|
||||
);
|
||||
|
||||
case SESSION_URL_SET:
|
||||
return state.setIn(['sessions', action.uid, 'url'], action.url);
|
||||
|
||||
case SESSION_URL_UNSET:
|
||||
return state.setIn(['sessions', action.uid, 'url'], null);
|
||||
|
||||
case SESSION_SET_ACTIVE:
|
||||
return state.set('activeUid', action.uid);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,18 +0,0 @@
|
|||
import path from 'path';
|
||||
import * as regex from './url-regex';
|
||||
|
||||
export default function isUrlCommand(shell, data) {
|
||||
const matcher = regex[path.parse(shell).name];
|
||||
if (undefined === matcher || !data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const match = data.match(matcher);
|
||||
const urlRegex = /((?:https?:\/\/)(?:[-a-z0-9]+\.)*[-a-z0-9]+.*)/;
|
||||
|
||||
if (match && urlRegex.test(match[2])) {
|
||||
return `${match[2]}`;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
export const sh = /(?:ba)?sh: ((?:file:\/\/)|(?:\/\/))?(.*): (?:(?:command not found)|(?:No such file or directory))/;
|
||||
export const bash = sh;
|
||||
export const zsh = /zsh: (?:(?:command not found)|(?:no such file or directory)): ((?:file:\/\/)|(?:\/\/))?([^\n]+)/;
|
||||
export const fish = /fish: Unknown command '((?:file:\/\/)|(?:\/\/))?([^']+)'/;
|
||||
Loading…
Reference in a new issue