Accept editor line height as multiple of font size

上级 da65c670
......@@ -2471,12 +2471,13 @@ class EditorInlayHints extends BaseEditorOption<EditorOption.inlayHints, EditorI
//#region lineHeight
class EditorLineHeight extends EditorIntOption<EditorOption.lineHeight> {
class EditorLineHeight extends EditorFloatOption<EditorOption.lineHeight> {
constructor() {
super(
EditorOption.lineHeight, 'lineHeight',
EDITOR_FONT_DEFAULTS.lineHeight, 0, 150,
EDITOR_FONT_DEFAULTS.lineHeight,
x => EditorFloatOption.clamp(x, 0, 150),
{ description: nls.localize('lineHeight', "Controls the line height. Use 0 to compute the line height from the font size.") }
);
}
......
......@@ -54,6 +54,11 @@ export class BareFontInfo {
if (lineHeight === 0) {
lineHeight = Math.round(GOLDEN_LINE_HEIGHT_RATIO * fontSize);
} else if (lineHeight < MINIMUM_LINE_HEIGHT) {
// Values too small to be line heights in pixels are probably in ems. Accept them gracefully.
lineHeight = lineHeight * fontSize;
}
if (lineHeight < MINIMUM_LINE_HEIGHT) {
lineHeight = MINIMUM_LINE_HEIGHT;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册