mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:57:34 +00:00
LibVT: Use NNOP<KString> to store window titles in the Kernel
This will allow us to eventually propagate allocation failure.
This commit is contained in:
parent
c8db8d6152
commit
5b572393a9
3 changed files with 24 additions and 3 deletions
|
@ -7,11 +7,14 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <AK/Noncopyable.h>
|
#include <AK/Noncopyable.h>
|
||||||
#include <AK/String.h>
|
|
||||||
#include <AK/Vector.h>
|
#include <AK/Vector.h>
|
||||||
#include <LibVT/Color.h>
|
#include <LibVT/Color.h>
|
||||||
#include <LibVT/XtermColors.h>
|
#include <LibVT/XtermColors.h>
|
||||||
|
|
||||||
|
#ifndef KERNEL
|
||||||
|
# include <AK/String.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace VT {
|
namespace VT {
|
||||||
|
|
||||||
struct Attribute {
|
struct Attribute {
|
||||||
|
|
|
@ -383,7 +383,11 @@ void Terminal::XTERM_WM(Parameters params)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dbgln_if(TERMINAL_DEBUG, "Title stack push: {}", m_current_window_title);
|
dbgln_if(TERMINAL_DEBUG, "Title stack push: {}", m_current_window_title);
|
||||||
[[maybe_unused]] auto rc = m_title_stack.try_append(move(m_current_window_title));
|
#ifdef KERNEL
|
||||||
|
(void)m_title_stack.try_append(m_current_window_title.release_nonnull()); // FIXME: Propagate Error
|
||||||
|
#else
|
||||||
|
(void)m_title_stack.try_append(move(m_current_window_title));
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 23: {
|
case 23: {
|
||||||
|
@ -395,7 +399,11 @@ void Terminal::XTERM_WM(Parameters params)
|
||||||
}
|
}
|
||||||
m_current_window_title = m_title_stack.take_last();
|
m_current_window_title = m_title_stack.take_last();
|
||||||
dbgln_if(TERMINAL_DEBUG, "Title stack pop: {}", m_current_window_title);
|
dbgln_if(TERMINAL_DEBUG, "Title stack pop: {}", m_current_window_title);
|
||||||
|
#ifdef KERNEL
|
||||||
|
m_client.set_window_title(m_current_window_title->view());
|
||||||
|
#else
|
||||||
m_client.set_window_title(m_current_window_title);
|
m_client.set_window_title(m_current_window_title);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -1280,8 +1288,13 @@ void Terminal::execute_osc_sequence(OscParameters parameters, u8 last_byte)
|
||||||
} else {
|
} else {
|
||||||
// FIXME: the split breaks titles containing semicolons.
|
// FIXME: the split breaks titles containing semicolons.
|
||||||
// Should we expose the raw OSC string from the parser? Or join by semicolon?
|
// Should we expose the raw OSC string from the parser? Or join by semicolon?
|
||||||
|
#ifdef KERNEL
|
||||||
|
m_current_window_title = Kernel::KString::try_create(stringview_ify(1)).release_value_but_fixme_should_propagate_errors();
|
||||||
|
m_client.set_window_title(m_current_window_title->view());
|
||||||
|
#else
|
||||||
m_current_window_title = stringview_ify(1).to_string();
|
m_current_window_title = stringview_ify(1).to_string();
|
||||||
m_client.set_window_title(m_current_window_title);
|
m_client.set_window_title(m_current_window_title);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
|
|
||||||
#include <AK/Noncopyable.h>
|
#include <AK/Noncopyable.h>
|
||||||
#include <AK/NonnullOwnPtrVector.h>
|
#include <AK/NonnullOwnPtrVector.h>
|
||||||
#include <AK/String.h>
|
|
||||||
#include <AK/Vector.h>
|
#include <AK/Vector.h>
|
||||||
#include <Kernel/API/KeyCode.h>
|
#include <Kernel/API/KeyCode.h>
|
||||||
#include <LibVT/CharacterSet.h>
|
#include <LibVT/CharacterSet.h>
|
||||||
|
@ -17,6 +16,7 @@
|
||||||
#include <LibVT/Position.h>
|
#include <LibVT/Position.h>
|
||||||
|
|
||||||
#ifndef KERNEL
|
#ifndef KERNEL
|
||||||
|
# include <AK/String.h>
|
||||||
# include <LibVT/Attribute.h>
|
# include <LibVT/Attribute.h>
|
||||||
# include <LibVT/Line.h>
|
# include <LibVT/Line.h>
|
||||||
#else
|
#else
|
||||||
|
@ -435,8 +435,13 @@ protected:
|
||||||
Attribute m_current_attribute;
|
Attribute m_current_attribute;
|
||||||
Attribute m_saved_attribute;
|
Attribute m_saved_attribute;
|
||||||
|
|
||||||
|
#ifdef KERNEL
|
||||||
|
OwnPtr<Kernel::KString> m_current_window_title;
|
||||||
|
NonnullOwnPtrVector<Kernel::KString> m_title_stack;
|
||||||
|
#else
|
||||||
String m_current_window_title;
|
String m_current_window_title;
|
||||||
Vector<String> m_title_stack;
|
Vector<String> m_title_stack;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef KERNEL
|
#ifndef KERNEL
|
||||||
u32 m_next_href_id { 0 };
|
u32 m_next_href_id { 0 };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue