From ac43bb42cb12522a886e1b9eaa87d64ea6d4b7a5 Mon Sep 17 00:00:00 2001
From: Kubat <mael.martin31@gmail.com>
Date: Wed, 25 Aug 2021 09:52:40 +0200
Subject: [PATCH] UI: The ScriptDocumentView has the same background as the
 ScriptEditor to avoid ugly not colored squares

---
 src/UI/ScriptDocumentView.cc      | 7 +++++++
 src/UI/ScriptViews/EditorProxy.cc | 6 +++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/UI/ScriptDocumentView.cc b/src/UI/ScriptDocumentView.cc
index bd82c101..9fa80f5e 100644
--- a/src/UI/ScriptDocumentView.cc
+++ b/src/UI/ScriptDocumentView.cc
@@ -41,6 +41,13 @@ ScriptDocumentView::ScriptDocumentView(std::shared_ptr<ScriptDocument> ptr, QWid
     }
 
     connect(this, &ScriptDocumentView::luaErrorFound, editor, &ScriptEditor::updateLastLuaError);
+
+    // Same style as the editor
+    setStyleSheet(QStringLiteral("* {"
+                                 "  background-color: #232629;"
+                                 "  font-family: \"FiraCode\";"
+                                 "  font-size: 10pt"
+                                 "}"));
 }
 
 void
diff --git a/src/UI/ScriptViews/EditorProxy.cc b/src/UI/ScriptViews/EditorProxy.cc
index aca744c0..0f297eca 100644
--- a/src/UI/ScriptViews/EditorProxy.cc
+++ b/src/UI/ScriptViews/EditorProxy.cc
@@ -356,11 +356,11 @@ EditorProxy::save(const QString &fileName) noexcept
 void
 EditorProxy::cancel(const QString &fileName) noexcept
 {
-    if (hasChanges(fileName)) {
+    if (hasChanges(fileName))
         qCritical() << tr("File \"%1\" was changed").arg(fileName);
-    } else {
+
+    else
         invalidate();
-    }
 }
 
 void
-- 
GitLab