Skip to content

Commit 38aaa88

Browse files
committed
Add line height config
1 parent 57c735c commit 38aaa88

File tree

6 files changed

+17
-1
lines changed

6 files changed

+17
-1
lines changed

Diff for: app/config/config-default.js

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ module.exports = {
2020
// font weight for bold characters: 'normal' or 'bold'
2121
fontWeightBold: 'bold',
2222

23+
// line height as a relative unit
24+
lineHeight: 1,
25+
2326
// terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk)
2427
cursorColor: 'rgba(248,28,229,0.8)',
2528

Diff for: lib/components/term-group.js

+1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ class TermGroup_ extends React.PureComponent {
7171
fontSmoothing: this.props.fontSmoothing,
7272
fontWeight: this.props.fontWeight,
7373
fontWeightBold: this.props.fontWeightBold,
74+
lineHeight: this.props.lineHeight,
7475
modifierKeys: this.props.modifierKeys,
7576
padding: this.props.padding,
7677
url: session.url,

Diff for: lib/components/term.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const getTermOptions = props => {
3232
fontSize: props.fontSize,
3333
fontWeight: props.fontWeight,
3434
fontWeightBold: props.fontWeightBold,
35+
lineHeight: props.lineHeight,
3536
allowTransparency: needTransparency,
3637
experimentalCharAtlas: 'dynamic',
3738
theme: {
@@ -263,7 +264,11 @@ export default class Term extends React.PureComponent {
263264
});
264265
}
265266

266-
if (this.props.fontSize !== nextProps.fontSize || this.props.fontFamily !== nextProps.fontFamily) {
267+
if (
268+
this.props.fontSize !== nextProps.fontSize ||
269+
this.props.fontFamily !== nextProps.fontFamily ||
270+
this.props.lineHeight !== nextProps.lineHeight
271+
) {
267272
// invalidate xterm cache about how wide each
268273
// character is
269274
this.term.charMeasure.measure(this.termOptions);

Diff for: lib/components/terms.js

+1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ export default class Terms extends React.Component {
101101
uiFontFamily: this.props.uiFontFamily,
102102
fontWeight: this.props.fontWeight,
103103
fontWeightBold: this.props.fontWeightBold,
104+
lineHeight: this.props.lineHeight,
104105
padding: this.props.padding,
105106
bell: this.props.bell,
106107
bellSoundURL: this.props.bellSoundURL,

Diff for: lib/containers/terms.js

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const TermsContainer = connect(
2626
fontFamily: state.ui.fontFamily,
2727
fontWeight: state.ui.fontWeight,
2828
fontWeightBold: state.ui.fontWeightBold,
29+
lineHeight: state.ui.lineHeight,
2930
uiFontFamily: state.ui.uiFontFamily,
3031
fontSmoothing: state.ui.fontSmoothingOverride,
3132
padding: state.ui.padding,

Diff for: lib/reducers/ui.js

+5
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ const initial = Immutable({
4747
fontSmoothingOverride: 'antialiased',
4848
fontWeight: 'normal',
4949
fontWeightBold: 'bold',
50+
lineHeight: 1,
5051
css: '',
5152
termCSS: '',
5253
openAt: {},
@@ -138,6 +139,10 @@ const reducer = (state = initial, action) => {
138139
ret.fontWeightBold = config.fontWeightBold;
139140
}
140141

142+
if (Number.isFinite(config.lineHeight)) {
143+
ret.lineHeight = config.lineHeight;
144+
}
145+
141146
if (config.uiFontFamily) {
142147
ret.uiFontFamily = config.uiFontFamily;
143148
}

0 commit comments

Comments
 (0)