mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:47:35 +00:00
Everywhere: Run clang-format
This commit is contained in:
parent
0376c127f6
commit
086969277e
1665 changed files with 8479 additions and 8479 deletions
|
@ -35,7 +35,7 @@ void DiffViewer::paint_event(GUI::PaintEvent& event)
|
|||
|
||||
size_t y_offset = 10;
|
||||
size_t current_original_line_index = 0;
|
||||
for (const auto& hunk : m_hunks) {
|
||||
for (auto const& hunk : m_hunks) {
|
||||
for (size_t i = current_original_line_index; i < hunk.original_start_line; ++i) {
|
||||
draw_line(painter, m_original_lines[i], y_offset, LinePosition::Both, LineType::Normal);
|
||||
y_offset += line_height();
|
||||
|
@ -43,7 +43,7 @@ void DiffViewer::paint_event(GUI::PaintEvent& event)
|
|||
current_original_line_index = hunk.original_start_line + hunk.removed_lines.size();
|
||||
|
||||
size_t left_y_offset = y_offset;
|
||||
for (const auto& removed_line : hunk.removed_lines) {
|
||||
for (auto const& removed_line : hunk.removed_lines) {
|
||||
draw_line(painter, removed_line, left_y_offset, LinePosition::Left, LineType::Diff);
|
||||
left_y_offset += line_height();
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ void DiffViewer::paint_event(GUI::PaintEvent& event)
|
|||
}
|
||||
|
||||
size_t right_y_offset = y_offset;
|
||||
for (const auto& added_line : hunk.added_lines) {
|
||||
for (auto const& added_line : hunk.added_lines) {
|
||||
draw_line(painter, added_line, right_y_offset, LinePosition::Right, LineType::Diff);
|
||||
right_y_offset += line_height();
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ void DiffViewer::paint_event(GUI::PaintEvent& event)
|
|||
}
|
||||
}
|
||||
|
||||
void DiffViewer::draw_line(GUI::Painter& painter, const String& line, size_t y_offset, LinePosition line_position, LineType line_type)
|
||||
void DiffViewer::draw_line(GUI::Painter& painter, String const& line, size_t y_offset, LinePosition line_position, LineType line_type)
|
||||
{
|
||||
size_t line_width = font().width(line);
|
||||
|
||||
|
@ -131,7 +131,7 @@ Gfx::IntRect DiffViewer::separator_rect() const
|
|||
frame_inner_rect().height() };
|
||||
}
|
||||
|
||||
void DiffViewer::set_content(const String& original, const String& diff)
|
||||
void DiffViewer::set_content(String const& original, String const& diff)
|
||||
{
|
||||
m_original_lines = split_to_lines(original);
|
||||
m_hunks = Diff::parse_hunks(diff);
|
||||
|
@ -147,7 +147,7 @@ DiffViewer::DiffViewer()
|
|||
setup_properties();
|
||||
}
|
||||
|
||||
DiffViewer::DiffViewer(const String& original, const String& diff)
|
||||
DiffViewer::DiffViewer(String const& original, String const& diff)
|
||||
: m_original_lines(split_to_lines(original))
|
||||
, m_hunks(Diff::parse_hunks(diff))
|
||||
{
|
||||
|
@ -161,7 +161,7 @@ void DiffViewer::setup_properties()
|
|||
set_foreground_role(ColorRole::BaseText);
|
||||
}
|
||||
|
||||
Vector<String> DiffViewer::split_to_lines(const String& text)
|
||||
Vector<String> DiffViewer::split_to_lines(String const& text)
|
||||
{
|
||||
// NOTE: This is slightly different than text.split('\n')
|
||||
Vector<String> lines;
|
||||
|
@ -204,7 +204,7 @@ void DiffViewer::update_content_size()
|
|||
|
||||
size_t num_lines = 0;
|
||||
size_t current_original_line_index = 0;
|
||||
for (const auto& hunk : m_hunks) {
|
||||
for (auto const& hunk : m_hunks) {
|
||||
num_lines += ((int)hunk.original_start_line - (int)current_original_line_index);
|
||||
|
||||
num_lines += hunk.removed_lines.size();
|
||||
|
|
|
@ -18,10 +18,10 @@ class DiffViewer final : public GUI::AbstractScrollableWidget {
|
|||
public:
|
||||
virtual ~DiffViewer() override = default;
|
||||
|
||||
void set_content(const String& original, const String& diff);
|
||||
void set_content(String const& original, String const& diff);
|
||||
|
||||
private:
|
||||
DiffViewer(const String& original, const String& diff);
|
||||
DiffViewer(String const& original, String const& diff);
|
||||
DiffViewer();
|
||||
|
||||
void setup_properties();
|
||||
|
@ -43,9 +43,9 @@ private:
|
|||
Missing,
|
||||
};
|
||||
|
||||
void draw_line(GUI::Painter&, const String& line, size_t y_offset, LinePosition, LineType);
|
||||
void draw_line(GUI::Painter&, String const& line, size_t y_offset, LinePosition, LineType);
|
||||
|
||||
static Vector<String> split_to_lines(const String& text);
|
||||
static Vector<String> split_to_lines(String const& text);
|
||||
|
||||
static Gfx::Color red_background();
|
||||
static Gfx::Color green_background();
|
||||
|
|
|
@ -167,8 +167,8 @@ void GitWidget::show_diff(String const& file_path)
|
|||
m_view_diff_callback("", Diff::generate_only_additions(content_string));
|
||||
return;
|
||||
}
|
||||
const auto& original_content = m_git_repo->original_file_content(file_path);
|
||||
const auto& diff = m_git_repo->unstaged_diff(file_path);
|
||||
auto const& original_content = m_git_repo->original_file_content(file_path);
|
||||
auto const& diff = m_git_repo->unstaged_diff(file_path);
|
||||
VERIFY(original_content.has_value() && diff.has_value());
|
||||
m_view_diff_callback(original_content.value(), diff.value());
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
namespace HackStudio {
|
||||
|
||||
using ViewDiffCallback = Function<void(const String& original_content, const String& diff)>;
|
||||
using ViewDiffCallback = Function<void(String const& original_content, String const& diff)>;
|
||||
|
||||
class GitWidget final : public GUI::Widget {
|
||||
C_OBJECT(GitWidget)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue