gitmaps 1.1.12 → 1.1.13
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/app/analytics.db
CHANGED
|
Binary file
|
|
@@ -6,11 +6,14 @@ describe('low zoom preview helpers', () => {
|
|
|
6
6
|
const file = {
|
|
7
7
|
path: 'src/example.ts',
|
|
8
8
|
ext: 'ts',
|
|
9
|
-
content: Array.from({ length:
|
|
9
|
+
content: Array.from({ length: 80 }, (_, i) => `line-${i + 1}`).join('\n'),
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
const top = getLowZoomPreviewText(file, 0);
|
|
13
|
+
const scrolled = getLowZoomPreviewText(file, 40);
|
|
14
|
+
expect(top.startsWith('line-1')).toBe(true);
|
|
15
|
+
expect(scrolled.startsWith('line-3')).toBe(true);
|
|
16
|
+
expect(scrolled.includes('line-80')).toBe(true);
|
|
14
17
|
});
|
|
15
18
|
|
|
16
19
|
test('skips binary or unsupported files', () => {
|
|
@@ -35,7 +35,7 @@ export function getLowZoomPreviewText(file: any, scrollTop: number): string {
|
|
|
35
35
|
const lines = normalized.split('\n');
|
|
36
36
|
const approxLineHeight = 20;
|
|
37
37
|
const startLine = Math.max(0, Math.floor(scrollTop / approxLineHeight));
|
|
38
|
-
return lines.slice(startLine
|
|
38
|
+
return lines.slice(startLine).join('\n').trim();
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
export function wrapPreviewText(text: string, maxCharsPerLine: number, maxLines: number): string[] {
|