<commit_before>#!/usr/bin/env bash

CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $CURRENT_DIR/utils.sh

match_lookup_table=$(fingers_tmp)
pane_output_temp=$(fingers_tmp)
flushed_input=0

# exporting them so they can be properly deleted at fingers.sh handle_exit trap
export match_lookup_table
export pane_output_temp

function lookup_match() {
  local input=$1
  echo "$(cat $match_lookup_table | grep "^$input:" | sed "s/^$input://" | head -n 1)"
}

function get_stdin() {
  if [[ $(cat $pane_output_temp | wc -l) -gt 0 ]]; then
    cat $pane_output_temp
  else
    flushed_input="1"
    tee $pane_output_temp
  fi
}

function show_hints() {
  local fingers_pane_id=$1
  local compact_hints=$2

  clear_screen "$fingers_pane_id"
  get_stdin | FINGERS_COMPACT_HINTS="$compact_hints" gawk -f $CURRENT_DIR/hinter.awk 3> $match_lookup_table
}

function show_hints_and_swap() {
  current_pane_id=$1
  fingers_pane_id=$2
  compact_state=$3
  tmux swap-pane -s "$current_pane_id" -t "$fingers_pane_id"
  show_hints "$fingers_pane_id" $compact_state
}<commit_msg>swap panes after showing hints ( fixes #26 )<commit_after>#!/usr/bin/env bash

CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $CURRENT_DIR/utils.sh

match_lookup_table=$(fingers_tmp)
pane_output_temp=$(fingers_tmp)
flushed_input=0

# exporting them so they can be properly deleted at fingers.sh handle_exit trap
export match_lookup_table
export pane_output_temp

function lookup_match() {
  local input=$1
  echo "$(cat $match_lookup_table | grep "^$input:" | sed "s/^$input://" | head -n 1)"
}

function get_stdin() {
  if [[ $(cat $pane_output_temp | wc -l) -gt 0 ]]; then
    cat $pane_output_temp
  else
    flushed_input="1"
    tee $pane_output_temp
  fi
}

function show_hints() {
  local fingers_pane_id=$1
  local compact_hints=$2

  clear_screen "$fingers_pane_id"
  get_stdin | FINGERS_COMPACT_HINTS="$compact_hints" gawk -f $CURRENT_DIR/hinter.awk 3> $match_lookup_table
}

function show_hints_and_swap() {
  current_pane_id=$1
  fingers_pane_id=$2
  compact_state=$3
  show_hints "$fingers_pane_id" $compact_state
  tmux swap-pane -s "$current_pane_id" -t "$fingers_pane_id"
}
{'fraction_non_alphanumeric': 0.12619589977220957, 'fraction_numerical': 0.01184510250569476, 'mean_word_length': 5.185915492957746, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2175481', 'n_tokens_mistral': 890, 'n_tokens_neox': 845, 'n_words': 183}