forked from qt-creator/qt-creator
DiffEditor: Use DiffSide enum inside ChunkSelection
Change-Id: If23b0f46856eebec96624e58b6ad90b1b3e8be23 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -74,8 +74,8 @@ ChunkData DiffEditorDocument::filterChunk(const ChunkData &data,
|
||||
chunk.rows.clear();
|
||||
for (int i = 0; i < data.rows.count(); ++i) {
|
||||
RowData row = data.rows[i];
|
||||
const bool isLeftSelected = selection.leftSelection.contains(i);
|
||||
const bool isRightSelected = selection.rightSelection.contains(i);
|
||||
const bool isLeftSelected = selection.selection[LeftSide].contains(i);
|
||||
const bool isRightSelected = selection.selection[RightSide].contains(i);
|
||||
|
||||
if (isLeftSelected || isRightSelected) {
|
||||
if (row.equal || (isLeftSelected && isRightSelected)) {
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace DiffEditor {
|
||||
|
||||
int ChunkSelection::selectedRowsCount() const
|
||||
{
|
||||
return Utils::toSet(leftSelection).unite(Utils::toSet(rightSelection)).size();
|
||||
return Utils::toSet(selection[LeftSide]).unite(Utils::toSet(selection[RightSide])).size();
|
||||
}
|
||||
|
||||
static QList<TextLineData> assemblyRows(const QList<TextLineData> &lines,
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "diffeditor_global.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/filepath.h>
|
||||
|
||||
#include <QMap>
|
||||
@@ -83,11 +84,10 @@ class DIFFEDITOR_EXPORT ChunkSelection {
|
||||
public:
|
||||
ChunkSelection() = default;
|
||||
ChunkSelection(const QList<int> &left, const QList<int> &right)
|
||||
: leftSelection(left), rightSelection(right) {}
|
||||
bool isNull() const { return leftSelection.isEmpty() && rightSelection.isEmpty(); }
|
||||
: selection({left, right}) {}
|
||||
bool isNull() const { return Utils::allOf(selection, &QList<int>::isEmpty); }
|
||||
int selectedRowsCount() const;
|
||||
QList<int> leftSelection;
|
||||
QList<int> rightSelection;
|
||||
std::array<QList<int>, SideCount> selection{};
|
||||
};
|
||||
|
||||
class DIFFEDITOR_EXPORT FileData {
|
||||
|
||||
Reference in New Issue
Block a user