zed icon indicating copy to clipboard operation
zed copied to clipboard

editor: Fix panic when full width crease is wrapped

Open bennetbo opened this issue 6 months ago • 2 comments

Closes #31919

Release Notes:

  • Fixed a panic that could sometimes occur when the agent panel was too narrow and contained context included via @.

bennetbo avatar Jun 03 '25 10:06 bennetbo

This change has one side effect (which might actually be desirable):

When a diagnostic is wrapped we do not underline the whitespace in a newline anymore. image

Previously:

image

The least invasive way to fix this would be to only set renderer to None.

return Some(Chunk {
    text: &display_text[start_ix..end_ix],
    renderer: None,
    ..self.input_chunk.clone()
});

bennetbo avatar Jun 03 '25 10:06 bennetbo

test_chunks_with_soft_wrapping is failing with:

assertion `left == right` failed
  left: [("fn \n", None), ("oute", Some(Hsla { h: 0.6666667, s: 1.0, l: 0.5, a: 1.0 })), ("\n", None), ("r", Some(Hsla { h: 0.6666667, s: 1.0, l: 0.5, a: 1.0 })), ("() \n{}\n\n", None)]
 right: [("fn \n", None), ("oute\nr", Some(Hsla { h: 0.6666667, s: 1.0, l: 0.5, a: 1.0 })), ("() \n{}\n\n", None)]

Which is expected, as documented above. The tests can be adjusted to the new behaviour with: test_fixes.patch

bennetbo avatar Jun 03 '25 11:06 bennetbo

/cherry-pick v0.189.x

ConradIrwin avatar Jun 03 '25 20:06 ConradIrwin