1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 17:40:06 +08:00

fix(vimchat): fix mouse position

This commit is contained in:
wsdjeg 2022-05-04 12:12:14 +08:00
parent af243de9a7
commit d1926518d0

View File

@ -115,10 +115,10 @@ function! chat#windows#open() abort
call s:enter() call s:enter()
elseif char ==# "\<LeftMouse>" elseif char ==# "\<LeftMouse>"
let mouse_left_lnum = v:mouse_lnum let mouse_left_lnum = v:mouse_lnum
let mouse_left_col = v:mouse_col let mouse_left_col = getmousepos().column
elseif char ==# "\<LeftRelease>" || char ==# "\x80\xfd-" elseif char ==# "\<LeftRelease>" || char ==# "\x80\xfd-"
let mouse_left_release_lnum = v:mouse_lnum let mouse_left_release_lnum = v:mouse_lnum
let mouse_left_relsese_col = v:mouse_col let mouse_left_relsese_col = getmousepos().column
let selected_text = s:high_pso(mouse_left_lnum, mouse_left_col, mouse_left_release_lnum, mouse_left_relsese_col) let selected_text = s:high_pso(mouse_left_lnum, mouse_left_col, mouse_left_release_lnum, mouse_left_relsese_col)
elseif char ==# "\<C-c>" elseif char ==# "\<C-c>"
" copy select text " copy select text
@ -270,8 +270,8 @@ endfunction
function! s:high_pso(l, c, rl, rc) abort function! s:high_pso(l, c, rl, rc) abort
let l = a:l let l = a:l
let rl = a:rl let rl = a:rl
let c = strlen(strcharpart(getline(l), 0, a:c)) + 1 let c = strlen(strpart(getline(l), 0, a:c)) + 1
let rc = strlen(strcharpart(getline(rl), 0, a:rc)) + 1 let rc = strlen(strpart(getline(rl), 0, a:rc)) + 1
call clearmatches() call clearmatches()
let selected_text = [] let selected_text = []
if l ==# rl && c == rc if l ==# rl && c == rc