<commit_before>namespace CSharpMath.Editor {
  using System;
  using System.Collections.Generic;
  using System.Drawing;
  using System.Linq;
  using Display;
  using Display.Text;
  using FrontEnd;
  using Color = Structures.Color;

  partial class DisplayEditingExtensions {
    public static MathListIndex IndexForPoint<TFont, TGlyph>(this ListDisplay<TFont, TGlyph> self, TypesettingContext<TFont, TGlyph> context, PointF point) where TFont : IFont<TGlyph> {
      // The origin of for the subelements of a MathList is the current position, so translate the current point to our origin.
      var translatedPoint = new PointF(point.X - self.Position.X, point.Y - self.Position.Y);

      IDisplay<TFont, TGlyph> closest = null;
      var xbounds = new List<IDisplay<TFont, TGlyph>>();
      float minDistance = float.MaxValue;
      foreach (var display in self.Displays) {
        var bounds = display.DisplayBounds;
        var rect = new RectangleF(display.Position, bounds.Size);
        var maxBoundsX = rect.Right;
        if (bounds.X - PixelDelta <= translatedPoint.X && translatedPoint.X <= maxBoundsX + PixelDelta)
          xbounds.Add(display);
        var distance = DistanceFromPointToRect(translatedPoint, rect);
        if (distance < minDistance) {
          closest = display;
          minDistance = distance;
        }
      }
      IDisplay<TFont, TGlyph> displayWithPoint;
      switch (xbounds.Count) {
        case 0:
          if (translatedPoint.X <= -PixelDelta)<commit_msg>small fix<commit_after>namespace CSharpMath.Editor {
  using System;
  using System.Collections.Generic;
  using System.Drawing;
  using System.Linq;
  using Display;
  using Display.Text;
  using FrontEnd;
  using Color = Structures.Color;

  partial class DisplayEditingExtensions {
    public static MathListIndex IndexForPoint<TFont, TGlyph>(this ListDisplay<TFont, TGlyph> self, TypesettingContext<TFont, TGlyph> context, PointF point) where TFont : IFont<TGlyph> {
      // The origin of for the subelements of a MathList is the current position, so translate the current point to our origin.
      var translatedPoint = new PointF(point.X - self.Position.X, point.Y - self.Position.Y);

      IDisplay<TFont, TGlyph> closest = null;
      var xbounds = new List<IDisplay<TFont, TGlyph>>();
      float minDistance = float.MaxValue;
      foreach (var display in self.Displays) {
        var bounds = display.DisplayBounds;
        var rect = new RectangleF(display.Position, bounds.Size);
        var maxBoundsX = rect.Right;
        if (rect.X - PixelDelta <= translatedPoint.X && translatedPoint.X <= maxBoundsX + PixelDelta)
          xbounds.Add(display);
        var distance = DistanceFromPointToRect(translatedPoint, rect);
        if (distance < minDistance) {
          closest = display;
          minDistance = distance;
        }
      }
      IDisplay<TFont, TGlyph> displayWithPoint;
      switch (xbounds.Count) {
        case 0:
          if (translatedPoint.X <= -PixelDelta)
{'fraction_non_alphanumeric': 0.09054593874833555, 'fraction_numerical': 0.0006657789613848203, 'mean_word_length': 3.0940054495912808, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 19, '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': '1691822', 'n_tokens_mistral': 872, 'n_tokens_neox': 856, 'n_words': 246}