Skip to content

Coming back to previous state when exec command failed#392

Merged
idursun merged 1 commit intoidursun:mainfrom
ArnaudBger:feature/exec_fallback_to_previous_state_on_failure
Nov 27, 2025
Merged

Coming back to previous state when exec command failed#392
idursun merged 1 commit intoidursun:mainfrom
ArnaudBger:feature/exec_fallback_to_previous_state_on_failure

Conversation

@ArnaudBger
Copy link
Copy Markdown
Contributor

@ArnaudBger ArnaudBger commented Nov 27, 2025

This PR enhances the user experience when executing commands (jj or shell) by automatically restoring failed commands to the input field, allowing users to easily
edit and retry without having to retype the entire command.

Copy link
Copy Markdown
Collaborator

@baggiiiie baggiiiie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

Comment on lines +139 to +140
keyMsg := tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune(msg.Msg.Line)}
updateCmd := m.Update(keyMsg)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe m.input.SetValue is more direct and clear than m.Update in this case, so no keyevent is needed

Copy link
Copy Markdown
Contributor Author

@ArnaudBger ArnaudBger Nov 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was my original intention, but m.input.SetValue doesn't produce the exact same state. It results in unexpected behavior with the fuzzy_input model. Thanks for reviewing !

Copy link
Copy Markdown
Owner

