micro-editor / micro-editor/micro

syntax highlighting fails on certain columns and line widths

Open
#4,018 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Go
Stars
29.6k
Forks
1.4k
Avg merge
2d 18h
Merged PRs (30d)
10

Description

Description

Using the following syntax highlighting rules:

filetype: highlight_test

detect:
    filename: "(\\.(test)$)"

rules:
    - comment:
        start: "//"
        end: "$"
        rules:
            - todo: "TODO"

The following highlights correctly:

// TODO: feed the cat
// TODO: walk the dog

However, the following does not:

xxxx//xTODO:
xxxx//xTODO 
xxxx//xTODOx
xxxx//xxTODO
xxx//xTODO
xx//TODO
xxxxx//xxxTODO
xxxxx//xxTODOx
xxxxx//xTODOxx

Some experimenting shows that only the positions of the "//" and "TODO" matter, as well as the line width. "x"s can be replaced with any other characters.
Line position doesn't seem to matter.

Environment
  • Version: 2.0.16-dev.20
  • Commit hash: d38f0dfe
  • OS: debian 13 (bookworm)
  • Terminal: gnome-terminal

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue using the YAML syntax-highlighting rules and the listed lines, varying the positions of //, TODO, and the line width. Trace the syntax-highlighting behavior responsible for column- and width-dependent matching. Done means all shown cases highlight the comment and TODO consistently, with regression coverage for the reported positions and widths.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.