/**
 * useHistorySearch - Hook for Ctrl+R reverse history search
 *
 * Manages search state and provides handlers for search operations.
 */
import { type Dispatch, type SetStateAction } from 'react';
import type { InputState, UIState } from '../state/types.js';
import type { TextBuffer } from '../components/shared/text-buffer.js';
interface UseHistorySearchProps {
    ui: UIState;
    input: InputState;
    buffer: TextBuffer;
    setUi: Dispatch<SetStateAction<UIState>>;
    setInput: Dispatch<SetStateAction<InputState>>;
}
interface UseHistorySearchReturn {
    /** Whether search mode is active */
    isActive: boolean;
    /** Current search query */
    query: string;
    /** Current match (or last valid match if no current results) */
    currentMatch: string | null;
    /** Whether there's a match for the current query */
    hasMatch: boolean;
    /** Original input to potentially restore */
    originalInput: string;
    /** Enter search mode */
    enter: () => void;
    /** Exit search mode (keep current input) */
    exit: (showRestoreHint?: boolean) => void;
    /** Cancel search mode (restore original - used by Escape) */
    cancel: () => void;
    /** Update search query */
    updateQuery: (query: string) => void;
    /** Add character to query */
    appendToQuery: (char: string) => void;
    /** Remove last character from query */
    backspace: () => void;
    /** Cycle to next (older) match - Ctrl+R */
    cycleNext: () => void;
    /** Cycle to previous (newer) match - Ctrl+Shift+R */
    cyclePrev: () => void;
    /** Accept current match (for Enter - also exits search mode) */
    accept: () => void;
    /** Handle a keypress - returns true if consumed */
    handleKey: (inputStr: string, key: {
        ctrl: boolean;
        shift: boolean;
        return: boolean;
        backspace: boolean;
        delete: boolean;
        escape: boolean;
        meta: boolean;
    }) => boolean;
}
/**
 * Hook for managing reverse history search
 */
export declare function useHistorySearch({ ui, input, buffer, setUi, setInput, }: UseHistorySearchProps): UseHistorySearchReturn;
export {};
//# sourceMappingURL=useHistorySearch.d.ts.map