<commit_before>
const {clipboard}  = require('electron');

function copySelection() {
    if (term.hasSelection()) {
        term.copiedText = term.getSelection();
        clipboard.writeText(term.getSelection());
        console.log(clipboard.readText());
        
    }
}

function pasteInTerminal() {
    clipboard.writeText(term.getSelection());    
}
module.exports = function($terminal, devTunnel){
    var term = new Terminal({
        cursorBlink: true
    });
    
    Terminal.prototype.copySelection = function (ev) {
        if (term.hasSelection()) { //only if u have seleted text in terminal otherwise bubble the event to parent element 
            term.copiedText = term.getSelection();
            clipboard.writeText(term.getSelection());
            term.clearSelection();
            ev.stopPropagation();
            return false; // Stop default behaviour of Ctrl + C or mouse event.
        }
    }
    
    Terminal.prototype.pasteInTerminal = function (ev) {
            ev.stopPropagation();
            term.handler(clipboard.readText());
            term.textarea.value = '';
            term.emit('paste', clipboard.readText());
            term.cancel(ev);
        
    }
    term.attachCustomKeyEventHandler(function (e) {
        if (e.type === 'keydown' && e.ctrlKey && e.key === 'c') {
            return this.copySelection(e);              
        }
        if (e.type === 'keydown' && e.ctrlKey && e.key === 'v') {
            this.pasteInTerminal(e);
            return false;
        }
    });
    term.open($terminal[0], {
        focus: true
    });
    $terminal.data('terminal', term);
    //term.writeln("Welcome to SSH Tunnel");
    setTimeout(function(){
        term.fit();
        devTunnel.getShellSocket({cols: term.cols, rows: term.rows, term: 'xterm'}).then(function(socket){
            //socket.write("sudo su\n");
            socket.on('close', function () {
                console.log('Stream :: close');
            }).on('data', function (data) {
                //console.log('STDOUT: ' + data);
                term.write(data.toString("UTF-8"));<commit_msg>Added the paste opte on right click also<commit_after>
const {clipboard}  = require('electron');

function copySelection() {
    if (term.hasSelection()) {
        term.copiedText = term.getSelection();
        clipboard.writeText(term.getSelection());
        console.log(clipboard.readText());
        
    }
}

function pasteInTerminal() {
    clipboard.writeText(term.getSelection());    
}
module.exports = function($terminal, devTunnel){
    var term = new Terminal({
        cursorBlink: true
    });
    
    Terminal.prototype.copySelection = function (ev) {
        if (term.hasSelection()) { //only if u have seleted text in terminal otherwise bubble the event to parent element 
            term.copiedText = term.getSelection();
            clipboard.writeText(term.getSelection());
            term.clearSelection();
            ev.stopPropagation();
            return false; // Stop default behaviour of Ctrl + C or mouse event.
        }
    }
    
    Terminal.prototype.pasteInTerminal = function (ev) {
            ev.stopPropagation();
            term.handler(clipboard.readText());
            term.textarea.value = '';
            term.emit('paste', clipboard.readText());
            term.cancel(ev);
        
    }
    term.attachCustomKeyEventHandler(function (e) {
        if (e.type === 'keydown' && e.ctrlKey && e.key === 'c') {
            return this.copySelection(e);              
        }
        if (e.type === 'keydown' && e.ctrlKey && e.key === 'v') {
            this.pasteInTerminal(e);
            return false;
        }
    });
   
    
    term.open($terminal[0], {
        focus: true
    });
    $terminal.data('terminal', term);
    //term.writeln("Welcome to SSH Tunnel");
    setTimeout(function(){
        term.fit();
        term.element.addEventListener('mousedown', function (ev){
            
                    if(ev.which == 3)
                    {
                          term.pasteInTerminal(ev);
                          console.log("sjdsjds");
                          return false;
                    }
                });
        devTunnel.getShellSocket({cols: term.cols, rows: term.rows, term: 'xterm'}).then(function(socket){
            //socket.write("sudo su\n");
            socket.on('close', function () {
                console.log('Stream :: close');
            }).on('data', function (data) {
                //console.log('STDOUT: ' + data);
                term.write(data.toString("UTF-8"));
{'fraction_non_alphanumeric': 0.14357189471394388, 'fraction_numerical': 0.0010876658690450293, 'mean_word_length': 1.906447534766119, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4515148', 'n_tokens_mistral': 1300, 'n_tokens_neox': 1262, 'n_words': 249}