Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add floating panes #1066

Merged
merged 50 commits into from Feb 18, 2022
Merged

Add floating panes #1066

merged 50 commits into from Feb 18, 2022

Conversation

imsnif
Copy link
Member

@imsnif imsnif commented Feb 18, 2022

Implements #636

Notable changes

Toggling Floating Panes

Now, when pressing ctrl+p + w (perhaps I'll also add an additional ALT shortcut later), all floating panes for this tab are displayed on screen. If there are no floating panes, a new one is opened.

When floating panes are visible, new panes added with ctrl+p + n or with alt+n are created as floating and placed in an appropriate place on screen. Resizing, moving and changing focus of floating panes is also possible in the same way as tiled panes are resized, moved or changed focus today.

Floating panes can also be moved with the mouse by clicking and dragging their frame.

Floating / Embedding an existing pane

It is now possible to float a focused embedded pane or embed a focused floating pane by pressing ctrl+p + e. This will work for all embedded panes except the first one (because there must always be at least one embedded pane).

New rendering mechanism

To support rendering floating panes without impacting performance, I created a new rendering mechanism. The main difference is that changed CharacterChunks are serialized into VTE by Output rather than by their individual Panes. This is because Output knows about the other panes and is able to intelligently "diff" the chunks so that only their exposed parts are rendered. For more on this, see: #636

There are certain cases in which Panes still need to send VTE output directly (eg. ringing the notification bell, hiding the cursor, etc.) For this, Output is able to handle "pre" and "post" vte instructions to be used accordingly.

link handler is now Rc

Due to the new rendering algorithm, I made the link handler global to the screen thread and wrapped it in a reference counter so that it can be shared between panes. This allows the Output, now in charge of serialization, to handle OSC 8 links for multiple panes.

New Tab integration tests

I added a new type of integration tests for Tabs (but this method can be used for anything that renders itself with Output). These perform a similar function to the E2E tests we have with a docker container, but are isolated to only Tabs. Meaning they're much faster and more reliable. Most tests for this feature are implemented in this way, except one to check that "all parts are connected" all the way through.

Performance fix

While working on this feature, I discovered that our performance has slightly degraded due to some uncached row-width calculation. I added a "width_cached" method to Row that significantly improved things.

@imsnif imsnif merged commit 821e7cb into main Feb 18, 2022
@har7an har7an deleted the scratch-term branch October 23, 2022 15:10
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.

None yet

1 participant