| import { |
| hasUsedBackslashReturn, |
| isShiftEnterKeyBindingInstalled, |
| } from '../../commands/terminalSetup/terminalSetup.js' |
| import type { Key } from '../../ink.js' |
| import { getGlobalConfig } from '../../utils/config.js' |
| import { env } from '../../utils/env.js' |
| |
| |
| |
| |
| export function isVimModeEnabled(): boolean { |
| const config = getGlobalConfig() |
| return config.editorMode === 'vim' |
| } |
|
|
| export function getNewlineInstructions(): string { |
| |
| if (env.terminal === 'Apple_Terminal' && process.platform === 'darwin') { |
| return 'shift + β for newline' |
| } |
|
|
| |
| if (isShiftEnterKeyBindingInstalled()) { |
| return 'shift + β for newline' |
| } |
|
|
| |
| return hasUsedBackslashReturn() |
| ? '\\β for newline' |
| : 'backslash (\\) + return (β) for newline' |
| } |
|
|
| |
| |
| |
| |
| |
| export function isNonSpacePrintable(input: string, key: Key): boolean { |
| if ( |
| key.ctrl || |
| key.meta || |
| key.escape || |
| key.return || |
| key.tab || |
| key.backspace || |
| key.delete || |
| key.upArrow || |
| key.downArrow || |
| key.leftArrow || |
| key.rightArrow || |
| key.pageUp || |
| key.pageDown || |
| key.home || |
| key.end |
| ) { |
| return false |
| } |
| return input.length > 0 && !/^\s/.test(input) && !input.startsWith('\x1b') |
| } |
|
|