|  | @@ -15,6 +15,7 @@ import * as AlgorithmManagement from './algorithm';
 | 
	
		
			
				|  |  |  import * as Utils from './utils';
 | 
	
		
			
				|  |  |  import { registerUserEvent, ActionTypes } from "./../services/userLog";
 | 
	
		
			
				|  |  |  import VersionInfo from './../../.ima_version.json';
 | 
	
		
			
				|  |  | +import * as TextEditor from "./text_editor";
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  var counter_new_functions = 0;
 | 
	
		
			
				|  |  |  var counter_new_parameters = 0;
 | 
	
	
		
			
				|  | @@ -854,6 +855,11 @@ export function initVisualUI () {
 | 
	
		
			
				|  |  |         updateSequenceGlobals(evt.oldIndex, evt.newIndex);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    });
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  TextEditor.initTextEditor("ivprog-text-editor");
 | 
	
		
			
				|  |  | +  if (settingsProgrammingTypes != "textual") {
 | 
	
		
			
				|  |  | +    TextEditor.disable(true);
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  |    
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -1011,16 +1017,22 @@ function toggleConsole (is_running) {
 | 
	
		
			
				|  |  |  // }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  function toggleTextualCoding () {
 | 
	
		
			
				|  |  | -  var code = CodeManagement.generate();
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -  if (code == null) {
 | 
	
		
			
				|  |  | -    return;
 | 
	
		
			
				|  |  | +  let code = null;
 | 
	
		
			
				|  |  | +  if (settingsProgrammingTypes != "textual") {
 | 
	
		
			
				|  |  | +    code = CodeManagement.generate();
 | 
	
		
			
				|  |  | +    if (code == null) {
 | 
	
		
			
				|  |  | +      return;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |    $('.ivprog_visual_panel').css('display', 'none');
 | 
	
		
			
				|  |  |    $('.ivprog_textual_panel').css('display', 'block');
 | 
	
		
			
				|  |  |    $('.ivprog_textual_panel').removeClass('loading');
 | 
	
		
			
				|  |  | -  $('.ivprog_textual_code').text(code);
 | 
	
		
			
				|  |  | +  TextEditor.updateEditor();
 | 
	
		
			
				|  |  | +  if (code != null)
 | 
	
		
			
				|  |  | +    TextEditor.setCode(code);
 | 
	
		
			
				|  |  | +  //$('.ivprog_textual_code').text(code);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    $('.visual_coding_button').removeClass('active');
 | 
	
		
			
				|  |  |    $('.textual_coding_button').addClass('active');
 |