1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 00:20:05 +08:00

pref(chat): disable cursorline & update buffer content once

This commit is contained in:
wsdjeg 2022-05-01 11:55:31 +08:00
parent 21264bdcb3
commit 87cce99383

View File

@ -205,19 +205,21 @@ endfunction
function! s:update_msg_screen() abort function! s:update_msg_screen() abort
if s:msg_win_opened if s:msg_win_opened
normal! gg"_dG normal! gg"_dG
let buffer = []
let msgs = filter(deepcopy(s:messages), 'v:val["room"] ==# s:current_channel') let msgs = filter(deepcopy(s:messages), 'v:val["room"] ==# s:current_channel')
for msg in msgs for msg in msgs
let name = s:get_str_with_width(msg['user'], 13) let name = s:get_str_with_width(msg['user'], 13)
let message = s:get_lines_with_width(msg['msg'], winwidth('$') - 36) 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] 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 if len(message) > 1
for l in 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 endfor
endif endif
endfor endfor
normal! gg"_ddG call setline(1, buffer)
normal! G
redraw redraw
call s:echon() call s:echon()
endif endif
@ -254,6 +256,7 @@ function! s:windowsinit() abort
setl filetype=vimchat setl filetype=vimchat
setl concealcursor=nivc setl concealcursor=nivc
setl conceallevel=2 setl conceallevel=2
setl nocursorline
endfunction endfunction
let s:enter_history = [] let s:enter_history = []