'Create a new editor instance
Returns finfo object (instead of editor as in previous releases)'

def create_new_editor(self, fname, enc, txt, set_current, new=False, cloned_from=None):

    editor = codeeditor.CodeEditor(self)
    introspector = self.introspector
    editor.get_completions.connect(introspector.get_completions)
    editor.sig_show_object_info.connect(introspector.show_object_info)
    editor.go_to_definition.connect(introspector.go_to_definition)
    finfo = FileInfo(fname, enc, editor, new, self.threadmanager, self.introspector)
    self.add_to_data(finfo, set_current)
    finfo.send_to_help.connect(self.send_to_help)
    finfo.analysis_results_changed.connect((lambda : self.analysis_results_changed.emit()))
    finfo.todo_results_changed.connect((lambda : self.todo_results_changed.emit()))
    finfo.edit_goto.connect((lambda fname, lineno, name: self.edit_goto.emit(fname, lineno, name)))
    finfo.save_breakpoints.connect((lambda s1, s2: self.save_breakpoints.emit(s1, s2)))
    editor.run_selection.connect(self.run_selection)
    editor.run_cell.connect(self.run_cell)
    editor.run_cell_and_advance.connect(self.run_cell_and_advance)
    editor.re_run_last_cell.connect(self.re_run_last_cell)
    editor.sig_new_file.connect(self.sig_new_file.emit)
    language = get_file_language(fname, txt)
    editor.setup_editor(linenumbers=self.linenumbers_enabled, show_blanks=self.blanks_enabled, edge_line=self.edgeline_enabled, edge_line_columns=self.edgeline_columns, language=language, markers=self.has_markers(), font=self.default_font, color_scheme=self.color_scheme, wrap=self.wrap_enabled, tab_mode=self.tabmode_enabled, intelligent_backspace=self.intelligent_backspace_enabled, highlight_current_line=self.highlight_current_line_enabled, highlight_current_cell=self.highlight_current_cell_enabled, occurrence_highlighting=self.occurrence_highlighting_enabled, occurrence_timeout=self.occurrence_highlighting_timeout, codecompletion_auto=self.codecompletion_auto_enabled, codecompletion_case=self.codecompletion_case_enabled, codecompletion_enter=self.codecompletion_enter_enabled, calltips=self.calltips_enabled, go_to_definition=self.go_to_definition_enabled, close_parentheses=self.close_parentheses_enabled, close_quotes=self.close_quotes_enabled, add_colons=self.add_colons_enabled, auto_unindent=self.auto_unindent_enabled, indent_chars=self.indent_chars, tab_stop_width_spaces=self.tab_stop_width_spaces, cloned_from=cloned_from, filename=fname, show_class_func_dropdown=self.show_class_func_dropdown, indent_guides=self.indent_guides)
    if (cloned_from is None):
        editor.set_text(txt)
        editor.document().setModified(False)
    finfo.text_changed_at.connect((lambda fname, position: self.text_changed_at.emit(fname, position)))
    editor.sig_cursor_position_changed.connect(self.editor_cursor_position_changed)
    editor.textChanged.connect(self.start_stop_analysis_timer)
    editor.modificationChanged.connect((lambda state: self.modification_changed(state, editor_id=id(editor))))
    editor.focus_in.connect(self.focus_changed)
    editor.zoom_in.connect((lambda : self.zoom_in.emit()))
    editor.zoom_out.connect((lambda : self.zoom_out.emit()))
    editor.zoom_reset.connect((lambda : self.zoom_reset.emit()))
    editor.sig_eol_chars_changed.connect((lambda eol_chars: self.refresh_eol_chars(eol_chars)))
    if (self.outlineexplorer is not None):
        editor.destroyed.connect((lambda obj=editor: self.outlineexplorer.remove_editor(obj)))
    self.find_widget.set_editor(editor)
    self.refresh_file_dependent_actions.emit()
    self.modification_changed(index=self.data.index(finfo))
    editor.run_pygments_highlighter()
    return finfo
