<commit_before>readline = require('readline')
EventEmitter = require('events').EventEmitter
deasync = require('deasync')
_ = require('underscore')

class MultilineState

  data: ''

  keypress: (input, chars) ->
    @data += chars
    if @data.match(/(\r|\n)\1$/)
      @data = ''
      input.state('single')
      input.send_data()
    else if chars.match(/(\r|\n)$/)
      input.prompt()

  prompt: (input, prompt) ->
    if @data == ''
      input.cli.setPrompt(prompt.replace(/[^>](?!$)/g, '-'))
    else
      input.cli.setPrompt(prompt.replace(/.(?!$)/g, '.'))
    input.cli._refreshLine()

class SinglelineState

  keypress: (input, chars) ->
    if chars is '\u0016'
      input.state('multi')
      input.prompt()
    else if chars.match(/(\r|\n)$/)
      input.send_data()

  prompt: (input, prompt) ->
    input.cli.setPrompt(prompt)
    input.cli.prompt()<commit_msg>Reprompt users instead of refreshing the line.<commit_after>readline = require('readline')
EventEmitter = require('events').EventEmitter
deasync = require('deasync')
_ = require('underscore')

class MultilineState

  data: ''

  keypress: (input, chars) ->
    @data += chars
    if @data.match(/(\r|\n)\1$/)
      @data = ''
      input.state('single')
      input.send_data()
    else if chars.match(/(\r|\n)$/)
      input.prompt()

  prompt: (input, prompt) ->
    if @data == ''
      input.cli.setPrompt(prompt.replace(/[^>](?!$)/g, '-'))
    else
      input.cli.setPrompt(prompt.replace(/.(?!$)/g, '.'))
    input.cli.prompt()

class SinglelineState

  keypress: (input, chars) ->
    if chars is '\u0016'
      input.state('multi')
      input.prompt()
    else if chars.match(/(\r|\n)$/)
      input.send_data()

  prompt: (input, prompt) ->
    input.cli.setPrompt(prompt)
    input.cli.prompt()
{'fraction_non_alphanumeric': 0.19775910364145657, 'fraction_numerical': 0.0056022408963585435, 'mean_word_length': 2.865800865800866, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '7218555', 'n_tokens_mistral': 652, 'n_tokens_neox': 607, 'n_words': 111}