Skip to content

Commit

Permalink
diffビューの横スクロールで、文字差分の表示が消える問題を修正
Browse files Browse the repository at this point in the history
  • Loading branch information
soramimi committed Aug 14, 2023
1 parent 0baa1b0 commit c821fde
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions src/FileDiffWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ void FileDiffWidget::setDiffText(Git::Diff const &diff, TextDiffLineList const &

ui->widget_diff_left->setText(&m->left_lines, mainwindow(), diff.blob.a_id_or_path, diff.path);
ui->widget_diff_right->setText(&m->right_lines, mainwindow(), diff.blob.b_id_or_path, diff.path);
refrectScrollBar(true);
refrectScrollBar();
ui->widget_diff_slider->clear(true);
}

Expand Down Expand Up @@ -719,7 +719,7 @@ void FileDiffWidget::updateDiffView(QString const &id_left, QString const &id_ri

void FileDiffWidget::resizeEvent(QResizeEvent *)
{
refrectScrollBar(true);
refrectScrollBar();
}

void FileDiffWidget::keyPressEvent(QKeyEvent *event)
Expand Down Expand Up @@ -809,11 +809,12 @@ void FileDiffWidget::onUpdateSliderBar()
* @brief スクロールバーの状態を反映
* @param updateformat
*/
void FileDiffWidget::refrectScrollBar(bool updateformat)
void FileDiffWidget::refrectScrollBar(/*bool updateformat*/)
{
ui->widget_diff_left->refrectScrollBar();
ui->widget_diff_right->refrectScrollBar();

const bool updateformat = true;
if (updateformat) {

// 左と右のテキストを取得
Expand Down Expand Up @@ -867,15 +868,15 @@ void FileDiffWidget::refrectScrollBar(bool updateformat)
*/
void FileDiffWidget::refrectScrollBarV()
{
refrectScrollBar(true);
refrectScrollBar();
}

/**
* @brief 横スクロールバーの状態を反映
*/
void FileDiffWidget::refrectScrollBarH()
{
refrectScrollBar(false);
refrectScrollBar();
}

QPixmap FileDiffWidget::makeDiffPixmap(DiffPane pane, int width, int height)
Expand All @@ -901,7 +902,7 @@ void FileDiffWidget::onMoved(int cur_row, int cur_col, int scr_row, int scr_col)
(void)cur_row;
ui->widget_diff_left->move(-1, -1, scr_row, scr_col, false);
ui->widget_diff_right->move(-1, -1, scr_row, scr_col, false);
refrectScrollBar(true);
refrectScrollBar();
onUpdateSliderBar();
}

Expand Down
2 changes: 1 addition & 1 deletion src/FileDiffWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class FileDiffWidget : public QWidget {

void makeSideBySideDiffData(const Git::Diff &diff, const std::vector<std::string> &original_lines, TextDiffLineList *left_lines, TextDiffLineList *right_lines);
void onUpdateSliderBar();
void refrectScrollBar(bool updateformat);
void refrectScrollBar();
void refrectScrollBarV();
void refrectScrollBarH();
void setOriginalLines_(QByteArray const &ba, const Git::SubmoduleItem *submodule, const Git::CommitItem *submodule_commit);
Expand Down

0 comments on commit c821fde

Please sign in to comment.