Skip to content

Panic on starting a command with space #4586

@ci4ic4

Description

@ci4ic4

Summary

Starting a line command with a space leads to a panic.

Reproduction Steps

I tried this:

  1. hx
  2. Enter colon to go to command line
  3. Enter space

I expected this to happen:

  1. nothing, I can return to normal mode.
    Instead, this happened:
    Panic

Helix log

~/.cache/helix/helix.log
`~/.cache/helix/helix.log` remains empty. 

RUST_BACKTRACE=full output under NetBSD follows.
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', helix-term/src/commands/typed.rs:2206:41
stack backtrace:
   0:        0x10c1843d3 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h7dd69a5540e54fa1
   1:        0x10b93bdfe - core::fmt::write::hdc7684da7ffcab3f
   2:        0x10c1612b5 - std::io::Write::write_fmt::hbe98920af2ef3b1c
   3:        0x10c1703fe - std::panicking::default_hook::{{closure}}::hd00883c5895d31be
   4:        0x10c17004f - std::panicking::default_hook::h37089c0e1ca56b68
   5:        0x10c170c61 - std::panicking::rust_panic_with_hook::h758a8f675318119b
   6:        0x10c1846bc - std::panicking::begin_panic_handler::{{closure}}::hff5edfae4168c537
   7:        0x10c1844f4 - std::sys_common::backtrace::__rust_end_short_backtrace::hba703bc5f07bca51
   8:        0x10c17061d - rust_begin_unwind
   9:        0x10b8b84d3 - core::panicking::panic_fmt::he94bae07399fe725
  10:        0x10b8b839d - core::panicking::panic::hd6cc19e938b8bf80
  11:        0x10be4b361 - helix_term::commands::typed::command_mode::{{closure}}::hbbb8082591504461
  12:        0x10be53e6b - helix_term::ui::prompt::Prompt::insert_char::hf05b00dceb6751de
  13:        0x10be55c95 - <helix_term::ui::prompt::Prompt as helix_term::compositor::Component>::handle_event::h33fa4adb614ab2d4
  14:        0x10bc284a6 - helix_term::compositor::Compositor::handle_event::hd734752ff674a8bf
  15:        0x10bec516f - helix_term::application::Application::handle_terminal_events::h38dc6d67de4f18ba
  16:        0x10bff6931 - helix_term::application::Application::event_loop_until_idle::{{closure}}::h7ca7ee1d812f8fcb
  17:        0x10c0132ca - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hbc4451ca1f37e398
  18:        0x10c015ee5 - std::thread::local::LocalKey<T>::with::h879d563e85707e36
  19:        0x10c00c704 - tokio::park::thread::CachedParkThread::block_on::h0ee0d434db0f3610
  20:        0x10bfd2793 - tokio::runtime::scheduler::multi_thread::MultiThread::block_on::hf389f51ccfecabb3
  21:        0x10c02f005 - tokio::runtime::Runtime::block_on::hf4ed25577cb74f35
  22:        0x10c015575 - hx::main::hcc5cf77bb3c0d5f4
  23:        0x10bfea303 - std::sys_common::backtrace::__rust_begin_short_backtrace::h9b94deba4615a4e9
  24:        0x10c0158e9 - std::rt::lang_start::{{closure}}::h52ec5605631e3a4b
  25:        0x10c15f281 - std::rt::lang_start_internal::h2dfc08e18281105c
  26:        0x10c015682 - main
  27:        0x10b8b388d - ___start
