helix: :pipe hangs when piping a large file through sed

Summary

Helix freezes and becomes unresponsive when piping a large (~7600 lines) file into sed. Piping the same file into sed outside of helix doesn’t produce the same behavior, and helix seems to handle piping smaller files just fine. Piping into other commands also doesn’t seem to cause the same issue though I didn’t try very many.

Reproduction Steps

I tried this:

  1. hx frankenstein.txt (from here)
  2. %
  3. |sed s/l/w/g

I expected this to happen: The command to execute and all of the ‘l’ characters in Frankenstein to be replaced with ‘w’

Instead, this happened: Helix became unresponsive

Helix log

~/.cache/helix/helix.log
2022-07-21T01:21:42.642 helix_view::theme [WARN] Theme: invalid style attribute: modifier
2022-07-21T01:21:42.642 helix_loader [DEBUG] Located configuration folders: []
2022-07-21T01:21:42.648 mio::poll [TRACE] registering event source with poller: token=Token(1), interests=READABLE | WRITABLE
2022-07-21T01:21:42.648 mio::poll [TRACE] registering event source with poller: token=Token(2), interests=READABLE | WRITABLE
2022-07-21T01:21:42.648 mio::poll [TRACE] registering event source with poller: token=Token(0), interests=READABLE
2022-07-21T01:21:42.648 mio::poll [TRACE] registering event source with poller: token=Token(1), interests=READABLE

Platform

Linux (Pop!_Os)

Terminal Emulator

Alactritty v0.10.0-rc1

Helix Version

helix 22.05 (5ed62239)

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 15 (15 by maintainers)

Most upvoted comments

But that means that we have to take ownership of the input data

I think that’s fine, you can clone the rope + selection and move them into the async closure. Cloning a rope is a shallow copy (essentially cloning an Arc internally), it will reuse the same tree and only start diverging as changes are made to the rope. The structure is immutable