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