aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/indent_c.c
diff options
context:
space:
mode:
authorFlorian Walch <florian@fwalch.com>2014-12-23 10:24:46 +0100
committerFlorian Walch <florian@fwalch.com>2014-12-23 10:27:05 +0100
commit1053f49ab08681ad2a7f98ee66aa90db9442d937 (patch)
tree5553f1fc108a001a0de6d0433c3ef4e00f80238c /src/nvim/indent_c.c
parentc3de63bfbc168cd8ccc53dbb3e587043c11f7276 (diff)
downloadrneovim-1053f49ab08681ad2a7f98ee66aa90db9442d937.tar.gz
rneovim-1053f49ab08681ad2a7f98ee66aa90db9442d937.tar.bz2
rneovim-1053f49ab08681ad2a7f98ee66aa90db9442d937.zip
vim-patch:7.4.395
Problem: C indent is wrong below an if with wrapped condition followed by curly braces. (Trevor Powell) Solution: Make a copy of tryposBrace. https://code.google.com/p/vim/source/detail?r=v7-4-395
Diffstat (limited to 'src/nvim/indent_c.c')
-rw-r--r--src/nvim/indent_c.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/nvim/indent_c.c b/src/nvim/indent_c.c
index bbc0b291dc..39ad512227 100644
--- a/src/nvim/indent_c.c
+++ b/src/nvim/indent_c.c
@@ -1545,6 +1545,7 @@ int get_c_indent(void)
char_u *linecopy;
pos_T *trypos;
pos_T *tryposBrace = NULL;
+ pos_T tryposBraceCopy;
pos_T our_paren_pos;
char_u *start;
int start_brace;
@@ -2026,6 +2027,10 @@ int get_c_indent(void)
} else {
// We are inside braces, there is a { before this line at the position
// stored in tryposBrace.
+ // Make a copy of tryposBrace, it may point to pos_copy inside
+ // find_start_brace(), which may be changed somewhere.
+ tryposBraceCopy = *tryposBrace;
+ tryposBrace = &tryposBraceCopy;
trypos = tryposBrace;
ourscope = trypos->lnum;
start = ml_get(ourscope);