Fix panic when loading bad text in the GUI.

This commit is contained in:
2026-02-01 17:15:21 -05:00
parent 0fac2b71ab
commit a5bed9ed2c
5 changed files with 54 additions and 41 deletions

View File

@@ -153,12 +153,13 @@ SplitView {
id: areaConsole
height: 100
placeholderText: qsTr("Placeholder for bash terminal.")
width: parent.width
placeholderText: qsTr("shaun@pc:~/Code/clide$ ")
placeholderTextColor: "white"
readOnly: true
wrapMode: TextArea.Wrap
background: Rectangle {
color: RustColors.editor_background
color: RustColors.terminal_background
implicitHeight: 100
// border.color: control.enabled ? RustColors.active : RustColors.inactive
}

View File

@@ -45,22 +45,25 @@ SplitView {
ColumnLayout {
spacing: 2
// TODO: Make a ClideBreadCrumb element to support select parent paths as root
Rectangle {
width: navigationView.width
height: breadCrumb.height + 5
color: RustColors.explorer_text
height: 25
color: RustColors.explorer_background
Text {
id: breadCrumb
anchors.fill: parent
text: clideTreeView.rootDirectory
color: RustColors.explorer_text
elide: Text.ElideLeft
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
}
ClideTreeView {
id: clideTreeView
onFileClicked: path => root.projectDir = path
onFileClicked: path => clideEditor.filePath = path
width: navigationView.width
height: navigationView.height
@@ -70,6 +73,7 @@ SplitView {
}
}
ClideEditor {
id: clideEditor
SplitView.fillWidth: true
// Provide a path to the file currently open in the text editor.

View File

@@ -119,11 +119,10 @@ TreeView {
switch (button) {
case Qt.LeftButton:
fileSystemTreeView.toggleExpanded(treeDelegate.row)
fileSystemTreeView.lastIndex = treeDelegate.index
// If this model item doesn't have children, it means it's
// representing a file.
if (!treeDelegate.hasChildren)
root.fileClicked(treeDelegate.filePath)
fileSystemTreeView.fileClicked(treeDelegate.filePath)
break;
case Qt.RightButton:
if (treeDelegate.hasChildren)