On 31/03/09 13:34, François Ingelrest wrote:
>
> Hi all,
>
> In my status line, I display the number of lines in the corresponding
> buffer. If I split the window, so that I have the same buffer into two
> visible windows, only the status line of the active window is updated.
> For instance, if I add some new lines to the buffer, the number of
> lines in the inactive windows remains the same.
>
> Even more confusing: If I change the file type, the syntax
> highlighting is updated in both windows, but only the file type in the
> status line of the active window is updated, not the other one.
>
> Is it the expected behavior? I would have expected the other status
> line to be updated, even if the corresponding window is inactive,
> since it's the same buffer I'm modifying.
>
> BTW, I'm using Vim 7.2.148 on Ubuntu Linux.

I'm confirming this in gvim 7.2.148 on openSUSE Linux 11.1. I suspect it 
is related to the bug investigated in the thread "How to redraw the 
whole Vim screen after splitting new windows?".

After splitting windows, adding lines (by o followed by several times 
Enter) does not cause the current line number in the non-current window 
to be updated immediately. However, I have a CursorHold,CursorHoldI 
autocommand which changes the color of the StatusLine and Wildmenu 
groups, and when that autocommand triggers, the non-current statusine is 
also updated, even though the autocommand changes neither the 
'statusline' option nor StatusLineNC highlight.

Here are the relevant lines from my "almost-default" colorscheme:


----------------8<--------------------8<--------------------
" display the status line of the active window in a distinctive color:
" bold black on bright red in the GUI, white on green in the console
" (where the bg is never bright, and dark red is sometimes an ugly sort
" of reddish brown).
hi StatusLine   gui=NONE,bold   guibg=red           guifg=black
         \       cterm=NONE,bold ctermbg=darkgreen   ctermfg=white
hi WildMenu     gui=NONE,bold   guibg=green         guifg=black
         \       cterm=NONE,bold ctermbg=black       ctermfg=white
" make the status line bold-reverse (but B&W) for inactive windows
hi StatusLineNC gui=reverse,bold
         \       cterm=NONE      ctermbg=black       ctermfg=lightgrey
" make the active status line colours alternate between two settings
" to give a visual notice of the CursorHold/CursorHoldI events
if ! exists("s:statuslineflag")
   let s:statuslineflag = 0
endif
function! ToggleStatusLine()
     if s:statuslineflag
         hi StatusLine
           \     cterm=NONE,bold ctermbg=darkgreen   ctermfg=white
           \     gui=NONE,bold   guibg=red           guifg=black
         hi WildMenu
           \     cterm=NONE,bold ctermbg=black       ctermfg=white
           \     gui=NONE,bold   guibg=green         guifg=black
     else
         hi StatusLine
           \     cterm=NONE,bold ctermbg=black       ctermfg=white
           \     gui=NONE,bold   guibg=green         guifg=black
         hi WildMenu
           \     cterm=NONE,bold ctermbg=darkgreen   ctermfg=white
           \     gui=NONE,bold   guibg=red           guifg=black
     endif
     let s:statuslineflag = ! s:statuslineflag
endfunction
exe "augroup" s:colors_name
     au! CursorHold,CursorHoldI * call ToggleStatusLine()
     au! ColorScheme *
         \ if g:colors_name != s:colors_name | exe "au!" s:colors_name | 
endif
augroup END
----------------8<--------------------8<--------------------


Both s:colors_name and g:colors-name are set to the colorscheme name 
(outside the part quoted above) when it is sourced.

Continuation lines need 'nocompatible' to be set.


Best regards,
Tony.
-- 
Tussman's Law:
        Nothing is as inevitable as a mistake whose time has come.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to