diff options
author | Bram Moolenaar <bram@vim.org> | 2011-06-12 21:51:08 +0200 |
---|---|---|
committer | Bram Moolenaar <bram@vim.org> | 2011-06-12 21:51:08 +0200 |
commit | b5a098664f45779bb4dfef41766986010c731814 (patch) | |
tree | 8af2dbcaf54c2569ee036fbb2fad6ac6c36141b5 | |
parent | 1e434b61d048601adaf0cfc9c8659ea9c5894f69 (diff) | |
download | vim-b5a098664f45779bb4dfef41766986010c731814.tar.gz |
Problem: Javascript object literal is not indented correctly.
Solution: Make a special case for when "J1" is in 'cino'. (Luc Deschenaux)
-rw-r--r-- | src/misc1.c | 2 | ||||
-rw-r--r-- | src/testdir/test3.in | 24 | ||||
-rw-r--r-- | src/testdir/test3.ok | 17 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 43 insertions, 2 deletions
diff --git a/src/misc1.c b/src/misc1.c index 913da2ad..d69f12fd 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -6965,7 +6965,7 @@ get_c_indent() * ldfd) { * } */ - if ((ind_keep_case_label + if (ind_js || (ind_keep_case_label && cin_iscase(skipwhite(ml_get_curline()), FALSE))) amount = get_indent(); else diff --git a/src/testdir/test3.in b/src/testdir/test3.in index 1b5cf893..1cfd8f23 100644 --- a/src/testdir/test3.in +++ b/src/testdir/test3.in @@ -1492,10 +1492,11 @@ baz(); STARTTEST :set cino=N-s -/namespaces +/^NAMESPACESTART =/^NAMESPACEEND ENDTEST +NAMESPACESTART /* valid namespaces with normal indent */ namespace { @@ -1561,6 +1562,27 @@ NAMESPACEEND STARTTEST +:set cino=J1 +/^JSSTART +=/^JSEND +ENDTEST + +JSSTART +var bar = { +foo: { +that: this, +some: ok, +}, +"bar":{ +a : 2, +b: "123abc", +x: 4, +"y": 5 +} +} +JSEND + +STARTTEST :g/^STARTTEST/.,/^ENDTEST/d :1;/start of AUTO/,$wq! test.out ENDTEST diff --git a/src/testdir/test3.ok b/src/testdir/test3.ok index cf4f85de..8475aff9 100644 --- a/src/testdir/test3.ok +++ b/src/testdir/test3.ok @@ -1337,6 +1337,7 @@ void func(void) } +NAMESPACESTART /* valid namespaces with normal indent */ namespace { @@ -1401,3 +1402,19 @@ namespace111111111 NAMESPACEEND + +JSSTART +var bar = { + foo: { + that: this, + some: ok, + }, + "bar":{ + a : 2, + b: "123abc", + x: 4, + "y": 5 + } +} +JSEND + diff --git a/src/version.c b/src/version.c index f648160c..7ae79842 100644 --- a/src/version.c +++ b/src/version.c @@ -710,6 +710,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 213, +/**/ 212, /**/ 211, |