Skip to content

Preserve path mappings when ignoring backup suffixes - #4111

Merged
keith-hall merged 4 commits into
sharkdp:masterfrom
Marve10s:fix/syntax-mapping-suffix-path
Nov 4, 2026
Merged

keith-hall merged 4 commits into
sharkdp:masterfrom
Marve10s:fix/syntax-mapping-suffix-path

Conversation

@Marve10s

@Marve10s Marve10s commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

An absolute-path or directory syntax mapping works for the original filename but stops matching a backup such as file.demo.bak. The suffix retry passes only the stripped basename, losing the parent path.

Keep the parent when replacing an ordinary stripped filename. Preserve the existing standalone retry for empty, . and .. results so parent directories cannot become filename matches and existing dot rules keep working. Mapping order and original-name precedence remain unchanged.

Verification

With file.demo.bak containing {"a": 1} and an exact absolute file.demo:JSON mapping, v0.26.1 and current master produce this escaped plain-text output:

"\u001b[38;2;248;248;242m{\"a\": 1}\u001b[0m\n"

The branch produces JSON highlighting, matching --language=JSON:

"\u001b[38;2;248;248;242m{\u001b[0m\u001b[38;2;253;151;31m\"\u001b[0m\u001b[38;2;253;151;31ma\u001b[0m\u001b[38;2;253;151;31m\"\u001b[0m\u001b[38;2;248;248;242m:\u001b[0m\u001b[38;2;248;248;242m \u001b[0m\u001b[38;2;190;132;255m1\u001b[0m\u001b[38;2;248;248;242m}\u001b[0m\n"

All commands exit 0 with empty stderr. Three new path/precedence/CLI regression tests compiled and failed against original production code, then passed with the fix. Compatibility coverage also preserves empty and dot-name behavior.

Formatting, locked all-target/all-feature check and Clippy with -D warnings, and the full default test suite pass: 471 passed, five ignored. CLI absolute-path coverage is Unix-only because the existing mapping delimiter conflicts with Windows drive paths; library unit coverage is platform-independent.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-04T17:03:41.141409Z 87c8610 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@keith-hall
keith-hall merged commit cbdad20 into sharkdp:master Nov 4, 2026
24 checks passed
cindykrafft pushed a commit to cindykrafft/bat that referenced this pull request Nov 4, 2026
Resolve the CHANGELOG conflict: keep the sharkdp#4111 and sharkdp#4110 entries and
drop the stale UTF-16BE '#XXXX' duplicate (the entry is listed as sharkdp#4076).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VVn4SeAXPsUajXT2rtHQfo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants