diff options
author | cathook <b01902109@csie.ntu.edu.tw> | 2014-11-05 02:20:58 +0800 |
---|---|---|
committer | cathook <b01902109@csie.ntu.edu.tw> | 2014-11-05 02:20:58 +0800 |
commit | 3f84cb8b7c2aa24e739ae1a02c883e1e4cdb4004 (patch) | |
tree | 3832af58287c2e35a7f4e061acdfdcb97c4408c5 | |
parent | b03e0b80e59fc649a7d26c880d10b545aeee6024 (diff) | |
download | vim-shrvim-3f84cb8b7c2aa24e739ae1a02c883e1e4cdb4004.tar.gz vim-shrvim-3f84cb8b7c2aa24e739ae1a02c883e1e4cdb4004.tar.zst vim-shrvim-3f84cb8b7c2aa24e739ae1a02c883e1e4cdb4004.zip |
Fix little bug.
-rw-r--r-- | shared_vim.vim | 8 | ||||
-rwxr-xr-x | shared_vim_server | 4 |
2 files changed, 10 insertions, 2 deletions
diff --git a/shared_vim.vim b/shared_vim.vim index d2b06f5..8a3fea2 100644 --- a/shared_vim.vim +++ b/shared_vim.vim @@ -178,6 +178,9 @@ def nums_to_rcs(lines, nums): else: break num = num_max + 1 + for index in range(len(rcs)): + if rcs[index] is None: + rcs[index] = (len(lines) - 1, len(lines[-1])) return rcs @@ -224,6 +227,8 @@ def main(): raise Exception('from server: ' + response[JSON_TOKEN.ERROR]) else: lines = re.split(r'\n', response[JSON_TOKEN.TEXT]) + if not lines: + lines = [''] rcs = nums_to_rcs(lines, response[JSON_TOKEN.CURSORS]) my_rc = nums_to_rcs(lines, [response[JSON_TOKEN.CURSOR]])[0] @@ -247,11 +252,14 @@ function! SharedVimEventsHandler(event_name) if exists('b:shared_vim_server_name') if a:event_name == 'VimCursorMoved' call SharedVimSync() + elseif a:event_name == 'VimCursorMovedI' + call SharedVimSync() endif endif endfunction autocmd CursorMoved * call SharedVimEventsHandler('VimCursorMoved') +autocmd CursorMovedI * call SharedVimEventsHandler('VimCursorMovedI') highlight SharedVimOthersCursors ctermbg=darkred diff --git a/shared_vim_server b/shared_vim_server index dd88155..54354bd 100755 --- a/shared_vim_server +++ b/shared_vim_server @@ -975,13 +975,13 @@ def main(): help_str = '[USAGE] %s <port_number> <user_list> <save_file>' % sys.argv[0] if len(sys.argv) != 4: - normal_print('Wrong arguments!!\n%s' % help_str, prompt=False) + normal_print('Wrong arguments!!\n%s\n' % help_str, prompt=False) exit(1) try: port = int(sys.argv[1]) except ValueError: - normal_print('Wrong port!!\n%s' % help_str, prompt=False) + normal_print('Wrong port!!\n%s\n' % help_str, prompt=False) exit(1) users_pool = UsersPool(TextChain(sys.argv[3])) |