okai 0.0.14 → 0.0.15
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/dist/index.js +27 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -524,8 +524,34 @@ async function createGistPreview(title, gist) {
|
|
524
524
|
screen.render();
|
525
525
|
}
|
526
526
|
});
|
527
|
+
fileList.on('keypress', (ch, key) => {
|
528
|
+
const boxHeight = preview.height;
|
529
|
+
const currentScroll = preview.getScroll();
|
530
|
+
const contentHeight = preview.getLines().length;
|
531
|
+
// Calculate scroll amount (half the box height)
|
532
|
+
const scrollAmount = Math.floor(boxHeight / 2);
|
533
|
+
// Page Up handler
|
534
|
+
if (key.name === 'pageup') {
|
535
|
+
// Calculate new scroll position, ensuring it doesn't go below 0
|
536
|
+
const newScrollPosition = Math.max(0, currentScroll - scrollAmount);
|
537
|
+
preview.setScroll(newScrollPosition);
|
538
|
+
screen.render();
|
539
|
+
}
|
540
|
+
// Page Down handler
|
541
|
+
if (key.name === 'pagedown') {
|
542
|
+
// Calculate max scroll position to prevent scrolling beyond content
|
543
|
+
const maxScroll = Math.max(0, contentHeight - boxHeight);
|
544
|
+
// Calculate new scroll position, ensuring it doesn't exceed max
|
545
|
+
const newScrollPosition = Math.min(maxScroll, currentScroll + scrollAmount);
|
546
|
+
preview.setScroll(newScrollPosition);
|
547
|
+
screen.render();
|
548
|
+
}
|
549
|
+
});
|
527
550
|
// Handle key events
|
528
551
|
screen.key(['q', 'C-c'], () => process.exit(0));
|
552
|
+
// screen.on('keypress', (ch, key) => {
|
553
|
+
// console.log('keypress', ch, key)
|
554
|
+
// })
|
529
555
|
// Focus on file list
|
530
556
|
fileList.focus();
|
531
557
|
// Render screen
|
@@ -534,6 +560,7 @@ async function createGistPreview(title, gist) {
|
|
534
560
|
function chooseFile(ctx, info, gist) {
|
535
561
|
const { screen, titleBar, fileList, preview, statusBar, result } = ctx;
|
536
562
|
const file = gist.files[result.selectedFile];
|
563
|
+
screen.destroy();
|
537
564
|
console.clear();
|
538
565
|
let acceptTask = null;
|
539
566
|
if (file.raw_url) {
|