Skip to content

Commit da793a7

Browse files
committed
asset editor decoration after regex match
1 parent fb2b6ea commit da793a7

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

css/ui.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,7 @@ div.asset_block.asset_highlight {
533533
.asset-header-badge {
534534
display: inline-block;
535535
padding: 1px 6px;
536+
margin: 0 4px;
536537
border-radius: 4px;
537538
background: rgba(153, 204, 153, 0.15);
538539
color: #99cc99;

src/ide/views/assetdecorations.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ function buildAssetHeaderDecorations(view: EditorView, handleClick: (span: HTMLE
3333
assetHeaderRegex.lastIndex = 0;
3434
const m = assetHeaderRegex.exec(line);
3535
if (m) {
36-
const lineEnd = lineStart + line.length;
36+
const matchEnd = lineStart + m.index + m[0].length;
3737
widgets.push(
3838
Decoration.widget({
3939
widget: new AssetHeaderWidget(m[0], handleClick),
40-
side: 1,
41-
}).range(lineEnd)
40+
side: -1,
41+
}).range(matchEnd)
4242
);
4343
}
4444
lineStart += line.length + 1;

0 commit comments

Comments
 (0)