mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-13 04:28: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);
|
||||
}
|
||||
};
|
||||
|
||||
// this.term.CursorNode_ is available at this point.
|
||||
this.term.setCursorShape(props.cursorShape);
|
||||
};
|
||||
this.term.decorate(this.refs.term);
|
||||
this.term.installKeyboard();
|
||||
|
|
@ -186,6 +189,10 @@ export default class Term extends Component {
|
|||
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) {
|
||||
this.term.prefs_.set('color-palette-overrides', getColorList(nextProps.colors));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,6 +128,7 @@ export default class Terms extends Component {
|
|||
customCSS: this.props.customCSS,
|
||||
fontSize: this.props.fontSize,
|
||||
cursorColor: this.props.cursorColor,
|
||||
cursorShape: this.props.cursorShape,
|
||||
fontFamily: this.props.fontFamily,
|
||||
fontSmoothing: this.props.fontSmoothing,
|
||||
foregroundColor: this.props.foregroundColor,
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ const TermsContainer = connect(
|
|||
fontSmoothing: state.ui.fontSmoothingOverride,
|
||||
padding: state.ui.padding,
|
||||
cursorColor: state.ui.cursorColor,
|
||||
cursorShape: state.ui.cursorShape,
|
||||
borderColor: state.ui.borderColor,
|
||||
colors: state.ui.colors,
|
||||
foregroundColor: state.ui.foregroundColor,
|
||||
|
|
|
|||
|
|
@ -18,12 +18,15 @@ import {
|
|||
import { UPDATE_AVAILABLE } from '../constants/updater';
|
||||
import { values } from '../utils/object';
|
||||
|
||||
const allowedCursorShapes = ['BEAM', 'BLOCK', 'UNDERLINE'];
|
||||
|
||||
// TODO: populate `config-default.js` from this :)
|
||||
const initial = Immutable({
|
||||
cols: null,
|
||||
rows: null,
|
||||
activeUid: null,
|
||||
cursorColor: '#F81CE5',
|
||||
cursorShape: 'BLOCK',
|
||||
borderColor: '#333',
|
||||
fontSize: 12,
|
||||
padding: '12px 14px',
|
||||
|
|
@ -93,6 +96,10 @@ const reducer = (state = initial, action) => {
|
|||
ret.cursorColor = config.cursorColor;
|
||||
}
|
||||
|
||||
if (allowedCursorShapes.includes(config.cursorShape)) {
|
||||
ret.cursorShape = config.cursorShape;
|
||||
}
|
||||
|
||||
if (null != 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)
|
||||
cursorColor: 'rgba(248,28,229,0.75)',
|
||||
|
||||
// `BEAM` for |, `UNDERLINE` for _, `BLOCK` for █
|
||||
cursorShape: 'BLOCK',
|
||||
|
||||
// color of the text
|
||||
foregroundColor: '#fff',
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue