[PR #13476] [MERGED] Allow leading spaces to bypass console aliases #29570

Open
opened 2026-01-31 09:35:41 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/13476
Author: @j4james
Created: 7/10/2022
Status: ✅ Merged
Merged: 7/11/2022
Merged by: @undefined

Base: main ← Head: fix-doskey-leading-space


📝 Commits (2)

  • 807ca6e Don't trim leading spaces when looking for an alias.
  • 164dafa Update the alias tests to match the new behavior.

📊 Changes

3 files changed (+6 additions, -24 deletions)

View changed files

📝 src/host/alias.cpp (+0 -15)
📝 src/host/alias.h (+0 -1)
📝 src/host/ut_host/AliasTests.cpp (+6 -8)

📄 Description

Summary of the Pull Request

When you create a console alias that overrides an existing command, it
should still be possible to execute the original command by prefixing it
with a space. However, at some point in the past, there was an attempt
to improve the usability by trimming leading spaces, and that ended up
breaking this functionality. This PR reverts that change, so leading
spaces can once again be used to bypass an alias.

PR Checklist

Validation Steps Performed

I've updated the existing alias unit test for leading spaces to match
the new behavior, i.e. it now confirms that a command with leading
spaces will not match the alias.

I've also manually confirmed that the doskey test case reported in
issue #4189 is now working as expected.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/13476 **Author:** [@j4james](https://github.com/j4james) **Created:** 7/10/2022 **Status:** ✅ Merged **Merged:** 7/11/2022 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `fix-doskey-leading-space` --- ### 📝 Commits (2) - [`807ca6e`](https://github.com/microsoft/terminal/commit/807ca6e3ae32dbc43d05c47fcc548dc149181626) Don't trim leading spaces when looking for an alias. - [`164dafa`](https://github.com/microsoft/terminal/commit/164dafa8ba3e2eef56a81f7b5517a47f2c53afd0) Update the alias tests to match the new behavior. ### 📊 Changes **3 files changed** (+6 additions, -24 deletions) <details> <summary>View changed files</summary> 📝 `src/host/alias.cpp` (+0 -15) 📝 `src/host/alias.h` (+0 -1) 📝 `src/host/ut_host/AliasTests.cpp` (+6 -8) </details> ### 📄 Description ## Summary of the Pull Request When you create a console alias that overrides an existing command, it should still be possible to execute the original command by prefixing it with a space. However, at some point in the past, there was an attempt to improve the usability by trimming leading spaces, and that ended up breaking this functionality. This PR reverts that change, so leading spaces can once again be used to bypass an alias. ## PR Checklist * [x] Closes #4189 * [x] CLA signed. * [x] Tests added/passed * [ ] Documentation updated. * [ ] Schema updated. * [x] I've discussed this with core contributors already. Issue number where discussion took place: #4189 ## Validation Steps Performed I've updated the existing alias unit test for leading spaces to match the new behavior, i.e. it now confirms that a command with leading spaces will not match the alias. I've also manually confirmed that the `doskey` test case reported in issue #4189 is now working as expected. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:35:41 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#29570