Skip to content

Incorrect folding for multi-line literal strings and block comments when performed incrementally #247

@nyamatongwe

Description

@nyamatongwe

For a multi-line literal string SCE_LUA_LITERALSTRING or block comment SCE_LUA_COMMENT, lexing the whole element produces correct folding but scrolling through the element produces negative folding levels.

The folding code checks for transitions out of the literal or comment state and treats these as ending the element so decrements the fold level which was incremented for the element start. The detection relies on reading the next styling byte but, for the final text byte, this is not yet set and is likely 0.

To fix this, the beyond-end style byte is assumed to be the same as the previous byte. Both of these elements end with ]] followed by a different style except for end-of-file so this is safe. The case where the ]] appears at file end is also OK because fold handling treats this as end of folding element as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    luaCaused by the Lua lexer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions