<commit_before>{$$, BufferedProcess, SelectListView} = require 'atom'
SelectStageHunks = require './select-stage-hunks-view'
git = require '../git'

module.exports =
class SelectStageHunkFile extends SelectListView

  initialize: (items) ->
    super
    @addClass 'overlay from-top'

    @setItems items
    atom.workspaceView.append this
    @focusFilterEditor()

  getFilterKey: -> 'path'

  viewForItem: (item) ->
    $$ ->
      @li =>
        @div class: 'pull-right', =>
          @span class: 'inline-block highlight', item.mode
        @span class: 'text-warning', item.path

  confirmed: ({path}) ->
    @cancel()
    git.diff(
      (data) -> new SelectStageHunks(data),
      path
    )<commit_msg>Upgrade stage hunk file view<commit_after>{BufferedProcess} = require 'atom'
{$$, SelectListView} = require 'atom-space-pen-views'
SelectStageHunks = require './select-stage-hunks-view'
git = require '../git'

module.exports =
class SelectStageHunkFile extends SelectListView

  initialize: (items) ->
    super
    @show()

    @setItems items
    @focusFilterEditor()

  getFilterKey: -> 'path'

  show: ->
    @panel ?= atom.workspace.addModalPanel(item: this)
    @panel.show()

  cancelled: -> @hide()

  hide: ->
    @panel?.hide()

  viewForItem: (item) ->
    $$ ->
      @li =>
        @div class: 'pull-right', =>
          @span class: 'inline-block highlight', item.mode
        @span class: 'text-warning', item.path

  confirmed: ({path}) ->
    @cancel()
    git.diff(
      (data) -> new SelectStageHunks(data),
      path
    )
{'fraction_non_alphanumeric': 0.1525096525096525, 'fraction_numerical': 0.0, 'mean_word_length': 2.8206388206388207, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 22, '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': '5441195', 'n_tokens_mistral': 508, 'n_tokens_neox': 485, 'n_words': 114}