Files
git/lib/autocorrect.h
Junio C Hamano faff5b2eb1 Merge branch 'ps/libgit-in-subdir' into seen
The source files for libgit.a have been moved into a new "lib/"
directory to clean up the top-level directory and clearly separate
library code.

* ps/libgit-in-subdir:
  Move libgit.a sources into separate "lib/" directory
  t/helper: prepare "test-example-tap.c" for introduction of "lib/"
2026-06-25 19:51:57 -07:00

37 lines
908 B
C

#ifndef AUTOCORRECT_H
#define AUTOCORRECT_H
/* An empirically derived magic number */
#define AUTOCORRECT_SIMILARITY_FLOOR 7
#define AUTOCORRECT_SIMILAR_ENOUGH(x) ((x) < AUTOCORRECT_SIMILARITY_FLOOR)
enum autocorrect_mode {
AUTOCORRECT_HINT,
AUTOCORRECT_NEVER,
AUTOCORRECT_PROMPT,
AUTOCORRECT_IMMEDIATELY,
AUTOCORRECT_DELAY,
};
/**
* `mode` indicates which action will be performed by autocorrect_confirm().
* `delay` is the timeout before autocorrect_confirm() returns, in tenths of a
* second. Use it only with AUTOCORRECT_DELAY.
*/
struct autocorrect {
enum autocorrect_mode mode;
int delay;
};
/**
* Resolve the autocorrect configuration into `conf`.
*/
void autocorrect_resolve(struct autocorrect *conf);
/**
* Interact with the user in different ways depending on `conf->mode`.
*/
void autocorrect_confirm(struct autocorrect *conf, const char *assumed);
#endif /* AUTOCORRECT_H */