<commit_before>module Compass::Magick::Commands
  class Crop < Compass::Magick::Command
    include Compass::Magick::Util

    def initialize(x1 = nil, y1 = nil, x2 = nil, y2 = nil)
      @x1 = x1
      @y1 = y1
      @x2 = x2
      @y2 = y2
    end

    def invoke(image)
      x1 = number_value(@x1, image.columns - 1, 0)
      y1 = number_value(@y1, image.rows - 1,    0)
      x2 = number_value(@x2, image.columns - 1, image.columns - 1)
      y2 = number_value(@y2, image.rows - 1,    image.rows - 1)
      x1, x2 = x2, x1 if x1 > x2
      y1, y2 = y2, y1 if y1 > y2
      image.crop(x1, y1, x2 - x1, y2 - y1)
    end
  end
end<commit_msg>Address an off-by-one issue in Crop command.<commit_after>module Compass::Magick::Commands
  class Crop < Compass::Magick::Command
    include Compass::Magick::Util

    def initialize(x1 = nil, y1 = nil, x2 = nil, y2 = nil)
      @x1 = x1
      @y1 = y1
      @x2 = x2
      @y2 = y2
    end

    def invoke(image)
      x1 = number_value(@x1, image.columns, 0)
      y1 = number_value(@y1, image.rows,    0)
      x2 = number_value(@x2, image.columns, image.columns)
      y2 = number_value(@y2, image.rows,    image.rows)
      x1, x2 = x2, x1 if x1 > x2
      y1, y2 = y2, y1 if y1 > y2
      image.crop(x1, y1, x2 - x1, y2 - y1)
    end
  end
end
{'fraction_non_alphanumeric': 0.13204633204633204, 'fraction_numerical': 0.06640926640926641, 'mean_word_length': 2.1609756097560977, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '4494504', 'n_tokens_mistral': 546, 'n_tokens_neox': 535, 'n_words': 143}