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:
@@ -41,6 +41,7 @@
|
||||
#define PREF_GROUP_MUC "muc"
|
||||
#define PREF_GROUP_PLUGINS "plugins"
|
||||
#define PREF_GROUP_EXECUTABLES "executables"
|
||||
#define PREF_GROUP_SPELLCHECK "spellcheck"
|
||||
|
||||
#define INPBLOCK_DEFAULT 1000
|
||||
|
||||
@@ -1909,6 +1910,9 @@ _get_group(preference_t pref)
|
||||
return PREF_GROUP_OMEMO;
|
||||
case PREF_OX_LOG:
|
||||
return PREF_GROUP_OX;
|
||||
case PREF_SPELLCHECK_ENABLE:
|
||||
case PREF_SPELLCHECK_LANG:
|
||||
return PREF_GROUP_SPELLCHECK;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
@@ -2196,6 +2200,10 @@ _get_key(preference_t pref)
|
||||
return "strophe.sm.enabled";
|
||||
case PREF_STROPHE_SM_RESEND:
|
||||
return "strophe.sm.resend";
|
||||
case PREF_SPELLCHECK_ENABLE:
|
||||
return "enabled";
|
||||
case PREF_SPELLCHECK_LANG:
|
||||
return "lang";
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
@@ -2249,6 +2257,7 @@ _get_default_boolean(preference_t pref)
|
||||
case PREF_STROPHE_SM_ENABLED:
|
||||
case PREF_STROPHE_SM_RESEND:
|
||||
return TRUE;
|
||||
case PREF_SPELLCHECK_ENABLE:
|
||||
case PREF_PGP_PUBKEY_AUTOIMPORT:
|
||||
default:
|
||||
return FALSE;
|
||||
@@ -2356,6 +2365,8 @@ _get_default_string(preference_t pref)
|
||||
return "0";
|
||||
case PREF_DBLOG:
|
||||
return "on";
|
||||
case PREF_SPELLCHECK_LANG:
|
||||
return "en_US";
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -161,6 +161,8 @@ typedef enum {
|
||||
PREF_STROPHE_SM_RESEND,
|
||||
PREF_VCARD_PHOTO_CMD,
|
||||
PREF_STATUSBAR_TABMODE,
|
||||
PREF_SPELLCHECK_ENABLE,
|
||||
PREF_SPELLCHECK_LANG,
|
||||
} preference_t;
|
||||
|
||||
typedef struct prof_alias_t
|
||||
|
||||
@@ -90,6 +90,7 @@ theme_init(const char* const theme_name)
|
||||
g_hash_table_insert(defaults, strdup("mention"), strdup("yellow"));
|
||||
g_hash_table_insert(defaults, strdup("trigger"), strdup("yellow"));
|
||||
g_hash_table_insert(defaults, strdup("input.text"), strdup("default"));
|
||||
g_hash_table_insert(defaults, strdup("input.misspelled"), strdup("red"));
|
||||
g_hash_table_insert(defaults, strdup("main.time"), strdup("default"));
|
||||
g_hash_table_insert(defaults, strdup("titlebar.text"), strdup("white"));
|
||||
g_hash_table_insert(defaults, strdup("titlebar.brackets"), strdup("cyan"));
|
||||
@@ -713,6 +714,9 @@ theme_attrs(theme_item_t attrs)
|
||||
case THEME_INPUT_TEXT:
|
||||
_theme_prep_fgnd("input.text", lookup_str, &bold);
|
||||
break;
|
||||
case THEME_INPUT_MISSPELLED:
|
||||
_theme_prep_fgnd("input.misspelled", lookup_str, &bold);
|
||||
break;
|
||||
case THEME_TIME:
|
||||
_theme_prep_fgnd("main.time", lookup_str, &bold);
|
||||
break;
|
||||
|
||||
@@ -27,6 +27,7 @@ typedef enum {
|
||||
THEME_MENTION,
|
||||
THEME_TRIGGER,
|
||||
THEME_INPUT_TEXT,
|
||||
THEME_INPUT_MISSPELLED,
|
||||
THEME_TIME,
|
||||
THEME_TITLE_TEXT,
|
||||
THEME_TITLE_BRACKET,
|
||||
|
||||
Reference in New Issue
Block a user