aboutsummaryrefslogtreecommitdiff
path: root/degesch.c
diff options
context:
space:
mode:
Diffstat (limited to 'degesch.c')
-rw-r--r--degesch.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/degesch.c b/degesch.c
index 4831a3b..59a60a0 100644
--- a/degesch.c
+++ b/degesch.c
@@ -11086,24 +11086,29 @@ on_editline_return (EditLine *editline, int key)
static void
app_editline_init (struct input *self)
{
- static const struct { const char *name; const char *help;
+#define XX(name, help, fn) { name, help, on_editline_ ## fn },
+
+ // el_set() leaks memory in 20150325 and other versions, we need wchar_t
+ static const struct { const wchar_t *name; const wchar_t *help;
unsigned char (*func) (EditLine *, int); } x[] =
{
- { "goto-buffer", "Go to buffer", on_editline_goto_buffer },
- { "previous-buffer", "Previous buffer", on_editline_previous_buffer },
- { "next-buffer", "Next buffer", on_editline_next_buffer },
- { "switch-buffer", "Switch buffer", on_editline_switch_buffer },
- { "display-backlog", "Show backlog", on_editline_display_backlog },
- { "display-full-log", "Show full log", on_editline_display_full_log },
- { "edit-input", "Edit input", on_editline_edit_input },
- { "redraw-screen", "Redraw screen", on_editline_redraw_screen },
- { "insert-attribute", "mIRC formatting", on_editline_insert_attribute },
- { "start-paste-mode", "Bracketed paste", on_editline_start_paste_mode },
- { "send-line", "Send line", on_editline_return },
- { "complete", "Complete word", on_editline_complete },
+ XX( L"goto-buffer", L"Go to buffer", goto_buffer )
+ XX( L"previous-buffer", L"Previous buffer", previous_buffer )
+ XX( L"next-buffer", L"Next buffer", next_buffer )
+ XX( L"switch-buffer", L"Switch buffer", switch_buffer )
+ XX( L"display-backlog", L"Show backlog", display_backlog )
+ XX( L"display-full-log", L"Show full log", display_full_log )
+ XX( L"edit-input", L"Edit input", edit_input )
+ XX( L"redraw-screen", L"Redraw screen", redraw_screen )
+ XX( L"insert-attribute", L"mIRC formatting", insert_attribute )
+ XX( L"start-paste-mode", L"Bracketed paste", start_paste_mode )
+ XX( L"send-line", L"Send line", return )
+ XX( L"complete", L"Complete word", complete )
};
for (size_t i = 0; i < N_ELEMENTS (x); i++)
- el_set (self->editline, EL_ADDFN, x[i].name, x[i].help, x[i].func);
+ el_wset (self->editline, EL_ADDFN, x[i].name, x[i].help, x[i].func);
+
+#undef XX
bind_common_keys (g_ctx);