fix: render syntax using only the first match at a point
This commit is contained in:
parent
486c6ba95e
commit
78f6756494
1 changed files with 6 additions and 2 deletions
|
@ -1079,9 +1079,13 @@ pub const Editor = struct {
|
|||
cache: *StyleCache,
|
||||
root: Buffer.Root,
|
||||
pos_cache: PosToWidthCache,
|
||||
fn cb(ctx: *@This(), range: syntax.Range, scope: []const u8, id: u32, _: usize, _: *const syntax.Node) error{Stop}!void {
|
||||
last_begin: Cursor = .{},
|
||||
fn cb(ctx: *@This(), range: syntax.Range, scope: []const u8, id: u32, idx: usize, _: *const syntax.Node) error{Stop}!void {
|
||||
const sel_ = ctx.pos_cache.range_to_selection(range, ctx.root, ctx.self.metrics) orelse return;
|
||||
|
||||
|
||||
if (idx > 0) return;
|
||||
if (sel_.begin.eql(ctx.last_begin)) return;
|
||||
ctx.last_begin = sel_.begin;
|
||||
const style_ = style_cache_lookup(ctx.theme, ctx.cache, scope, id);
|
||||
const style = if (style_) |sty| sty.style else return;
|
||||
var sel = sel_;
|
||||
|
|
Loading…
Add table
Reference in a new issue