fixed the color and title settings not getting inherited from profile defaults - fixes #5395

This commit is contained in:
Eugene Pankov 2022-01-30 20:03:57 +01:00
parent 6289229bf2
commit eb0fa29fad
No known key found for this signature in database
GPG Key ID: 5896FCBBDD1CF4F4
3 changed files with 18 additions and 5 deletions

View File

@ -47,7 +47,9 @@ export abstract class BaseTabComponent extends BaseComponent {
/**
* CSS color override for the tab's header
*/
color: string|null = null
get color (): string|null { return this._color }
set color (value: string|null) { this._color = value }
private _color: string|null = null
hasFocus = false

View File

@ -629,6 +629,16 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit
super.clearActivity()
}
get color (): string|null {
return this.getFocusedTab()?.color ?? null
}
set color (color: string|null) {
for (const t of this.getAllTabs()) {
t.color = color
}
}
private updateTitle (): void {
this.setTitle(this.getAllTabs().map(x => x.title).join(' | '))
}

View File

@ -37,9 +37,7 @@ export class ProfilesService {
async openNewTabForProfile <P extends Profile> (profile: PartialProfile<P>): Promise<BaseTabComponent|null> {
const params = await this.newTabParametersForProfile(profile)
if (params) {
const tab = this.app.openNewTab(params)
;(this.app.getParentTab(tab) ?? tab).color = profile.color ?? null
return tab
return this.app.openNewTab(params)
}
return null
}
@ -50,9 +48,12 @@ export class ProfilesService {
if (params) {
params.inputs ??= {}
params.inputs['title'] = profile.name
if (profile.disableDynamicTitle) {
if (fullProfile.disableDynamicTitle) {
params.inputs['disableDynamicTitle'] = true
}
if (fullProfile.color) {
params.inputs['color'] = fullProfile.color
}
}
return params
}