package vcaml

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file window.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
open! Core
open! Async
open! Import
open! Vcaml
open Test_client

let%expect_test "get_height, set_height" =
  let%bind () =
    with_client (fun client ->
      let open Deferred.Or_error.Let_syntax in
      let%bind win = Vcaml.Nvim.get_current_win |> run_join [%here] client in
      let%bind () =
        Window.set_height ~window:win ~height:10 |> run_join [%here] client
      in
      let%bind height = Window.get_height ~window:win |> run_join [%here] client in
      print_s [%message (height : int)];
      return ())
  in
  [%expect "(height 10)"];
  return ()
;;

let%expect_test "get_cursor, set_cursor" =
  let%bind () =
    with_client (fun client ->
      let open Deferred.Or_error.Let_syntax in
      let%bind win = Vcaml.Nvim.get_current_win |> run_join [%here] client in
      let%bind () =
        Vcaml.Nvim.feedkeys ~keys:"ithisisatest" ~mode:"n" ~escape_csi:false
        |> run_join [%here] client
      in
      let%bind { row; col } =
        Vcaml.Window.get_cursor ~window:win |> run_join [%here] client
      in
      print_s [%message (row : int) (col : int)];
      let%bind () =
        Vcaml.Window.set_cursor ~window:win { row = 1; col = 5 }
        |> run_join [%here] client
      in
      let%bind position =
        Vcaml.Window.get_cursor ~window:win |> run_join [%here] client
      in
      print_s [%sexp (position : Position.One_indexed_row.t)];
      return ())
  in
  [%expect {|
    ((row 1) (col 11))
    ((row 1) (col 5)) |}];
  return ()
;;
OCaml

Innovation. Community. Security.