external/bbop.js
function read_cli(event){

	var which = event.which;
	var ctrl_p = event.ctrlKey;
	//log('cli: ' + which + ', ' + ctrl_p);

	if ( which == 13 ) { // return
	    
	    // Stop events.
	    event.preventDefault();
	    
	    // Get and ensure nice JS, wipe CLI clean.
	    var to_eval = jQuery('#' + command_line.get_id()).val();
	    if( to_eval != '' ){
		jQuery('#' + command_line.get_id()).val('');
		
		// Enter the new command into our history and bump the
		// index to the last thing pushed on.
		history_list.pop(); // pop the empty ''
		history_list.push(to_eval);
		history_list.push(''); // push new empty ''
		history_pointer = history_list.length -1;
		//log('// history: '+history_pointer+', '+history_list.length);
		
		// Log, eval, log.
		to_eval = bbop.core.ensure(to_eval, ';', 'back');
		log(to_eval);
		var evals = _evaluate(to_eval);
		log('// ' + evals[1]);
		_advance_log_to_bottom();

		return false;
	    }
	}else if( ctrl_p && which == 38 ){ // ctrl + up

	    // Stop stuff?
	    event.preventDefault();

	    if( history_pointer == 0 ){
		_update_cli();
	    }else if( history_pointer > 0 ){
		history_pointer--;
		_update_cli();
	    }

	    return false;

	}else if( ctrl_p && which == 40 ){ // ctrl + down

	    // Stop stuff?
	    event.preventDefault();

	    if( history_pointer < history_list.length -1 ){
		history_pointer++;
		_update_cli();
	    }

	    return false;
	}

	return true;
    }
function read_cli(event){

	var which = event.which;
	var ctrl_p = event.ctrlKey;
	//log('cli: ' + which + ', ' + ctrl_p);

	if ( which == 13 ) { // return
	    
	    // Stop events.
	    event.preventDefault();
	    
	    // Get and ensure nice JS, wipe CLI clean.
	    var to_eval = jQuery('#' + command_line.get_id()).val();
	    if( to_eval != '' ){
		jQuery('#' + command_line.get_id()).val('');
		
		// Enter the new command into our history and bump the
		// index to the last thing pushed on.
		history_list.pop(); // pop the empty ''
		history_list.push(to_eval);
		history_list.push(''); // push new empty ''
		history_pointer = history_list.length -1;
		//log('// history: '+history_pointer+', '+history_list.length);
		
		// Log, eval, log.
		to_eval = bbop.core.ensure(to_eval, ';', 'back');
		log(to_eval);
		var evals = _evaluate(to_eval);
		log('// ' + evals[1]);
		_advance_log_to_bottom();

		return false;
	    }
	}else if( ctrl_p && which == 38 ){ // ctrl + up

	    // Stop stuff?
	    event.preventDefault();

	    if( history_pointer == 0 ){
		_update_cli();
	    }else if( history_pointer > 0 ){
		history_pointer--;
		_update_cli();
	    }

	    return false;

	}else if( ctrl_p && which == 40 ){ // ctrl + down

	    // Stop stuff?
	    event.preventDefault();

	    if( history_pointer < history_list.length -1 ){
		history_pointer++;
		_update_cli();
	    }

	    return false;
	}

	return true;
    }
function read_cli ( event ) { var which = event . which ; var ctrl_p = event . ctrlKey ; //log('cli: ' + which + ', ' + ctrl_p); if ( which == 13 ) { // return // Stop events. event . preventDefault ( ) ; // Get and ensure nice JS, wipe CLI clean. var to_eval = jQuery ( '#' + command_line . get_id ( ) ) . val ( ) ; if ( to_eval != '' ) { jQuery ( '#' + command_line . get_id ( ) ) . val ( '' ) ; // Enter the new command into our history and bump the // index to the last thing pushed on. history_list . pop ( ) ; // pop the empty '' history_list . push ( to_eval ) ; history_list . push ( '' ) ; // push new empty '' history_pointer = history_list . length - 1 ; //log('// history: '+history_pointer+', '+history_list.length); // Log, eval, log. to_eval = bbop . core . ensure ( to_eval , ';' , 'back' ) ; log ( to_eval ) ; var evals = _evaluate ( to_eval ) ; log ( '// ' + evals [ 1 ] ) ; _advance_log_to_bottom ( ) ; return false ; } } else if ( ctrl_p && which == 38 ) { // ctrl + up // Stop stuff? event . preventDefault ( ) ; if ( history_pointer == 0 ) { _update_cli ( ) ; } else if ( history_pointer > 0 ) { history_pointer -- ; _update_cli ( ) ; } return false ; } else if ( ctrl_p && which == 40 ) { // ctrl + down // Stop stuff? event . preventDefault ( ) ; if ( history_pointer < history_list . length - 1 ) { history_pointer ++ ; _update_cli ( ) ; } return false ; } return true ; }
A lot of cases for button presses when reading from the command line.
A lot of cases for button presses when reading from the command line .