Skip to content

Feat/transient show interrupt#7369

Open
kovjanos wants to merge 2 commits intoJanDeDobbeleer:mainfrom
kovjanos:feat/transient-show-interrupt
Open

Feat/transient show interrupt#7369
kovjanos wants to merge 2 commits intoJanDeDobbeleer:mainfrom
kovjanos:feat/transient-show-interrupt

Conversation

@kovjanos
Copy link
Copy Markdown

@kovjanos kovjanos commented Mar 6, 2026

Prerequisites

  • I have read and understood the contributing guide.
  • The commit message follows the conventional commits guidelines.
  • Tests for the changes have been added (for bug fixes / features).
  • Docs have been added/updated (for bug fixes / features).

Description

This is the 2nd feature on top of the Feat/zsh transient multiline #7360 PR

This feature adds a new status flag .Interrupted that can be used e.g. in transient_template:

I have a transient command that shows the command and the return code if it is non-zero:

[00:06:47]❯ return 1
✘ 1
[00:06:48]❯ return 1
✘ 1

The problem is that in quick typing I sometimes interrupt the command with Ctrl-C, which then sometimes can not be differentiated from the submitted but failed commands. To be able to differentiate them, I'm adding a new state which then can be used in the transient_template for this reason, e.g.:

[transient_prompt]
  template = "{{ if .Interrupted }}<red>^C </>{{ end }}"

With this, you can easily see which commands were interrupted:

[00:15:08]❯ return 1
✘ 1
[00:15:10]❯ ^C return 1
✘ 1

Note: the reason of the status flag and template usage showing ^C in front of the command instead of having ^C in the position where it was pressed is because sometimes in lazy mode - especially with long multi-line commands - I prefer to be able to copy part of the previously interrupted command, which would be hard if the ^C would be in the middle of the command messing it up

@kovjanos kovjanos mentioned this pull request Mar 12, 2026
4 tasks
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.

1 participant