Permalink
Browse files

Load a clink_inputrc file from Clink's profile directory (fixes #406).

  • Loading branch information...
1 parent 10e6b55 commit ba9f2334f0f16b88cca82e15f58cd4cf6ba0cbbb @mridgers committed Jul 13, 2016
Showing with 12 additions and 0 deletions.
  1. +12 −0 clink/dll/rl.c
View
@@ -32,6 +32,7 @@ void move_cursor(int, int);
void* initialise_clink_settings();
int getc_impl(FILE* stream);
int get_clink_setting_int(const char*);
+void get_config_dir(char*, int);
void clink_register_rl_funcs();
char* filter_prompt(const char*);
void* extract_prompt(int);
@@ -449,6 +450,15 @@ static void display_matches(char** matches, int match_count, int longest)
}
//------------------------------------------------------------------------------
+static void read_profile_inputrc()
+{
+ char buffer[MAX_PATH];
+ get_config_dir(buffer, sizeof_array(buffer));
+ str_cat(buffer, "/clink_inputrc", sizeof_array(buffer));
+ rl_read_init_file(buffer);
+}
+
+//------------------------------------------------------------------------------
static int initialise_hook()
{
rl_redisplay_function = display;
@@ -477,6 +487,8 @@ static int initialise_hook()
initialise_rl_scroller();
rl_re_read_init_file(0, 0);
+ read_profile_inputrc();
+
rl_visible_stats = 0; // serves no purpose under win32.
rl_startup_hook = NULL;

0 comments on commit ba9f233

Please sign in to comment.