mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
parent
500c8b0e05
commit
dc33d4846b
3 changed files with 12 additions and 16 deletions
|
|
@ -4,6 +4,7 @@ const {_import, getDefaultConfig} = require('./config/import');
|
|||
const _openConfig = require('./config/open');
|
||||
const win = require('./config/windows');
|
||||
const {cfgPath, cfgDir} = require('./config/paths');
|
||||
const {getColorMap} = require('./utils/colors');
|
||||
|
||||
const watchers = [];
|
||||
let cfg = {};
|
||||
|
|
@ -129,6 +130,7 @@ const checkDeprecatedConfig = function() {
|
|||
|
||||
exports.fixConfigDefaults = decoratedConfig => {
|
||||
const defaultConfig = getDefaultConfig().config;
|
||||
decoratedConfig.colors = getColorMap(decoratedConfig.colors) || {};
|
||||
// We must have default colors for xterm css.
|
||||
decoratedConfig.colors = Object.assign({}, defaultConfig.colors, decoratedConfig.colors);
|
||||
return decoratedConfig;
|
||||
|
|
|
|||
|
|
@ -19,13 +19,14 @@ const colorList = [
|
|||
'grayscale'
|
||||
];
|
||||
|
||||
export default function getColorList(colors) {
|
||||
// For backwards compatibility, return early if it's already an array
|
||||
if (Array.isArray(colors)) {
|
||||
exports.getColorMap = colors => {
|
||||
if (!Array.isArray(colors)) {
|
||||
return colors;
|
||||
}
|
||||
|
||||
return colorList.map(colorName => {
|
||||
return colors[colorName];
|
||||
});
|
||||
}
|
||||
return colors.reduce((result, color, index) => {
|
||||
if (index < colorList.length) {
|
||||
result[colorList[index]] = color;
|
||||
}
|
||||
return result;
|
||||
}, {});
|
||||
};
|
||||
|
|
@ -20,7 +20,6 @@ import {
|
|||
SESSION_SET_CWD
|
||||
} from '../constants/sessions';
|
||||
import {UPDATE_AVAILABLE} from '../constants/updater';
|
||||
import {values} from '../utils/object';
|
||||
|
||||
const allowedCursorShapes = new Set(['BEAM', 'BLOCK', 'UNDERLINE']);
|
||||
const allowedCursorBlinkValues = new Set([true, false]);
|
||||
|
|
@ -200,13 +199,7 @@ const reducer = (state = initial, action) => {
|
|||
}
|
||||
|
||||
if (config.colors) {
|
||||
if (Array.isArray(config.colors)) {
|
||||
const stateColors = Array.isArray(state.colors) ? state.colors : values(state.colors);
|
||||
|
||||
if (stateColors.toString() !== config.colors.toString()) {
|
||||
ret.colors = config.colors;
|
||||
}
|
||||
} else if (JSON.stringify(state.colors) !== JSON.stringify(config.colors)) {
|
||||
if (JSON.stringify(state.colors) !== JSON.stringify(config.colors)) {
|
||||
ret.colors = config.colors;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue