[pyqgis-console] fix undo/redo actions when autocompletion bracket is enabled