everything in here shamelessly copied from ripgrep itself