From 6bdb0cde8bcc00c78eeeecf36792d0b51bdeff43 Mon Sep 17 00:00:00 2001 From: axel Date: Sat, 27 May 2006 22:35:16 +1000 Subject: Add support for highligting qutes in a special color - defaults to blue darcs-hash:20060527123516-ac50b-d6e0cf08bd9dfe8514e64004d93dc4035e73fad8.gz --- doc_src/doc.hdr | 2 +- etc/fish_interactive.fish.in | 1 + highlight.c | 13 +++++++++---- output.h | 1 + 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/doc_src/doc.hdr b/doc_src/doc.hdr index 266ac516..4db089d3 100644 --- a/doc_src/doc.hdr +++ b/doc_src/doc.hdr @@ -752,7 +752,7 @@ certain environment variables. - \c BROWSER, which is the users preferred web browser. If this variable is set, fish will use the specified browser instead of the system default browser to display the fish documentation. - \c CDPATH, which is an array of directories in which to search for the new directory for the \c cd builtin. -- \c fish_color_normal, \c fish_color_command, \c fish_color_redirection, \c fish_color_end, \c fish_color_error, \c fish_color_param, \c fish_color_comment, \c fish_color_match, \c fish_color_search_match, \c fish_color_operator, \c fish_color_escape, \c fish_color_cwd, \c fish_pager_color_prefix, \c fish_pager_color_completion, \c fish_pager_color_description and \c fish_pager_color_progress are used to change the color of various elements in \c fish. These variables are universal, i.e. when changing them, their new value will be used by all running fish sessions. The new value will also be retained when restarting fish. +- \c fish_color_normal, \c fish_color_command, \c fish_color_quote, \c fish_color_redirection, \c fish_color_end, \c fish_color_error, \c fish_color_param, \c fish_color_comment, \c fish_color_match, \c fish_color_search_match, \c fish_color_operator, \c fish_color_escape, \c fish_color_cwd, \c fish_pager_color_prefix, \c fish_pager_color_completion, \c fish_pager_color_description and \c fish_pager_color_progress are used to change the color of various elements in \c fish. These variables are universal, i.e. when changing them, their new value will be used by all running fish sessions. The new value will also be retained when restarting fish. - \c PATH, which is an array of directories in which to search for commands - \c umask, which is the current file creation mask. The preferred way to change the umask variable is through the umask shellscript function. An attempt to set umask to an invalid value will always fail. diff --git a/etc/fish_interactive.fish.in b/etc/fish_interactive.fish.in index 873d77ed..33eb050b 100644 --- a/etc/fish_interactive.fish.in +++ b/etc/fish_interactive.fish.in @@ -72,6 +72,7 @@ set_default fish_color_comment brown set_default fish_color_error red set_default fish_color_escape cyan set_default fish_color_operator cyan +set_default fish_color_quote blue set_default fish_color_cwd green diff --git a/highlight.c b/highlight.c index ae446233..6995184d 100644 --- a/highlight.c +++ b/highlight.c @@ -52,7 +52,8 @@ static wchar_t *highlight_var[] = L"fish_color_match", L"fish_color_search_match", L"fish_color_operator", - L"fish_color_escape" + L"fish_color_escape", + L"fish_color_quote" } ; @@ -262,12 +263,14 @@ static void highlight_param( const wchar_t * buff, case L'\'': { + color[in_pos] = HIGHLIGHT_QUOTE; mode = 1; break; } case L'\"': { + color[in_pos] = HIGHLIGHT_QUOTE; mode = 2; break; } @@ -291,7 +294,7 @@ static void highlight_param( const wchar_t * buff, case L'\'': { color[start_pos] = HIGHLIGHT_ESCAPE; - color[in_pos+1] = HIGHLIGHT_NORMAL; + color[in_pos+1] = HIGHLIGHT_QUOTE; break; } @@ -306,6 +309,7 @@ static void highlight_param( const wchar_t * buff, if( c == L'\'' ) { mode = 0; + color[in_pos+1] = HIGHLIGHT_NORMAL; } break; @@ -321,6 +325,7 @@ static void highlight_param( const wchar_t * buff, case '"': { mode = 0; + color[in_pos+1] = HIGHLIGHT_NORMAL; break; } @@ -339,7 +344,7 @@ static void highlight_param( const wchar_t * buff, case '"': { color[start_pos] = HIGHLIGHT_ESCAPE; - color[in_pos+1] = HIGHLIGHT_NORMAL; + color[in_pos+1] = HIGHLIGHT_QUOTE; break; } } @@ -349,7 +354,7 @@ static void highlight_param( const wchar_t * buff, case '$': { color[in_pos] = HIGHLIGHT_OPERATOR; - color[in_pos+1] = HIGHLIGHT_NORMAL; + color[in_pos+1] = HIGHLIGHT_QUOTE; break; } diff --git a/output.h b/output.h index 1ab56262..094f1b37 100644 --- a/output.h +++ b/output.h @@ -23,6 +23,7 @@ enum HIGHLIGHT_SEARCH_MATCH, HIGHLIGHT_OPERATOR, HIGHLIGHT_ESCAPE, + HIGHLIGHT_QUOTE, } ; -- cgit v1.2.3