Removed replacing of whitespaces with dashes in tab name

This commit is contained in:
Abdelilah El Aissaoui 2023-04-19 23:15:52 +02:00
parent 4d32df5717
commit 6fab65cf2c
No known key found for this signature in database
GPG Key ID: 7587FC860F594869

View File

@ -100,7 +100,6 @@ fun RepositoriesTabPanel(
Tab( Tab(
title = tab.tabName, title = tab.tabName,
isSelected = currentTab == tab, isSelected = currentTab == tab,
isNewTab = tab.path == null,
onClick = { onClick = {
onTabSelected(tab) onTabSelected(tab)
}, },
@ -147,7 +146,6 @@ fun RepositoriesTabPanel(
fun Tab( fun Tab(
title: MutableState<String>, title: MutableState<String>,
isSelected: Boolean, isSelected: Boolean,
isNewTab: Boolean,
onClick: () -> Unit, onCloseTab: () -> Unit onClick: () -> Unit, onCloseTab: () -> Unit
) { ) {
val backgroundColor = if (isSelected) val backgroundColor = if (isSelected)
@ -157,18 +155,11 @@ fun Tab(
val hoverInteraction = remember { MutableInteractionSource() } val hoverInteraction = remember { MutableInteractionSource() }
val isHovered by hoverInteraction.collectIsHoveredAsState() val isHovered by hoverInteraction.collectIsHoveredAsState()
val tabTitle = if (isNewTab)
title.value
else
title.value.replace(
" ",
"-"
) // Long tab names with spaces make compose not taking full text width for the tab. More info https://issuetracker.google.com/issues/278044455
Box( Box(
modifier = Modifier modifier = Modifier
.widthIn(min = 200.dp) .widthIn(min = 200.dp)
.width(IntrinsicSize.Min) .width(IntrinsicSize.Max)
.fillMaxHeight() .fillMaxHeight()
.hoverable(hoverInteraction) .hoverable(hoverInteraction)
.handMouseClickable { onClick() } .handMouseClickable { onClick() }
@ -181,7 +172,7 @@ fun Tab(
horizontalArrangement = Arrangement.SpaceBetween, horizontalArrangement = Arrangement.SpaceBetween,
) { ) {
Text( Text(
text = tabTitle, text = title.value,
modifier = Modifier modifier = Modifier
.padding(start = 16.dp) .padding(start = 16.dp)
.weight(1f) .weight(1f)