Skip to content

Conversation

@coletrammer
Copy link
Owner

@coletrammer coletrammer commented Apr 13, 2025

Summary

Closes #19.

Check List

  • Self-review the code
  • Update tests if necessary
  • Update docs if necessary

The plan is to implement menus and other UI components as a popup
terminal running fzf. I think this will super cool.
Now, prefix+z will toggle full-screen on the active pane. In full-
screen mode, the only way to navigate to other panes it to disable
the full screen mode.
We mostly want this to recover the terminal when a full-screen
application crashes before cleaning up the terminal state. This
happens often when running ttx inside ttx. Now, pressing prefix+shift+r
will soft reset the terminal.

Additionally, this improves conformance on the hyperlink test as
soft reset was previously ignored, and thus didn't reset current
hyperlink.
Currently, there's no way to use this functionality, but soon we'll
put a menu in the popup.

This commit also fixes 2 issues which caused crashes:
1. Improper cursor movement when resizing the screen.
2. Failing to delete erased panes from the pane list if that pane
wasn't already active.
This is pretty cool, but because you can't rename tabs right now
you can only tell the difference between tabs by the index. Next
up is allowing user-provided names for tabs.
To get the desired behavior with fzf, its necessary to disable some of
the UI components and pass nothing into the input pipe, and additionally
use the --print-query option. The next commit will additionally force
the prompt window to have a height of 3 and be top aligned, which works
perfectly.

Using fzf lets us avoid writing our own line editor just for certain
text prompts. We should be able to use fzf for all the UI components
in ttx.
Now the rename tab prompt is forced to have height 3, preventing fzf
from showing any padding.
@coletrammer coletrammer added this to the 0.1 milestone Apr 13, 2025
Next we can support creating, renaming, and switching between
sessions. The code between tabs and sessions is fairly repetitive,
but we can at least stop adding layers of indirection now.

LayoutState -> Session -> Tab -> Pane
This is a temporary measure to enable running ttx in a program like
dtach. Without this, all of the terminal modes ttx sets will be lost
when reattaching to the session. Once ttx supports a proper
client/server architecture, this logic can be removed.
The spec is clear on this, but I forgot to put the state in the
ScreenState struct. This helps ensure we clear the kitty key flags
when exiting the alternate screen buffer.
@coletrammer coletrammer marked this pull request as ready for review April 16, 2025 04:54
@codecov
Copy link

codecov bot commented Apr 16, 2025

Codecov Report

Attention: Patch coverage is 29.67172% with 557 lines in your changes missing coverage. Please review.

Project coverage is 66.28%. Comparing base (be5169a) to head (784f3bc).
Report is 19 commits behind head on main.

Files with missing lines Patch % Lines
src/actions.cpp 1.25% 237 Missing ⚠️
src/tab.cpp 35.61% 47 Missing ⚠️
lib/src/pane.cpp 14.00% 43 Missing ⚠️
src/fzf.h 0.00% 34 Missing ⚠️
src/render.cpp 10.52% 34 Missing ⚠️
src/fzf.cpp 0.00% 30 Missing ⚠️
src/layout_state.cpp 50.81% 30 Missing ⚠️
src/session.cpp 64.28% 25 Missing ⚠️
lib/src/renderer.cpp 26.92% 19 Missing ⚠️
src/input.cpp 11.11% 16 Missing ⚠️
... and 10 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #20      +/-   ##
==========================================
- Coverage   72.55%   66.28%   -6.27%     
==========================================
  Files          56       62       +6     
  Lines        4328     4933     +605     
  Branches      607      698      +91     
==========================================
+ Hits         3140     3270     +130     
- Misses       1188     1663     +475     
Flag Coverage Δ
Linux 66.28% <29.67%> (-6.27%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coletrammer coletrammer merged commit 784f3bc into main Apr 16, 2025
12 checks passed
@coletrammer coletrammer deleted the popup-ux branch April 16, 2025 05:15
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.

client: Implement sessions and fzf based switching

1 participant