Cleanup (rename HyperTerm to Hyper) (#812)

* Rename container

* Rename hyper container itself

* Add HYPER_DEBUG for debug

* Rename HyperTerm to Hyper

* Rename HyperTerm connector and extension

* Add HyperTerm state and dispatch for backwards compatibility
This commit is contained in:
Daniel Bayerlein 2016-10-08 18:26:07 +02:00 committed by Guillermo Rauch
parent 2ffc1aee3d
commit aa285a8bc6
6 changed files with 30 additions and 17 deletions

View file

@ -113,9 +113,9 @@ app.on('ready', () => installDevExtensions(isDev).then(() => {
backgroundColor: toElectronBackgroundColor(cfg.backgroundColor || '#000'), backgroundColor: toElectronBackgroundColor(cfg.backgroundColor || '#000'),
transparent: true, transparent: true,
icon: resolve(__dirname, 'static/icon.png'), icon: resolve(__dirname, 'static/icon.png'),
// we only want to show when the prompt // we only want to show when the prompt is ready for user input
// is ready for user input // HYPERTERM_DEBUG for backwards compatibility with hyperterm
show: process.env.HYPERTERM_DEBUG || isDev, show: process.env.HYPER_DEBUG || process.env.HYPERTERM_DEBUG || isDev,
x: startX, x: startX,
y: startY y: startY
}; };

View file

@ -21,7 +21,8 @@ const localPath = resolve(homedir(), '.hyper_plugins', 'local');
const availableExtensions = new Set([ const availableExtensions = new Set([
'onApp', 'onWindow', 'onUnload', 'middleware', 'onApp', 'onWindow', 'onUnload', 'middleware',
'reduceUI', 'reduceSessions', 'decorateMenu', 'reduceUI', 'reduceSessions', 'decorateMenu',
'decorateTerm', 'decorateHyperTerm', 'decorateTab', 'decorateTerm', 'decorateHyper', 'decorateTab',
'decorateHyperTerm', // for backwards compatibility with hyperterm
'decorateNotification', 'decorateNotifications', 'decorateNotification', 'decorateNotifications',
'decorateTabs', 'decorateConfig', 'decorateEnv' 'decorateTabs', 'decorateConfig', 'decorateEnv'
]); ]);

View file

@ -13,7 +13,7 @@ import NotificationsContainer from './notifications';
const isMac = /Mac/.test(navigator.userAgent); const isMac = /Mac/.test(navigator.userAgent);
class HyperTerm extends Component { class Hyper extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.handleFocusActive = this.handleFocusActive.bind(this); this.handleFocusActive = this.handleFocusActive.bind(this);
@ -132,7 +132,7 @@ class HyperTerm extends Component {
} }
} }
const HyperTermContainer = connect( const HyperContainer = connect(
state => { state => {
return { return {
isMac, isMac,
@ -159,6 +159,6 @@ const HyperTermContainer = connect(
}, },
null, null,
{withRef: true} {withRef: true}
)(HyperTerm, 'HyperTerm'); )(Hyper, 'Hyper');
export default HyperTermContainer; export default HyperContainer;

View file

@ -17,7 +17,7 @@ const oldMouse = hterm.Terminal.prototype.onMouse_;
hterm.Terminal.prototype.onMouse_ = function (e) { hterm.Terminal.prototype.onMouse_ = function (e) {
if (e.type === 'dblclick') { if (e.type === 'dblclick') {
selection.extend(this); selection.extend(this);
console.log('[hyperterm+hterm] ignore double click'); console.log('[hyper+hterm] ignore double click');
return; return;
} }
return oldMouse.call(this, e); return oldMouse.call(this, e);
@ -37,7 +37,7 @@ hterm.Terminal.prototype.copySelectionToClipboard = function () {
}; };
// passthrough all the commands that are meant to control // passthrough all the commands that are meant to control
// hyperterm and not the terminal itself // hyper and not the terminal itself
const oldKeyDown = hterm.Keyboard.prototype.onKeyDown_; const oldKeyDown = hterm.Keyboard.prototype.onKeyDown_;
hterm.Keyboard.prototype.onKeyDown_ = function (e) { hterm.Keyboard.prototype.onKeyDown_ = function (e) {
const modifierKeysConf = this.terminal.modifierKeys; const modifierKeysConf = this.terminal.modifierKeys;

View file

@ -14,7 +14,7 @@ import * as sessionActions from './actions/sessions';
import * as termGroupActions from './actions/term-groups'; import * as termGroupActions from './actions/term-groups';
import {addNotificationMessage} from './actions/notifications'; import {addNotificationMessage} from './actions/notifications';
import {loadConfig, reloadConfig} from './actions/config'; import {loadConfig, reloadConfig} from './actions/config';
import HyperTermContainer from './containers/hyperterm'; import HyperContainer from './containers/hyper';
import configureStore from './store/configure-store'; import configureStore from './store/configure-store';
// Disable pinch zoom // Disable pinch zoom
@ -130,7 +130,7 @@ rpc.on('add notification', ({text, url, dismissable}) => {
const app = render( const app = render(
<Provider store={store_}> <Provider store={store_}>
<HyperTermContainer/> <HyperContainer/>
</Provider>, </Provider>,
document.getElementById('mount') document.getElementById('mount')
); );

View file

@ -66,7 +66,7 @@ const loadModules = () => {
connectors = { connectors = {
Terms: {state: [], dispatch: []}, Terms: {state: [], dispatch: []},
Header: {state: [], dispatch: []}, Header: {state: [], dispatch: []},
HyperTerm: {state: [], dispatch: []}, Hyper: {state: [], dispatch: []},
Notifications: {state: [], dispatch: []} Notifications: {state: [], dispatch: []}
}; };
uiReducers = []; uiReducers = [];
@ -99,6 +99,18 @@ const loadModules = () => {
} }
} }
// mapHyperTermState mapping for backwards compatibility with hyperterm
if (mod.mapHyperTermState) {
mod.mapHyperState = mod.mapHyperTermState;
console.error('mapHyperTermState is deprecated. Use mapHyperState instead.');
}
// mapHyperTermDispatch mapping for backwards compatibility with hyperterm
if (mod.mapHyperTermDispatch) {
mod.mapHyperDispatch = mod.mapHyperTermDispatch;
console.error('mapHyperTermDispatch is deprecated. Use mapHyperDispatch instead.');
}
if (mod.middleware) { if (mod.middleware) {
middlewares.push(mod.middleware); middlewares.push(mod.middleware);
} }
@ -127,12 +139,12 @@ const loadModules = () => {
connectors.Header.dispatch.push(mod.mapHeaderDispatch); connectors.Header.dispatch.push(mod.mapHeaderDispatch);
} }
if (mod.mapHyperTermState) { if (mod.mapHyperState) {
connectors.HyperTerm.state.push(mod.mapHyperTermState); connectors.Hyper.state.push(mod.mapHyperState);
} }
if (mod.mapHyperTermDispatch) { if (mod.mapHyperDispatch) {
connectors.HyperTerm.dispatch.push(mod.mapHyperTermDispatch); connectors.Hyper.dispatch.push(mod.mapHyperDispatch);
} }
if (mod.mapNotificationsState) { if (mod.mapNotificationsState) {