properly account for scrollbar in applies-to widget

This commit is contained in:
tophf 2021-07-30 15:38:38 +03:00
parent ebb5fcafbc
commit 23d86c53a7
2 changed files with 8 additions and 2 deletions

View File

@ -926,8 +926,7 @@ body.linter-disabled .hidden-unless-compact {
/************ line widget *************/
.CodeMirror-linewidget .applies-to {
margin: 1em 0;
padding: .75rem .75rem .25rem;
padding-right: calc(1em + 20px);
padding: .75rem calc(.25rem + var(--cm-bar-width, 0)) .25rem .75rem;
}
.CodeMirror-linewidget .applies-to li {

View File

@ -286,6 +286,13 @@ function MozSectionWidget(cm, finder = MozSectionFinder(cm)) {
above: true,
height,
});
widget.on('redraw', () => {
const value = cm.display.barWidth + 'px';
if (widget[KEY] !== value) {
widget[KEY] = value;
node.style.setProperty('--cm-bar-width', value);
}
});
}
if (!funcHeight) {
funcHeight = node.offsetHeight / (sec.funcs.length || 1);