def _refresh_editor_and_scrollbars(self):
        """
        Refrehes editor content and scollbars.

        We generate a fake resize event to refresh scroll bar.

        We have the same problem as described here:
        http://www.qtcentre.org/threads/44803 and we apply the same solution
        (don't worry, there is no visual effect, the editor does not grow up
        at all, even with a value = 500)
        """
        TextHelper(self.editor).mark_whole_doc_dirty()
        self.editor.repaint()
        s = self.editor.size()
        s.setWidth(s.width() + 1)
        self.editor.resizeEvent(QtGui.QResizeEvent(self.editor.size(), s))
    def focusInEvent(self, event):
        """
        Overrides focusInEvent to emits the focused_in signal

        :param event: QFocusEvent
        """
        # fix a visual bug if the editor was resized while being hidden (
        # e.g. a dock # widget has been resized and some editors were in a
        # tab widget. Non visible editor have a visual bug where horizontal
        # scroll bar range
        #
        TextHelper(self).mark_whole_doc_dirty()
        s = self.size()
        s.setWidth(s.width() + 1)
        self.resizeEvent(QtGui.QResizeEvent(self.size(), s))

        self.focused_in.emit(event)
        super(CodeEdit, self).focusInEvent(event)
        self.repaint()