<commit_before>TModalTextView = kindof(TWindow)
TModalTextView.can.init = function(Desktop, fileName, viewClass, colors) {
	dnaof(this)
	this.title = fileName
	this.scrollBar = TScrollBar.create(colors)
	this.add(this.scrollBar)
	this.viewer = viewClass.create(fileName)
	this.viewer.pal = colors
	this.add(this.viewer)
	this.scrollBar.disabled = true
	this.scrollBar.track = this.viewer.track.bind(this.viewer)
	this.scrollBar.pal = [this.viewer.pal[0], this.viewer.pal[1]]
	this.react(100, keycode.ESCAPE, this.close)//Prompt)
	this.react(100, keycode['o'], this.commandShowOutput)
	this.react(0, keycode.F9, this.commandRun)
	this.react(100, keycode.F9, this.commandRunNew)
	this.actor = this.viewer
	this.runCommand = ''
	this.runCwd = (fileName.split('/'))
	this.runCwd.pop()
	this.runCwd = this.runCwd.join('/')
	var syntax = colors
	this.pal = [syntax[0], syntax[1], syntax[2], syntax[3]]//colors
	this.fileName = fileName
}

TModalTextView.can.runDone = function() {
	this.hideOutput()
}

var fileRunCommands = []
function findFileCmd(name) {
	var n = fileRunCommands
	for (var i = 0; i < n.length; i++) if (n[i].name == name) return n[i]
}

TModalTextView.can.commandRun = function() {
	if (this.runCommand == '') {
		var N = findFileCmd(this.fileName)
		if (N) {
			this.runCommand = N.command
		} else return this.commandRunNew()
	}
	this.viewer.save()
	var o = this.norton.output
	o.size(this.w - 2, this.h - 2) // НАДО: используй window.getInnerSize // а его пока нет 
	o.pos(1, 1)
	var f = this.runDone.bind(this)
	this.showOutput()
	o.respawn(this.runCommand, '', this.runCwd, f)
	return true
}

TModalTextView.can.commandRunNew = function() {
	var me = this
	var w = TInputBox.create(50, 'Выполнить', 'Имя файла и передаваемые аргументы', function(text) {
		me.runCommand = text
		var N = findFileCmd(me.fileName)
		if (N) N.command = text; else fileRunCommands.push({name: me.fileName, command: text})

		if (text != '') me.commandRun()
		else messageBox(
			me.getDesktop(), 
			'Обратите внимание, что вы ничего не ввели и комманда теперь пустая')
	})
	w.input.setText('node ' + this.fileName.split('/').pop())
	this.getDesktop().showModal(w)
	return true
}

TModalTextView.can.showOutput = function() {
	var me = this, o = me.norton.output
	me.viewer.curLineHilite = false
	me.hide(me.viewer)
	me.hide(me.scrollBar)
	me.add(o)
	me.actor = undefined
	o.disabled = true
}
<commit_msg>control+C в правке чтобы прибить зависшую прогу<commit_after>TModalTextView = kindof(TWindow)
TModalTextView.can.init = function(Desktop, fileName, viewClass, colors) {
	dnaof(this)
	this.title = fileName
	this.scrollBar = TScrollBar.create(colors)
	this.add(this.scrollBar)
	this.viewer = viewClass.create(fileName)
	this.viewer.pal = colors
	this.add(this.viewer)
	this.scrollBar.disabled = true
	this.scrollBar.track = this.viewer.track.bind(this.viewer)
	this.scrollBar.pal = [this.viewer.pal[0], this.viewer.pal[1]]
	this.react(100, keycode.ESCAPE, this.close)//Prompt)
	this.react(100, keycode['o'], this.commandShowOutput)
	this.react(0, keycode.F9, this.commandRun)
	this.react(100, keycode.F9, this.commandRunNew)
	this.react(100, keycode['c'], this.commandKill)
	this.actor = this.viewer
	this.runCommand = ''
	this.runCwd = (fileName.split('/'))
	this.runCwd.pop()
	this.runCwd = this.runCwd.join('/')
	var syntax = colors
	this.pal = [syntax[0], syntax[1], syntax[2], syntax[3]]//colors
	this.fileName = fileName
}

TModalTextView.can.runDone = function() {
	this.hideOutput()
}

var fileRunCommands = []
function findFileCmd(name) {
	var n = fileRunCommands
	for (var i = 0; i < n.length; i++) if (n[i].name == name) return n[i]
}

TModalTextView.can.commandRun = function() {
	if (this.runCommand == '') {
		var N = findFileCmd(this.fileName)
		if (N) {
			this.runCommand = N.command
		} else return this.commandRunNew()
	}
	this.viewer.save()
	var o = this.norton.output
	o.size(this.w - 2, this.h - 2) // НАДО: используй window.getInnerSize // а его пока нет 
	o.pos(1, 1)
	var f = this.runDone.bind(this)
	this.showOutput()
	o.respawn(this.runCommand, '', this.runCwd, f)
	return true
}

TModalTextView.can.commandKill = function() {
	var o = this.norton.output
	o.kill()
	return true
}

TModalTextView.can.commandRunNew = function() {
	var me = this
	var w = TInputBox.create(50, 'Выполнить', 'Имя файла и передаваемые аргументы', function(text) {
		me.runCommand = text
		var N = findFileCmd(me.fileName)
		if (N) N.command = text; else fileRunCommands.push({name: me.fileName, command: text})

		if (text != '') me.commandRun()
		else messageBox(
			me.getDesktop(), 
			'Обратите внимание, что вы ничего не ввели и комманда теперь пустая')
	})
	w.input.setText('node ' + this.fileName.split('/').pop())
	this.getDesktop().showModal(w)
	return true
}

TModalTextView.can.showOutput = function() {
	var me = this, o = me.norton.output
	me.viewer.curLineHilite = false
	me.hide(me.viewer)
	me.hide(me.scrollBar)
	me.add(o)
	me.actor = undefined
	o.disabled = true
}

{'fraction_non_alphanumeric': 0.15480248646480851, 'fraction_numerical': 0.010627631842791257, 'mean_word_length': 4.283898305084746, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '587969', 'n_tokens_mistral': 1994, 'n_tokens_neox': 1979, 'n_words': 385}