Skip to content

wordWrap ignores visually hidden inline decorations (layout based on model text?) #283

@Junta1980

Description

@Junta1980

Description

We are using ngx-monaco-editor and visually hiding inline portions of text
using Monaco decorations (inlineClassName) combined with CSS
(e.g. width: 0, font-size: 0, etc.).

While the inline text is visually hidden, wordWrap still behaves as if the
original text were fully visible.


Observed behavior

  • Inline text can be visually hidden using decorations and CSS
  • Cursor positioning issues caused by this can be mitigated using
    disableMonospaceOptimizations: true
  • However, wordWrap does not change
  • Lines are wrapped as if the hidden text were still present in full

Forcing layout recalculation (editor.layout()), toggling wordWrap,
or changing fontSize does not affect wrapping behavior.


Question / clarification

Is this expected behavior?

More specifically:

Is wordWrap always computed from the Monaco model text value,
independently of decorations and visually hidden content in the rendered view?

If this is a known limitation or by-design behavior of Monaco Editor,
it would be helpful to confirm or document it explicitly, so users know that
visually hiding inline text via decorations is not sufficient to affect wrapping.


Why this matters

Without this clarification, it is unclear whether this behavior is:

  • a limitation of the wrapper
  • a limitation of Monaco Editor itself
  • or an unsupported use case

This information is important to decide whether inline hiding requires
modifying the model text (e.g. replacing hidden ranges with placeholders)
instead of relying on decorations alone.


Environment

  • Angular 20.3.2
  • ngx-monaco-editor 20.3.0
  • Monaco Editor "^0.52.2",
  • wordWrap: "on"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions