Fix code style

This commit is contained in:
Leo Lamprecht 2016-07-29 22:40:46 +02:00
parent 220b29c6c7
commit c3e4cbebe4
3 changed files with 131 additions and 131 deletions

View file

@ -67,14 +67,14 @@ const reducer = (state = initialState, action) => {
case SESSION_PTY_DATA: case SESSION_PTY_DATA:
return state return state
.set('write', Write(action)) .set('write', Write(action))
.merge({ .merge({
sessions: { sessions: {
[action.uid]: { [action.uid]: {
cleared: false cleared: false
}
} }
} }, { deep: true });
}, { deep: true });
case SESSION_PTY_EXIT: case SESSION_PTY_EXIT:
if (state.sessions[action.uid]) { if (state.sessions[action.uid]) {

View file

@ -75,73 +75,73 @@ const reducer = (state = initial, action) => {
case CONFIG_RELOAD: case CONFIG_RELOAD:
const { config } = action; const { config } = action;
state_ = state state_ = state
// we unset the user font size override if the // we unset the user font size override if the
// font size changed from the config // font size changed from the config
.merge((() => { .merge((() => {
const ret = {}; const ret = {};
if (state.fontSizeOverride && config.fontSize !== state.fontSize) { if (state.fontSizeOverride && config.fontSize !== state.fontSize) {
ret.fontSizeOverride = null; ret.fontSizeOverride = null;
} }
if (null != config.fontSize) { if (null != config.fontSize) {
ret.fontSize = config.fontSize; ret.fontSize = config.fontSize;
} }
if (null != config.fontFamily) { if (null != config.fontFamily) {
ret.fontFamily = config.fontFamily; ret.fontFamily = config.fontFamily;
} }
if (null != config.cursorColor) { if (null != config.cursorColor) {
ret.cursorColor = config.cursorColor; ret.cursorColor = config.cursorColor;
} }
if (allowedCursorShapes.includes(config.cursorShape)) { if (allowedCursorShapes.includes(config.cursorShape)) {
ret.cursorShape = config.cursorShape; ret.cursorShape = config.cursorShape;
} }
if (null != config.borderColor) { if (null != config.borderColor) {
ret.borderColor = config.borderColor; ret.borderColor = config.borderColor;
} }
if (null != config.padding) { if (null != config.padding) {
ret.padding = config.padding; ret.padding = config.padding;
} }
if (null != config.foregroundColor) { if (null != config.foregroundColor) {
ret.foregroundColor = config.foregroundColor; ret.foregroundColor = config.foregroundColor;
} }
if (null != config.backgroundColor) { if (null != config.backgroundColor) {
ret.backgroundColor = config.backgroundColor; ret.backgroundColor = config.backgroundColor;
} }
if (null != config.css) { if (null != config.css) {
ret.css = config.css; ret.css = config.css;
} }
if (null != config.termCSS) { if (null != config.termCSS) {
ret.termCSS = config.termCSS; ret.termCSS = config.termCSS;
} }
if (null != config.colors) { if (null != config.colors) {
if (Array.isArray(config.colors)) { if (Array.isArray(config.colors)) {
const stateColors = Array.isArray(state.colors) const stateColors = Array.isArray(state.colors)
? state.colors ? state.colors
: values(state.colors); : values(state.colors);
if (stateColors.toString() !== config.colors.toString()) { if (stateColors.toString() !== config.colors.toString()) {
ret.colors = config.colors; ret.colors = config.colors;
} }
} else { } else {
if (JSON.stringify(state.colors) !== JSON.stringify(config.colors)) { if (JSON.stringify(state.colors) !== JSON.stringify(config.colors)) {
ret.colors = config.colors; ret.colors = config.colors;
}
} }
} }
}
return ret; return ret;
})()); })());
break; break;
case SESSION_ADD: case SESSION_ADD:
@ -162,16 +162,16 @@ const reducer = (state = initial, action) => {
case SESSION_PTY_EXIT: case SESSION_PTY_EXIT:
state_ = state state_ = state
.updateIn(['openAt'], (times) => { .updateIn(['openAt'], (times) => {
const times_ = times.asMutable(); const times_ = times.asMutable();
delete times_[action.uid]; delete times_[action.uid];
return times_; return times_;
}) })
.updateIn(['activityMarkers'], (markers) => { .updateIn(['activityMarkers'], (markers) => {
const markers_ = markers.asMutable(); const markers_ = markers.asMutable();
delete markers_[action.uid]; delete markers_[action.uid];
return markers_; return markers_;
}); });
break; break;
case SESSION_SET_ACTIVE: case SESSION_SET_ACTIVE:

View file

@ -63,87 +63,87 @@ const loadModules = () => {
termPropsDecorators = []; termPropsDecorators = [];
modules = paths.plugins.concat(paths.localPlugins) modules = paths.plugins.concat(paths.localPlugins)
.map((path) => { .map((path) => {
let mod; let mod;
const pluginName = getPluginName(path); const pluginName = getPluginName(path);
// window.require allows us to ensure this doesn't get // window.require allows us to ensure this doesn't get
// in the way of our build // in the way of our build
try { try {
mod = window.require(path); mod = window.require(path);
} catch (err) { } catch (err) {
console.error(err.stack); console.error(err.stack);
notify('Plugin load error', `"${pluginName}" failed to load in the renderer process. Check Developer Tools for details.`); notify('Plugin load error', `"${pluginName}" failed to load in the renderer process. Check Developer Tools for details.`);
return; return;
} }
for (const i in mod) { for (const i in mod) {
mod[i]._pluginName = pluginName; mod[i]._pluginName = pluginName;
} }
if (mod.middleware) { if (mod.middleware) {
middlewares.push(mod.middleware); middlewares.push(mod.middleware);
} }
if (mod.reduceUI) { if (mod.reduceUI) {
uiReducers.push(mod.reduceUI); uiReducers.push(mod.reduceUI);
} }
if (mod.reduceSessions) { if (mod.reduceSessions) {
sessionsReducers.push(mod.reduceSessions); sessionsReducers.push(mod.reduceSessions);
} }
if (mod.mapTermsState) { if (mod.mapTermsState) {
connectors.Terms.state.push(mod.mapTermsState); connectors.Terms.state.push(mod.mapTermsState);
} }
if (mod.mapTermsDispatch) { if (mod.mapTermsDispatch) {
connectors.Terms.dispatch.push(mod.mapTermsDispatch); connectors.Terms.dispatch.push(mod.mapTermsDispatch);
} }
if (mod.mapHeaderState) { if (mod.mapHeaderState) {
connectors.Header.state.push(mod.mapHeaderState); connectors.Header.state.push(mod.mapHeaderState);
} }
if (mod.mapHeaderDispatch) { if (mod.mapHeaderDispatch) {
connectors.Header.dispatch.push(mod.mapHeaderDispatch); connectors.Header.dispatch.push(mod.mapHeaderDispatch);
} }
if (mod.mapHyperTermState) { if (mod.mapHyperTermState) {
connectors.HyperTerm.state.push(mod.mapHyperTermState); connectors.HyperTerm.state.push(mod.mapHyperTermState);
} }
if (mod.mapHyperTermDispatch) { if (mod.mapHyperTermDispatch) {
connectors.HyperTerm.dispatch.push(mod.mapHyperTermDispatch); connectors.HyperTerm.dispatch.push(mod.mapHyperTermDispatch);
} }
if (mod.mapNotificationsState) { if (mod.mapNotificationsState) {
connectors.Notifications.state.push(mod.mapNotificationsState); connectors.Notifications.state.push(mod.mapNotificationsState);
} }
if (mod.mapNotificationsDispatch) { if (mod.mapNotificationsDispatch) {
connectors.Notifications.dispatch.push(mod.mapNotificationsDispatch); connectors.Notifications.dispatch.push(mod.mapNotificationsDispatch);
} }
if (mod.getTermProps) { if (mod.getTermProps) {
termPropsDecorators.push(mod.getTermProps); termPropsDecorators.push(mod.getTermProps);
} }
if (mod.getTabProps) { if (mod.getTabProps) {
tabPropsDecorators.push(mod.getTabProps); tabPropsDecorators.push(mod.getTabProps);
} }
if (mod.getTabsProps) { if (mod.getTabsProps) {
tabsPropsDecorators.push(mod.getTabsProps); tabsPropsDecorators.push(mod.getTabsProps);
} }
if (mod.onRendererWindow) { if (mod.onRendererWindow) {
mod.onRendererWindow(window); mod.onRendererWindow(window);
} }
return mod; return mod;
}) })
.filter((mod) => !!mod); .filter((mod) => !!mod);
}; };
// load modules for initial decoration // load modules for initial decoration