Skip to content

Commit c8f0fe7

Browse files
committed
fix: row/col starts from 1 rather than 0
1 parent 7b28d64 commit c8f0fe7

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

builtin/coordinator/compact.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ export function compact(
110110
heightMax,
111111
Math.max(heightMin, Math.floor(screenHeight * heightRatio)),
112112
);
113-
const col = Math.floor((screenWidth - width) / 2);
114-
const row = Math.floor((screenHeight - height) / 2);
113+
const col = 1 + Math.floor((screenWidth - width) / 2);
114+
const row = 1 + Math.floor((screenHeight - height) / 2);
115115
return { col, row, width, height };
116116
};
117117

builtin/coordinator/modern.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ export function modern(options: ModernOptions = {}): Coordinator {
106106
heightMax,
107107
Math.max(heightMin, Math.floor(screenHeight * heightRatio)),
108108
);
109-
const col = Math.floor((screenWidth - width) / 2);
110-
const row = Math.floor((screenHeight - height) / 2);
109+
const col = 1 + Math.floor((screenWidth - width) / 2);
110+
const row = 1 + Math.floor((screenHeight - height) / 2);
111111
return { col, row, width, height };
112112
};
113113

builtin/coordinator/separate.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ export function separate(options: SeparateOptions = {}): Coordinator {
101101
heightMax,
102102
Math.max(heightMin, Math.floor(screenHeight * heightRatio)),
103103
);
104-
const col = Math.floor((screenWidth - width) / 2);
105-
const row = Math.floor((screenHeight - height) / 2);
104+
const col = 1 + Math.floor((screenWidth - width) / 2);
105+
const row = 1 + Math.floor((screenHeight - height) / 2);
106106
return { col, row, width, height };
107107
};
108108

util/testutil.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export function renderBorder(
6868
for (let x = 0; x < width + 2; x++) {
6969
const char = getChar(x, y);
7070
if (char) {
71-
canvas[row + y][col + x] = char;
71+
canvas[row - 1 + y][col - 1 + x] = char;
7272
}
7373
}
7474
}

0 commit comments

Comments
 (0)