feat: add spellcheck highlighting support

Introduce optional spellcheck highlighting in the input window using
the Enchant-2 library.

```
/spellcheck on
/spellcheck lang en_US
```

New theme color `input.misspelled`.

Fixes: https://github.com/profanity-im/profanity/issues/183
Signed-off-by: Michael Vetter <jubalh@iodoru.org>
This commit is contained in:
Michael Vetter
2026-03-26 22:37:06 +01:00
parent 88b80c33ef
commit 4922366366
17 changed files with 335 additions and 0 deletions

52
src/tools/spellcheck.h Normal file
View File

@@ -0,0 +1,52 @@
/*
* spellcheck.h
* vim: expandtab:ts=4:sts=4:sw=4
*
* Copyright (C) 2026 Michael Vetter <jubalh@iodoru.org>
*
* SPDX-License-Identifier: GPL-3.0-or-later WITH OpenSSL-exception
*/
#ifndef TOOLS_SPELLCHECK_H
#define TOOLS_SPELLCHECK_H
#include "config.h"
#include <glib.h>
#ifdef HAVE_SPELLCHECK
void spellcheck_init(void);
void spellcheck_deinit(void);
gboolean spellcheck_is_misspelled(const char* word);
gboolean spellcheck_set_lang(const char* lang);
const char* spellcheck_get_lang(void);
#else
static inline void
spellcheck_init(void)
{
}
static inline void
spellcheck_deinit(void)
{
}
static inline gboolean
spellcheck_is_misspelled(const char* word)
{
return FALSE;
}
static inline gboolean
spellcheck_set_lang(const char* lang)
{
return FALSE;
}
static inline const char*
spellcheck_get_lang(void)
{
return NULL;
}
#endif
#endif