editor: Display only the basename of the current file in the window title

This commit is contained in:
apio 2024-03-29 20:36:44 +01:00
parent ec44213f4e
commit d6f7069589
Signed by: apio
GPG Key ID: B8A7D06E42258954

View File

@ -9,6 +9,7 @@
#include "EditorWidget.h"
#include <ctype.h>
#include <luna/PathParser.h>
#include <luna/Utf8.h>
#include <os/File.h>
#include <os/FileSystem.h>
@ -42,7 +43,9 @@ Result<void> 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());