gemini-cli icon indicating copy to clipboard operation
gemini-cli copied to clipboard

Multiline paste in CLI duplicates current prompt and ignores intermediate lines

Open gaureshpai opened this issue 1 year ago • 9 comments

What happened?

When using Gemini CLI, if I paste a multiline prompt into the terminal prompt without using \ escape characters, the CLI behaves incorrectly. Specifically:

The current prompt line gets duplicated multiple times.

All intermediate lines from the pasted content are ignored.

Only the last line from the pasted content is submitted.

This causes Gemini to receive an incomplete and error-prone prompt, leading to incorrect or redundant responses.

What did you expect to happen?

I expected the Gemini CLI to correctly process all lines from the pasted multiline input, preserving formatting and line breaks, instead of ignoring intermediate lines or multiplying the current prompt.

Client information

Client Information
> /about
About Gemini CLI                                     
                                                      
 CLI Version       0.3.4                              
 Git Commit        2acadeca                           
 Model             gemini-2.5-flash                   
 Sandbox           no sandbox                         
 OS                win32                              
 Auth Method       OAuth  

Login information

I faced the same issue using Google Account login as well as API key login.

Anything else we need to know?

This issue especially affects workflows where I prepare longer structured prompts (such as markdown or code snippets) and paste them directly into Gemini CLI. It reduces usability and makes the CLI unreliable for multiline contexts.

gaureshpai avatar Sep 07 '25 23:09 gaureshpai

The issue describes a bug where pasting multiline input into the CLI prompt fails to process the text correctly, which is a user experience problem. It affects the core usability of the CLI for users who work with structured text or code snippets. Based on the detailed report, the issue has sufficient information for investigation.

gemini-cli[bot] avatar Sep 07 '25 23:09 gemini-cli[bot]

#7863

edison-manrique avatar Sep 08 '25 17:09 edison-manrique

When I paste this:

When using Gemini CLI, if I paste a multiline prompt into the terminal prompt without using \ escape characters, the CLI behaves incorrectly. Specifically:

The current prompt line gets duplicated multiple times.

All intermediate lines from the pasted content are ignored.

Only the last line from the pasted content is submitted.

This causes Gemini to receive an incomplete and error-prone prompt, leading to incorrect or redundant responses.

What did you expect to happen?
I expected the Gemini CLI to correctly process all lines from the pasted multiline input, preserving formatting and line breaks, instead of ignoring intermediate lines or multiplying the current prompt.

I will get this:

Image

doggy8088 avatar Sep 11 '25 03:09 doggy8088

Hey @doggy8088 , what I meant is a prompt such as logs or something and when we already have some prompt in the prompt window, try to check it out as the problem is still not resolved, not the text over here as it has default escape character embedded.

Something like this mentioned in issue #7863

Image

gaureshpai avatar Sep 11 '25 04:09 gaureshpai

I think I mentioned a new issue. :)

doggy8088 avatar Sep 11 '25 06:09 doggy8088

I also recieve this issue, which makes working with Gemini CLI impossible

NeonBeacon avatar Sep 11 '25 13:09 NeonBeacon

I'm having the same issue on a mac, gemini cli 0.5.3. With claude code I'm used to copy&paste logs from the browser console or other places and it just handles it well - like attaching a file. similar issues: https://github.com/google-gemini/gemini-cli/issues/8288 https://github.com/google-gemini/gemini-cli/issues/4938 https://github.com/google-gemini/gemini-cli/issues/3476

scholtalbers avatar Sep 18 '25 08:09 scholtalbers

When I paste this:

When using Gemini CLI, if I paste a multiline prompt into the terminal prompt without using \ escape characters, the CLI behaves incorrectly. Specifically:

The current prompt line gets duplicated multiple times.

All intermediate lines from the pasted content are ignored.

Only the last line from the pasted content is submitted.

This causes Gemini to receive an incomplete and error-prone prompt, leading to incorrect or redundant responses.

What did you expect to happen? I expected the Gemini CLI to correctly process all lines from the pasted multiline input, preserving formatting and line breaks, instead of ignoring intermediate lines or multiplying the current prompt. I will get this:

Image

My issue already been resolved.

doggy8088 avatar Oct 10 '25 18:10 doggy8088

one solution is push CTRL+X twice so that you edit the cli text buffer in notepad, and there you can put as many lines as you want

iuli4n avatar Nov 12 '25 02:11 iuli4n