Skip to content

Commit

Permalink
fixed #8028 - ghost panes and missing pane drag handle
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugeny committed Mar 18, 2023
1 parent ceb9b3c commit ef3c9e3
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
8 changes: 8 additions & 0 deletions tabby-core/src/components/baseTab.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,14 @@ export abstract class BaseTabComponent extends BaseComponent {
this.viewContainer = undefined
}

get topmostParent (): BaseTabComponent|null {
let parent = this.parent
while (parent?.parent) {
parent = parent.parent
}
return parent
}

/**
* Called before the tab is closed
*/
Expand Down
14 changes: 10 additions & 4 deletions tabby-core/src/components/splitTab.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -458,12 +458,18 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit
tab.destroy()
}

let allTabs: BaseTabComponent[] = []
if (thing instanceof BaseTabComponent) {
if (thing.parent instanceof SplitTabComponent) {
thing.parent.removeTab(thing)
allTabs = [thing]
} else if (thing instanceof SplitContainer) {
allTabs = thing.getAllTabs()
}
for (const tab of allTabs) {
if (tab.parent instanceof SplitTabComponent) {
tab.parent.removeTab(tab)
}
thing.removeFromContainer()
thing.parent = this
tab.removeFromContainer()
tab.parent = this
}

let target = relative ? this.getParentOf(relative) : null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
padding: 5px 15px 5px 15px;
display: flex;
z-index: 3;
overflow: hidden;

::ng-deep .btn {
white-space: nowrap;
Expand Down
2 changes: 1 addition & 1 deletion tabby-terminal/src/components/terminalToolbar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class TerminalToolbarComponent {
}

get shouldShowDragHandle (): boolean {
return this.tab.parent instanceof SplitTabComponent && this.tab.parent.getAllTabs().length > 1
return this.tab.topmostParent instanceof SplitTabComponent && this.tab.topmostParent.getAllTabs().length > 1
}

@HostListener('mouseenter') onMouseEnter () {
Expand Down

0 comments on commit ef3c9e3

Please sign in to comment.