From 87cce993831929ad4f0c33279533f6db5be75228 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 1 May 2022 11:55:31 +0800 Subject: [PATCH] pref(chat): disable cursorline & update buffer content once --- bundle/vim-chat/autoload/chat/windows.vim | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bundle/vim-chat/autoload/chat/windows.vim b/bundle/vim-chat/autoload/chat/windows.vim index 5cb372963..f8c548e4b 100644 --- a/bundle/vim-chat/autoload/chat/windows.vim +++ b/bundle/vim-chat/autoload/chat/windows.vim @@ -205,19 +205,21 @@ endfunction function! s:update_msg_screen() abort if s:msg_win_opened normal! gg"_dG + let buffer = [] let msgs = filter(deepcopy(s:messages), 'v:val["room"] ==# s:current_channel') for msg in msgs let name = s:get_str_with_width(msg['user'], 13) let message = s:get_lines_with_width(msg['msg'], winwidth('$') - 36) let first_line = '[' . msg['time'] . '] ' . nr2char(9474) . repeat(' ', 13 - strwidth(name)) . name . ' ' . nr2char(9474) . ' ' . message[0] - call append(line('$'), first_line) + call add(buffer, first_line) if len(message) > 1 for l in message[1:] - call append(line('$'), repeat(' ', 18) . ' ' . nr2char(9474) . ' ' .repeat(' ', 12) . ' ' . nr2char(9474) . ' ' . l) + call add(buffer, repeat(' ', 18) . ' ' . nr2char(9474) . ' ' .repeat(' ', 12) . ' ' . nr2char(9474) . ' ' . l ) endfor endif endfor - normal! gg"_ddG + call setline(1, buffer) + normal! G redraw call s:echon() endif @@ -254,6 +256,7 @@ function! s:windowsinit() abort setl filetype=vimchat setl concealcursor=nivc setl conceallevel=2 + setl nocursorline endfunction let s:enter_history = []