@idursun idursun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@idursun idursun merged commit 842d745 into idursun:main Nov 27, 2025
3 checks passed
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Dec 3, 2025
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [idursun/jjui](https://github.com/idursun/jjui) | patch | `v0.9.6` -> `v0.9.7` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>idursun/jjui (idursun/jjui)</summary>

### [`v0.9.7`](https://github.com/idursun/jjui/releases/tag/v0.9.7)

[Compare Source](idursun/jjui@v0.9.6...v0.9.7)

🎉 This release enhances performance and introduces stability improvements in log parsing and command execution. It also takes back some of the stability by adding basic mouse support.

#### Features

##### 📈 Performance Improvements

Implemented frame-rate limited rendering (capped at 120 FPS) to significantly improve application performance by deferring view generation until the next frame tick. This addresses the slowest path in the application - view generation - making it much more responsive

##### 🐭 Mouse Support

- Clickable and scrollable revisions view (excluding operations) ([#&#8203;391](idursun/jjui#391))
- Clickable and scrollable op log view
- Draggable and scrollable (vertically + horizontally) preview pane
- Scrollable diff window
- Replaced custom viewport with bubbles/viewport for more responsive rendering ([#&#8203;396](idursun/jjui#396))

<https://github.com/user-attachments/assets/7cbad275-713e-4fa3-8d61-4e86c301ab0c>

##### 🔎 Preview

- Replaced surrounding border with divider for more preview space ([#&#8203;396](idursun/jjui#396))

##### Operation Log (oplog)

- Added `jj op revert` functionality with `R` key binding ([#&#8203;400](idursun/jjui#400))

##### Revset Handling

- Pressing up arrow in empty revset field now sets the current revset ([#&#8203;284](idursun/jjui#284))
- Fixed mismatch where empty revset input would use config default instead of session default from `-r` flag. Now correctly updates `CurrentRevset` to session default instead of empty string ([#&#8203;399](idursun/jjui#399))

##### Details View

- Allow quitting from details view when quit key is pressed (e.g. `q`)

#### Bug Fixes

##### Rendering Issues

- Fixed double rendering of inline describe content when next line contains only revision line. Added `revisionLineRendered` tracking flag to properly sequence the description overlay rendering ([#&#8203;403](idursun/jjui#403), [#&#8203;369](idursun/jjui#369))
- Fixed viewport adjustment when PageDown moves cursor below viewport. The renderer now continues rendering until it reaches the focused item, ensuring proper viewport adjustment ([#&#8203;395](idursun/jjui#395))
- Fixed PageUp/Down navigation at top and bottom of revset when less than one page remains. Now includes early return with feedback message when already at boundary ([#&#8203;387](idursun/jjui#387), [#&#8203;386](idursun/jjui#386))
- Removed incorrect space trimming in renderer ([#&#8203;393](idursun/jjui#393))

##### Log Processing

- Applied partial fixes to prevent out-of-order row updates in log streamer

##### Details View

- Handle cases where conflict markers span multiple lines ([#&#8203;398](idursun/jjui#398))
- Ignore virtual selection on refresh ([#&#8203;381](idursun/jjui#381))

##### Operation Log (oplog)

- Fixed an issue in operation ID detection ([#&#8203;380](idursun/jjui#380), [#&#8203;377](idursun/jjui#377))

##### Command Execution

- Added a mechanism for restoring failed commands to input field, allowing retries without retyping ([#&#8203;392](idursun/jjui#392))

##### Template System

- Enhanced `jj log` parsing using native template prefixes for better change ID and commit ID detection. Fixes issues when bookmarks are "HexLike" ([#&#8203;358](idursun/jjui#358), [#&#8203;228](idursun/jjui#228), [#&#8203;372](idursun/jjui#372))

#### What's Changed

- Remove teatest package and simplify tests by [@&#8203;idursun](https://github.com/idursun) in [#&#8203;379](idursun/jjui#379)
- internal/parser: get revision ids with template prefixes by [@&#8203;baggiiiie](https://github.com/baggiiiie) in [#&#8203;372](idursun/jjui#372)
- fix(oplog): improve operation id detection by [@&#8203;idursun](https://github.com/idursun) in [#&#8203;380](idursun/jjui#380)
- refactor: serialise command execution by [@&#8203;idursun](https://github.com/idursun) in [#&#8203;378](idursun/jjui#378)
- Revert "refactor: serialise command execution" by [@&#8203;idursun](https://github.com/idursun) in [#&#8203;383](idursun/jjui#383)
- revisions: fix scrolling at the top and bottom of revset by [@&#8203;baggiiiie](https://github.com/baggiiiie) in [#&#8203;387](idursun/jjui#387)
- refactor: introduce and implement common.Model by [@&#8203;idursun](https://github.com/idursun) in [#&#8203;384](idursun/jjui#384)
- refactor: Replace custom cell buffer implementation with `cellbuf` package by [@&#8203;idursun](https://github.com/idursun) in [#&#8203;388](idursun/jjui#388)
- refactor: use simple layout functions to lay out the main UI by [@&#8203;idursun](https://github.com/idursun) in [#&#8203;389](idursun/jjui#389)
- Coming back to previous state  when exec command failed by [@&#8203;ArnaudBger](https://github.com/ArnaudBger) in [#&#8203;392](idursun/jjui#392)
- feat: add basic mouse support by [@&#8203;idursun](https://github.com/idursun) in [#&#8203;391](idursun/jjui#391)
- list/renderer: fix viewport adjustment on PageDown by [@&#8203;baggiiiie](https://github.com/baggiiiie) in [#&#8203;395](idursun/jjui#395)
- Make preview horizontally scrollable by [@&#8203;idursun](https://github.com/idursun) in [#&#8203;396](idursun/jjui#396)
- revset: fix revset not using default when empty by [@&#8203;baggiiiie](https://github.com/baggiiiie) in [#&#8203;399](idursun/jjui#399)
- operation: add op log revert by [@&#8203;baggiiiie](https://github.com/baggiiiie) in [#&#8203;400](idursun/jjui#400)
- revision: fix double rendering of inline describe content by [@&#8203;baggiiiie](https://github.com/baggiiiie) in [#&#8203;403](idursun/jjui#403)
- refactor: replace usages of scattered width/height pairs with `ViewNode` by [@&#8203;idursun](https://github.com/idursun) in [#&#8203;401](idursun/jjui#401)
- describe: catch cursor blinking to avoid unnecessary rendering by [@&#8203;baggiiiie](https://github.com/baggiiiie) in [#&#8203;404](idursun/jjui#404)

#### New Contributors

- [@&#8203;ArnaudBger](https://github.com/ArnaudBger) made their first contribution in [#&#8203;392](idursun/jjui#392)

**Full Changelog**: <idursun/jjui@v0.9.6...v0.9.7>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi4yOS40IiwidXBkYXRlZEluVmVyIjoiNDIuMjkuNCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90Il19-->
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.

3 participants