summaryrefslogtreecommitdiff
path: root/Libraries/LibVT
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-05-17 20:31:49 +0200
committerAndreas Kling <kling@serenityos.org>2020-05-17 22:35:25 +0200
commit0d78ee95f95cd94ad6266645630eae2952ec2ffd (patch)
treef001070d633d9ea2c4dad99d1a17feebb5d7527b /Libraries/LibVT
parent86242f9c18103afa7364ef40a19dd27cf3c26f9e (diff)
downloadserenity-0d78ee95f95cd94ad6266645630eae2952ec2ffd.zip
LibVT: Make TerminalWidget::selected_text() produce UTF-8 strings :^)
Diffstat (limited to 'Libraries/LibVT')
-rw-r--r--Libraries/LibVT/TerminalWidget.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/Libraries/LibVT/TerminalWidget.cpp b/Libraries/LibVT/TerminalWidget.cpp
index 0c0c232101..97cb2c8544 100644
--- a/Libraries/LibVT/TerminalWidget.cpp
+++ b/Libraries/LibVT/TerminalWidget.cpp
@@ -30,6 +30,7 @@
#include <AK/StdLibExtras.h>
#include <AK/String.h>
#include <AK/StringBuilder.h>
+#include <AK/Utf32View.h>
#include <AK/Utf8View.h>
#include <Kernel/KeyCode.h>
#include <LibCore/ConfigFile.h>
@@ -739,7 +740,13 @@ String TerminalWidget::selected_text() const
builder.append('\n');
break;
}
- builder.append(line.codepoint(column));
+ // FIXME: This is a bit hackish.
+ if (line.is_utf32()) {
+ u32 codepoint = line.codepoint(column);
+ builder.append(Utf32View(&codepoint, 1));
+ } else {
+ builder.append(line.codepoint(column));
+ }
if (column == line.length() - 1 || (m_rectangle_selection && column == last_column)) {
builder.append('\n');
}