Skip to content

Commit ba9f233

Browse files
committed
Load a clink_inputrc file from Clink's profile directory (fixes #406).
1 parent 10e6b55 commit ba9f233

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

clink/dll/rl.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ void move_cursor(int, int);
3232
void* initialise_clink_settings();
3333
int getc_impl(FILE* stream);
3434
int get_clink_setting_int(const char*);
35+
void get_config_dir(char*, int);
3536
void clink_register_rl_funcs();
3637
char* filter_prompt(const char*);
3738
void* extract_prompt(int);
@@ -448,6 +449,15 @@ static void display_matches(char** matches, int match_count, int longest)
448449
free(new_matches);
449450
}
450451

452+
//------------------------------------------------------------------------------
453+
static void read_profile_inputrc()
454+
{
455+
char buffer[MAX_PATH];
456+
get_config_dir(buffer, sizeof_array(buffer));
457+
str_cat(buffer, "/clink_inputrc", sizeof_array(buffer));
458+
rl_read_init_file(buffer);
459+
}
460+
451461
//------------------------------------------------------------------------------
452462
static int initialise_hook()
453463
{
@@ -477,6 +487,8 @@ static int initialise_hook()
477487
initialise_rl_scroller();
478488

479489
rl_re_read_init_file(0, 0);
490+
read_profile_inputrc();
491+
480492
rl_visible_stats = 0; // serves no purpose under win32.
481493

482494
rl_startup_hook = NULL;

0 commit comments

Comments
 (0)