diffstalker 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dependency-cruiser.cjs +67 -0
- package/.githooks/pre-commit +2 -0
- package/.githooks/pre-push +15 -0
- package/.github/workflows/release.yml +8 -0
- package/README.md +43 -35
- package/bun.lock +82 -3
- package/dist/App.js +555 -552
- package/dist/FollowMode.js +85 -0
- package/dist/KeyBindings.js +228 -0
- package/dist/MouseHandlers.js +192 -0
- package/dist/core/ExplorerStateManager.js +423 -78
- package/dist/core/GitStateManager.js +260 -119
- package/dist/git/diff.js +102 -17
- package/dist/git/status.js +16 -54
- package/dist/git/test-helpers.js +67 -0
- package/dist/index.js +60 -53
- package/dist/ipc/CommandClient.js +6 -7
- package/dist/state/UIState.js +39 -4
- package/dist/ui/PaneRenderers.js +76 -0
- package/dist/ui/modals/FileFinder.js +193 -0
- package/dist/ui/modals/HotkeysModal.js +12 -3
- package/dist/ui/modals/ThemePicker.js +1 -2
- package/dist/ui/widgets/CommitPanel.js +1 -1
- package/dist/ui/widgets/CompareListView.js +123 -80
- package/dist/ui/widgets/DiffView.js +228 -180
- package/dist/ui/widgets/ExplorerContent.js +15 -28
- package/dist/ui/widgets/ExplorerView.js +148 -43
- package/dist/ui/widgets/FileList.js +62 -95
- package/dist/ui/widgets/FlatFileList.js +65 -0
- package/dist/ui/widgets/Footer.js +25 -11
- package/dist/ui/widgets/Header.js +17 -52
- package/dist/ui/widgets/fileRowFormatters.js +73 -0
- package/dist/utils/ansiTruncate.js +0 -1
- package/dist/utils/displayRows.js +101 -21
- package/dist/utils/fileCategories.js +37 -0
- package/dist/utils/fileTree.js +148 -0
- package/dist/utils/flatFileList.js +67 -0
- package/dist/utils/layoutCalculations.js +5 -3
- package/eslint.metrics.js +15 -0
- package/metrics/.gitkeep +0 -0
- package/metrics/v0.2.1.json +268 -0
- package/metrics/v0.2.2.json +229 -0
- package/package.json +9 -2
- package/dist/utils/ansiToBlessed.js +0 -125
- package/dist/utils/mouseCoordinates.js +0 -165
- package/dist/utils/rowCalculations.js +0 -246
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import { categorizeFiles } from './fileCategories.js';
|
|
2
|
-
/**
|
|
3
|
-
* Calculate the row boundaries for each pane in the layout.
|
|
4
|
-
* Layout: Header (headerHeight) + sep (1) + top pane + sep (1) + bottom pane + sep (1) + footer (1)
|
|
5
|
-
*/
|
|
6
|
-
export function calculatePaneBoundaries(topPaneHeight, bottomPaneHeight, terminalHeight, headerHeight = 1) {
|
|
7
|
-
// Layout (1-indexed rows):
|
|
8
|
-
// Rows 1 to headerHeight: Header
|
|
9
|
-
// Row headerHeight+1: Separator
|
|
10
|
-
// Row headerHeight+2: Top pane header ("STAGING AREA" or "COMMITS")
|
|
11
|
-
// Rows headerHeight+3 to headerHeight+1+topPaneHeight: Top pane content
|
|
12
|
-
const stagingPaneStart = headerHeight + 2; // First row of top pane (the header row)
|
|
13
|
-
const fileListEnd = headerHeight + 1 + topPaneHeight; // Last row of top pane
|
|
14
|
-
const separatorRow = fileListEnd + 1; // Separator between panes
|
|
15
|
-
const diffPaneStart = fileListEnd + 2; // First row of bottom pane content
|
|
16
|
-
const diffPaneEnd = diffPaneStart + bottomPaneHeight - 1;
|
|
17
|
-
const footerRow = terminalHeight;
|
|
18
|
-
return {
|
|
19
|
-
stagingPaneStart,
|
|
20
|
-
fileListEnd,
|
|
21
|
-
separatorRow,
|
|
22
|
-
diffPaneStart,
|
|
23
|
-
diffPaneEnd,
|
|
24
|
-
footerRow,
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Given a y-coordinate in the file list area, calculate which file index was clicked.
|
|
29
|
-
* Returns -1 if the click is not on a file.
|
|
30
|
-
*
|
|
31
|
-
* FileList layout: Modified → Untracked → Staged (with headers and spacers)
|
|
32
|
-
*/
|
|
33
|
-
export function getClickedFileIndex(y, scrollOffset, files, stagingPaneStart, fileListEnd) {
|
|
34
|
-
if (y < stagingPaneStart + 1 || y > fileListEnd)
|
|
35
|
-
return -1;
|
|
36
|
-
// Calculate which row in the list was clicked (0-indexed)
|
|
37
|
-
// Use stagingPaneStart + 1 to account for the "STAGING AREA" header row
|
|
38
|
-
const listRow = y - (stagingPaneStart + 1) + scrollOffset;
|
|
39
|
-
// Split files into 3 categories (same order as FileList)
|
|
40
|
-
const { modified: modifiedFiles, untracked: untrackedFiles, staged: stagedFiles, } = categorizeFiles(files);
|
|
41
|
-
// Build row map (same structure as FileList builds)
|
|
42
|
-
// Each section: header (1) + files (n)
|
|
43
|
-
// Spacer (1) between sections if previous section exists
|
|
44
|
-
let currentRow = 0;
|
|
45
|
-
let currentFileIndex = 0;
|
|
46
|
-
// Modified section
|
|
47
|
-
if (modifiedFiles.length > 0) {
|
|
48
|
-
currentRow++; // "Modified:" header
|
|
49
|
-
for (let i = 0; i < modifiedFiles.length; i++) {
|
|
50
|
-
if (listRow === currentRow) {
|
|
51
|
-
return currentFileIndex;
|
|
52
|
-
}
|
|
53
|
-
currentRow++;
|
|
54
|
-
currentFileIndex++;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
// Untracked section
|
|
58
|
-
if (untrackedFiles.length > 0) {
|
|
59
|
-
if (modifiedFiles.length > 0) {
|
|
60
|
-
currentRow++; // spacer
|
|
61
|
-
}
|
|
62
|
-
currentRow++; // "Untracked:" header
|
|
63
|
-
for (let i = 0; i < untrackedFiles.length; i++) {
|
|
64
|
-
if (listRow === currentRow) {
|
|
65
|
-
return currentFileIndex;
|
|
66
|
-
}
|
|
67
|
-
currentRow++;
|
|
68
|
-
currentFileIndex++;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
// Staged section
|
|
72
|
-
if (stagedFiles.length > 0) {
|
|
73
|
-
if (modifiedFiles.length > 0 || untrackedFiles.length > 0) {
|
|
74
|
-
currentRow++; // spacer
|
|
75
|
-
}
|
|
76
|
-
currentRow++; // "Staged:" header
|
|
77
|
-
for (let i = 0; i < stagedFiles.length; i++) {
|
|
78
|
-
if (listRow === currentRow) {
|
|
79
|
-
return currentFileIndex;
|
|
80
|
-
}
|
|
81
|
-
currentRow++;
|
|
82
|
-
currentFileIndex++;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return -1;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Calculate the x-coordinate boundaries for each tab in the footer.
|
|
89
|
-
* Tab layout (right-aligned): [1]Diff [2]Commit [3]History [4]Compare [5]Explorer (51 chars total)
|
|
90
|
-
*/
|
|
91
|
-
export function getTabBoundaries(terminalWidth) {
|
|
92
|
-
const tabsStart = terminalWidth - 51; // 1-indexed start of tabs section
|
|
93
|
-
return {
|
|
94
|
-
diffStart: tabsStart,
|
|
95
|
-
diffEnd: tabsStart + 6,
|
|
96
|
-
commitStart: tabsStart + 8,
|
|
97
|
-
commitEnd: tabsStart + 16,
|
|
98
|
-
historyStart: tabsStart + 18,
|
|
99
|
-
historyEnd: tabsStart + 27,
|
|
100
|
-
compareStart: tabsStart + 29,
|
|
101
|
-
compareEnd: tabsStart + 38,
|
|
102
|
-
explorerStart: tabsStart + 40,
|
|
103
|
-
explorerEnd: tabsStart + 50,
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Given an x-coordinate in the footer row, determine which tab was clicked.
|
|
108
|
-
* Returns null if no tab was clicked.
|
|
109
|
-
*/
|
|
110
|
-
export function getClickedTab(x, terminalWidth) {
|
|
111
|
-
const bounds = getTabBoundaries(terminalWidth);
|
|
112
|
-
if (x >= bounds.diffStart && x <= bounds.diffEnd) {
|
|
113
|
-
return 'diff';
|
|
114
|
-
}
|
|
115
|
-
else if (x >= bounds.commitStart && x <= bounds.commitEnd) {
|
|
116
|
-
return 'commit';
|
|
117
|
-
}
|
|
118
|
-
else if (x >= bounds.historyStart && x <= bounds.historyEnd) {
|
|
119
|
-
return 'history';
|
|
120
|
-
}
|
|
121
|
-
else if (x >= bounds.compareStart && x <= bounds.compareEnd) {
|
|
122
|
-
return 'compare';
|
|
123
|
-
}
|
|
124
|
-
else if (x >= bounds.explorerStart && x <= bounds.explorerEnd) {
|
|
125
|
-
return 'explorer';
|
|
126
|
-
}
|
|
127
|
-
return null;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Check if a click is in the file button area (first 6 columns for stage/unstage toggle).
|
|
131
|
-
*/
|
|
132
|
-
export function isButtonAreaClick(x) {
|
|
133
|
-
return x <= 6;
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Check if a y-coordinate is within a given pane.
|
|
137
|
-
*/
|
|
138
|
-
export function isInPane(y, paneStart, paneEnd) {
|
|
139
|
-
return y >= paneStart && y <= paneEnd;
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Given an x-coordinate in the footer row, determine which left indicator was clicked.
|
|
143
|
-
* Layout (scroll mode): "? [scroll] [auto] [wrap]"
|
|
144
|
-
* 1 3 10 12 17 19 24
|
|
145
|
-
* (In select mode, mouse tracking is disabled so clicks don't register)
|
|
146
|
-
*/
|
|
147
|
-
export function getFooterLeftClick(x) {
|
|
148
|
-
// "?" area: column 1
|
|
149
|
-
if (x === 1) {
|
|
150
|
-
return 'hotkeys';
|
|
151
|
-
}
|
|
152
|
-
// "[scroll]" or "[select]" area: columns 3-10
|
|
153
|
-
if (x >= 3 && x <= 10) {
|
|
154
|
-
return 'mouse-mode';
|
|
155
|
-
}
|
|
156
|
-
// "[auto]" area: columns 12-17
|
|
157
|
-
if (x >= 12 && x <= 17) {
|
|
158
|
-
return 'auto-tab';
|
|
159
|
-
}
|
|
160
|
-
// "[wrap]" area: columns 19-24
|
|
161
|
-
if (x >= 19 && x <= 24) {
|
|
162
|
-
return 'wrap';
|
|
163
|
-
}
|
|
164
|
-
return null;
|
|
165
|
-
}
|
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
import { isDisplayableDiffLine } from './diffFilters.js';
|
|
2
|
-
import { formatDateAbsolute } from './formatDate.js';
|
|
3
|
-
import { getDiffTotalRows, getDiffLineRowCount } from './diffRowCalculations.js';
|
|
4
|
-
// ============================================================================
|
|
5
|
-
// History View Row Calculations
|
|
6
|
-
// ============================================================================
|
|
7
|
-
/**
|
|
8
|
-
* Map a visual row index to the commit index in HistoryView.
|
|
9
|
-
* Since each commit takes 1 row, this is simply visualRow + scrollOffset.
|
|
10
|
-
*/
|
|
11
|
-
export function getCommitIndexFromRow(visualRow, commits, _terminalWidth, scrollOffset = 0) {
|
|
12
|
-
const index = visualRow + scrollOffset;
|
|
13
|
-
if (index < 0 || index >= commits.length) {
|
|
14
|
-
return -1;
|
|
15
|
-
}
|
|
16
|
-
return index;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Get the total number of visual rows for all commits in HistoryView.
|
|
20
|
-
* Since each commit takes 1 row, this equals commits.length.
|
|
21
|
-
*/
|
|
22
|
-
export function getHistoryTotalRows(commits, _terminalWidth) {
|
|
23
|
-
return commits.length;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Get the visual row offset for a given commit index in HistoryView.
|
|
27
|
-
* Since each commit takes 1 row, this equals commitIndex.
|
|
28
|
-
*/
|
|
29
|
-
export function getHistoryRowOffset(_commits, commitIndex, _terminalWidth) {
|
|
30
|
-
return commitIndex;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Build all displayable rows for the history diff view.
|
|
34
|
-
* This includes commit metadata, message, and diff lines.
|
|
35
|
-
* Single source of truth for both rendering and row counting.
|
|
36
|
-
*/
|
|
37
|
-
export function buildHistoryDiffRows(commit, diff) {
|
|
38
|
-
const rows = [];
|
|
39
|
-
if (commit) {
|
|
40
|
-
// Commit header: hash, author, date
|
|
41
|
-
rows.push({
|
|
42
|
-
type: 'commit-header',
|
|
43
|
-
content: `commit ${commit.hash}`,
|
|
44
|
-
});
|
|
45
|
-
rows.push({
|
|
46
|
-
type: 'commit-header',
|
|
47
|
-
content: `Author: ${commit.author}`,
|
|
48
|
-
});
|
|
49
|
-
rows.push({
|
|
50
|
-
type: 'commit-header',
|
|
51
|
-
content: `Date: ${formatDateAbsolute(commit.date)}`,
|
|
52
|
-
});
|
|
53
|
-
// Blank line before message
|
|
54
|
-
rows.push({ type: 'spacer' });
|
|
55
|
-
// Commit message (can be multi-line)
|
|
56
|
-
const messageLines = commit.message.split('\n');
|
|
57
|
-
for (const line of messageLines) {
|
|
58
|
-
rows.push({
|
|
59
|
-
type: 'commit-message',
|
|
60
|
-
content: ` ${line}`,
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
// Blank line after message, before diff
|
|
64
|
-
rows.push({ type: 'spacer' });
|
|
65
|
-
}
|
|
66
|
-
// Diff lines (filter same as DiffView)
|
|
67
|
-
if (diff) {
|
|
68
|
-
for (const line of diff.lines) {
|
|
69
|
-
if (isDisplayableDiffLine(line)) {
|
|
70
|
-
rows.push({ type: 'diff-line', diffLine: line });
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return rows;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Get the visual row count for a single HistoryDiffRow.
|
|
78
|
-
* Headers, spacers, and commit messages are always 1 row.
|
|
79
|
-
* Diff lines may wrap based on terminal width.
|
|
80
|
-
*/
|
|
81
|
-
export function getHistoryDiffRowHeight(row, lineNumWidth, terminalWidth) {
|
|
82
|
-
if (row.type !== 'diff-line' || !row.diffLine) {
|
|
83
|
-
return 1; // Headers, spacers, commit messages don't wrap
|
|
84
|
-
}
|
|
85
|
-
return getDiffLineRowCount(row.diffLine, lineNumWidth, terminalWidth);
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Get total displayable rows for history diff scroll calculation.
|
|
89
|
-
* Uses getDiffTotalRows for the diff portion to account for line wrapping.
|
|
90
|
-
*/
|
|
91
|
-
export function getHistoryDiffTotalRows(commit, diff, terminalWidth) {
|
|
92
|
-
// Count header rows (these don't wrap - they're short metadata)
|
|
93
|
-
let headerRows = 0;
|
|
94
|
-
if (commit) {
|
|
95
|
-
headerRows += 3; // hash, author, date
|
|
96
|
-
headerRows += 1; // spacer before message
|
|
97
|
-
headerRows += commit.message.split('\n').length; // message lines
|
|
98
|
-
headerRows += 1; // spacer after message
|
|
99
|
-
}
|
|
100
|
-
// Use getDiffTotalRows for diff portion (handles line wrapping)
|
|
101
|
-
const diffRows = getDiffTotalRows(diff, terminalWidth);
|
|
102
|
-
return headerRows + diffRows;
|
|
103
|
-
}
|
|
104
|
-
// ============================================================================
|
|
105
|
-
// Compare View Row Calculations
|
|
106
|
-
// ============================================================================
|
|
107
|
-
/**
|
|
108
|
-
* Build a combined DiffResult from all compare files.
|
|
109
|
-
* This is the single source of truth for compare diff content.
|
|
110
|
-
*/
|
|
111
|
-
export function buildCombinedCompareDiff(compareDiff) {
|
|
112
|
-
if (!compareDiff || compareDiff.files.length === 0) {
|
|
113
|
-
return { raw: '', lines: [] };
|
|
114
|
-
}
|
|
115
|
-
const allLines = [];
|
|
116
|
-
const rawParts = [];
|
|
117
|
-
for (const file of compareDiff.files) {
|
|
118
|
-
// Include all lines from each file's diff (including headers)
|
|
119
|
-
for (const line of file.diff.lines) {
|
|
120
|
-
allLines.push(line);
|
|
121
|
-
}
|
|
122
|
-
rawParts.push(file.diff.raw);
|
|
123
|
-
}
|
|
124
|
-
return {
|
|
125
|
-
raw: rawParts.join('\n'),
|
|
126
|
-
lines: allLines,
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Calculate the total number of displayable lines in the compare diff.
|
|
131
|
-
* This accounts for header filtering done by DiffView.
|
|
132
|
-
*/
|
|
133
|
-
export function getCompareDiffTotalRows(compareDiff) {
|
|
134
|
-
const combined = buildCombinedCompareDiff(compareDiff);
|
|
135
|
-
return combined.lines.filter(isDisplayableDiffLine).length;
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Calculate the row offset to scroll to a specific file in the compare diff.
|
|
139
|
-
* Returns the row index where the file's diff --git header starts.
|
|
140
|
-
*/
|
|
141
|
-
export function getFileScrollOffset(compareDiff, fileIndex) {
|
|
142
|
-
if (!compareDiff || fileIndex < 0 || fileIndex >= compareDiff.files.length)
|
|
143
|
-
return 0;
|
|
144
|
-
const combined = buildCombinedCompareDiff(compareDiff);
|
|
145
|
-
let displayableRow = 0;
|
|
146
|
-
let currentFileIndex = 0;
|
|
147
|
-
for (const line of combined.lines) {
|
|
148
|
-
// Check if this is a file boundary
|
|
149
|
-
if (line.type === 'header' && line.content.startsWith('diff --git')) {
|
|
150
|
-
if (currentFileIndex === fileIndex) {
|
|
151
|
-
return displayableRow;
|
|
152
|
-
}
|
|
153
|
-
currentFileIndex++;
|
|
154
|
-
}
|
|
155
|
-
// Skip lines that DiffView filters out
|
|
156
|
-
if (!isDisplayableDiffLine(line)) {
|
|
157
|
-
continue;
|
|
158
|
-
}
|
|
159
|
-
displayableRow++;
|
|
160
|
-
}
|
|
161
|
-
return 0;
|
|
162
|
-
}
|
|
163
|
-
// ============================================================================
|
|
164
|
-
// Compare List View Row Calculations
|
|
165
|
-
// ============================================================================
|
|
166
|
-
/**
|
|
167
|
-
* Map a visual row index to the item index in CompareListView.
|
|
168
|
-
* Returns the commit index for commits, or commitCount + fileIndex for files.
|
|
169
|
-
* Returns -1 if the row is a header, spacer, or out of bounds.
|
|
170
|
-
*
|
|
171
|
-
* Row structure (when both commits and files exist, both expanded):
|
|
172
|
-
* Row 0: "▼ Commits" header
|
|
173
|
-
* Row 1..N: commits
|
|
174
|
-
* Row N+1: spacer
|
|
175
|
-
* Row N+2: "▼ Files" header
|
|
176
|
-
* Rows N+3..: files
|
|
177
|
-
*/
|
|
178
|
-
export function getCompareItemIndexFromRow(row, commitCount, fileCount, commitsExpanded = true, filesExpanded = true) {
|
|
179
|
-
let currentRow = 0;
|
|
180
|
-
// Commits section
|
|
181
|
-
if (commitCount > 0) {
|
|
182
|
-
if (row === currentRow)
|
|
183
|
-
return -1; // "▼ Commits" header
|
|
184
|
-
currentRow++;
|
|
185
|
-
if (commitsExpanded) {
|
|
186
|
-
if (row < currentRow + commitCount) {
|
|
187
|
-
return row - currentRow; // Commit index
|
|
188
|
-
}
|
|
189
|
-
currentRow += commitCount;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
// Files section
|
|
193
|
-
if (fileCount > 0) {
|
|
194
|
-
if (commitCount > 0) {
|
|
195
|
-
if (row === currentRow)
|
|
196
|
-
return -1; // Spacer
|
|
197
|
-
currentRow++;
|
|
198
|
-
}
|
|
199
|
-
if (row === currentRow)
|
|
200
|
-
return -1; // "▼ Files" header
|
|
201
|
-
currentRow++;
|
|
202
|
-
if (filesExpanded) {
|
|
203
|
-
if (row < currentRow + fileCount) {
|
|
204
|
-
return commitCount + (row - currentRow); // File index (offset by commit count)
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
return -1; // Out of bounds
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* Map an item index to its row position in CompareListView.
|
|
212
|
-
* This is the inverse of getCompareItemIndexFromRow.
|
|
213
|
-
*
|
|
214
|
-
* For itemIndex in 0..(commitCount-1): row = 1 + itemIndex
|
|
215
|
-
* For itemIndex in commitCount..(commitCount+fileCount-1): row = 1 + commitCount + 1 + 1 + (itemIndex - commitCount)
|
|
216
|
-
*/
|
|
217
|
-
export function getCompareRowFromItemIndex(itemIndex, commitCount, fileCount, commitsExpanded = true, filesExpanded = true) {
|
|
218
|
-
if (itemIndex < 0)
|
|
219
|
-
return 0;
|
|
220
|
-
// Handle commit items
|
|
221
|
-
if (itemIndex < commitCount) {
|
|
222
|
-
// Row 0 is commits header, so commit i is at row 1 + i
|
|
223
|
-
return commitsExpanded ? 1 + itemIndex : 0;
|
|
224
|
-
}
|
|
225
|
-
// Handle file items
|
|
226
|
-
const fileIndex = itemIndex - commitCount;
|
|
227
|
-
if (fileIndex >= fileCount)
|
|
228
|
-
return 0;
|
|
229
|
-
// Calculate row for file:
|
|
230
|
-
// - commits header (1 row if commits exist)
|
|
231
|
-
// - commits (commitCount rows if expanded)
|
|
232
|
-
// - spacer (1 row if commits exist)
|
|
233
|
-
// - files header (1 row)
|
|
234
|
-
// - file items
|
|
235
|
-
let row = 0;
|
|
236
|
-
if (commitCount > 0) {
|
|
237
|
-
row += 1; // commits header
|
|
238
|
-
if (commitsExpanded)
|
|
239
|
-
row += commitCount;
|
|
240
|
-
row += 1; // spacer
|
|
241
|
-
}
|
|
242
|
-
row += 1; // files header
|
|
243
|
-
if (filesExpanded)
|
|
244
|
-
row += fileIndex;
|
|
245
|
-
return row;
|
|
246
|
-
}
|