mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-16 05:38:41 -09:00
Add support for multiple cursor shapes (#352)
* Add config support for cursor shapes * Add cursorShape to default config
This commit is contained in:
parent
4206f4e96f
commit
e66d6c90f0
5 changed files with 19 additions and 0 deletions
|
|
@ -47,6 +47,9 @@ export default class Term extends Component {
|
||||||
props.onResize(cols, rows);
|
props.onResize(cols, rows);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// this.term.CursorNode_ is available at this point.
|
||||||
|
this.term.setCursorShape(props.cursorShape);
|
||||||
};
|
};
|
||||||
this.term.decorate(this.refs.term);
|
this.term.decorate(this.refs.term);
|
||||||
this.term.installKeyboard();
|
this.term.installKeyboard();
|
||||||
|
|
@ -186,6 +189,10 @@ export default class Term extends Component {
|
||||||
this.term.prefs_.set('cursor-color', Color(nextProps.cursorColor).rgbString());
|
this.term.prefs_.set('cursor-color', Color(nextProps.cursorColor).rgbString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.props.cursorShape !== nextProps.cursorShape) {
|
||||||
|
this.term.setCursorShape(nextProps.cursorShape);
|
||||||
|
}
|
||||||
|
|
||||||
if (this.props.colors !== nextProps.colors) {
|
if (this.props.colors !== nextProps.colors) {
|
||||||
this.term.prefs_.set('color-palette-overrides', getColorList(nextProps.colors));
|
this.term.prefs_.set('color-palette-overrides', getColorList(nextProps.colors));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -128,6 +128,7 @@ export default class Terms extends Component {
|
||||||
customCSS: this.props.customCSS,
|
customCSS: this.props.customCSS,
|
||||||
fontSize: this.props.fontSize,
|
fontSize: this.props.fontSize,
|
||||||
cursorColor: this.props.cursorColor,
|
cursorColor: this.props.cursorColor,
|
||||||
|
cursorShape: this.props.cursorShape,
|
||||||
fontFamily: this.props.fontFamily,
|
fontFamily: this.props.fontFamily,
|
||||||
fontSmoothing: this.props.fontSmoothing,
|
fontSmoothing: this.props.fontSmoothing,
|
||||||
foregroundColor: this.props.foregroundColor,
|
foregroundColor: this.props.foregroundColor,
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ const TermsContainer = connect(
|
||||||
fontSmoothing: state.ui.fontSmoothingOverride,
|
fontSmoothing: state.ui.fontSmoothingOverride,
|
||||||
padding: state.ui.padding,
|
padding: state.ui.padding,
|
||||||
cursorColor: state.ui.cursorColor,
|
cursorColor: state.ui.cursorColor,
|
||||||
|
cursorShape: state.ui.cursorShape,
|
||||||
borderColor: state.ui.borderColor,
|
borderColor: state.ui.borderColor,
|
||||||
colors: state.ui.colors,
|
colors: state.ui.colors,
|
||||||
foregroundColor: state.ui.foregroundColor,
|
foregroundColor: state.ui.foregroundColor,
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,15 @@ import {
|
||||||
import { UPDATE_AVAILABLE } from '../constants/updater';
|
import { UPDATE_AVAILABLE } from '../constants/updater';
|
||||||
import { values } from '../utils/object';
|
import { values } from '../utils/object';
|
||||||
|
|
||||||
|
const allowedCursorShapes = ['BEAM', 'BLOCK', 'UNDERLINE'];
|
||||||
|
|
||||||
// TODO: populate `config-default.js` from this :)
|
// TODO: populate `config-default.js` from this :)
|
||||||
const initial = Immutable({
|
const initial = Immutable({
|
||||||
cols: null,
|
cols: null,
|
||||||
rows: null,
|
rows: null,
|
||||||
activeUid: null,
|
activeUid: null,
|
||||||
cursorColor: '#F81CE5',
|
cursorColor: '#F81CE5',
|
||||||
|
cursorShape: 'BLOCK',
|
||||||
borderColor: '#333',
|
borderColor: '#333',
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
padding: '12px 14px',
|
padding: '12px 14px',
|
||||||
|
|
@ -93,6 +96,10 @@ const reducer = (state = initial, action) => {
|
||||||
ret.cursorColor = config.cursorColor;
|
ret.cursorColor = config.cursorColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (allowedCursorShapes.includes(config.cursorShape)) {
|
||||||
|
ret.cursorShape = config.cursorShape;
|
||||||
|
}
|
||||||
|
|
||||||
if (null != config.borderColor) {
|
if (null != config.borderColor) {
|
||||||
ret.borderColor = config.borderColor;
|
ret.borderColor = config.borderColor;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,9 @@ module.exports = {
|
||||||
// terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk)
|
// terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk)
|
||||||
cursorColor: 'rgba(248,28,229,0.75)',
|
cursorColor: 'rgba(248,28,229,0.75)',
|
||||||
|
|
||||||
|
// `BEAM` for |, `UNDERLINE` for _, `BLOCK` for █
|
||||||
|
cursorShape: 'BLOCK',
|
||||||
|
|
||||||
// color of the text
|
// color of the text
|
||||||
foregroundColor: '#fff',
|
foregroundColor: '#fff',
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue