mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2026-12-01 05:58:01 -06:00
* Add ability to use custom font family in editors
As suggested by @brainplot in #803
This commit is contained in:
@@ -184,7 +184,8 @@ Ast.prototype.onSettingsChange = function (newSettings) {
|
||||
contextmenu: newSettings.useCustomContextMenu,
|
||||
minimap: {
|
||||
enabled: newSettings.showMinimap
|
||||
}
|
||||
},
|
||||
fontFamily: newSettings.editorsFFont
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ function Compiler(hub, container, state) {
|
||||
scrollBeyondLastLine: false,
|
||||
readOnly: true,
|
||||
language: 'asm',
|
||||
fontFamily: 'Consolas, "Liberation Mono", Courier, monospace',
|
||||
fontFamily: this.settings.editorsFFont,
|
||||
glyphMargin: !options.embedded,
|
||||
fixedOverflowWidgets: true,
|
||||
minimap: {
|
||||
@@ -1295,7 +1295,8 @@ Compiler.prototype.onSettingsChange = function (newSettings) {
|
||||
contextmenu: this.settings.useCustomContextMenu,
|
||||
minimap: {
|
||||
enabled: this.settings.showMinimap && !options.embedded
|
||||
}
|
||||
},
|
||||
fontFamily: this.settings.editorsFFont
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -239,7 +239,8 @@ Diff.prototype.onSettingsChange = function (newSettings) {
|
||||
this.outputEditor.updateOptions({
|
||||
minimap: {
|
||||
enabled: newSettings.showMinimap
|
||||
}
|
||||
},
|
||||
fontFamily: newSettings.editorsFFont
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ function Editor(hub, state, container) {
|
||||
this.editor = monaco.editor.create(root[0], {
|
||||
scrollBeyondLastLine: false,
|
||||
language: this.currentLanguage.monaco,
|
||||
fontFamily: 'Consolas, "Liberation Mono", Courier, monospace',
|
||||
fontFamily: this.settings.editorsFFont,
|
||||
readOnly: !!options.readOnly || legacyReadOnly,
|
||||
glyphMargin: !options.embedded,
|
||||
quickSuggestions: false,
|
||||
@@ -538,6 +538,7 @@ Editor.prototype.onSettingsChange = function (newSettings) {
|
||||
minimap: {
|
||||
enabled: this.settings.showMinimap && !options.embedded
|
||||
},
|
||||
fontFamily: this.settings.editorsFFont,
|
||||
wordWrap: this.settings.wordWrap ? 'bounded' : 'off',
|
||||
wordWrapColumn: this.editor.getLayoutInfo().viewportColumn // Ensure the column count is up to date
|
||||
});
|
||||
|
||||
@@ -297,7 +297,8 @@ GccDump.prototype.onSettingsChange = function (newSettings) {
|
||||
contextmenu: newSettings.useCustomContextMenu,
|
||||
minimap: {
|
||||
enabled: newSettings.showMinimap
|
||||
}
|
||||
},
|
||||
fontFamily: newSettings.editorsFFont
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -224,7 +224,8 @@ Opt.prototype.onSettingsChange = function (newSettings) {
|
||||
contextmenu: newSettings.useCustomContextMenu,
|
||||
minimap: {
|
||||
enabled: newSettings.showMinimap
|
||||
}
|
||||
},
|
||||
fontFamily: newSettings.editorsFFont
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -78,6 +78,18 @@ Slider.prototype.putUi = function (elem, value) {
|
||||
elem.slider('setValue', value);
|
||||
};
|
||||
|
||||
function Textbox() {
|
||||
}
|
||||
|
||||
Textbox.prototype.getUi = function (elem) {
|
||||
return elem.val();
|
||||
};
|
||||
|
||||
Textbox.prototype.putUi = function (elem, value) {
|
||||
elem.val(value);
|
||||
};
|
||||
|
||||
|
||||
function setupSettings(root, settings, onChange, langId) {
|
||||
settings = settings || {};
|
||||
// Ensure the default language is not "null" but undefined. Temporary patch for a previous bug :(
|
||||
@@ -206,6 +218,7 @@ function setupSettings(root, settings, onChange, langId) {
|
||||
})
|
||||
);
|
||||
add(root.find('.enableCtrlS'), 'enableCtrlS', true, Checkbox);
|
||||
add(root.find('.editorsFFont'), 'editorsFFont', 'Consolas, "Liberation Mono", Courier, monospace', Textbox);
|
||||
|
||||
setSettings(settings);
|
||||
handleThemes();
|
||||
|
||||
@@ -100,6 +100,10 @@
|
||||
.card-title
|
||||
h4 Editor
|
||||
.form-group(role="group")
|
||||
div
|
||||
label
|
||||
| Desired Font Family in editors
|
||||
input.editorsFFont(type="text" style="width:100%")
|
||||
.checkbox
|
||||
label
|
||||
input.autoCloseBrackets(type="checkbox")
|
||||
|
||||
Reference in New Issue
Block a user