aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/modules/git/GitPage.qml
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/modules/git/GitPage.qml')
-rw-r--r--desktop/modules/git/GitPage.qml27
1 files changed, 26 insertions, 1 deletions
diff --git a/desktop/modules/git/GitPage.qml b/desktop/modules/git/GitPage.qml
index c1bffb5..c91f050 100644
--- a/desktop/modules/git/GitPage.qml
+++ b/desktop/modules/git/GitPage.qml
@@ -31,6 +31,7 @@ Column {
// write because the value did not change.
property var errors: ({})
property bool busy: false
+ property string loadError: ""
// The module, which outlives the page: a write in flight finishes even if
// the page is closed. Not named `gm`, the module's id (it would bind to itself).
required property QtObject owner
@@ -58,7 +59,10 @@ Column {
function load() {
page.run([page.ctl, "list"], out => {
- page.entries = G.parse(out);
+ // gitcfg reports a file git cannot parse as one error= line;
+ // without it the page would draw an empty config.
+ page.loadError = out.startsWith("error=") ? out.slice(6).trim() : "";
+ page.entries = page.loadError ? [] : G.parse(out);
page.busy = false;
});
}
@@ -85,6 +89,15 @@ Column {
onClicked: Quickshell.execDetached(["sublime_text", Quickshell.env("HOME") + "/.gitconfig"])
}
+ Text {
+ width: parent.width
+ visible: page.loadError !== ""
+ text: page.loadError
+ wrapMode: Text.Wrap
+ color: Theme.red
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 4 }
+ }
+
Repeater {
model: page.entries
@@ -200,6 +213,12 @@ Column {
selectByMouse: true
color: Theme.text
font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2 }
+ // Typed text is cleared first, as a row's edit is undone;
+ // an empty field lets Escape through, to leave the page.
+ Keys.onEscapePressed: event => {
+ if (text !== "") text = "";
+ else event.accepted = false;
+ }
Text {
anchors.verticalCenter: parent.verticalCenter
visible: parent.text === ""
@@ -223,6 +242,12 @@ Column {
selectByMouse: true
color: Theme.text
font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2 }
+ // Typed text is cleared first, as a row's edit is undone;
+ // an empty field lets Escape through, to leave the page.
+ Keys.onEscapePressed: event => {
+ if (text !== "") text = "";
+ else event.accepted = false;
+ }
onAccepted: if (addBtn.enabled) addBtn.clicked()
Text {
anchors.verticalCenter: parent.verticalCenter