<commit_before>"use strict";

const {round, getPrecision, sortForRegExp, tsvTable} = require("../utils/other.js");
const {hasSelectedText, mutate} = require("../utils/buffer.js");
const {filter, key, prompt} = require("../utils/commands.js");
const EDITOR_PANES = "atom-text-editor:not([mini])";


// Fix for failed indent-detection
atom.commands.add("atom-workspace", "user:unfuck-tabstops", () => {
	const editor = atom.workspace.getActiveTextEditor();
	if(!editor) return;
	const hardenUp = () => atom.commands.dispatch(editor.element, "whitespace:convert-spaces-to-tabs");
	const squashedLines = editor.getText().match(/^\x20{2}(?=\S)/mg);
	
	// Seriously, fuck this tab-stop width.
	if(squashedLines){
		editor.setSoftTabs(true);
		editor.setTabLength(2);
		hardenUp();
	}
	
	else hardenUp();
});


// Inhibit copying to the clipboard without a selection
atom.commands.add("atom-text-editor", "user:copy", event =>
	hasSelectedText(atom.workspace.getActiveTextEditor()) && event.abortKeyBinding());
<commit_msg>Fix `user:copy` command not working in prompt windows<commit_after>"use strict";

const {round, getPrecision, sortForRegExp, tsvTable} = require("../utils/other.js");
const {hasSelectedText, mutate} = require("../utils/buffer.js");
const {filter, key, prompt} = require("../utils/commands.js");
const EDITOR_PANES = "atom-text-editor:not([mini])";


// Fix for failed indent-detection
atom.commands.add("atom-workspace", "user:unfuck-tabstops", () => {
	const editor = atom.workspace.getActiveTextEditor();
	if(!editor) return;
	const hardenUp = () => atom.commands.dispatch(editor.element, "whitespace:convert-spaces-to-tabs");
	const squashedLines = editor.getText().match(/^\x20{2}(?=\S)/mg);
	
	// Seriously, fuck this tab-stop width.
	if(squashedLines){
		editor.setSoftTabs(true);
		editor.setTabLength(2);
		hardenUp();
	}
	
	else hardenUp();
});


// Inhibit copying to the clipboard without a selection
atom.commands.add("atom-text-editor", "user:copy", event =>
	hasSelectedText(event.currentTarget.getModel()) && event.abortKeyBinding());

{'fraction_non_alphanumeric': 0.17957405614714425, 'fraction_numerical': 0.003872216844143272, 'mean_word_length': 5.37962962962963, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': 2, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '774140', 'n_tokens_mistral': 708, 'n_tokens_neox': 673, 'n_words': 131}