mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-01 07:15:32 -04:00
url-mode: disable IME mode while URL-mode is active
This prevents the IME from stealing "our" key-presses, and thus preventing the user from opening URLs. Closes #1718, hopefully.
This commit is contained in:
parent
18b702b249
commit
8716ca5784
4 changed files with 18 additions and 1 deletions
|
|
@ -87,9 +87,11 @@
|
||||||
* No error response for empty `XTGETTCAP` request ([#1694][1694]).
|
* No error response for empty `XTGETTCAP` request ([#1694][1694]).
|
||||||
* Unicode-mode in one foot client affecting other clients, in foot
|
* Unicode-mode in one foot client affecting other clients, in foot
|
||||||
server mode ([#1717][1717]).
|
server mode ([#1717][1717]).
|
||||||
|
* IME interfering in URL-mode ([#1718][1718]).
|
||||||
|
|
||||||
[1694]: https://codeberg.org/dnkl/foot/issues/1694
|
[1694]: https://codeberg.org/dnkl/foot/issues/1694
|
||||||
[1717]: https://codeberg.org/dnkl/foot/issues/1717
|
[1717]: https://codeberg.org/dnkl/foot/issues/1717
|
||||||
|
[1718]: https://codeberg.org/dnkl/foot/issues/1718
|
||||||
|
|
||||||
|
|
||||||
### Security
|
### Security
|
||||||
|
|
|
||||||
4
csi.c
4
csi.c
|
|
@ -507,8 +507,10 @@ decset_decrst(struct terminal *term, unsigned param, bool enable)
|
||||||
case 737769:
|
case 737769:
|
||||||
if (enable)
|
if (enable)
|
||||||
term_ime_enable(term);
|
term_ime_enable(term);
|
||||||
else
|
else {
|
||||||
term_ime_disable(term);
|
term_ime_disable(term);
|
||||||
|
term->ime_reenable_after_url_mode = false;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -714,6 +714,7 @@ struct terminal {
|
||||||
char32_t url_keys[5];
|
char32_t url_keys[5];
|
||||||
bool urls_show_uri_on_jump_label;
|
bool urls_show_uri_on_jump_label;
|
||||||
struct grid *url_grid_snapshot;
|
struct grid *url_grid_snapshot;
|
||||||
|
bool ime_reenable_after_url_mode;
|
||||||
|
|
||||||
#if defined(FOOT_IME_ENABLED) && FOOT_IME_ENABLED
|
#if defined(FOOT_IME_ENABLED) && FOOT_IME_ENABLED
|
||||||
bool ime_enabled;
|
bool ime_enabled;
|
||||||
|
|
|
||||||
12
url-mode.c
12
url-mode.c
|
|
@ -778,6 +778,12 @@ urls_render(struct terminal *term)
|
||||||
if (tll_length(win->term->urls) == 0)
|
if (tll_length(win->term->urls) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* Disable IME while in URL-mode */
|
||||||
|
if (term_ime_is_enabled(term)) {
|
||||||
|
term->ime_reenable_after_url_mode = true;
|
||||||
|
term_ime_disable(term);
|
||||||
|
}
|
||||||
|
|
||||||
/* Dirty the last cursor, to ensure it is erased */
|
/* Dirty the last cursor, to ensure it is erased */
|
||||||
{
|
{
|
||||||
struct row *cursor_row = term->render.last_cursor.row;
|
struct row *cursor_row = term->render.last_cursor.row;
|
||||||
|
|
@ -861,5 +867,11 @@ urls_reset(struct terminal *term)
|
||||||
term->urls_show_uri_on_jump_label = false;
|
term->urls_show_uri_on_jump_label = false;
|
||||||
memset(term->url_keys, 0, sizeof(term->url_keys));
|
memset(term->url_keys, 0, sizeof(term->url_keys));
|
||||||
|
|
||||||
|
/* Re-enable IME, if it was enabled before we entered URL-mode */
|
||||||
|
if (term->ime_reenable_after_url_mode) {
|
||||||
|
term->ime_reenable_after_url_mode = false;
|
||||||
|
term_ime_enable(term);
|
||||||
|
}
|
||||||
|
|
||||||
render_refresh(term);
|
render_refresh(term);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue