Skip to content

🐞 Syntax highlights not applied to end of file #142

Closed

Description

@thecoolwinter

Description

When appending text to the end of a file the highlighter doesn't apply fonts. If you resize the window or scroll away it will apply the fonts. After some investigation it looks like the visibleSet isn't being updated with new characters, so new characters are being removed from any actionable sets when highlights are being applied.

An easy fix would be to recalculate the visible set every edit, but that would be quite inefficient. A possible solution may be to check whether an edit is being applied to the end of the visible set, and if it's exactly on the end extend the visible set.

To Reproduce

  • Open a blank code file (or one you can see the bottom of without scrolling)
  • Type some code, you'll notice there's no fonts/colors being applied.

Expected behavior

Should apply fonts/colors to edits made at the end of the file.

Version information

CodeEditTextView: [main]
macOS: [e.g. 13.2]
Xcode: [e.g. 14.2]

Additional context

Screen.Recording.2023-02-14.at.8.07.12.PM.mov

This video shows the issue. I deleted exactly 5 characters from the file (4 lines and a tab) before typing this. So the visible set originally included the class text. After that the visible set no longer contains the edited indices.

Activity

  1. moved this from 🆕 New to 📋 Todo in CodeEdit Projecton Feb 15, 2023
  2. austincondiff commented on Mar 4, 2023

    @austincondiff
    Collaborator

    Can this be closed? Syntax highlights for me at the bottom of the file...

    Screen.Recording.2023-03-04.at.10.43.04.AM.mov

    Although I see two more bugs here...

    • Scroll position does not follow cursor, so if I type new lines that are out of view, the scroll position does not adjust so that the cursor is in view.
    • There are some strange alignment issues.
  3. thecoolwinter commented on Mar 27, 2023

    @thecoolwinter
    CollaboratorAuthor

    Those alignment issues are the highlighter not finding those characters and applying a style to them. I have a fix ready for this that I'll push asap.

  4. moved this from 📋 Todo to 🏃‍♂️ In Progress in CodeEdit Projecton Mar 27, 2023
  5. added a commit that references this issue on Apr 4, 2023
    cfceb13
  6. moved this from 🏃‍♂️ In Progress to 🏁 Complete in CodeEdit Projecton Apr 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions