From 992ffadef3925e3fc41978f14f0fbda6d9c9aada Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 3 May 2022 22:00:28 +0800 Subject: [PATCH] fix(protocal): keep protocal when fail to switch --- bundle/vim-chat/autoload/chat/windows.vim | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bundle/vim-chat/autoload/chat/windows.vim b/bundle/vim-chat/autoload/chat/windows.vim index 85faa3ede..7db4be851 100644 --- a/bundle/vim-chat/autoload/chat/windows.vim +++ b/bundle/vim-chat/autoload/chat/windows.vim @@ -379,6 +379,7 @@ function! s:enter() abort let s:c_begin = '' return elseif s:c_begin . s:c_char . s:c_end =~# '/set_protocol\s*' + let saved_protocal = s:protocol let s:protocol = matchstr(s:c_begin . s:c_char . s:c_end, '/set_protocol\s*\zs\S*') let s:c_end = '' let s:c_char = '' @@ -389,6 +390,15 @@ function! s:enter() abort let s:opened_channels[s:protocol] = [] endif catch + call chat#windows#push({ + \ 'user' : '--->', + \ 'username' : '--->', + \ 'room' : '', + \ 'protocol' : s:protocol, + \ 'msg' : 'protocal does not exists: ' . s:current_channel, + \ 'time': strftime("%Y-%m-%d %H:%M"), + \ }) + let s:protocol = saved_protocal endtry call s:update_msg_screen() return @@ -410,7 +420,7 @@ function! s:enter() abort \ 'username' : '--->', \ 'room' : saved_channel, \ 'protocol' : s:protocol, - \ 'msg' : 'can not find channel:' . s:current_channel, + \ 'msg' : 'channel does not exists: ' . s:current_channel, \ 'time': strftime("%Y-%m-%d %H:%M"), \ }) let s:current_channel = saved_channel