From 662a3155971fa6c1ff31d5bcc74dd872b8e4f1c2 Mon Sep 17 00:00:00 2001 From: apio Date: Fri, 29 Mar 2024 20:36:44 +0100 Subject: [PATCH] editor: Display only the basename of the current file in the window title --- editor/EditorWidget.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/editor/EditorWidget.cpp b/editor/EditorWidget.cpp index ad1b8ebc..833e7076 100644 --- a/editor/EditorWidget.cpp +++ b/editor/EditorWidget.cpp @@ -9,6 +9,7 @@ #include "EditorWidget.h" #include +#include #include #include #include @@ -42,7 +43,9 @@ Result EditorWidget::load_file(const os::Path& path) m_path = path; - String title = TRY(String::format("Text Editor - %s"_sv, m_path.name().chars())); + auto basename = TRY(PathParser::basename(m_path.name())); + + String title = TRY(String::format("Text Editor - %s"_sv, basename.chars())); window()->set_title(title.view()); TRY(recalculate_lines());