rust-tools.nvim icon indicating copy to clipboard operation
rust-tools.nvim copied to clipboard

cannot input words into terminal

Open Civitasv opened this issue 1 year ago • 6 comments

So, I have codes to print any character I input to the terminal. Like:

fn main() {
    for b in io::stdin().bytes() {
        let c = b.unwrap() as char;
        println!("{}", c);
    }
}

Actual behavior: But when I run it, the execute terminal won't let me input and it will be closed after whatever key I click. image

Expected behavior: I should be able to input, and when I input <C-c>, it will stop.

Any idea?

Civitasv avatar Jul 12 '22 06:07 Civitasv

You can press i to go into insert mode in the terminal buffer, and input whatever you want

simrat39 avatar Jul 14 '22 01:07 simrat39

When I press i, yes, it enter into insert mode, but then after I input something, it'll disappear. See: Peek 2022-07-14 10-29

Civitasv avatar Jul 14 '22 02:07 Civitasv

Looks like the process exits (successfully as well). For some reason, it isn't waiting for your input.

Could you test this code out?

fn main() {
    loop {
        let mut a = String::new();
        io::stdin().read_line(&mut a);
        println!("{}", a)
    }
}

simrat39 avatar Jul 14 '22 03:07 simrat39

I find it weird. I think it enters into loop and wait for my input in the terminal. But I can't input anything in it(and you can see I've entered into terminal mode from normal mode). After click Ctrl+C, it exits.

Peek 2022-07-14 13-15

You can see my config for rust-tools.

Civitasv avatar Jul 14 '22 05:07 Civitasv

Don't think this is an issue with rust-tools, but with your terminal. What happens if you run the code outside of neovim? Does the issue still persist?

simrat39 avatar Jul 18 '22 23:07 simrat39

I've tested in vscode, it works fine.

Civitasv avatar Jul 19 '22 08:07 Civitasv