fsharp/zarchive-vim-fsharp

fsharpbinding#python#FsiSendSel() sends visual selections multiple times

Banashek opened this issue · 1 comments

It seems that if I have a visual selection and call fsharpbinding#python#FsiSendSel(), it will send the selection once for each line.

Example:

let sample = [|-2; -3; 4; -1; -2; 1; 5; 3;|]
let sample2 = [|-2; 1; -3; 4; -1; 2; 1; -5; 4;|]

It will send both lines twice with output:

val sample : int [] = [|-2; -3; 4; -1; -2; 1; 5; 3|]
val sample2 : int [] = [|-2; 1; -3; 4; -1; 2; 1; -5; 4|]

val sample : int [] = [|-2; -3; 4; -1; -2; 1; 5; 3|]
val sample2 : int [] = [|-2; 1; -3; 4; -1; 2; 1; -5; 4|]

Example 2:

let kadane data =
  let mutable maxV, maxCP = 0, 0
  for i in data do
    maxCP <- max 0 (maxCP + i)
    maxV <- max maxV maxCP
  maxV

It will send the selection 6 times with output:

val kadane : data:seq<int> -> int


val kadane : data:seq<int> -> int


val kadane : data:seq<int> -> int


val kadane : data:seq<int> -> int


val kadane : data:seq<int> -> int


val kadane : data:seq<int> -> int

function looks fine: https://github.com/fsharp/vim-fsharp/blob/1390044c1076890a65e15339c693dde1bd8eea78/autoload/fsharpbinding/python.vim#L432

I'll try debugging the output and see if I can figure it out.

Hey thanks for fixing this! I really appreciate it.