summaryrefslogtreecommitdiffstats
path: root/window-choose.c
diff options
context:
space:
mode:
authornicm <nicm>2015-11-12 11:05:34 +0000
committernicm <nicm>2015-11-12 11:05:34 +0000
commit69e0b8326ad0a983759518b90ed8632146341acf (patch)
tree03f69cf9a96b5e87b760243cc535878940bc7a02 /window-choose.c
parent7062b0e65dcbb94bb190f6c50f4089b2ea6278bb (diff)
Support UTF-8 key bindings by expanding the key type from int to
uint64_t and converting UTF-8 to Unicode on input and the reverse on output. (This allows key bindings, there are still omissions - the largest being that the various prompts do not accept UTF-8.)
Diffstat (limited to 'window-choose.c')
-rw-r--r--window-choose.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/window-choose.c b/window-choose.c
index f1c3f94a..fa0e95c8 100644
--- a/window-choose.c
+++ b/window-choose.c
@@ -29,11 +29,11 @@ struct screen *window_choose_init(struct window_pane *);
void window_choose_free(struct window_pane *);
void window_choose_resize(struct window_pane *, u_int, u_int);
void window_choose_key(struct window_pane *, struct client *,
- struct session *, int, struct mouse_event *);
+ struct session *, key_code, struct mouse_event *);
void window_choose_default_callback(struct window_choose_data *);
struct window_choose_mode_item *window_choose_get_item(struct window_pane *,
- int, struct mouse_event *);
+ key_code, struct mouse_event *);
void window_choose_fire_callback(
struct window_pane *, struct window_choose_data *);
@@ -86,9 +86,9 @@ struct window_choose_mode_data {
void window_choose_free1(struct window_choose_mode_data *);
int window_choose_key_index(struct window_choose_mode_data *, u_int);
-int window_choose_index_key(struct window_choose_mode_data *, int);
+int window_choose_index_key(struct window_choose_mode_data *, key_code);
void window_choose_prompt_input(enum window_choose_input_type,
- const char *, struct window_pane *, int);
+ const char *, struct window_pane *, key_code);
void window_choose_reset_top(struct window_pane *, u_int);
void
@@ -314,7 +314,7 @@ window_choose_fire_callback(
void
window_choose_prompt_input(enum window_choose_input_type input_type,
- const char *prompt, struct window_pane *wp, int key)
+ const char *prompt, struct window_pane *wp, key_code key)
{
struct window_choose_mode_data *data = wp->modedata;
size_t input_len;
@@ -490,7 +490,8 @@ window_choose_expand(struct window_pane *wp, struct session *s, u_int pos)
}
struct window_choose_mode_item *
-window_choose_get_item(struct window_pane *wp, int key, struct mouse_event *m)
+window_choose_get_item(struct window_pane *wp, key_code key,
+ struct mouse_event *m)
{
struct window_choose_mode_data *data = wp->modedata;
u_int x, y, idx;
@@ -509,7 +510,7 @@ window_choose_get_item(struct window_pane *wp, int key, struct mouse_event *m)
void
window_choose_key(struct window_pane *wp, unused struct client *c,
- unused struct session *sess, int key, struct mouse_event *m)
+ unused struct session *sess, key_code key, struct mouse_event *m)
{
struct window_choose_mode_data *data = wp->modedata;
struct screen *s = &data->screen;
@@ -743,8 +744,8 @@ window_choose_key(struct window_pane *wp, unused struct client *c,
}
void
-window_choose_write_line(
- struct window_pane *wp, struct screen_write_ctx *ctx, u_int py)
+window_choose_write_line(struct window_pane *wp, struct screen_write_ctx *ctx,
+ u_int py)
{
struct window_choose_mode_data *data = wp->modedata;
struct window_choose_mode_item *item;
@@ -821,7 +822,7 @@ window_choose_key_index(struct window_choose_mode_data *data, u_int idx)
}
int
-window_choose_index_key(struct window_choose_mode_data *data, int key)
+window_choose_index_key(struct window_choose_mode_data *data, key_code key)
{
static const char keys[] = "0123456789"
"abcdefghijklmnopqrstuvwxyz"
@@ -834,7 +835,7 @@ window_choose_index_key(struct window_choose_mode_data *data, int key)
mkey = mode_key_lookup(&data->mdata, *ptr, NULL);
if (mkey != MODEKEY_NONE && mkey != MODEKEY_OTHER)
continue;
- if (key == *ptr)
+ if (key == (key_code)*ptr)
return (idx);
idx++;
}