Ticket #3232: fish_prompt.diff

File fish_prompt.diff, 1.0 KB (added by chown, 10 years ago)

diff file

  • src/subshell.c

    diff --git a/src/subshell.c b/src/subshell.c
    index 3d908be..05d6be9 100644
    a b init_subshell (void) 
    759759{ 
    760760    /* This must be remembered across calls to init_subshell() */ 
    761761    static char pty_name[BUF_SMALL]; 
    762     char precmd[BUF_SMALL]; 
     762    char precmd[BUF_MEDIUM]; 
    763763 
    764764    switch (check_sid ()) 
    765765    { 
    init_subshell (void) 
    889889                    "alias precmd 'echo $cwd:q >>%s;kill -STOP $$'\n", tcsh_fifo); 
    890890        break; 
    891891    case FISH: 
     892        /* 
     893         * Use fish_prompt_mc function for prompt, if not present then copy 
     894         * fish_prompt to it. 
     895         */ 
    892896        g_snprintf (precmd, sizeof (precmd), 
    893                     "function fish_prompt ; pwd>&%d;kill -STOP %%self; end\n", 
     897                    "if not functions -q fish_prompt_mc;" 
     898                    "functions -c fish_prompt fish_prompt_mc; end;" 
     899                    "function fish_prompt; pwd>&%d; fish_prompt_mc; kill -STOP %%self; end\n", 
    894900                    subshell_pipe[WRITE]); 
    895901        break; 
    896902