<commit_before>require "helper"

module Neovim
  RSpec.describe Window do
    let(:client) { Neovim.attach_child(["nvim", "--headless", "-n", "-u", "NONE"]) }
    let(:window) { client.current.window }

    describe "if_ruby compatibility" do
      describe "#buffer" do
        it "returns the buffer displayed in the window" do
          expect(window.buffer).to be_a(Buffer)
        end
      end

      describe "#height" do
        it "returns the height of the window" do
          client.set_option("lines", 5)
          expect(window.height).to be(3)
        end
      end

      describe "#height=" do
        it "sets the height of the window" do
          expect {
            window.height = 5
          }.to change { window.height }.to(5)
        end
      end

      describe "#width" do
        it "returns the width of the window" do
          client.set_option("columns", 20)
          expect(window.width).to be(20)
        end
      end

      describe "#width=" do
        it "sets the width of the window" do
          pending "This doesn't seem to actually do anything"

          expect {
            window.width = 20
          }.to change { window.width }.to(20)
        end
      end

      describe "#cursor" do
        it "returns the cursor coordinates" do
          expect(window.cursor).to eq([1, 0])
        end
      end

      describe "#cursor=" do
        it "sets the cursor coodinates" do
          window.buffer.lines = ["one", "two"]

          expect {
            window.cursor = [2, 2]
          }.to change { window.cursor }.to([2, 2])
        end
      end
    end
  end
end<commit_msg>Fix pending window spec with vertical split<commit_after>require "helper"

module Neovim
  RSpec.describe Window do
    let(:client) { Neovim.attach_child(["nvim", "--headless", "-n", "-u", "NONE"]) }
    let(:window) { client.current.window }

    describe "if_ruby compatibility" do
      describe "#buffer" do
        it "returns the buffer displayed in the window" do
          expect(window.buffer).to be_a(Buffer)
        end
      end

      describe "#height" do
        it "returns the height of the window" do
          client.set_option("lines", 5)
          expect(window.height).to be(3)
        end
      end

      describe "#height=" do
        it "sets the height of the window" do
          expect {
            window.height = 5
          }.to change { window.height }.to(5)
        end
      end

      describe "#width" do
        it "returns the width of the window" do
          client.set_option("columns", 20)
          expect(window.width).to be(20)
        end
      end

      describe "#width=" do
        it "sets the width of a vertically split window" do
          client.command("vsplit")

          expect {
            window.width += 1
          }.to change { window.width }.by(1)
        end
      end

      describe "#cursor" do
        it "returns the cursor coordinates" do
          expect(window.cursor).to eq([1, 0])
        end
      end

      describe "#cursor=" do
        it "sets the cursor coodinates" do
          window.buffer.lines = ["one", "two"]

          expect {
            window.cursor = [2, 2]
          }.to change { window.cursor }.to([2, 2])
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.10582494663007014, 'fraction_numerical': 0.01036901494358036, 'mean_word_length': 1.7085053674649051, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4008828', 'n_tokens_mistral': 965, 'n_tokens_neox': 914, 'n_words': 314}