mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-13 04:28:41 -09:00
add hterm cursor blink support (#1547)
* add hterm cursor blink support * update website with cursorblink doc
This commit is contained in:
parent
27cf69fea3
commit
0ee48c9841
7 changed files with 27 additions and 0 deletions
|
|
@ -12,6 +12,9 @@ module.exports = {
|
||||||
// `BEAM` for |, `UNDERLINE` for _, `BLOCK` for █
|
// `BEAM` for |, `UNDERLINE` for _, `BLOCK` for █
|
||||||
cursorShape: 'BLOCK',
|
cursorShape: 'BLOCK',
|
||||||
|
|
||||||
|
// set to true for blinking cursor
|
||||||
|
cursorBlink: false,
|
||||||
|
|
||||||
// color of the text
|
// color of the text
|
||||||
foregroundColor: '#fff',
|
foregroundColor: '#fff',
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ class TermGroup_ extends Component {
|
||||||
fontSize: this.props.fontSize,
|
fontSize: this.props.fontSize,
|
||||||
cursorColor: this.props.cursorColor,
|
cursorColor: this.props.cursorColor,
|
||||||
cursorShape: this.props.cursorShape,
|
cursorShape: this.props.cursorShape,
|
||||||
|
cursorBlink: this.props.cursorBlink,
|
||||||
fontFamily: this.props.fontFamily,
|
fontFamily: this.props.fontFamily,
|
||||||
fontSmoothing: this.props.fontSmoothing,
|
fontSmoothing: this.props.fontSmoothing,
|
||||||
foregroundColor: this.props.foregroundColor,
|
foregroundColor: this.props.foregroundColor,
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ export default class Term extends Component {
|
||||||
prefs.set('font-size', props.fontSize);
|
prefs.set('font-size', props.fontSize);
|
||||||
prefs.set('font-smoothing', props.fontSmoothing);
|
prefs.set('font-smoothing', props.fontSmoothing);
|
||||||
prefs.set('cursor-color', this.validateColor(props.cursorColor, 'rgba(255,255,255,0.5)'));
|
prefs.set('cursor-color', this.validateColor(props.cursorColor, 'rgba(255,255,255,0.5)'));
|
||||||
|
prefs.set('cursor-blink', props.cursorBlink);
|
||||||
prefs.set('enable-clipboard-notice', false);
|
prefs.set('enable-clipboard-notice', false);
|
||||||
prefs.set('foreground-color', props.foregroundColor);
|
prefs.set('foreground-color', props.foregroundColor);
|
||||||
|
|
||||||
|
|
@ -77,6 +78,8 @@ export default class Term extends Component {
|
||||||
this.term.modifierKeys = props.modifierKeys;
|
this.term.modifierKeys = props.modifierKeys;
|
||||||
// this.term.CursorNode_ is available at this point.
|
// this.term.CursorNode_ is available at this point.
|
||||||
this.term.setCursorShape(props.cursorShape);
|
this.term.setCursorShape(props.cursorShape);
|
||||||
|
// required to be set for CursorBlink to work
|
||||||
|
this.term.setCursorVisible(true);
|
||||||
|
|
||||||
// emit onTitle event when hterm instance
|
// emit onTitle event when hterm instance
|
||||||
// wants to set the title of its tab
|
// wants to set the title of its tab
|
||||||
|
|
@ -333,6 +336,10 @@ export default class Term extends Component {
|
||||||
this.term.setCursorShape(nextProps.cursorShape);
|
this.term.setCursorShape(nextProps.cursorShape);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.props.cursorBlink !== nextProps.cursorBlink) {
|
||||||
|
prefs.set('cursor-blink', nextProps.cursorBlink);
|
||||||
|
}
|
||||||
|
|
||||||
if (this.props.colors !== nextProps.colors) {
|
if (this.props.colors !== nextProps.colors) {
|
||||||
prefs.set('color-palette-overrides', getColorList(nextProps.colors));
|
prefs.set('color-palette-overrides', getColorList(nextProps.colors));
|
||||||
}
|
}
|
||||||
|
|
@ -355,6 +362,9 @@ export default class Term extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
|
// turn blinking off to prevent leaking a timeout when disposing terminal
|
||||||
|
const prefs = this.term.getPrefs();
|
||||||
|
prefs.set('cursor-blink', false);
|
||||||
clearTimeout(this.scrollbarsHideTimer);
|
clearTimeout(this.scrollbarsHideTimer);
|
||||||
this.props.ref_(null);
|
this.props.ref_(null);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,7 @@ export default class Terms extends Component {
|
||||||
borderColor: this.props.borderColor,
|
borderColor: this.props.borderColor,
|
||||||
cursorColor: this.props.cursorColor,
|
cursorColor: this.props.cursorColor,
|
||||||
cursorShape: this.props.cursorShape,
|
cursorShape: this.props.cursorShape,
|
||||||
|
cursorBlink: this.props.cursorBlink,
|
||||||
fontFamily: this.props.fontFamily,
|
fontFamily: this.props.fontFamily,
|
||||||
fontSmoothing: this.props.fontSmoothing,
|
fontSmoothing: this.props.fontSmoothing,
|
||||||
foregroundColor: this.props.foregroundColor,
|
foregroundColor: this.props.foregroundColor,
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ const TermsContainer = connect(
|
||||||
padding: state.ui.padding,
|
padding: state.ui.padding,
|
||||||
cursorColor: state.ui.cursorColor,
|
cursorColor: state.ui.cursorColor,
|
||||||
cursorShape: state.ui.cursorShape,
|
cursorShape: state.ui.cursorShape,
|
||||||
|
cursorBlink: state.ui.cursorBlink,
|
||||||
borderColor: state.ui.borderColor,
|
borderColor: state.ui.borderColor,
|
||||||
colors: state.ui.colors,
|
colors: state.ui.colors,
|
||||||
foregroundColor: state.ui.foregroundColor,
|
foregroundColor: state.ui.foregroundColor,
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ import {UPDATE_AVAILABLE} from '../constants/updater';
|
||||||
import {values} from '../utils/object';
|
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 allowedBells = new Set(['SOUND', false]);
|
const allowedBells = new Set(['SOUND', false]);
|
||||||
const allowedHamburgerMenuValues = new Set([true, false]);
|
const allowedHamburgerMenuValues = new Set([true, false]);
|
||||||
const allowedWindowControlsValues = new Set([true, false, 'left']);
|
const allowedWindowControlsValues = new Set([true, false, 'left']);
|
||||||
|
|
@ -34,6 +35,7 @@ const initial = Immutable({
|
||||||
activeUid: null,
|
activeUid: null,
|
||||||
cursorColor: '#F81CE5',
|
cursorColor: '#F81CE5',
|
||||||
cursorShape: 'BLOCK',
|
cursorShape: 'BLOCK',
|
||||||
|
cursorBlink: false,
|
||||||
borderColor: '#333',
|
borderColor: '#333',
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
padding: '12px 14px',
|
padding: '12px 14px',
|
||||||
|
|
@ -125,6 +127,10 @@ const reducer = (state = initial, action) => {
|
||||||
ret.cursorShape = config.cursorShape;
|
ret.cursorShape = config.cursorShape;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (allowedCursorBlinkValues.has(config.cursorBlink)) {
|
||||||
|
ret.cursorBlink = config.cursorBlink;
|
||||||
|
}
|
||||||
|
|
||||||
if (config.borderColor) {
|
if (config.borderColor) {
|
||||||
ret.borderColor = config.borderColor;
|
ret.borderColor = config.borderColor;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -710,6 +710,11 @@
|
||||||
<td>"BLOCK"</td>
|
<td>"BLOCK"</td>
|
||||||
<td>The shape of the caret in the terminal. Available options are: 'BEAM', 'UNDERLINE', 'BLOCK'</td>
|
<td>The shape of the caret in the terminal. Available options are: 'BEAM', 'UNDERLINE', 'BLOCK'</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>"cursorBlink"</td>
|
||||||
|
<td>"false"</td>
|
||||||
|
<td>If true, cursor will blink</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>"foregroundColor"</td>
|
<td>"foregroundColor"</td>
|
||||||
<td>"#fff"</td>
|
<td>"#fff"</td>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue