diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/diff_driver.c | 1 | ||||
-rw-r--r-- | src/userdiff.h | 6 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/diff_driver.c b/src/diff_driver.c index 9249d1415..4c9a0af65 100644 --- a/src/diff_driver.c +++ b/src/diff_driver.c @@ -437,6 +437,7 @@ static int diff_context_line__pattern_match( i = (pmatch[1].rm_so >= 0) ? 1 : 0; git_buf_consume(line, git_buf_cstr(line) + pmatch[i].rm_so); git_buf_truncate(line, pmatch[i].rm_eo - pmatch[i].rm_so); + git_buf_rtrim(line); return true; } diff --git a/src/userdiff.h b/src/userdiff.h index 93b4d0d58..2257035ac 100644 --- a/src/userdiff.h +++ b/src/userdiff.h @@ -193,9 +193,9 @@ PATTERNS("php", "|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->"), PATTERNS("javascript", - "^[ \t]*(\(?function[ \t].*)$\n" - "^[ \t]*(var[ \t]+[a-zA-Z_][a-zA-Z0-9_]*[ \t]*=[ \t]*function[ \t\(].*)$\n" - "^[ \t]*([a-zA-Z_][a-zA-Z0-9_]*[ \t]*:[ \t]*function[ \t\(].*)$", + "^[ \t]*(function[ \t][a-zA-Z_][^\{]*)\n" + "^[ \t]*(var[ \t]+[a-zA-Z_][a-zA-Z0-9_]*[ \t]*=[ \t]*function[ \t\(][^\{]*)\n" + "^[ \t]*([a-zA-Z_][a-zA-Z0-9_]*[ \t]*:[ \t]*function[ \t\(][^\{]*)", /* -- */ "[a-zA-Z_][a-zA-Z0-9_]*" "|[-+0-9.e]+[fFlL]?|0[xX]?[0-9a-fA-F]+[lL]?" |