Fix close tabbar item

pull/2/head
reionwong 4 years ago
parent ca444e5775
commit 3fbb98876c

@ -350,7 +350,7 @@ TerminalDisplay::TerminalDisplay(QQuickItem *parent)
,m_font("Monospace", 12)
,m_color_role(QPalette::Background)
,m_full_cursor_height(false)
,_leftBaseMargin(1)
,_leftBaseMargin(4)
,_topBaseMargin(1)
{
// terminal applications are not designed with Right-To-Left in mind,

@ -0,0 +1,103 @@
[Background]
Bold=false
Color=46, 46, 46
Transparency=false
[BackgroundIntense]
Bold=false
Color=0,0,0
Transparency=false
[Color0]
Bold=false
Color=0,0,0
Transparency=false
[Color0Intense]
Bold=false
Color=104,104,104
Transparency=false
[Color1]
Bold=false
Color=250,75,75
Transparency=false
[Color1Intense]
Bold=false
Color=255,84,84
Transparency=false
[Color2]
Bold=false
Color=24,178,24
Transparency=false
[Color2Intense]
Bold=false
Color=84,255,84
Transparency=false
[Color3]
Bold=false
Color=178,104,24
Transparency=false
[Color3Intense]
Bold=false
Color=255,255,84
Transparency=false
[Color4]
Bold=false
Color=92,167,251
Transparency=false
[Color4Intense]
Bold=false
Color=84,84,255
Transparency=false
[Color5]
Bold=false
Color=225,30,225
Transparency=false
[Color5Intense]
Bold=false
Color=255,84,255
Transparency=false
[Color6]
Bold=false
Color=24,178,178
Transparency=false
[Color6Intense]
Bold=false
Color=84,255,255
Transparency=false
[Color7]
Bold=false
Color=178,178,178
Transparency=false
[Color7Intense]
Bold=false
Color=255,255,255
Transparency=false
[Foreground]
Bold=false
Color=24,240,24
Transparency=false
[ForegroundIntense]
Bold=true
Color=24,240,24
Transparency=false
[General]
Description=Green on Black
Opacity=1

@ -0,0 +1,94 @@
[Background]
Color=243,244,249
[BackgroundIntense]
Color=255,255,255
[BackgroundFaint]
Color=255,255,255
[Color0]
Color=0,0,0
[Color0Intense]
Color=104,104,104
[Color0Faint]
Color=192,192,192
[Color1]
Color=178,24,24
[Color1Intense]
Color=255,84,84
[Color1Faint]
Color=224,142,142
[Color2]
Color=24,178,24
[Color2Intense]
Color=84,255,84
[Color2Faint]
Color=142,224,142
[Color3]
Color=178,104,24
[Color3Intense]
Color=255,255,84
[Color3Faint]
Color=224,224,142
[Color4]
Color=24,24,178
[Color4Intense]
Color=84,84,255
[Color4Faint]
Color=142,142,224
[Color5]
Color=178,24,178
[Color5Intense]
Color=255,84,255
[Color5Faint]
Color=224,142,224
[Color6]
Color=24,178,178
[Color6Intense]
Color=84,255,255
[Color6Faint]
Color=142,224,224
[Color7]
Color=178,178,178
[Color7Intense]
Color=255,255,255
[Color7Faint]
Color=142,142,142
[Foreground]
Color=0,0,0
[ForegroundIntense]
Bold=true
Color=0,0,0
[ForegroundFaint]
Color=0,0,0
[General]
Description=Black on White
Opacity=1

@ -89,7 +89,7 @@ Page {
QMLTermWidget {
id: _terminal
anchors.fill: parent
colorScheme: "GreenOnBlack"
colorScheme: FishUI.Theme.darkMode ? "Cutefish-Dark" : "Cutefish-Light"
font.family: "Noto Sans Mono"
font.pointSize: settings.fontPointSize
blinkingCursor: settings.blinkingCursor

@ -34,8 +34,9 @@ FishUI.Window {
height: settings.height
title: currentItem && currentItem.terminal ? currentItem.terminal.session.title : ""
header.height: 46
header.height: 45
property int currentIndex: -1
property alias currentItem: _view.currentItem
readonly property QMLTermWidget currentTerminal: currentItem.terminal
@ -89,7 +90,7 @@ FishUI.Window {
delegate: Item {
id: _tabItem
height: _tabView.height
height: root.header.height - FishUI.Units.largeSpacing
width: Math.min(_layout.implicitWidth + FishUI.Units.largeSpacing,
_tabView.width / _tabView.count - FishUI.Units.smallSpacing)
@ -113,8 +114,8 @@ FishUI.Window {
RowLayout {
id: _layout
anchors.fill: parent
anchors.margins: FishUI.Units.smallSpacing
anchors.rightMargin: FishUI.Units.smallSpacing / 2
anchors.leftMargin: FishUI.Units.smallSpacing
anchors.rightMargin: FishUI.Units.smallSpacing
spacing: 0
Label {
@ -170,7 +171,10 @@ FishUI.Window {
highlightMoveVelocity: -1
highlightResizeVelocity: -1
onMovementEnded: _view.currentIndex = indexAt(contentX, contentY)
onCurrentItemChanged: currentItem.forceActiveFocus()
onCurrentItemChanged: {
if (currentItem)
currentItem.forceActiveFocus()
}
interactive: false
}
@ -203,7 +207,17 @@ FishUI.Window {
function closeTab(index) {
tabsModel.remove(index)
if (tabsModel.count == 0) Qt.quit()
if (index === tabsModel.count) {
_view.currentIndex = tabsModel.count - 1
} else if (index === _view.currentIndex) {
// Reion: Need to reset index.
_view.currentIndex = -1
_view.currentIndex = index
}
if (tabsModel.count == 0)
Qt.quit()
}
function closeCurrentTab() {

Loading…
Cancel
Save