Skip to content

"elastic tabs" for tables do not work very well while editing a table #50

@AdamNorberg

Description

@AdamNorberg

When editing a table in Inform 7 source, edited lines wind up with confused and scrambled indentation. Deleting and re-adding blank lines sometimes fixes it and sometimes doesn't. Reloading works. Tab characters are correct in the code.

I am currently investigating this to fix it. Source/Project/Syntax/IFSyntaxData.m's -syntaxHighlightRange:forceUpdateTabs: looks like it should be (effectively) expanding its range to cover the necessary lines for table recalculation, but it doesn't behave like that's happening. I don't know if there's a bug there or in the elastic tab calculation logic later on, I'm trying to trace through both parts of it.

Something that sticks out to me as odd is that, in the "Phase One" loop, when adding paragraph indentation styles to existing lines, it checks whether the first character of the line is within previousElasticRange to avoid overwriting elastic tabs, but we haven't actually calculated elastic tabs at this point so previousElasticRange is always the 0-length range starting at NSNotFound, thereby containing nothing. So I would assume this logic was shaped differently at some point. I assume the early-out for "no additional syntax changes" was incompatible with elastic tab layout, so it got split into a separate loop? I'm still trying to figure out what's going on to cause the behavior, but I don't fully understand what's going on with this code in general. tinkering with it!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions