warpdotdev / warpdotdev/warp

M-. only inserts part of previous arg if the arg contained a space

Open
#4,648 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug needs-info ready-to-implement triaged
Dominant language
Rust
Stars
65.1k
Forks
5.6k
PR merge metrics
PR metrics pending

Description

Discord username (optional)

No response

Describe the bug

M-. can be used to insert the last argument from the previous command.

For example:

mkdir foo
cd # If I press `M-.` now, I'll get `cd foo`

However, this breaks if the previous argument contains a space. For example:

mkdir foo\ bar
cd # If I press `M-.` now, I'll get `cd bar`

Using quotes to enclose the arg that includes spaces also yields unexpected results:

mkdir "foo bar"
cd # If I press `M-.` now, I'll get `cd bar"`
To reproduce
  1. Settings > Features > Left Option key is Meta
  2. In Warp, type:
    mkdir foo\ bar
    cd
    
  3. Press the left Option key and the . key.
Expected behavior
cd foo\ bar
Screenshots

https://github.com/warpdotdev/Warp/assets/116432/3721fa10-ebd0-499b-94ac-2540b8b311fc

Operating system

MacOS

Operating system and version

14.4.1

Shell Version

fish 3.7.1, zsh 5.9

Current Warp version

v0.2024.03.19.08.01.stable_01

Regression

No, this bug or issue has existed throughout my experience using Warp

Recent working Warp date

No response

Additional context

No response

Does this block you from using Warp daily?

No

Is this a Warp specific issue? (i.e. does it happen in Terminal, iTerm, Kitty, etc.)

Yes, this I confirmed this only happens in Warp, not other terminals.

Warp Internal (ignore): linear-label:b9d78064-c89e-4973-b153-5178a31ee54e

None

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files or tests; start by reproducing the M-. behavior with escaped and quoted arguments, then search for the M-. key binding and history-argument insertion entry point. Done means the complete previous argument is inserted, preserving spaces and quoting, with regression coverage for both examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
fish, macos, rust, shell, zsh
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.