<commit_before>'use strict'

const sy = require('../lib/sy')
const ui = require('../lib/ui')
const utils = require('./utils.js')
const path = require('path')
const ipc = require('electron').ipcRenderer;

function scrollTo(element) {
  var top = element.getBoundingClientRect().top
  ui.sideBar.scrollTop = top
}

function scrollToRelative(from, to) {
  var fromTop = from.getBoundingClientRect().top
  var toTop = to.getBoundingClientRect().top
  ui.sideBar.scrollTop += toTop - fromTop
}

function clear() {
  while (ui.directoryTree.firstChild) {
      ui.directoryTree.removeChild(ui.directoryTree.firstChild)
  }
}

function appendLink(filePath, referer, click) {
  var link = document.createElement('span')
  link.className = 'nav-group-item'

  var file = path.basename(filePath)
  link.id = referer === file ? 'directory-current-page' : ''

  var klass = sy.isDirectory(filePath) ? "icon-folder" : "icon-picture"
  link.innerHTML = '<span class="icon ' + klass + '"></span>' + file + '</span>'

  link.setAttribute('href', path.normalize(filePath))

  link.addEventListener("click", click, false)
  ui.directoryTree.appendChild(link)
}

function clickFileLink(filePath) {
  if (sy.isDirectory(filePath)) {
    utils.jump(filePath)
  }
}

class DirectoryView {

  render(data) {<commit_msg>Bugfix: check on marking current<commit_after>'use strict'

const sy = require('../lib/sy')
const ui = require('../lib/ui')
const utils = require('./utils.js')
const path = require('path')
const ipc = require('electron').ipcRenderer;

function scrollTo(element) {
  var top = element.getBoundingClientRect().top
  ui.sideBar.scrollTop = top
}

function scrollToRelative(from, to) {
  var fromTop = from.getBoundingClientRect().top
  var toTop = to.getBoundingClientRect().top
  ui.sideBar.scrollTop += toTop - fromTop
}

function clear() {
  while (ui.directoryTree.firstChild) {
      ui.directoryTree.removeChild(ui.directoryTree.firstChild)
  }
}

function appendLink(filePath, referer, click) {
  var link = document.createElement('span')
  link.className = 'nav-group-item'

  link.id = referer == filePath ? 'directory-current-page' : ''

  var klass = sy.isDirectory(filePath) ? "icon-folder" : "icon-picture"
  link.innerHTML = '<span class="icon ' + klass + '"></span>' + path.basename(filePath) + '</span>'

  link.setAttribute('href', path.normalize(filePath))

  link.addEventListener("click", click, false)
  ui.directoryTree.appendChild(link)
}

function clickFileLink(filePath) {
  if (sy.isDirectory(filePath)) {
    utils.jump(filePath)
  }
}

class DirectoryView {

  render(data) {
{'fraction_non_alphanumeric': 0.15292758089368258, 'fraction_numerical': 0.0, 'mean_word_length': 4.51380042462845, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '6795970', 'n_tokens_mistral': 852, 'n_tokens_neox': 841, 'n_words': 167}