<commit_before>package org.sikuli.ide;

import java.io.*;
import java.awt.*;
import java.awt.datatransfer.*;
import java.awt.image.*;
import java.awt.event.*;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
import javax.swing.*;
import javax.swing.text.*;
import javax.swing.filechooser.FileFilter;
import javax.swing.event.CaretEvent;
import javax.swing.event.CaretListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
//import javax.swing.undo.*;

import javax.imageio.*;

import org.python.util.PythonInterpreter; 
import org.python.core.*; 

import org.sikuli.script.ImageLocator;
import org.sikuli.script.ScriptRunner;
import org.sikuli.script.Debug;
import org.sikuli.script.Location;


public class SikuliPane extends JTextPane implements KeyListener, 
                                                     CaretListener{
   private String _editingFilename;
   private String _srcBundlePath = null;
   private boolean _dirty = false;
   private Class _historyBtnClass;
   private CurrentLineHighlighter _highlighter;
   private ImageLocator _imgLocator;

   private String _tabString = "   ";

   private Pattern _lastSearchPattern = null;
   private String _lastSearchString = null;
   private Matcher _lastSearchMatcher;

   private UndoManager _undo = new UndoManager();

   public SikuliPane(){
      setEditorKitForContentType("text/python", new SikuliEditorKit());
      setContentType("text/python");
      initKeyMap();
      addKeyListener(this);
      //setTransferHandler(new JTextPaneTransferHandler());
      _highlighter = new CurrentLineHighlighter(this);
      addCaretListener(_highlighter);
      addCaretListener(this);
      setFont(new Font("Courier", Font.PLAIN, 18));
      setMargin( new Insets( 3, 3, 3, 3 ) );
      //setTabSize(4);
      setBackground(Color.WHITE);
      updateDocumentListeners();
   }

   private void updateDocumentListeners(){
      getDocument().addDocumentListener(new DirtyHandler());
      getDocument().addUndoableEditListener(_undo);
   }

   public UndoManager getUndoManager(){
      return _undo;
   }

   private void initKeyMap(){
      InputMap map = this.getInputMap();
      int shift = InputEvent.SHIFT_MASK;
      map.put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, shift),          
              SikuliEditorKit.sklDeindentAction);
   }


   public void setTabSize(int charactersPerTab)
   {<commit_msg>change selection color on windows<commit_after>package org.sikuli.ide;

import java.io.*;
import java.awt.*;
import java.awt.datatransfer.*;
import java.awt.image.*;
import java.awt.event.*;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
import javax.swing.*;
import javax.swing.text.*;
import javax.swing.filechooser.FileFilter;
import javax.swing.event.CaretEvent;
import javax.swing.event.CaretListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
//import javax.swing.undo.*;

import javax.imageio.*;

import org.python.util.PythonInterpreter; 
import org.python.core.*; 

import org.sikuli.script.ImageLocator;
import org.sikuli.script.ScriptRunner;
import org.sikuli.script.Debug;
import org.sikuli.script.Location;


public class SikuliPane extends JTextPane implements KeyListener, 
                                                     CaretListener{
   private String _editingFilename;
   private String _srcBundlePath = null;
   private boolean _dirty = false;
   private Class _historyBtnClass;
   private CurrentLineHighlighter _highlighter;
   private ImageLocator _imgLocator;

   private String _tabString = "   ";

   private Pattern _lastSearchPattern = null;
   private String _lastSearchString = null;
   private Matcher _lastSearchMatcher;

   private UndoManager _undo = new UndoManager();

   public SikuliPane(){
      setEditorKitForContentType("text/python", new SikuliEditorKit());
      setContentType("text/python");
      initKeyMap();
      addKeyListener(this);
      //setTransferHandler(new JTextPaneTransferHandler());
      _highlighter = new CurrentLineHighlighter(this);
      addCaretListener(_highlighter);
      addCaretListener(this);
      setFont(new Font("Courier", Font.PLAIN, 18));
      setMargin( new Insets( 3, 3, 3, 3 ) );
      //setTabSize(4);
      setBackground(Color.WHITE);
      if(!Utils.isMacOSX())
         setSelectionColor(new Color(170, 200, 255));
      updateDocumentListeners();
   }

   private void updateDocumentListeners(){
      getDocument().addDocumentListener(new DirtyHandler());
      getDocument().addUndoableEditListener(_undo);
   }

   public UndoManager getUndoManager(){
      return _undo;
   }

   private void initKeyMap(){
      InputMap map = this.getInputMap();
      int shift = InputEvent.SHIFT_MASK;
      map.put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, shift),          
              SikuliEditorKit.sklDeindentAction);
   }


   public void setTabSize(int charactersPerTab)
   {
{'fraction_non_alphanumeric': 0.10193782801776342, 'fraction_numerical': 0.004642712959224869, 'mean_word_length': 3.630841121495327, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '932735', 'n_tokens_mistral': 1473, 'n_tokens_neox': 1432, 'n_words': 307}