<commit_before>_ = require 'underscore-plus'
# {Point} = require 'atom'

module.exports =
class NonNavigation
  constructor: (@editor) ->

  destroy: ->

  moveToNextBoundary: ->
    for cursor in @cursors()
      scope = scope or cursor.getScopeDescriptor()
      if position = cursor.getNextWordBoundaryBufferPosition(@cursorOptions(scope))
        cursor.setBufferPosition(position)

  wordAndNonWordRegExp: (scope, options={}) ->
    nonWordCharacters = atom.config.get(scope, 'editor.nonWordCharacters')
    segments = ["^[\t ]*$"]
    segments.push("[^\\s#{_.escapeRegExp(nonWordCharacters)}]+")
    segments.push("[#{_.escapeRegExp(nonWordCharacters)}]?")
    new RegExp(segments.join("|"), "g")

  cursors: ->
    if @editor then @editor.getCursors() else []

  cursorOptions: (scope, options={}) ->
    {wordRegex: @wordAndNonWordRegExp(scope, options)}<commit_msg>Clean<commit_after>_ = require 'underscore-plus'

module.exports =
class NonNavigation
  constructor: (@editor) ->

  destroy: ->

  moveToNextBoundary: ->
    for cursor in @cursors()
      scope = scope or cursor.getScopeDescriptor()
      options = @cursorOptions(scope)
      if position = cursor.getNextWordBoundaryBufferPosition(options)
        cursor.setBufferPosition(position)

  wordAndNonWordRegExp: (scope, options={}) ->
    nonWordCharacters = atom.config.get(scope, 'editor.nonWordCharacters')
    segments = ["^[\t ]*$"]
    segments.push("[^\\s#{_.escapeRegExp(nonWordCharacters)}]+")
    segments.push("[#{_.escapeRegExp(nonWordCharacters)}]?")
    new RegExp(segments.join("|"), "g")

  cursors: ->
    if @editor then @editor.getCursors() else []

  cursorOptions: (scope, options={}) ->
    {wordRegex: @wordAndNonWordRegExp(scope, options)}
{'fraction_non_alphanumeric': 0.15947035118019573, 'fraction_numerical': 0.0, 'mean_word_length': 4.414330218068536, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '4978993', 'n_tokens_mistral': 552, 'n_tokens_neox': 549, 'n_words': 98}