Skip to content

Commit

Permalink
fix #10, del heading hideDecoration when cursor in line
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean10 committed Oct 29, 2021
1 parent 4454335 commit 0def568
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,24 @@ function bootstrap(context) {
} else {
endSymbolNeedDecoration = start;
}
function delDecoration(decoration, currentLine) {
let decList = state.decorationRanges.get(decoration);
for (let i=0; i < decList.length; i++) {
if (currentLine == decList[i].start.line) {
decList.splice(i, 1);
break;
}
}
}

addDecoration(getEnlargeDecoration(state.fontSize + Math.ceil(state.fontSize) / 6 * (7 - node.depth)), endSymbolNeedDecoration, end);
addDecoration(hideDecoration, start, endSymbolNeedDecoration);
// console.log("offset: ", state.offset, "start: ", start , " end: ", end);

if (node.position.start.line - 1 == editor.selection.active.line) {
delDecoration(hideDecoration, editor.selection.active.line);
delDecoration(getEnlargeDecoration, editor.selection.active.line);
}
};
})()]],
["horizontalRule", ["thematicBreak", (() => {
Expand Down

0 comments on commit 0def568

Please sign in to comment.