MCPcopy
hub / github.com/codeaashu/claude-code / modalPagerAction

Function modalPagerAction

src/components/ScrollKeybindingHandler.tsx:900–960  ·  view source on GitHub ↗
(input: string, key: Pick<Key, 'ctrl' | 'meta' | 'shift' | 'upArrow' | 'downArrow' | 'home' | 'end'>)

Source from the content-addressed store, hash-verified

898 * to the selection-clear-on-printable handler).
899 */
900export function modalPagerAction(input: string, key: Pick<Key, 'ctrl' | 'meta' | 'shift' | 'upArrow' | 'downArrow' | 'home' | 'end'>): ModalPagerAction | null {
901 if (key.meta) return null;
902 // Special keys first — arrows/home/end arrive with empty or junk input,
903 // so these must be checked before any input-string logic. shift is
904 // reserved for selection-extend (selectionFocusMoveForKey); ctrl+home/end
905 // already has a useKeybindings route to scroll:top/bottom.
906 if (!key.ctrl && !key.shift) {
907 if (key.upArrow) return 'lineUp';
908 if (key.downArrow) return 'lineDown';
909 if (key.home) return 'top';
910 if (key.end) return 'bottom';
911 }
912 if (key.ctrl) {
913 if (key.shift) return null;
914 switch (input) {
915 case 'u':
916 return 'halfPageUp';
917 case 'd':
918 return 'halfPageDown';
919 case 'b':
920 return 'fullPageUp';
921 case 'f':
922 return 'fullPageDown';
923 // emacs-style line scroll (less accepts both ctrl+n/p and ctrl+e/y).
924 // Works during search nav — fine-adjust after a jump without
925 // leaving modal. No !searchOpen gate on this useInput's isActive.
926 case 'n':
927 return 'lineDown';
928 case 'p':
929 return 'lineUp';
930 default:
931 return null;
932 }
933 }
934 // Bare letters. Key-repeat batches: only act on uniform runs.
935 const c = input[0];
936 if (!c || input !== c.repeat(input.length)) return null;
937 // kitty sends G as input='g' shift=true; legacy as 'G' shift=false.
938 // Check BEFORE the shift-gate so both hit 'bottom'.
939 if (c === 'G' || c === 'g' && key.shift) return 'bottom';
940 if (key.shift) return null;
941 switch (c) {
942 case 'g':
943 return 'top';
944 // j/k re-added per Tom Mar 18 — reversal of Mar 16 removal. Works
945 // during search nav (fine-adjust after n/N lands) since isModal is
946 // independent of searchOpen.
947 case 'j':
948 return 'lineDown';
949 case 'k':
950 return 'lineUp';
951 // less: space = page down, b = page up. ctrl+b already maps above;
952 // bare b is the less-native version.
953 case ' ':
954 return 'fullPageDown';
955 case 'b':
956 return 'fullPageUp';
957 default:

Callers 1

ScrollKeybindingHandlerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected