Attempt to fix line wrapper bugs
This commit is contained in:
parent
36004a7977
commit
9f7b59905a
@ -18,11 +18,13 @@ interface WrapElement {
|
||||
function wrapLines(view: EditorView, wrapElements: WrapElement[]) {
|
||||
let widgets: Range<Decoration>[] = [];
|
||||
let elementStack: string[] = [];
|
||||
for (let { from, to } of view.visibleRanges) {
|
||||
const doc = view.state.doc;
|
||||
// Disabling the visible ranges for now, because it may be a bit buggy.
|
||||
// RISK: this may actually become slow for large documents.
|
||||
// for (let { from, to } of view.visibleRanges) {
|
||||
syntaxTree(view.state).iterate({
|
||||
from,
|
||||
to,
|
||||
// from,
|
||||
// to,
|
||||
enter: ({ type, from, to }) => {
|
||||
for (let wrapElement of wrapElements) {
|
||||
if (type.name == wrapElement.selector) {
|
||||
@ -54,7 +56,7 @@ function wrapLines(view: EditorView, wrapElements: WrapElement[]) {
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
// }
|
||||
// Widgets have to be sorted by `from` in ascending order
|
||||
widgets = widgets.sort((a, b) => {
|
||||
return a.from < b.from ? -1 : 1;
|
||||
|
@ -1,12 +1,7 @@
|
||||
@import "constants.scss";
|
||||
|
||||
//div.rhs-open #editor .cm-editor .cm-content {
|
||||
// max-width: 550px;
|
||||
//}
|
||||
|
||||
.cm-editor {
|
||||
font-size: var(--ident);
|
||||
//overflow-y: hidden;
|
||||
padding: 0 20px;
|
||||
|
||||
.cm-content {
|
||||
@ -256,7 +251,6 @@
|
||||
color: #989797;
|
||||
background-color: rgba(210, 210, 210, 0.2);
|
||||
border-radius: 5px;
|
||||
// font-style: italic;
|
||||
font-size: 75%;
|
||||
line-height: 75%;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user