From c60150da15c069297a093a28694665a058a9e05f Mon Sep 17 00:00:00 2001 From: Shannon Booth Date: Sat, 24 Jun 2023 13:08:47 +1200 Subject: [PATCH] HackStudio: Use StringView in DiffViewer::draw_line --- Userland/DevTools/HackStudio/Git/DiffViewer.cpp | 6 +++--- Userland/DevTools/HackStudio/Git/DiffViewer.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Userland/DevTools/HackStudio/Git/DiffViewer.cpp b/Userland/DevTools/HackStudio/Git/DiffViewer.cpp index 078289e0d5f..06d95bc2b73 100644 --- a/Userland/DevTools/HackStudio/Git/DiffViewer.cpp +++ b/Userland/DevTools/HackStudio/Git/DiffViewer.cpp @@ -48,7 +48,7 @@ void DiffViewer::paint_event(GUI::PaintEvent& event) left_y_offset += line_height(); } for (int i = 0; i < (int)hunk.added_lines.size() - (int)hunk.removed_lines.size(); ++i) { - draw_line(painter, "", left_y_offset, LinePosition::Left, LineType::Missing); + draw_line(painter, ""sv, left_y_offset, LinePosition::Left, LineType::Missing); left_y_offset += line_height(); } @@ -58,7 +58,7 @@ void DiffViewer::paint_event(GUI::PaintEvent& event) right_y_offset += line_height(); } for (int i = 0; i < (int)hunk.removed_lines.size() - (int)hunk.added_lines.size(); ++i) { - draw_line(painter, "", right_y_offset, LinePosition::Right, LineType::Missing); + draw_line(painter, ""sv, right_y_offset, LinePosition::Right, LineType::Missing); right_y_offset += line_height(); } @@ -71,7 +71,7 @@ void DiffViewer::paint_event(GUI::PaintEvent& event) } } -void DiffViewer::draw_line(GUI::Painter& painter, DeprecatedString const& line, size_t y_offset, LinePosition line_position, LineType line_type) +void DiffViewer::draw_line(GUI::Painter& painter, StringView line, size_t y_offset, LinePosition line_position, LineType line_type) { size_t line_width = font().width(line); diff --git a/Userland/DevTools/HackStudio/Git/DiffViewer.h b/Userland/DevTools/HackStudio/Git/DiffViewer.h index 337fb7650f3..24a9283373b 100644 --- a/Userland/DevTools/HackStudio/Git/DiffViewer.h +++ b/Userland/DevTools/HackStudio/Git/DiffViewer.h @@ -43,7 +43,7 @@ private: Missing, }; - void draw_line(GUI::Painter&, DeprecatedString const& line, size_t y_offset, LinePosition, LineType); + void draw_line(GUI::Painter&, StringView line, size_t y_offset, LinePosition, LineType); static Vector split_to_lines(DeprecatedString const& text);