If focus was lost for the first time after manually setting cursorline but we
were NOT held in insert mode, cursorline would incorrectly be unset when
focus was restored.
Losing focus for the first time after manually setting cursorline when held
in insert mode behaved correctly.
fun! <SID>ToggleCursorLine() "{{{2
call Iain_Vars()
- if b:iainstatus =~# "f" && b:iainstatus =~# "H" && b:iainstatus =~# "I"
- " Focus lost while held in insert mode.
- let b:iaincul = getbufvar("", "&cursorline")
- setlocal cursorline
- elseif ! b:iaincul
- setlocal nocursorline
+ if b:iainstatus =~# "H" && b:iainstatus =~# "I"
+ " We are held in insert mode.
+ if b:iainstatus =~# "f"
+ " And focus was lost.
+ let b:iaincul = getbufvar("", "&cursorline")
+ setlocal cursorline
+ elseif ! b:iaincul
+ setlocal nocursorline
+ endif
endif
endfun "}}}2