<commit_before>module.exports = function(app){
  app.controller("ActiveFilesController", ['$scope','$window', function ($scope, $window) {
    const livewriting = require('livewriting');
    $scope.FileListData = [];
    $scope.isRecording = false;
    $scope.recordingMessage = "Please select a file";
    $scope.recordingButtonMessage = "Record";
    $scope.selectedFile;
    $scope.isSelected = false;
    $scope.isExpanded = false;
    for (file of atom.workspace.getTextEditors()) {
      $scope.FileListData.push({
        name : file.getTitle(),
        checked : false,
        disabled : false,
        editor : file
      });
    }

    atom.workspace.onDidAddPaneItem(function(object){
      $scope.FileListData.push({
        name : object['item'].getTitle(),
        checked : false,
        disabled : $scope.isRecording,
        editor : object['item']
      });
      $scope.$apply();
    })

    atom.workspace.onDidDestroyPaneItem(function(object){
      var name_to_delete = object['item'].getTitle();
      if(name_to_delete == $scope.selectedFile.name){
        if($scope.isRecording)
          $scope.stopRecording();
        else
          $scope.handle_radio_change($scope.selectedFile);
      }
      var count = 0;
      for(file of $scope.FileListData) {
        if(file.name == name_to_delete)
          $scope.FileListData.splice(count,1);
        count++;
      }
      if($scope.FileListData.length == 0)
        $scope.isExpanded = false;
      $scope.$apply();
    })

    $scope.handle_radio_change = function(file_in){
      if($scope.selectedFile == file_in){<commit_msg>Fix error with deleting pane<commit_after>module.exports = function(app){
  app.controller("ActiveFilesController", ['$scope','$window', function ($scope, $window) {
    const livewriting = require('livewriting');
    $scope.FileListData = [];
    $scope.isRecording = false;
    $scope.recordingMessage = "Please select a file";
    $scope.recordingButtonMessage = "Record";
    $scope.selectedFile;
    $scope.isSelected = false;
    $scope.isExpanded = false;
    for (file of atom.workspace.getTextEditors()) {
      $scope.FileListData.push({
        name : file.getTitle(),
        checked : false,
        disabled : false,
        editor : file
      });
    }

    atom.workspace.onDidAddPaneItem(function(object){
      $scope.FileListData.push({
        name : object['item'].getTitle(),
        checked : false,
        disabled : $scope.isRecording,
        editor : object['item']
      });
      $scope.$apply();
    })

    atom.workspace.onDidDestroyPaneItem(function(object){
      var name_to_delete = object['item'].getTitle();
      if($scope.isSelected){
        if(name_to_delete == $scope.selectedFile.name){
          if($scope.isRecording)
            $scope.stopRecording();
          else
            $scope.handle_radio_change($scope.selectedFile);
        }
      }
      var count = 0;
      for(file of $scope.FileListData) {
        if(file.name == name_to_delete)
          $scope.FileListData.splice(count,1);
        count++;
      }
      if($scope.FileListData.length == 0)
        $scope.isExpanded = false;
      $scope.$apply();
    })

    $scope.handle_radio_change = function(file_in){
      if($scope.selectedFile == file_in){
{'fraction_non_alphanumeric': 0.14215985356924954, 'fraction_numerical': 0.0018303843807199512, 'mean_word_length': 2.6352549889135255, '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': '5313744', 'n_tokens_mistral': 991, 'n_tokens_neox': 978, 'n_words': 160}