<commit_before>import { commandTrie } from './commandTrie';
import { isModifierKey } from 'lib/keys';
import { commands } from './commands';

export const mode = {
  name: 'Command',
  onCreate: () => {},
  onEnter: async (event) => {
    commandTrie.reset();
  },
  onExit: async (event) => {
    commandTrie.reset();
  },
  onSettingsChange: ({ bindings }) => {
    commandTrie.init(bindings);
  },
  events: {
    keydown: async (event) => {
      if (event.key !== 'Escape') {
        event.stopImmediatePropagation();
      }
      if (!isModifierKey(event)) {
        const command = commandTrie.advance(event);
        if (command) {
          const nextMode = commands[command]();
          if (nextMode) {
            return nextMode;
          }
        }
      }
      return 'Same';
    },
    keypress: async (event) => {
      // NOTE: do not call event.preventDefault();
      // this will break built-in shortcuts on firefox as of 3/2017
      event.stopImmediatePropagation();
      return 'Same';
    },
    keyup: async (event) => {
      event.stopImmediatePropagation();
      return 'Same';
    },
    focusout: (event) => 'Reset',
    focusin: async (event) => 'Reset',
    click: (event) => 'Same',
    mousedown: (event) => 'Same'
  },
  messages: {}
};<commit_msg>quick cleanup<commit_after>import { commandTrie } from './commandTrie';
import { isModifierKey } from 'lib/keys';
import { commands } from './commands';

export const mode = {
  name: 'Command',
  onCreate: () => {},
  onEnter: (event) => {
    commandTrie.reset();
  },
  onExit: (event) => {
    commandTrie.reset();
  },
  onSettingsChange: ({ bindings }) => {
    commandTrie.init(bindings);
  },
  events: {
    keydown: (event) => {
      if (event.key !== 'Escape') {
        event.stopImmediatePropagation();
      }
      if (!isModifierKey(event)) {
        const command = commandTrie.advance(event);
        if (command) {
          const nextMode = commands[command]();
          if (nextMode) {
            return nextMode;
          }
        }
      }
      return 'Same';
    },
    keypress: (event) => {
      // NOTE: do not call event.preventDefault();
      // this will break built-in shortcuts on firefox as of 3/2017
      event.stopImmediatePropagation();
      return 'Same';
    },
    keyup: (event) => {
      event.stopImmediatePropagation();
      return 'Same';
    },
    focusout: (event) => 'Reset',
    focusin: (event) => 'Reset',
    click: (event) => 'Same',
    mousedown: (event) => 'Same'
  },
  messages: {}
};
{'fraction_non_alphanumeric': 0.16352201257861634, 'fraction_numerical': 0.003930817610062893, 'mean_word_length': 2.3664021164021163, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 25, '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': '2200249', 'n_tokens_mistral': 810, 'n_tokens_neox': 805, 'n_words': 183}