RUST+BACKTRACE=full hx error output follows in the case of Ubuntu 22.10 Aarch64:

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', helix-term/src/commands/typed.rs:2206:41
stack backtrace:
   0:     0xaaaad57a65a4 - std::backtrace_rs::backtrace::libunwind::trace::h5c6c463ec2c6c72d
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0xaaaad57a65a4 - std::backtrace_rs::backtrace::trace_unsynchronized::hce9ad2493dd56d2f
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0xaaaad57a65a4 - std::sys_common::backtrace::_print_fmt::h843fbcfc4a4cb66f
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:66:5
   3:     0xaaaad57a65a4 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h3e06e6426122a4a5
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:45:22
   4:     0xaaaad506381c - core::fmt::write::h916b435d578f4283
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/fmt/mod.rs:1194:17
   5:     0xaaaad57a0524 - std::io::Write::write_fmt::h390a4386e823ee3a
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/io/mod.rs:1655:15
   6:     0xaaaad57a830c - std::sys_common::backtrace::_print::h1664f2d77d570b48
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:48:5
   7:     0xaaaad57a830c - std::sys_common::backtrace::print::h111ccf4407b4ad23
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:35:9
   8:     0xaaaad57a830c - std::panicking::default_hook::{{closure}}::h034523c159880859
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:295:22
   9:     0xaaaad57a806c - std::panicking::default_hook::h3f39cbf3cecec004
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:314:9
  10:     0xaaaad57a88f4 - std::panicking::rust_panic_with_hook::h2d28629b4a0e5d8c
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:702:17
  11:     0xaaaad57a8738 - std::panicking::begin_panic_handler::{{closure}}::h3211a1bbdc8bb914
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:586:13
  12:     0xaaaad57a6aec - std::sys_common::backtrace::__rust_end_short_backtrace::h5ebef8920596ba7b
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:138:18
  13:     0xaaaad57a84f0 - rust_begin_unwind
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:584:5
  14:     0xaaaad4ff1994 - core::panicking::panic_fmt::habb8b180056de53b
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:143:14
  15:     0xaaaad4ff18b0 - core::panicking::panic::hdea21bfc1f07ca26
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:48:5
  16:     0xaaaad5538a80 - helix_term::commands::typed::command_mode::{{closure}}::hf01cfb0d35b6439d
  17:     0xaaaad553eba0 - helix_term::ui::prompt::Prompt::insert_char::h0f86eadf82e7c8cc
  18:     0xaaaad5540568 - <helix_term::ui::prompt::Prompt as helix_term::compositor::Component>::handle_event::h5e70199eaac97c7f
  19:     0xaaaad532d4b0 - helix_term::compositor::Compositor::handle_event::h2cb87a0f89c51a12
  20:     0xaaaad5536cac - helix_term::application::Application::handle_terminal_events::h843cfbf16c4ff920
  21:     0xaaaad5661bec - hx::main_impl::{{closure}}::h771f8e0604a271e4
  22:     0xaaaad5651f78 - std::thread::local::LocalKey<T>::with::h7817275195d3fc90
  23:     0xaaaad5647bf8 - tokio::park::thread::CachedParkThread::block_on::h7a50f4ecd7108eba
  24:     0xaaaad561f860 - tokio::runtime::scheduler::multi_thread::MultiThread::block_on::h7fa4940cd76e6d1a
  25:     0xaaaad5671860 - tokio::runtime::Runtime::block_on::h7896c7a634ef3127
  26:     0xaaaad56374dc - hx::main::h6877e7fe8834d79d
  27:     0xaaaad563abe0 - std::sys_common::backtrace::__rust_begin_short_backtrace::hf11066bef1e90a0c
  28:     0xaaaad5666260 - std::rt::lang_start::{{closure}}::h6a66f24d2fc6dc3a
  29:     0xaaaad579b118 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::hf2e75ddf82beafb7
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/ops/function.rs:259:13
  30:     0xaaaad579b118 - std::panicking::try::do_call::h4f9d51ca6d9f6d37
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:492:40
  31:     0xaaaad579b118 - std::panicking::try::hd6db047d89e81270
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:456:19
  32:     0xaaaad579b118 - std::panic::catch_unwind::hb8d7b093053b2846
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panic.rs:137:14
  33:     0xaaaad579b118 - std::rt::lang_start_internal::{{closure}}::h7a17627dfe99a2cc
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/rt.rs:128:48
  34:     0xaaaad579b118 - std::panicking::try::do_call::h929c8acc478263b2
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:492:40
  35:     0xaaaad579b118 - std::panicking::try::h837881870f64c8f1
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:456:19
  36:     0xaaaad579b118 - std::panic::catch_unwind::h7fd790fc643b22b9
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panic.rs:137:14
  37:     0xaaaad579b118 - std::rt::lang_start_internal::h3635c969986132ab
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/rt.rs:128:20
  38:     0xaaaad56375ec - main
  39:     0xffffa63b7780 - <unknown>
  40:     0xffffa63b7858 - __libc_start_main
  41:     0xaaaad5023670 - _start
  42:                0x0 - <unknown>

Platform

Linux (Ubuntu 22.10, Aarch64), NetBSD 9.99.104 (amd64)

Terminal Emulator

Windows Terminal 1.16.2642.0

Helix Version

helix 22.08.1 (ba394dc)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-helix-termArea: Helix term improvementsC-bugCategory: This is a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions