/* gitg-diff-view-file-renderer-text.c generated by valac 0.56.19, the Vala compiler
 * generated from gitg-diff-view-file-renderer-text.vala, do not modify */

/*
 * This file is part of gitg
 *
 * Copyright (C) 2016 - Jesse van den Kieboom
 *
 * gitg is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * gitg is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with gitg. If not, see <http://www.gnu.org/licenses/>.
 */

#include <gtksourceview/gtksource.h>
#include <glib-object.h>
#include <glib.h>
#include "libgitg.h"
#include <gtk/gtk.h>
#include <libgit2-glib/ggit.h>
#include <gee.h>
#include <gio/gio.h>
#include <cairo-gobject.h>
#include <stdlib.h>
#include <string.h>
#include "config.h"
#include <stdio.h>
#include <gdk/gdk.h>
#include <float.h>
#include <math.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

#define GITG_TYPE_DIFF_SELECTABLE (gitg_diff_selectable_get_type ())
#define GITG_DIFF_SELECTABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_TYPE_DIFF_SELECTABLE, GitgDiffSelectable))
#define GITG_IS_DIFF_SELECTABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GITG_TYPE_DIFF_SELECTABLE))
#define GITG_DIFF_SELECTABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GITG_TYPE_DIFF_SELECTABLE, GitgDiffSelectableIface))

typedef struct _GitgDiffSelectable GitgDiffSelectable;
typedef struct _GitgDiffSelectableIface GitgDiffSelectableIface;

#define GITG_TYPE_DIFF_VIEW_FILE_RENDERER (gitg_diff_view_file_renderer_get_type ())
#define GITG_DIFF_VIEW_FILE_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_TYPE_DIFF_VIEW_FILE_RENDERER, GitgDiffViewFileRenderer))
#define GITG_IS_DIFF_VIEW_FILE_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GITG_TYPE_DIFF_VIEW_FILE_RENDERER))
#define GITG_DIFF_VIEW_FILE_RENDERER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GITG_TYPE_DIFF_VIEW_FILE_RENDERER, GitgDiffViewFileRendererIface))

typedef struct _GitgDiffViewFileRenderer GitgDiffViewFileRenderer;
typedef struct _GitgDiffViewFileRendererIface GitgDiffViewFileRendererIface;

#define GITG_TYPE_DIFF_VIEW_FILE_RENDERER_TEXTABLE (gitg_diff_view_file_renderer_textable_get_type ())
#define GITG_DIFF_VIEW_FILE_RENDERER_TEXTABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_TYPE_DIFF_VIEW_FILE_RENDERER_TEXTABLE, GitgDiffViewFileRendererTextable))
#define GITG_IS_DIFF_VIEW_FILE_RENDERER_TEXTABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GITG_TYPE_DIFF_VIEW_FILE_RENDERER_TEXTABLE))
#define GITG_DIFF_VIEW_FILE_RENDERER_TEXTABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GITG_TYPE_DIFF_VIEW_FILE_RENDERER_TEXTABLE, GitgDiffViewFileRendererTextableIface))

typedef struct _GitgDiffViewFileRendererTextable GitgDiffViewFileRendererTextable;
typedef struct _GitgDiffViewFileRendererTextableIface GitgDiffViewFileRendererTextableIface;

#define GITG_TYPE_DIFF_VIEW_FILE_RENDERER_TEXT (gitg_diff_view_file_renderer_text_get_type ())
#define GITG_DIFF_VIEW_FILE_RENDERER_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_TYPE_DIFF_VIEW_FILE_RENDERER_TEXT, GitgDiffViewFileRendererText))
#define GITG_DIFF_VIEW_FILE_RENDERER_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GITG_TYPE_DIFF_VIEW_FILE_RENDERER_TEXT, GitgDiffViewFileRendererTextClass))
#define GITG_IS_DIFF_VIEW_FILE_RENDERER_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GITG_TYPE_DIFF_VIEW_FILE_RENDERER_TEXT))
#define GITG_IS_DIFF_VIEW_FILE_RENDERER_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GITG_TYPE_DIFF_VIEW_FILE_RENDERER_TEXT))
#define GITG_DIFF_VIEW_FILE_RENDERER_TEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GITG_TYPE_DIFF_VIEW_FILE_RENDERER_TEXT, GitgDiffViewFileRendererTextClass))

typedef struct _GitgDiffViewFileRendererText GitgDiffViewFileRendererText;
typedef struct _GitgDiffViewFileRendererTextClass GitgDiffViewFileRendererTextClass;
typedef struct _GitgDiffViewFileRendererTextPrivate GitgDiffViewFileRendererTextPrivate;

#define GITG_TYPE_DIFF_VIEW_FILE_SELECTABLE (gitg_diff_view_file_selectable_get_type ())
#define GITG_DIFF_VIEW_FILE_SELECTABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_TYPE_DIFF_VIEW_FILE_SELECTABLE, GitgDiffViewFileSelectable))
#define GITG_DIFF_VIEW_FILE_SELECTABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GITG_TYPE_DIFF_VIEW_FILE_SELECTABLE, GitgDiffViewFileSelectableClass))
#define GITG_IS_DIFF_VIEW_FILE_SELECTABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GITG_TYPE_DIFF_VIEW_FILE_SELECTABLE))
#define GITG_IS_DIFF_VIEW_FILE_SELECTABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GITG_TYPE_DIFF_VIEW_FILE_SELECTABLE))
#define GITG_DIFF_VIEW_FILE_SELECTABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GITG_TYPE_DIFF_VIEW_FILE_SELECTABLE, GitgDiffViewFileSelectableClass))

typedef struct _GitgDiffViewFileSelectable GitgDiffViewFileSelectable;
typedef struct _GitgDiffViewFileSelectableClass GitgDiffViewFileSelectableClass;

#define GITG_TYPE_DIFF_VIEW_LINES_RENDERER (gitg_diff_view_lines_renderer_get_type ())
#define GITG_DIFF_VIEW_LINES_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_TYPE_DIFF_VIEW_LINES_RENDERER, GitgDiffViewLinesRenderer))
#define GITG_DIFF_VIEW_LINES_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GITG_TYPE_DIFF_VIEW_LINES_RENDERER, GitgDiffViewLinesRendererClass))
#define GITG_IS_DIFF_VIEW_LINES_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GITG_TYPE_DIFF_VIEW_LINES_RENDERER))
#define GITG_IS_DIFF_VIEW_LINES_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GITG_TYPE_DIFF_VIEW_LINES_RENDERER))
#define GITG_DIFF_VIEW_LINES_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GITG_TYPE_DIFF_VIEW_LINES_RENDERER, GitgDiffViewLinesRendererClass))

typedef struct _GitgDiffViewLinesRenderer GitgDiffViewLinesRenderer;
typedef struct _GitgDiffViewLinesRendererClass GitgDiffViewLinesRendererClass;

#define GITG_DIFF_VIEW_FILE_RENDERER_TEXT_TYPE_REGION (gitg_diff_view_file_renderer_text_region_get_type ())
typedef struct _GitgDiffViewFileRendererTextRegion GitgDiffViewFileRendererTextRegion;
typedef enum  {
	GITG_DIFF_VIEW_FILE_RENDERER_TEXT_REGION_TYPE_ADDED,
	GITG_DIFF_VIEW_FILE_RENDERER_TEXT_REGION_TYPE_REMOVED,
	GITG_DIFF_VIEW_FILE_RENDERER_TEXT_REGION_TYPE_CONTEXT
} GitgDiffViewFileRendererTextRegionType;

#define GITG_DIFF_VIEW_FILE_RENDERER_TEXT_TYPE_REGION_TYPE (gitg_diff_view_file_renderer_text_region_type_get_type ())
typedef enum  {
	GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_ONE,
	GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_OLD,
	GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_NEW
} GitgDiffViewFileRendererTextStyle;

#define GITG_DIFF_VIEW_FILE_RENDERER_TEXT_TYPE_STYLE (gitg_diff_view_file_renderer_text_style_get_type ())

#define GITG_TYPE_DIFF_VIEW_FILE_INFO (gitg_diff_view_file_info_get_type ())
#define GITG_DIFF_VIEW_FILE_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_TYPE_DIFF_VIEW_FILE_INFO, GitgDiffViewFileInfo))
#define GITG_DIFF_VIEW_FILE_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GITG_TYPE_DIFF_VIEW_FILE_INFO, GitgDiffViewFileInfoClass))
#define GITG_IS_DIFF_VIEW_FILE_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GITG_TYPE_DIFF_VIEW_FILE_INFO))
#define GITG_IS_DIFF_VIEW_FILE_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GITG_TYPE_DIFF_VIEW_FILE_INFO))
#define GITG_DIFF_VIEW_FILE_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GITG_TYPE_DIFF_VIEW_FILE_INFO, GitgDiffViewFileInfoClass))

typedef struct _GitgDiffViewFileInfo GitgDiffViewFileInfo;
typedef struct _GitgDiffViewFileInfoClass GitgDiffViewFileInfoClass;
enum  {
	GITG_DIFF_VIEW_FILE_RENDERER_TEXT_0_PROPERTY,
	GITG_DIFF_VIEW_FILE_RENDERER_TEXT_ADDED_PROPERTY,
	GITG_DIFF_VIEW_FILE_RENDERER_TEXT_REMOVED_PROPERTY,
	GITG_DIFF_VIEW_FILE_RENDERER_TEXT_D_STYLE_PROPERTY,
	GITG_DIFF_VIEW_FILE_RENDERER_TEXT_NEW_IS_WORKDIR_PROPERTY,
	GITG_DIFF_VIEW_FILE_RENDERER_TEXT_WRAP_LINES_PROPERTY,
	GITG_DIFF_VIEW_FILE_RENDERER_TEXT_TAB_WIDTH_PROPERTY,
	GITG_DIFF_VIEW_FILE_RENDERER_TEXT_MAXLINES_PROPERTY,
	GITG_DIFF_VIEW_FILE_RENDERER_TEXT_INFO_PROPERTY,
	GITG_DIFF_VIEW_FILE_RENDERER_TEXT_DELTA_PROPERTY,
	GITG_DIFF_VIEW_FILE_RENDERER_TEXT_REPOSITORY_PROPERTY,
	GITG_DIFF_VIEW_FILE_RENDERER_TEXT_HIGHLIGHT_PROPERTY,
	GITG_DIFF_VIEW_FILE_RENDERER_TEXT_HAS_SELECTION_PROPERTY,
	GITG_DIFF_VIEW_FILE_RENDERER_TEXT_CAN_SELECT_PROPERTY,
	GITG_DIFF_VIEW_FILE_RENDERER_TEXT_SELECTION_PROPERTY,
	GITG_DIFF_VIEW_FILE_RENDERER_TEXT_NUM_PROPERTIES
};
static GParamSpec* gitg_diff_view_file_renderer_text_properties[GITG_DIFF_VIEW_FILE_RENDERER_TEXT_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _GitgDiffViewFileRendererTextInitHighlightingBufferOldData GitgDiffViewFileRendererTextInitHighlightingBufferOldData;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _ggit_diff_file_unref0(var) ((var == NULL) ? NULL : (var = (ggit_diff_file_unref (var), NULL)))
typedef struct _GitgDiffViewFileRendererTextInitHighlightingBufferNewData GitgDiffViewFileRendererTextInitHighlightingBufferNewData;
#define __vala_GgitOId_free0(var) ((var == NULL) ? NULL : (var = (_vala_GgitOId_free (var), NULL)))
#define _g_bytes_unref0(var) ((var == NULL) ? NULL : (var = (g_bytes_unref (var), NULL)))
typedef struct _GitgDiffViewFileRendererTextInitHighlightingBufferData GitgDiffViewFileRendererTextInitHighlightingBufferData;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _GitgDiffViewFileRendererTextInitHighlightingBufferFromStreamData GitgDiffViewFileRendererTextInitHighlightingBufferFromStreamData;
#define _g_settings_schema_source_unref0(var) ((var == NULL) ? NULL : (var = (g_settings_schema_source_unref (var), NULL)))
#define _g_settings_schema_unref0(var) ((var == NULL) ? NULL : (var = (g_settings_schema_unref (var), NULL)))
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
#define _ggit_diff_line_unref0(var) ((var == NULL) ? NULL : (var = (ggit_diff_line_unref (var), NULL)))
#define _gitg_patch_set_patch_free0(var) ((var == NULL) ? NULL : (var = (gitg_patch_set_patch_free (var), NULL)))
typedef enum  {
	GITG_DIFF_VIEW_LINES_RENDERER_STYLE_OLD,
	GITG_DIFF_VIEW_LINES_RENDERER_STYLE_NEW,
	GITG_DIFF_VIEW_LINES_RENDERER_STYLE_SYMBOL,
	GITG_DIFF_VIEW_LINES_RENDERER_STYLE_SYMBOL_OLD,
	GITG_DIFF_VIEW_LINES_RENDERER_STYLE_SYMBOL_NEW
} GitgDiffViewLinesRendererStyle;

#define GITG_DIFF_VIEW_LINES_RENDERER_TYPE_STYLE (gitg_diff_view_lines_renderer_style_get_type ())

struct _GitgDiffSelectableIface {
	GTypeInterface parent_iface;
	void (*clear_selection) (GitgDiffSelectable* self);
	gboolean (*get_has_selection) (GitgDiffSelectable* self);
	gboolean (*get_can_select) (GitgDiffSelectable* self);
	void (*set_can_select) (GitgDiffSelectable* self, gboolean value);
	GitgPatchSet* (*get_selection) (GitgDiffSelectable* self);
};

struct _GitgDiffViewFileRendererIface {
	GTypeInterface parent_iface;
	void (*add_hunk) (GitgDiffViewFileRenderer* self, GgitDiffHunk* hunk, GeeArrayList* lines);
};

struct _GitgDiffViewFileRendererTextableIface {
	GTypeInterface parent_iface;
	gboolean (*get_wrap_lines) (GitgDiffViewFileRendererTextable* self);
	void (*set_wrap_lines) (GitgDiffViewFileRendererTextable* self, gboolean value);
	gint (*get_tab_width) (GitgDiffViewFileRendererTextable* self);
	void (*set_tab_width) (GitgDiffViewFileRendererTextable* self, gint value);
	gint (*get_maxlines) (GitgDiffViewFileRendererTextable* self);
	void (*set_maxlines) (GitgDiffViewFileRendererTextable* self, gint value);
	gboolean (*get_highlight) (GitgDiffViewFileRendererTextable* self);
	void (*set_highlight) (GitgDiffViewFileRendererTextable* self, gboolean value);
};

struct _GitgDiffViewFileRendererText {
	GtkSourceView parent_instance;
	GitgDiffViewFileRendererTextPrivate * priv;
};

struct _GitgDiffViewFileRendererTextClass {
	GtkSourceViewClass parent_class;
};

struct _GitgDiffViewFileRendererTextRegion {
	GitgDiffViewFileRendererTextRegionType type;
	gint buffer_line_start;
	gint source_line_start;
	gint length;
};

struct _GitgDiffViewFileRendererTextPrivate {
	guint _added;
	guint _removed;
	gint64 d_doffset;
	GeeHashMap* d_lines;
	GitgDiffViewFileSelectable* d_selectable;
	GitgDiffViewLinesRenderer* d_old_lines;
	GitgDiffViewLinesRenderer* d_new_lines;
	GitgDiffViewLinesRenderer* d_sym_lines;
	gboolean d_highlight;
	GCancellable* d_higlight_cancellable;
	GtkSourceBuffer* d_old_highlight_buffer;
	GtkSourceBuffer* d_new_highlight_buffer;
	gboolean d_old_highlight_ready;
	gboolean d_new_highlight_ready;
	GitgDiffViewFileRendererTextRegion* d_regions;
	gint d_regions_length1;
	gint _d_regions_size_;
	gboolean d_constructed;
	GSettings* d_stylesettings;
	GitgFontManager* d_font_manager;
	gboolean d_has_selection;
	GitgDiffViewFileRendererTextStyle _d_style;
	gboolean _new_is_workdir;
	gint _maxlines;
	GitgDiffViewFileInfo* _info;
	gboolean _can_select;
};

struct _GitgDiffViewFileRendererTextInitHighlightingBufferOldData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GitgDiffViewFileRendererText* self;
	GCancellable* cancellable;
	GtkSourceBuffer* buffer;
	GgitDiffDelta* _tmp0_;
	GgitDiffDelta* _tmp1_;
	GgitDiffFile* _tmp2_;
	GtkSourceBuffer* _tmp3_;
	GtkSourceBuffer* _tmp4_;
	GtkSourceBuffer* _tmp5_;
};

struct _GitgDiffViewFileRendererTextInitHighlightingBufferNewData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GitgDiffViewFileRendererText* self;
	GCancellable* cancellable;
	GtkSourceBuffer* buffer;
	GgitDiffFile* file;
	GgitDiffDelta* _tmp0_;
	GgitDiffDelta* _tmp1_;
	GgitDiffFile* _tmp2_;
	GgitDiffFile* _tmp3_;
	GitgDiffViewFileInfo* _tmp4_;
	GInputStream* _tmp5_;
	GInputStream* _tmp6_;
	GInputStream* stream;
	GitgDiffViewFileInfo* _tmp7_;
	GInputStream* _tmp8_;
	GInputStream* _tmp9_;
	GInputStream* _tmp10_;
	GitgDiffViewFileInfo* _tmp11_;
	GgitDiffDelta* _tmp12_;
	GgitDiffDelta* _tmp13_;
	GgitDiffFile* _tmp14_;
	GgitDiffFile* _tmp15_;
	GFile* _tmp16_;
	GFile* _tmp17_;
	GInputStream* _tmp18_;
	GitgDiffViewFileInfo* _tmp19_;
	const gchar* _tmp20_;
	const gchar* _tmp21_;
	GtkSourceBuffer* _tmp22_;
	GgitDiffDelta* _tmp23_;
	GgitDiffDelta* _tmp24_;
	GgitDiffFile* _tmp25_;
	GitgDiffViewFileInfo* _tmp26_;
	gboolean _tmp27_;
	gboolean _tmp28_;
	GtkSourceBuffer* _tmp29_;
	GtkSourceBuffer* _tmp30_;
	GtkSourceBuffer* _tmp31_;
};

struct _GitgDiffViewFileRendererTextInitHighlightingBufferData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GitgDiffViewFileRendererText* self;
	GgitDiffFile* file;
	gboolean from_workdir;
	GCancellable* cancellable;
	GtkSourceBuffer* result;
	GgitOId* id;
	GgitOId* _tmp0_;
	GgitOId* _tmp1_;
	GFile* location;
	GFile* _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp4_;
	GgitOId* _tmp5_;
	gboolean _tmp6_;
	GFile* _tmp7_;
	guint8* content;
	gint content_length1;
	gint _content_size_;
	GgitBlob* blob;
	GgitBlob* _tmp8_;
	GitgRepository* _tmp9_;
	GitgRepository* _tmp10_;
	GgitOId* _tmp11_;
	gpointer _tmp12_;
	GgitBlob* _tmp13_;
	GitgRepository* _tmp14_;
	GitgRepository* _tmp15_;
	GitgRepository* _tmp16_;
	GitgRepository* _tmp17_;
	gint _tmp18_;
	guint8* _tmp19_;
	GgitBlob* _tmp20_;
	gsize _tmp21_;
	guint8* _tmp22_;
	guint8* _tmp23_;
	gint _tmp23__length1;
	GFile* _tmp24_;
	guint8* _tmp25_;
	gsize _tmp26_;
	GitgRepository* _tmp27_;
	GitgRepository* _tmp28_;
	GitgRepository* _tmp29_;
	GitgRepository* _tmp30_;
	guint8* _tmp31_;
	gint _tmp31__length1;
	gint _tmp32_;
	guint8* _tmp33_;
	gboolean uncertain;
	gchar* content_type;
	GFile* _tmp34_;
	gchar* _tmp35_;
	gchar* _tmp36_;
	guint8* _tmp37_;
	gint _tmp37__length1;
	gboolean _tmp38_;
	gchar* _tmp39_;
	gchar* _tmp40_;
	GMemoryInputStream* stream;
	guint8* _tmp41_;
	gint _tmp41__length1;
	GBytes* _tmp42_;
	GBytes* _tmp43_;
	GMemoryInputStream* _tmp44_;
	GMemoryInputStream* _tmp45_;
	GFile* _tmp46_;
	GMemoryInputStream* _tmp47_;
	const gchar* _tmp48_;
	GtkSourceBuffer* _tmp49_;
	GError* _inner_error0_;
};

struct _GitgDiffViewFileRendererTextInitHighlightingBufferFromStreamData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GitgDiffViewFileRendererText* self;
	GgitDiffFile* file;
	GFile* location;
	GInputStream* stream;
	gchar* content_type;
	GCancellable* cancellable;
	GtkSourceBuffer* result;
	GtkSourceLanguageManager* manager;
	GtkSourceLanguageManager* _tmp0_;
	GtkSourceLanguageManager* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	GtkSourceLanguage* language;
	GtkSourceLanguageManager* _tmp4_;
	GtkSourceLanguage* _tmp5_;
	GtkSourceLanguage* _tmp6_;
	GtkSourceBuffer* buffer;
	GtkTextBuffer* _tmp7_;
	GtkTextBuffer* _tmp8_;
	GtkTextTagTable* _tmp9_;
	GtkTextTagTable* _tmp10_;
	GtkSourceBuffer* _tmp11_;
	GtkSourceLanguage* _tmp12_;
	GtkSourceBuffer* _tmp13_;
	GtkSourceLanguage* _tmp14_;
	GtkSourceStyleSchemeManager* style_scheme_manager;
	GtkSourceStyleSchemeManager* _tmp15_;
	GtkSourceStyleSchemeManager* _tmp16_;
	GtkSourceBuffer* _tmp17_;
	GSettings* _tmp18_;
	GSettings* _tmp19_;
	GSettings* _tmp20_;
	GtkSourceBuffer* _tmp21_;
	GtkSourceStyleSchemeManager* _tmp22_;
	GtkSourceStyleScheme* _tmp23_;
	GtkSourceFile* sfile;
	GtkSourceFile* _tmp24_;
	GtkSourceFileLoader* loader;
	GtkSourceBuffer* _tmp25_;
	GtkSourceFileLoader* _tmp26_;
	GtkSourceBuffer* _tmp27_;
	GError* e;
	FILE* _tmp28_;
	const gchar* _tmp29_;
	const gchar* _tmp30_;
	GError* _tmp31_;
	const gchar* _tmp32_;
	const gchar* _tmp33_;
	gchar* _tmp34_;
	gchar* _tmp35_;
	GError* _inner_error0_;
};

static gint GitgDiffViewFileRendererText_private_offset;
static gpointer gitg_diff_view_file_renderer_text_parent_class = NULL;
static GitgDiffSelectableIface * gitg_diff_view_file_renderer_text_gitg_diff_selectable_parent_iface = NULL;
static GitgDiffViewFileRendererIface * gitg_diff_view_file_renderer_text_gitg_diff_view_file_renderer_parent_iface = NULL;
static GitgDiffViewFileRendererTextableIface * gitg_diff_view_file_renderer_text_gitg_diff_view_file_renderer_textable_parent_iface = NULL;

VALA_EXTERN GType gitg_diff_selectable_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType gitg_diff_view_file_renderer_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType gitg_diff_view_file_renderer_textable_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType gitg_diff_view_file_renderer_text_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType gitg_diff_view_file_selectable_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType gitg_diff_view_lines_renderer_get_type (void) G_GNUC_CONST ;
static GType gitg_diff_view_file_renderer_text_region_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static GType gitg_diff_view_file_renderer_text_region_type_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static GitgDiffViewFileRendererTextRegion* gitg_diff_view_file_renderer_text_region_dup (const GitgDiffViewFileRendererTextRegion* self);
static void gitg_diff_view_file_renderer_text_region_free (GitgDiffViewFileRendererTextRegion* self);
VALA_EXTERN GType gitg_diff_view_file_renderer_text_style_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType gitg_diff_view_file_info_get_type (void) G_GNUC_CONST ;
static void gitg_diff_view_file_renderer_text_real_clear_selection (GitgDiffSelectable* base);
VALA_EXTERN GitgDiffViewFileRendererText* gitg_diff_view_file_renderer_text_new (GitgDiffViewFileInfo* info,
                                                                     gboolean can_select,
                                                                     GitgDiffViewFileRendererTextStyle style);
VALA_EXTERN GitgDiffViewFileRendererText* gitg_diff_view_file_renderer_text_construct (GType object_type,
                                                                           GitgDiffViewFileInfo* info,
                                                                           gboolean can_select,
                                                                           GitgDiffViewFileRendererTextStyle style);
static void gitg_diff_view_file_renderer_text_real_dispose (GObject* base);
static void gitg_diff_view_file_renderer_text_update_highlight (GitgDiffViewFileRendererText* self);
VALA_EXTERN gboolean gitg_diff_view_file_renderer_textable_get_highlight (GitgDiffViewFileRendererTextable* self);
VALA_EXTERN GitgRepository* gitg_diff_view_file_renderer_text_get_repository (GitgDiffViewFileRendererText* self);
VALA_EXTERN GgitDiffDelta* gitg_diff_view_file_renderer_text_get_delta (GitgDiffViewFileRendererText* self);
static void gitg_diff_view_file_renderer_text_init_highlighting_buffer_old (GitgDiffViewFileRendererText* self,
                                                                     GCancellable* cancellable,
                                                                     GAsyncReadyCallback _callback_,
                                                                     gpointer _user_data_);
static void gitg_diff_view_file_renderer_text_init_highlighting_buffer_old_finish (GitgDiffViewFileRendererText* self,
                                                                            GAsyncResult* _res_);
static void ___lambda58_ (GitgDiffViewFileRendererText* self,
                   GObject* obj,
                   GAsyncResult* res);
static void ____lambda58__gasync_ready_callback (GObject* source_object,
                                          GAsyncResult* res,
                                          gpointer self);
static void gitg_diff_view_file_renderer_text_init_highlighting_buffer_new (GitgDiffViewFileRendererText* self,
                                                                     GCancellable* cancellable,
                                                                     GAsyncReadyCallback _callback_,
                                                                     gpointer _user_data_);
static void gitg_diff_view_file_renderer_text_init_highlighting_buffer_new_finish (GitgDiffViewFileRendererText* self,
                                                                            GAsyncResult* _res_);
static void ___lambda59_ (GitgDiffViewFileRendererText* self,
                   GObject* obj,
                   GAsyncResult* res);
static void ____lambda59__gasync_ready_callback (GObject* source_object,
                                          GAsyncResult* res,
                                          gpointer self);
static void gitg_diff_view_file_renderer_text_update_highlighting_ready (GitgDiffViewFileRendererText* self);
static void gitg_diff_view_file_renderer_text_init_highlighting_buffer_old_data_free (gpointer _data);
static gboolean gitg_diff_view_file_renderer_text_init_highlighting_buffer_old_co (GitgDiffViewFileRendererTextInitHighlightingBufferOldData* _data_);
static void gitg_diff_view_file_renderer_text_init_highlighting_buffer (GitgDiffViewFileRendererText* self,
                                                                 GgitDiffFile* file,
                                                                 gboolean from_workdir,
                                                                 GCancellable* cancellable,
                                                                 GAsyncReadyCallback _callback_,
                                                                 gpointer _user_data_);
static GtkSourceBuffer* gitg_diff_view_file_renderer_text_init_highlighting_buffer_finish (GitgDiffViewFileRendererText* self,
                                                                                    GAsyncResult* _res_);
static void gitg_diff_view_file_renderer_text_init_highlighting_buffer_old_ready (GObject* source_object,
                                                                           GAsyncResult* _res_,
                                                                           gpointer _user_data_);
static GFile* gitg_diff_view_file_renderer_text_get_file_location (GitgDiffViewFileRendererText* self,
                                                            GgitDiffFile* file);
static void gitg_diff_view_file_renderer_text_init_highlighting_buffer_new_data_free (gpointer _data);
static gboolean gitg_diff_view_file_renderer_text_init_highlighting_buffer_new_co (GitgDiffViewFileRendererTextInitHighlightingBufferNewData* _data_);
VALA_EXTERN GitgDiffViewFileInfo* gitg_diff_view_file_renderer_text_get_info (GitgDiffViewFileRendererText* self);
VALA_EXTERN GInputStream* gitg_diff_view_file_info_get_new_file_input_stream (GitgDiffViewFileInfo* self);
VALA_EXTERN void gitg_diff_view_file_info_set_new_file_input_stream (GitgDiffViewFileInfo* self,
                                                         GInputStream* value);
static void gitg_diff_view_file_renderer_text_init_highlighting_buffer_from_stream (GitgDiffViewFileRendererText* self,
                                                                             GgitDiffFile* file,
                                                                             GFile* location,
                                                                             GInputStream* stream,
                                                                             const gchar* content_type,
                                                                             GCancellable* cancellable,
                                                                             GAsyncReadyCallback _callback_,
                                                                             gpointer _user_data_);
static GtkSourceBuffer* gitg_diff_view_file_renderer_text_init_highlighting_buffer_from_stream_finish (GitgDiffViewFileRendererText* self,
                                                                                                GAsyncResult* _res_);
VALA_EXTERN const gchar* gitg_diff_view_file_info_get_new_file_content_type (GitgDiffViewFileInfo* self);
static void gitg_diff_view_file_renderer_text_init_highlighting_buffer_new_ready (GObject* source_object,
                                                                           GAsyncResult* _res_,
                                                                           gpointer _user_data_);
VALA_EXTERN gboolean gitg_diff_view_file_info_get_from_workdir (GitgDiffViewFileInfo* self);
static void gitg_diff_view_file_renderer_text_init_highlighting_buffer_data_free (gpointer _data);
static gboolean gitg_diff_view_file_renderer_text_init_highlighting_buffer_co (GitgDiffViewFileRendererTextInitHighlightingBufferData* _data_);
static GgitOId* _vala_GgitOId_copy (GgitOId* self);
static void _vala_GgitOId_free (GgitOId* self);
static guint8* _vala_array_dup12 (guint8* self,
                           gssize length);
static void gitg_diff_view_file_renderer_text_init_highlighting_buffer_ready (GObject* source_object,
                                                                       GAsyncResult* _res_,
                                                                       gpointer _user_data_);
static void gitg_diff_view_file_renderer_text_init_highlighting_buffer_from_stream_data_free (gpointer _data);
static gboolean gitg_diff_view_file_renderer_text_init_highlighting_buffer_from_stream_co (GitgDiffViewFileRendererTextInitHighlightingBufferFromStreamData* _data_);
static GSettings* gitg_diff_view_file_renderer_text_try_settings (GitgDiffViewFileRendererText* self,
                                                           const gchar* schema_id);
static void ___lambda57_ (GitgDiffViewFileRendererText* self,
                   GSettings* s,
                   const gchar* k);
static void gitg_diff_view_file_renderer_text_update_style (GitgDiffViewFileRendererText* self);
static void ____lambda57__g_settings_changed (GSettings* _sender,
                                       const gchar* key,
                                       gpointer self);
static void gitg_diff_view_file_renderer_text_init_highlighting_buffer_from_stream_ready (GObject* source_object,
                                                                                   GAsyncResult* _res_,
                                                                                   gpointer _user_data_);
static void gitg_diff_view_file_renderer_text_strip_carriage_returns (GitgDiffViewFileRendererText* self,
                                                               GtkSourceBuffer* buffer);
static gboolean gitg_diff_view_file_renderer_text_real_draw (GtkWidget* base,
                                                      cairo_t* cr);
VALA_EXTERN GitgDiffViewFileRendererTextStyle gitg_diff_view_file_renderer_text_get_d_style (GitgDiffViewFileRendererText* self);
static void gitg_diff_view_file_renderer_text_update_theme (GitgDiffViewFileRendererText* self);
static void gitg_diff_view_file_renderer_text_real_constructed (GObject* base);
static void gitg_diff_view_file_renderer_text_real_add_hunk (GitgDiffViewFileRenderer* base,
                                                      GgitDiffHunk* hunk,
                                                      GeeArrayList* lines);
VALA_EXTERN guint gitg_diff_view_file_renderer_text_get_added (GitgDiffViewFileRendererText* self);
VALA_EXTERN void gitg_diff_view_file_renderer_text_set_added (GitgDiffViewFileRendererText* self,
                                                  guint value);
VALA_EXTERN guint gitg_diff_view_file_renderer_text_get_removed (GitgDiffViewFileRendererText* self);
VALA_EXTERN void gitg_diff_view_file_renderer_text_set_removed (GitgDiffViewFileRendererText* self,
                                                    guint value);
static void _vala_array_add2 (GitgDiffViewFileRendererTextRegion* * array,
                       gint* length,
                       gint* size,
                       const GitgDiffViewFileRendererTextRegion* value);
static guint8* _vala_array_dup13 (guint8* self,
                           gssize length);
static GitgDiffViewFileRendererTextRegionType* _gitg_diff_view_file_renderer_text_region_type_dup (GitgDiffViewFileRendererTextRegionType* self);
static gboolean _gitg_diff_view_file_renderer_text_region_type_equal (const GitgDiffViewFileRendererTextRegionType * s1,
                                                               const GitgDiffViewFileRendererTextRegionType * s2);
static void _vala_array_add3 (GitgDiffViewFileRendererTextRegion* * array,
                       gint* length,
                       gint* size,
                       const GitgDiffViewFileRendererTextRegion* value);
VALA_EXTERN void gitg_diff_view_lines_renderer_add_hunk (GitgDiffViewLinesRenderer* self,
                                             gint buffer_line_start,
                                             gint buffer_line_end,
                                             GgitDiffHunk* hunk,
                                             GtkSourceBuffer* buffer);
VALA_EXTERN void gitg_diff_view_file_renderer_text_set_d_style (GitgDiffViewFileRendererText* self,
                                                    GitgDiffViewFileRendererTextStyle value);
VALA_EXTERN gboolean gitg_diff_view_file_renderer_text_get_new_is_workdir (GitgDiffViewFileRendererText* self);
VALA_EXTERN void gitg_diff_view_file_renderer_text_set_new_is_workdir (GitgDiffViewFileRendererText* self,
                                                           gboolean value);
VALA_EXTERN void gitg_diff_view_file_renderer_text_set_info (GitgDiffViewFileRendererText* self,
                                                 GitgDiffViewFileInfo* value);
VALA_EXTERN GgitDiffDelta* gitg_diff_view_file_info_get_delta (GitgDiffViewFileInfo* self);
VALA_EXTERN GitgRepository* gitg_diff_view_file_info_get_repository (GitgDiffViewFileInfo* self);
VALA_EXTERN gboolean gitg_diff_selectable_get_can_select (GitgDiffSelectable* self);
VALA_EXTERN gint* gitg_diff_view_file_selectable_get_selected_lines (GitgDiffViewFileSelectable* self,
                                                         gint* result_length1);
static void _vala_array_add4 (GitgPatchSetPatch* * array,
                       gint* length,
                       gint* size,
                       const GitgPatchSetPatch* value);
static void _vala_array_add5 (GitgPatchSetPatch* * array,
                       gint* length,
                       gint* size,
                       const GitgPatchSetPatch* value);
static GitgPatchSetPatch* _vala_array_dup14 (GitgPatchSetPatch* self,
                                      gssize length);
static GObject * gitg_diff_view_file_renderer_text_constructor (GType type,
                                                         guint n_construct_properties,
                                                         GObjectConstructParam * construct_properties);
VALA_EXTERN GType gitg_diff_view_lines_renderer_style_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GitgDiffViewLinesRenderer* gitg_diff_view_lines_renderer_new (GitgDiffViewLinesRendererStyle style);
VALA_EXTERN GitgDiffViewLinesRenderer* gitg_diff_view_lines_renderer_construct (GType object_type,
                                                                    GitgDiffViewLinesRendererStyle style);
static void _gitg_diff_view_file_renderer_text_update_theme_g_object_notify (GObject* _sender,
                                                                      GParamSpec* pspec,
                                                                      gpointer self);
VALA_EXTERN GitgDiffViewFileSelectable* gitg_diff_view_file_selectable_new (GtkSourceView* source_view);
VALA_EXTERN GitgDiffViewFileSelectable* gitg_diff_view_file_selectable_construct (GType object_type,
                                                                      GtkSourceView* source_view);
static void _gitg_diff_view_file_renderer_text____lambda60_ (GitgDiffViewFileRendererText* self);
VALA_EXTERN gboolean gitg_diff_view_file_selectable_get_has_selection (GitgDiffViewFileSelectable* self);
static void __gitg_diff_view_file_renderer_text____lambda60__g_object_notify (GObject* _sender,
                                                                       GParamSpec* pspec,
                                                                       gpointer self);
VALA_EXTERN void gitg_diff_view_file_renderer_textable_set_highlight (GitgDiffViewFileRendererTextable* self,
                                                          gboolean value);
VALA_EXTERN void gitg_diff_selectable_clear_selection (GitgDiffSelectable* self);
VALA_EXTERN gboolean gitg_diff_selectable_get_has_selection (GitgDiffSelectable* self);
VALA_EXTERN void gitg_diff_selectable_set_can_select (GitgDiffSelectable* self,
                                          gboolean value);
VALA_EXTERN GitgPatchSet* gitg_diff_selectable_get_selection (GitgDiffSelectable* self);
VALA_EXTERN void gitg_diff_view_file_renderer_add_hunk (GitgDiffViewFileRenderer* self,
                                            GgitDiffHunk* hunk,
                                            GeeArrayList* lines);
VALA_EXTERN gboolean gitg_diff_view_file_renderer_textable_get_wrap_lines (GitgDiffViewFileRendererTextable* self);
VALA_EXTERN void gitg_diff_view_file_renderer_textable_set_wrap_lines (GitgDiffViewFileRendererTextable* self,
                                                           gboolean value);
VALA_EXTERN gint gitg_diff_view_file_renderer_textable_get_tab_width (GitgDiffViewFileRendererTextable* self);
VALA_EXTERN void gitg_diff_view_file_renderer_textable_set_tab_width (GitgDiffViewFileRendererTextable* self,
                                                          gint value);
VALA_EXTERN gint gitg_diff_view_file_renderer_textable_get_maxlines (GitgDiffViewFileRendererTextable* self);
VALA_EXTERN void gitg_diff_view_file_renderer_textable_set_maxlines (GitgDiffViewFileRendererTextable* self,
                                                         gint value);
static void gitg_diff_view_file_renderer_text_finalize (GObject * obj);
static GType gitg_diff_view_file_renderer_text_get_type_once (void);
static void _vala_gitg_diff_view_file_renderer_text_get_property (GObject * object,
                                                           guint property_id,
                                                           GValue * value,
                                                           GParamSpec * pspec);
static void _vala_gitg_diff_view_file_renderer_text_set_property (GObject * object,
                                                           guint property_id,
                                                           const GValue * value,
                                                           GParamSpec * pspec);

static inline gpointer
gitg_diff_view_file_renderer_text_get_instance_private (GitgDiffViewFileRendererText* self)
{
	return G_STRUCT_MEMBER_P (self, GitgDiffViewFileRendererText_private_offset);
}

 G_GNUC_NO_INLINE static GType
gitg_diff_view_file_renderer_text_region_type_get_type_once (void)
{
	static const GEnumValue values[] = {{GITG_DIFF_VIEW_FILE_RENDERER_TEXT_REGION_TYPE_ADDED, "GITG_DIFF_VIEW_FILE_RENDERER_TEXT_REGION_TYPE_ADDED", "added"}, {GITG_DIFF_VIEW_FILE_RENDERER_TEXT_REGION_TYPE_REMOVED, "GITG_DIFF_VIEW_FILE_RENDERER_TEXT_REGION_TYPE_REMOVED", "removed"}, {GITG_DIFF_VIEW_FILE_RENDERER_TEXT_REGION_TYPE_CONTEXT, "GITG_DIFF_VIEW_FILE_RENDERER_TEXT_REGION_TYPE_CONTEXT", "context"}, {0, NULL, NULL}};
	GType gitg_diff_view_file_renderer_text_region_type_type_id;
	gitg_diff_view_file_renderer_text_region_type_type_id = g_enum_register_static ("GitgDiffViewFileRendererTextRegionType", values);
	return gitg_diff_view_file_renderer_text_region_type_type_id;
}

static GType
gitg_diff_view_file_renderer_text_region_type_get_type (void)
{
	static gsize gitg_diff_view_file_renderer_text_region_type_type_id__once = 0;
	if (g_once_init_enter (&gitg_diff_view_file_renderer_text_region_type_type_id__once)) {
		GType gitg_diff_view_file_renderer_text_region_type_type_id;
		gitg_diff_view_file_renderer_text_region_type_type_id = gitg_diff_view_file_renderer_text_region_type_get_type_once ();
		g_once_init_leave (&gitg_diff_view_file_renderer_text_region_type_type_id__once, gitg_diff_view_file_renderer_text_region_type_type_id);
	}
	return gitg_diff_view_file_renderer_text_region_type_type_id__once;
}

 G_GNUC_NO_INLINE static GType
gitg_diff_view_file_renderer_text_style_get_type_once (void)
{
	static const GEnumValue values[] = {{GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_ONE, "GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_ONE", "one"}, {GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_OLD, "GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_OLD", "old"}, {GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_NEW, "GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_NEW", "new"}, {0, NULL, NULL}};
	GType gitg_diff_view_file_renderer_text_style_type_id;
	gitg_diff_view_file_renderer_text_style_type_id = g_enum_register_static ("GitgDiffViewFileRendererTextStyle", values);
	return gitg_diff_view_file_renderer_text_style_type_id;
}

GType
gitg_diff_view_file_renderer_text_style_get_type (void)
{
	static gsize gitg_diff_view_file_renderer_text_style_type_id__once = 0;
	if (g_once_init_enter (&gitg_diff_view_file_renderer_text_style_type_id__once)) {
		GType gitg_diff_view_file_renderer_text_style_type_id;
		gitg_diff_view_file_renderer_text_style_type_id = gitg_diff_view_file_renderer_text_style_get_type_once ();
		g_once_init_leave (&gitg_diff_view_file_renderer_text_style_type_id__once, gitg_diff_view_file_renderer_text_style_type_id);
	}
	return gitg_diff_view_file_renderer_text_style_type_id__once;
}

static void
gitg_diff_view_file_renderer_text_real_clear_selection (GitgDiffSelectable* base)
{
	GitgDiffViewFileRendererText * self;
	self = (GitgDiffViewFileRendererText*) base;
	self->priv->d_has_selection = FALSE;
}

GitgDiffViewFileRendererText*
gitg_diff_view_file_renderer_text_construct (GType object_type,
                                             GitgDiffViewFileInfo* info,
                                             gboolean can_select,
                                             GitgDiffViewFileRendererTextStyle style)
{
	GitgDiffViewFileRendererText * self = NULL;
	g_return_val_if_fail (info != NULL, NULL);
	self = (GitgDiffViewFileRendererText*) g_object_new (object_type, "info", info, "can-select", can_select, "d-style", style, NULL);
	return self;
}

GitgDiffViewFileRendererText*
gitg_diff_view_file_renderer_text_new (GitgDiffViewFileInfo* info,
                                       gboolean can_select,
                                       GitgDiffViewFileRendererTextStyle style)
{
	return gitg_diff_view_file_renderer_text_construct (GITG_TYPE_DIFF_VIEW_FILE_RENDERER_TEXT, info, can_select, style);
}

static void
gitg_diff_view_file_renderer_text_real_dispose (GObject* base)
{
	GitgDiffViewFileRendererText * self;
	GCancellable* _tmp0_;
	self = (GitgDiffViewFileRendererText*) base;
	G_OBJECT_CLASS (gitg_diff_view_file_renderer_text_parent_class)->dispose ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_source_view_get_type (), GtkSourceView));
	_tmp0_ = self->priv->d_higlight_cancellable;
	if (_tmp0_ != NULL) {
		GCancellable* _tmp1_;
		_tmp1_ = self->priv->d_higlight_cancellable;
		g_cancellable_cancel (_tmp1_);
		_g_object_unref0 (self->priv->d_higlight_cancellable);
		self->priv->d_higlight_cancellable = NULL;
	}
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

static void
___lambda58_ (GitgDiffViewFileRendererText* self,
              GObject* obj,
              GAsyncResult* res)
{
	g_return_if_fail (res != NULL);
	gitg_diff_view_file_renderer_text_init_highlighting_buffer_old_finish (self, res);
}

static void
____lambda58__gasync_ready_callback (GObject* source_object,
                                     GAsyncResult* res,
                                     gpointer self)
{
	___lambda58_ ((GitgDiffViewFileRendererText*) self, source_object, res);
	g_object_unref (self);
}

static void
___lambda59_ (GitgDiffViewFileRendererText* self,
              GObject* obj,
              GAsyncResult* res)
{
	g_return_if_fail (res != NULL);
	gitg_diff_view_file_renderer_text_init_highlighting_buffer_new_finish (self, res);
}

static void
____lambda59__gasync_ready_callback (GObject* source_object,
                                     GAsyncResult* res,
                                     gpointer self)
{
	___lambda59_ ((GitgDiffViewFileRendererText*) self, source_object, res);
	g_object_unref (self);
}

static void
gitg_diff_view_file_renderer_text_update_highlight (GitgDiffViewFileRendererText* self)
{
	GCancellable* _tmp0_;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gboolean _tmp4_;
	gboolean _tmp5_;
	g_return_if_fail (self != NULL);
	if (!self->priv->d_constructed) {
		return;
	}
	_tmp0_ = self->priv->d_higlight_cancellable;
	if (_tmp0_ != NULL) {
		GCancellable* _tmp1_;
		_tmp1_ = self->priv->d_higlight_cancellable;
		g_cancellable_cancel (_tmp1_);
		_g_object_unref0 (self->priv->d_higlight_cancellable);
		self->priv->d_higlight_cancellable = NULL;
	}
	_g_object_unref0 (self->priv->d_old_highlight_buffer);
	self->priv->d_old_highlight_buffer = NULL;
	_g_object_unref0 (self->priv->d_new_highlight_buffer);
	self->priv->d_new_highlight_buffer = NULL;
	self->priv->d_old_highlight_ready = FALSE;
	self->priv->d_new_highlight_ready = FALSE;
	_tmp4_ = gitg_diff_view_file_renderer_textable_get_highlight ((GitgDiffViewFileRendererTextable*) self);
	_tmp5_ = _tmp4_;
	if (_tmp5_) {
		GitgRepository* _tmp6_;
		GitgRepository* _tmp7_;
		_tmp6_ = gitg_diff_view_file_renderer_text_get_repository (self);
		_tmp7_ = _tmp6_;
		_tmp3_ = _tmp7_ != NULL;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		GgitDiffDelta* _tmp8_;
		GgitDiffDelta* _tmp9_;
		_tmp8_ = gitg_diff_view_file_renderer_text_get_delta (self);
		_tmp9_ = _tmp8_;
		_tmp2_ = _tmp9_ != NULL;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		GCancellable* cancellable = NULL;
		GCancellable* _tmp10_;
		GCancellable* _tmp11_;
		GCancellable* _tmp12_;
		GCancellable* _tmp13_;
		GCancellable* _tmp14_;
		_tmp10_ = g_cancellable_new ();
		cancellable = _tmp10_;
		_tmp11_ = cancellable;
		_tmp12_ = _g_object_ref0 (_tmp11_);
		_g_object_unref0 (self->priv->d_higlight_cancellable);
		self->priv->d_higlight_cancellable = _tmp12_;
		_tmp13_ = cancellable;
		gitg_diff_view_file_renderer_text_init_highlighting_buffer_old (self, _tmp13_, ____lambda58__gasync_ready_callback, g_object_ref (self));
		_tmp14_ = cancellable;
		gitg_diff_view_file_renderer_text_init_highlighting_buffer_new (self, _tmp14_, ____lambda59__gasync_ready_callback, g_object_ref (self));
		_g_object_unref0 (cancellable);
	} else {
		gitg_diff_view_file_renderer_text_update_highlighting_ready (self);
	}
}

static void
gitg_diff_view_file_renderer_text_init_highlighting_buffer_old_data_free (gpointer _data)
{
	GitgDiffViewFileRendererTextInitHighlightingBufferOldData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (GitgDiffViewFileRendererTextInitHighlightingBufferOldData, _data_);
}

static void
gitg_diff_view_file_renderer_text_init_highlighting_buffer_old (GitgDiffViewFileRendererText* self,
                                                                GCancellable* cancellable,
                                                                GAsyncReadyCallback _callback_,
                                                                gpointer _user_data_)
{
	GitgDiffViewFileRendererTextInitHighlightingBufferOldData* _data_;
	GitgDiffViewFileRendererText* _tmp0_;
	GCancellable* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (cancellable != NULL);
	_data_ = g_slice_new0 (GitgDiffViewFileRendererTextInitHighlightingBufferOldData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, gitg_diff_view_file_renderer_text_init_highlighting_buffer_old_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp1_;
	gitg_diff_view_file_renderer_text_init_highlighting_buffer_old_co (_data_);
}

static void
gitg_diff_view_file_renderer_text_init_highlighting_buffer_old_finish (GitgDiffViewFileRendererText* self,
                                                                       GAsyncResult* _res_)
{
	GitgDiffViewFileRendererTextInitHighlightingBufferOldData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	if (NULL == _data_) {
		return;
	}
}

static void
gitg_diff_view_file_renderer_text_init_highlighting_buffer_old_ready (GObject* source_object,
                                                                      GAsyncResult* _res_,
                                                                      gpointer _user_data_)
{
	GitgDiffViewFileRendererTextInitHighlightingBufferOldData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	gitg_diff_view_file_renderer_text_init_highlighting_buffer_old_co (_data_);
}

static gboolean
gitg_diff_view_file_renderer_text_init_highlighting_buffer_old_co (GitgDiffViewFileRendererTextInitHighlightingBufferOldData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = gitg_diff_view_file_renderer_text_get_delta (_data_->self);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = ggit_diff_delta_get_old_file (_data_->_tmp1_);
	_data_->_state_ = 1;
	gitg_diff_view_file_renderer_text_init_highlighting_buffer (_data_->self, _data_->_tmp2_, FALSE, _data_->cancellable, gitg_diff_view_file_renderer_text_init_highlighting_buffer_old_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp3_ = gitg_diff_view_file_renderer_text_init_highlighting_buffer_finish (_data_->self, _data_->_res_);
	_data_->buffer = _data_->_tmp3_;
	if (!g_cancellable_is_cancelled (_data_->cancellable)) {
		_data_->_tmp4_ = _data_->buffer;
		_data_->_tmp5_ = _g_object_ref0 (_data_->_tmp4_);
		_g_object_unref0 (_data_->self->priv->d_old_highlight_buffer);
		_data_->self->priv->d_old_highlight_buffer = _data_->_tmp5_;
		_data_->self->priv->d_old_highlight_ready = TRUE;
		gitg_diff_view_file_renderer_text_update_highlighting_ready (_data_->self);
	}
	_g_object_unref0 (_data_->buffer);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static GFile*
gitg_diff_view_file_renderer_text_get_file_location (GitgDiffViewFileRendererText* self,
                                                     GgitDiffFile* file)
{
	gchar* path = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	GFile* workdir = NULL;
	GitgRepository* _tmp3_;
	GitgRepository* _tmp4_;
	GFile* _tmp5_;
	GFile* _tmp6_;
	GFile* _tmp7_;
	const gchar* _tmp8_;
	GFile* _tmp9_;
	GFile* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (file != NULL, NULL);
	_tmp0_ = ggit_diff_file_get_path (file);
	_tmp1_ = g_strdup (_tmp0_);
	path = _tmp1_;
	_tmp2_ = path;
	if (_tmp2_ == NULL) {
		result = NULL;
		_g_free0 (path);
		return result;
	}
	_tmp3_ = gitg_diff_view_file_renderer_text_get_repository (self);
	_tmp4_ = _tmp3_;
	_tmp5_ = ggit_repository_get_workdir ((GgitRepository*) _tmp4_);
	workdir = _tmp5_;
	_tmp6_ = workdir;
	if (_tmp6_ == NULL) {
		result = NULL;
		_g_object_unref0 (workdir);
		_g_free0 (path);
		return result;
	}
	_tmp7_ = workdir;
	_tmp8_ = path;
	_tmp9_ = g_file_get_child (_tmp7_, _tmp8_);
	result = _tmp9_;
	_g_object_unref0 (workdir);
	_g_free0 (path);
	return result;
}

static void
gitg_diff_view_file_renderer_text_init_highlighting_buffer_new_data_free (gpointer _data)
{
	GitgDiffViewFileRendererTextInitHighlightingBufferNewData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (GitgDiffViewFileRendererTextInitHighlightingBufferNewData, _data_);
}

static void
gitg_diff_view_file_renderer_text_init_highlighting_buffer_new (GitgDiffViewFileRendererText* self,
                                                                GCancellable* cancellable,
                                                                GAsyncReadyCallback _callback_,
                                                                gpointer _user_data_)
{
	GitgDiffViewFileRendererTextInitHighlightingBufferNewData* _data_;
	GitgDiffViewFileRendererText* _tmp0_;
	GCancellable* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (cancellable != NULL);
	_data_ = g_slice_new0 (GitgDiffViewFileRendererTextInitHighlightingBufferNewData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, gitg_diff_view_file_renderer_text_init_highlighting_buffer_new_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp1_;
	gitg_diff_view_file_renderer_text_init_highlighting_buffer_new_co (_data_);
}

static void
gitg_diff_view_file_renderer_text_init_highlighting_buffer_new_finish (GitgDiffViewFileRendererText* self,
                                                                       GAsyncResult* _res_)
{
	GitgDiffViewFileRendererTextInitHighlightingBufferNewData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	if (NULL == _data_) {
		return;
	}
}

static gpointer
_ggit_diff_file_ref0 (gpointer self)
{
	return self ? ggit_diff_file_ref (self) : NULL;
}

static void
gitg_diff_view_file_renderer_text_init_highlighting_buffer_new_ready (GObject* source_object,
                                                                      GAsyncResult* _res_,
                                                                      gpointer _user_data_)
{
	GitgDiffViewFileRendererTextInitHighlightingBufferNewData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	gitg_diff_view_file_renderer_text_init_highlighting_buffer_new_co (_data_);
}

static gboolean
gitg_diff_view_file_renderer_text_init_highlighting_buffer_new_co (GitgDiffViewFileRendererTextInitHighlightingBufferNewData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = gitg_diff_view_file_renderer_text_get_delta (_data_->self);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = ggit_diff_delta_get_new_file (_data_->_tmp1_);
	_data_->_tmp3_ = _ggit_diff_file_ref0 (_data_->_tmp2_);
	_data_->file = _data_->_tmp3_;
	_data_->_tmp4_ = _data_->self->priv->_info;
	_data_->_tmp5_ = gitg_diff_view_file_info_get_new_file_input_stream (_data_->_tmp4_);
	_data_->_tmp6_ = _data_->_tmp5_;
	if (_data_->_tmp6_ != NULL) {
		_data_->_tmp7_ = _data_->self->priv->_info;
		_data_->_tmp8_ = gitg_diff_view_file_info_get_new_file_input_stream (_data_->_tmp7_);
		_data_->_tmp9_ = _data_->_tmp8_;
		_data_->_tmp10_ = _g_object_ref0 (_data_->_tmp9_);
		_data_->stream = _data_->_tmp10_;
		_data_->_tmp11_ = _data_->self->priv->_info;
		gitg_diff_view_file_info_set_new_file_input_stream (_data_->_tmp11_, NULL);
		_data_->_tmp12_ = gitg_diff_view_file_renderer_text_get_delta (_data_->self);
		_data_->_tmp13_ = _data_->_tmp12_;
		_data_->_tmp14_ = ggit_diff_delta_get_new_file (_data_->_tmp13_);
		_data_->_tmp15_ = _data_->file;
		_data_->_tmp16_ = gitg_diff_view_file_renderer_text_get_file_location (_data_->self, _data_->_tmp15_);
		_data_->_tmp17_ = _data_->_tmp16_;
		_data_->_tmp18_ = _data_->stream;
		_data_->_tmp19_ = _data_->self->priv->_info;
		_data_->_tmp20_ = gitg_diff_view_file_info_get_new_file_content_type (_data_->_tmp19_);
		_data_->_tmp21_ = _data_->_tmp20_;
		_data_->_state_ = 1;
		gitg_diff_view_file_renderer_text_init_highlighting_buffer_from_stream (_data_->self, _data_->_tmp14_, _data_->_tmp17_, _data_->_tmp18_, _data_->_tmp21_, _data_->cancellable, gitg_diff_view_file_renderer_text_init_highlighting_buffer_new_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp22_ = gitg_diff_view_file_renderer_text_init_highlighting_buffer_from_stream_finish (_data_->self, _data_->_res_);
		_g_object_unref0 (_data_->buffer);
		_data_->buffer = _data_->_tmp22_;
		_g_object_unref0 (_data_->_tmp17_);
		_g_object_unref0 (_data_->stream);
	} else {
		_data_->_tmp23_ = gitg_diff_view_file_renderer_text_get_delta (_data_->self);
		_data_->_tmp24_ = _data_->_tmp23_;
		_data_->_tmp25_ = ggit_diff_delta_get_new_file (_data_->_tmp24_);
		_data_->_tmp26_ = _data_->self->priv->_info;
		_data_->_tmp27_ = gitg_diff_view_file_info_get_from_workdir (_data_->_tmp26_);
		_data_->_tmp28_ = _data_->_tmp27_;
		_data_->_state_ = 2;
		gitg_diff_view_file_renderer_text_init_highlighting_buffer (_data_->self, _data_->_tmp25_, _data_->_tmp28_, _data_->cancellable, gitg_diff_view_file_renderer_text_init_highlighting_buffer_new_ready, _data_);
		return FALSE;
		_state_2:
		_data_->_tmp29_ = gitg_diff_view_file_renderer_text_init_highlighting_buffer_finish (_data_->self, _data_->_res_);
		_g_object_unref0 (_data_->buffer);
		_data_->buffer = _data_->_tmp29_;
	}
	if (!g_cancellable_is_cancelled (_data_->cancellable)) {
		_data_->_tmp30_ = _data_->buffer;
		_data_->_tmp31_ = _g_object_ref0 (_data_->_tmp30_);
		_g_object_unref0 (_data_->self->priv->d_new_highlight_buffer);
		_data_->self->priv->d_new_highlight_buffer = _data_->_tmp31_;
		_data_->self->priv->d_new_highlight_ready = TRUE;
		gitg_diff_view_file_renderer_text_update_highlighting_ready (_data_->self);
	}
	_ggit_diff_file_unref0 (_data_->file);
	_g_object_unref0 (_data_->buffer);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
gitg_diff_view_file_renderer_text_init_highlighting_buffer_data_free (gpointer _data)
{
	GitgDiffViewFileRendererTextInitHighlightingBufferData* _data_;
	_data_ = _data;
	_ggit_diff_file_unref0 (_data_->file);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (GitgDiffViewFileRendererTextInitHighlightingBufferData, _data_);
}

static void
gitg_diff_view_file_renderer_text_init_highlighting_buffer (GitgDiffViewFileRendererText* self,
                                                            GgitDiffFile* file,
                                                            gboolean from_workdir,
                                                            GCancellable* cancellable,
                                                            GAsyncReadyCallback _callback_,
                                                            gpointer _user_data_)
{
	GitgDiffViewFileRendererTextInitHighlightingBufferData* _data_;
	GitgDiffViewFileRendererText* _tmp0_;
	GgitDiffFile* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (file != NULL);
	g_return_if_fail (cancellable != NULL);
	_data_ = g_slice_new0 (GitgDiffViewFileRendererTextInitHighlightingBufferData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, gitg_diff_view_file_renderer_text_init_highlighting_buffer_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _ggit_diff_file_ref0 (file);
	_ggit_diff_file_unref0 (_data_->file);
	_data_->file = _tmp1_;
	_data_->from_workdir = from_workdir;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	gitg_diff_view_file_renderer_text_init_highlighting_buffer_co (_data_);
}

static GtkSourceBuffer*
gitg_diff_view_file_renderer_text_init_highlighting_buffer_finish (GitgDiffViewFileRendererText* self,
                                                                   GAsyncResult* _res_)
{
	GtkSourceBuffer* result;
	GitgDiffViewFileRendererTextInitHighlightingBufferData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static GgitOId*
_vala_GgitOId_copy (GgitOId* self)
{
	return g_boxed_copy (ggit_oid_get_type (), self);
}

static gpointer
__vala_GgitOId_copy0 (gpointer self)
{
	return self ? _vala_GgitOId_copy (self) : NULL;
}

static void
_vala_GgitOId_free (GgitOId* self)
{
	g_boxed_free (ggit_oid_get_type (), self);
}

static guint8*
_vala_array_dup12 (guint8* self,
                   gssize length)
{
	if (length > 0) {
		return g_memdup2 (self, length * sizeof (guint8));
	}
	return NULL;
}

static void
gitg_diff_view_file_renderer_text_init_highlighting_buffer_ready (GObject* source_object,
                                                                  GAsyncResult* _res_,
                                                                  gpointer _user_data_)
{
	GitgDiffViewFileRendererTextInitHighlightingBufferData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	gitg_diff_view_file_renderer_text_init_highlighting_buffer_co (_data_);
}

static gboolean
gitg_diff_view_file_renderer_text_init_highlighting_buffer_co (GitgDiffViewFileRendererTextInitHighlightingBufferData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = ggit_diff_file_get_oid (_data_->file);
	_data_->_tmp1_ = __vala_GgitOId_copy0 (_data_->_tmp0_);
	_data_->id = _data_->_tmp1_;
	_data_->_tmp2_ = gitg_diff_view_file_renderer_text_get_file_location (_data_->self, _data_->file);
	_data_->location = _data_->_tmp2_;
	_data_->_tmp5_ = _data_->id;
	if (ggit_oid_is_zero (_data_->_tmp5_)) {
		_data_->_tmp4_ = !_data_->from_workdir;
	} else {
		_data_->_tmp4_ = FALSE;
	}
	if (_data_->_tmp4_) {
		_data_->_tmp3_ = TRUE;
	} else {
		_data_->_tmp7_ = _data_->location;
		if (_data_->_tmp7_ == NULL) {
			_data_->_tmp6_ = _data_->from_workdir;
		} else {
			_data_->_tmp6_ = FALSE;
		}
		_data_->_tmp3_ = _data_->_tmp6_;
	}
	if (_data_->_tmp3_) {
		_data_->result = NULL;
		_g_object_unref0 (_data_->location);
		__vala_GgitOId_free0 (_data_->id);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->content_length1 = 0;
	_data_->_content_size_ = 0;
	if (!_data_->from_workdir) {
		{
			_data_->_tmp9_ = gitg_diff_view_file_renderer_text_get_repository (_data_->self);
			_data_->_tmp10_ = _data_->_tmp9_;
			_data_->_tmp11_ = _data_->id;
			_data_->_tmp12_ = gitg_repository_lookup (_data_->_tmp10_, ggit_blob_get_type (), (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp11_, &_data_->_inner_error0_);
			_data_->_tmp8_ = (GgitBlob*) _data_->_tmp12_;
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
			_data_->_tmp13_ = _data_->_tmp8_;
			_data_->_tmp8_ = NULL;
			_g_object_unref0 (_data_->blob);
			_data_->blob = _data_->_tmp13_;
			_g_object_unref0 (_data_->_tmp8_);
		}
		goto __finally0;
		__catch0_g_error:
		{
			g_clear_error (&_data_->_inner_error0_);
			_data_->result = NULL;
			_g_object_unref0 (_data_->blob);
			_data_->content = (g_free (_data_->content), NULL);
			_g_object_unref0 (_data_->location);
			__vala_GgitOId_free0 (_data_->id);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		__finally0:
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_object_unref0 (_data_->blob);
			_data_->content = (g_free (_data_->content), NULL);
			_g_object_unref0 (_data_->location);
			__vala_GgitOId_free0 (_data_->id);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
			g_clear_error (&_data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp14_ = gitg_diff_view_file_renderer_text_get_repository (_data_->self);
		_data_->_tmp15_ = _data_->_tmp14_;
		if (gitg_text_conv_has_textconv_command (_data_->_tmp15_, _data_->file)) {
			_data_->_tmp16_ = gitg_diff_view_file_renderer_text_get_repository (_data_->self);
			_data_->_tmp17_ = _data_->_tmp16_;
			_data_->_tmp18_ = 0;
			_data_->_tmp19_ = gitg_text_conv_get_textconv_content (_data_->_tmp17_, _data_->file, &_data_->_tmp18_);
			_data_->content = (g_free (_data_->content), NULL);
			_data_->content = _data_->_tmp19_;
			_data_->content_length1 = _data_->_tmp18_;
			_data_->_content_size_ = _data_->content_length1;
		} else {
			_data_->_tmp20_ = _data_->blob;
			_data_->_tmp21_ = 0;
			_data_->_tmp22_ = ggit_blob_get_raw_content (_data_->_tmp20_, &_data_->_tmp21_);
			_data_->_tmp23_ = (_data_->_tmp22_ != NULL) ? _vala_array_dup12 (_data_->_tmp22_, _data_->_tmp21_) : _data_->_tmp22_;
			_data_->_tmp23__length1 = _data_->_tmp21_;
			_data_->content = (g_free (_data_->content), NULL);
			_data_->content = _data_->_tmp23_;
			_data_->content_length1 = _data_->_tmp23__length1;
			_data_->_content_size_ = _data_->content_length1;
		}
		_g_object_unref0 (_data_->blob);
	} else {
		{
			_data_->_tmp24_ = _data_->location;
			_data_->_tmp25_ = NULL;
			_data_->_tmp26_ = 0;
			_data_->_state_ = 1;
			g_file_load_contents_async (_data_->_tmp24_, _data_->cancellable, gitg_diff_view_file_renderer_text_init_highlighting_buffer_ready, _data_);
			return FALSE;
			_state_1:
			g_file_load_contents_finish (_data_->_tmp24_, _data_->_res_, &_data_->_tmp25_, &_data_->_tmp26_, NULL, &_data_->_inner_error0_);
			_data_->content = (g_free (_data_->content), NULL);
			_data_->content = _data_->_tmp25_;
			_data_->content_length1 = _data_->_tmp26_;
			_data_->_content_size_ = _data_->content_length1;
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				goto __catch1_g_error;
			}
			_data_->_tmp27_ = gitg_diff_view_file_renderer_text_get_repository (_data_->self);
			_data_->_tmp28_ = _data_->_tmp27_;
			if (gitg_text_conv_has_textconv_command (_data_->_tmp28_, _data_->file)) {
				_data_->_tmp29_ = gitg_diff_view_file_renderer_text_get_repository (_data_->self);
				_data_->_tmp30_ = _data_->_tmp29_;
				_data_->_tmp31_ = _data_->content;
				_data_->_tmp31__length1 = _data_->content_length1;
				_data_->_tmp32_ = 0;
				_data_->_tmp33_ = gitg_text_conv_get_textconv_content_from_raw (_data_->_tmp30_, _data_->file, _data_->_tmp31_, (gint) _data_->_tmp31__length1, &_data_->_tmp32_);
				_data_->content = (g_free (_data_->content), NULL);
				_data_->content = _data_->_tmp33_;
				_data_->content_length1 = _data_->_tmp32_;
				_data_->_content_size_ = _data_->content_length1;
			}
		}
		goto __finally1;
		__catch1_g_error:
		{
			g_clear_error (&_data_->_inner_error0_);
			_data_->result = NULL;
			_data_->content = (g_free (_data_->content), NULL);
			_g_object_unref0 (_data_->location);
			__vala_GgitOId_free0 (_data_->id);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		__finally1:
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_data_->content = (g_free (_data_->content), NULL);
			_g_object_unref0 (_data_->location);
			__vala_GgitOId_free0 (_data_->id);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
			g_clear_error (&_data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	}
	_data_->_tmp34_ = _data_->location;
	_data_->_tmp35_ = g_file_get_basename (_data_->_tmp34_);
	_data_->_tmp36_ = _data_->_tmp35_;
	_data_->_tmp37_ = _data_->content;
	_data_->_tmp37__length1 = _data_->content_length1;
	_data_->_tmp38_ = FALSE;
	_data_->_tmp39_ = g_content_type_guess (_data_->_tmp36_, _data_->_tmp37_, (gsize) _data_->_tmp37__length1, &_data_->_tmp38_);
	_data_->uncertain = _data_->_tmp38_;
	_data_->_tmp40_ = _data_->_tmp39_;
	_g_free0 (_data_->_tmp36_);
	_data_->content_type = _data_->_tmp40_;
	_data_->_tmp41_ = _data_->content;
	_data_->_tmp41__length1 = _data_->content_length1;
	_data_->_tmp42_ = g_bytes_new (_data_->_tmp41_, _data_->_tmp41__length1);
	_data_->_tmp43_ = _data_->_tmp42_;
	_data_->_tmp44_ = (GMemoryInputStream*) g_memory_input_stream_new_from_bytes (_data_->_tmp43_);
	_data_->_tmp45_ = _data_->_tmp44_;
	_g_bytes_unref0 (_data_->_tmp43_);
	_data_->stream = _data_->_tmp45_;
	_data_->_tmp46_ = _data_->location;
	_data_->_tmp47_ = _data_->stream;
	_data_->_tmp48_ = _data_->content_type;
	_data_->_state_ = 2;
	gitg_diff_view_file_renderer_text_init_highlighting_buffer_from_stream (_data_->self, _data_->file, _data_->_tmp46_, (GInputStream*) _data_->_tmp47_, _data_->_tmp48_, _data_->cancellable, gitg_diff_view_file_renderer_text_init_highlighting_buffer_ready, _data_);
	return FALSE;
	_state_2:
	_data_->_tmp49_ = gitg_diff_view_file_renderer_text_init_highlighting_buffer_from_stream_finish (_data_->self, _data_->_res_);
	_data_->result = _data_->_tmp49_;
	_g_object_unref0 (_data_->stream);
	_g_free0 (_data_->content_type);
	_data_->content = (g_free (_data_->content), NULL);
	_g_object_unref0 (_data_->location);
	__vala_GgitOId_free0 (_data_->id);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
gitg_diff_view_file_renderer_text_init_highlighting_buffer_from_stream_data_free (gpointer _data)
{
	GitgDiffViewFileRendererTextInitHighlightingBufferFromStreamData* _data_;
	_data_ = _data;
	_ggit_diff_file_unref0 (_data_->file);
	_g_object_unref0 (_data_->location);
	_g_object_unref0 (_data_->stream);
	_g_free0 (_data_->content_type);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (GitgDiffViewFileRendererTextInitHighlightingBufferFromStreamData, _data_);
}

static void
gitg_diff_view_file_renderer_text_init_highlighting_buffer_from_stream (GitgDiffViewFileRendererText* self,
                                                                        GgitDiffFile* file,
                                                                        GFile* location,
                                                                        GInputStream* stream,
                                                                        const gchar* content_type,
                                                                        GCancellable* cancellable,
                                                                        GAsyncReadyCallback _callback_,
                                                                        gpointer _user_data_)
{
	GitgDiffViewFileRendererTextInitHighlightingBufferFromStreamData* _data_;
	GitgDiffViewFileRendererText* _tmp0_;
	GgitDiffFile* _tmp1_;
	GFile* _tmp2_;
	GInputStream* _tmp3_;
	gchar* _tmp4_;
	GCancellable* _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (file != NULL);
	g_return_if_fail (location != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (content_type != NULL);
	g_return_if_fail (cancellable != NULL);
	_data_ = g_slice_new0 (GitgDiffViewFileRendererTextInitHighlightingBufferFromStreamData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, gitg_diff_view_file_renderer_text_init_highlighting_buffer_from_stream_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _ggit_diff_file_ref0 (file);
	_ggit_diff_file_unref0 (_data_->file);
	_data_->file = _tmp1_;
	_tmp2_ = _g_object_ref0 (location);
	_g_object_unref0 (_data_->location);
	_data_->location = _tmp2_;
	_tmp3_ = _g_object_ref0 (stream);
	_g_object_unref0 (_data_->stream);
	_data_->stream = _tmp3_;
	_tmp4_ = g_strdup (content_type);
	_g_free0 (_data_->content_type);
	_data_->content_type = _tmp4_;
	_tmp5_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp5_;
	gitg_diff_view_file_renderer_text_init_highlighting_buffer_from_stream_co (_data_);
}

static GtkSourceBuffer*
gitg_diff_view_file_renderer_text_init_highlighting_buffer_from_stream_finish (GitgDiffViewFileRendererText* self,
                                                                               GAsyncResult* _res_)
{
	GtkSourceBuffer* result;
	GitgDiffViewFileRendererTextInitHighlightingBufferFromStreamData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
___lambda57_ (GitgDiffViewFileRendererText* self,
              GSettings* s,
              const gchar* k)
{
	g_return_if_fail (s != NULL);
	g_return_if_fail (k != NULL);
	gitg_diff_view_file_renderer_text_update_style (self);
}

static void
____lambda57__g_settings_changed (GSettings* _sender,
                                  const gchar* key,
                                  gpointer self)
{
	___lambda57_ ((GitgDiffViewFileRendererText*) self, _sender, key);
}

static void
gitg_diff_view_file_renderer_text_init_highlighting_buffer_from_stream_ready (GObject* source_object,
                                                                              GAsyncResult* _res_,
                                                                              gpointer _user_data_)
{
	GitgDiffViewFileRendererTextInitHighlightingBufferFromStreamData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	gitg_diff_view_file_renderer_text_init_highlighting_buffer_from_stream_co (_data_);
}

static const gchar*
string_to_string (const gchar* self)
{
	const gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self;
	return result;
}

static gboolean
gitg_diff_view_file_renderer_text_init_highlighting_buffer_from_stream_co (GitgDiffViewFileRendererTextInitHighlightingBufferFromStreamData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = gtk_source_language_manager_get_default ();
	_data_->_tmp1_ = _g_object_ref0 (_data_->_tmp0_);
	_data_->manager = _data_->_tmp1_;
	if (_data_->location != NULL) {
		_data_->_tmp3_ = g_file_get_basename (_data_->location);
		_g_free0 (_data_->_tmp2_);
		_data_->_tmp2_ = _data_->_tmp3_;
	} else {
		_g_free0 (_data_->_tmp2_);
		_data_->_tmp2_ = NULL;
	}
	_data_->_tmp4_ = _data_->manager;
	_data_->_tmp5_ = gtk_source_language_manager_guess_language (_data_->_tmp4_, _data_->_tmp2_, _data_->content_type);
	_data_->_tmp6_ = _g_object_ref0 (_data_->_tmp5_);
	_data_->language = _data_->_tmp6_;
	_data_->_tmp7_ = gtk_text_view_get_buffer ((GtkTextView*) _data_->self);
	_data_->_tmp8_ = _data_->_tmp7_;
	_data_->_tmp9_ = gtk_text_buffer_get_tag_table (_data_->_tmp8_);
	_data_->_tmp10_ = _data_->_tmp9_;
	_data_->_tmp11_ = gtk_source_buffer_new (_data_->_tmp10_);
	_data_->buffer = _data_->_tmp11_;
	_data_->_tmp12_ = _data_->language;
	if (_data_->_tmp12_ != NULL) {
		_data_->_tmp13_ = _data_->buffer;
		_data_->_tmp14_ = _data_->language;
		gtk_source_buffer_set_language (_data_->_tmp13_, _data_->_tmp14_);
	}
	_data_->_tmp15_ = gtk_source_style_scheme_manager_get_default ();
	_data_->_tmp16_ = _g_object_ref0 (_data_->_tmp15_);
	_data_->style_scheme_manager = _data_->_tmp16_;
	_data_->_tmp17_ = _data_->buffer;
	gtk_source_buffer_set_highlight_syntax (_data_->_tmp17_, TRUE);
	_data_->_tmp18_ = gitg_diff_view_file_renderer_text_try_settings (_data_->self, APPLICATION_ID ".preferences.interface");
	_g_object_unref0 (_data_->self->priv->d_stylesettings);
	_data_->self->priv->d_stylesettings = _data_->_tmp18_;
	_data_->_tmp19_ = _data_->self->priv->d_stylesettings;
	if (_data_->_tmp19_ != NULL) {
		_data_->_tmp20_ = _data_->self->priv->d_stylesettings;
		g_signal_connect_object (_data_->_tmp20_, "changed::style-scheme", (GCallback) ____lambda57__g_settings_changed, _data_->self, 0);
		gitg_diff_view_file_renderer_text_update_style (_data_->self);
	} else {
		_data_->_tmp21_ = _data_->buffer;
		_data_->_tmp22_ = _data_->style_scheme_manager;
		_data_->_tmp23_ = gtk_source_style_scheme_manager_get_scheme (_data_->_tmp22_, "classic");
		gtk_source_buffer_set_style_scheme (_data_->_tmp21_, _data_->_tmp23_);
	}
	_data_->_tmp24_ = gtk_source_file_new ();
	_data_->sfile = _data_->_tmp24_;
	gtk_source_file_set_location (_data_->sfile, _data_->location);
	_data_->_tmp25_ = _data_->buffer;
	_data_->_tmp26_ = gtk_source_file_loader_new_from_stream (_data_->_tmp25_, _data_->sfile, _data_->stream);
	_data_->loader = _data_->_tmp26_;
	{
		_data_->_state_ = 1;
		gtk_source_file_loader_load_async (_data_->loader, G_PRIORITY_LOW, _data_->cancellable, NULL, NULL, NULL, gitg_diff_view_file_renderer_text_init_highlighting_buffer_from_stream_ready, _data_);
		return FALSE;
		_state_1:
		gtk_source_file_loader_load_finish (_data_->loader, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp27_ = _data_->buffer;
		gitg_diff_view_file_renderer_text_strip_carriage_returns (_data_->self, _data_->_tmp27_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		if (!g_cancellable_is_cancelled (_data_->cancellable)) {
			_data_->_tmp28_ = stderr;
			_data_->_tmp29_ = ggit_diff_file_get_path (_data_->file);
			_data_->_tmp30_ = string_to_string (_data_->_tmp29_);
			_data_->_tmp31_ = _data_->e;
			_data_->_tmp32_ = _data_->_tmp31_->message;
			_data_->_tmp33_ = string_to_string (_data_->_tmp32_);
			_data_->_tmp34_ = g_strconcat ("ERROR: failed to load ", _data_->_tmp30_, " for highlighting: ", _data_->_tmp33_, "\n", NULL);
			_data_->_tmp35_ = _data_->_tmp34_;
			fprintf (_data_->_tmp28_, "%s", _data_->_tmp35_);
			_g_free0 (_data_->_tmp35_);
		}
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->loader);
		_g_object_unref0 (_data_->sfile);
		_g_object_unref0 (_data_->style_scheme_manager);
		_g_object_unref0 (_data_->buffer);
		_g_object_unref0 (_data_->language);
		_g_free0 (_data_->_tmp2_);
		_g_object_unref0 (_data_->manager);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->result = _data_->buffer;
	_g_object_unref0 (_data_->loader);
	_g_object_unref0 (_data_->sfile);
	_g_object_unref0 (_data_->style_scheme_manager);
	_g_object_unref0 (_data_->language);
	_g_free0 (_data_->_tmp2_);
	_g_object_unref0 (_data_->manager);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
gitg_diff_view_file_renderer_text_update_style (GitgDiffViewFileRendererText* self)
{
	gchar* scheme = NULL;
	GSettings* _tmp0_;
	gchar* _tmp1_;
	GtkSourceStyleSchemeManager* manager = NULL;
	GtkSourceStyleSchemeManager* _tmp2_;
	GtkSourceStyleSchemeManager* _tmp3_;
	GtkSourceStyleScheme* s = NULL;
	GtkSourceStyleSchemeManager* _tmp4_;
	const gchar* _tmp5_;
	GtkSourceStyleScheme* _tmp6_;
	GtkSourceStyleScheme* _tmp7_;
	GtkSourceStyleScheme* _tmp8_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->d_stylesettings;
	_tmp1_ = g_settings_get_string (_tmp0_, "style-scheme");
	scheme = _tmp1_;
	_tmp2_ = gtk_source_style_scheme_manager_get_default ();
	_tmp3_ = _g_object_ref0 (_tmp2_);
	manager = _tmp3_;
	_tmp4_ = manager;
	_tmp5_ = scheme;
	_tmp6_ = gtk_source_style_scheme_manager_get_scheme (_tmp4_, _tmp5_);
	_tmp7_ = _g_object_ref0 (_tmp6_);
	s = _tmp7_;
	_tmp8_ = s;
	if (_tmp8_ != NULL) {
		GtkTextBuffer* _tmp9_;
		GtkTextBuffer* _tmp10_;
		GtkSourceStyleScheme* _tmp11_;
		_tmp9_ = gtk_text_view_get_buffer ((GtkTextView*) self);
		_tmp10_ = _tmp9_;
		_tmp11_ = s;
		gtk_source_buffer_set_style_scheme (G_TYPE_CHECK_INSTANCE_CAST (_tmp10_, gtk_source_buffer_get_type (), GtkSourceBuffer), _tmp11_);
	}
	_g_object_unref0 (s);
	_g_object_unref0 (manager);
	_g_free0 (scheme);
}

static gpointer
_g_settings_schema_source_ref0 (gpointer self)
{
	return self ? g_settings_schema_source_ref (self) : NULL;
}

static GSettings*
gitg_diff_view_file_renderer_text_try_settings (GitgDiffViewFileRendererText* self,
                                                const gchar* schema_id)
{
	GSettingsSchemaSource* source = NULL;
	GSettingsSchemaSource* _tmp0_;
	GSettingsSchemaSource* _tmp1_;
	GSettingsSchemaSource* _tmp2_;
	GSettingsSchemaSource* _tmp3_;
	GSettingsSchema* _tmp4_;
	GSettingsSchema* _tmp5_;
	gboolean _tmp6_;
	GSettings* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (schema_id != NULL, NULL);
	_tmp0_ = g_settings_schema_source_get_default ();
	_tmp1_ = _g_settings_schema_source_ref0 (_tmp0_);
	source = _tmp1_;
	_tmp2_ = source;
	if (_tmp2_ == NULL) {
		result = NULL;
		_g_settings_schema_source_unref0 (source);
		return result;
	}
	_tmp3_ = source;
	_tmp4_ = g_settings_schema_source_lookup (_tmp3_, schema_id, TRUE);
	_tmp5_ = _tmp4_;
	_tmp6_ = _tmp5_ != NULL;
	_g_settings_schema_unref0 (_tmp5_);
	if (_tmp6_) {
		GSettings* _tmp7_;
		_tmp7_ = g_settings_new (schema_id);
		result = _tmp7_;
		_g_settings_schema_source_unref0 (source);
		return result;
	}
	result = NULL;
	_g_settings_schema_source_unref0 (source);
	return result;
}

static void
gitg_diff_view_file_renderer_text_strip_carriage_returns (GitgDiffViewFileRendererText* self,
                                                          GtkSourceBuffer* buffer)
{
	GtkSourceSearchSettings* search_settings = NULL;
	GtkSourceSearchSettings* _tmp0_;
	GtkSourceSearchContext* search_context = NULL;
	GtkSourceSearchContext* _tmp1_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (buffer != NULL);
	_tmp0_ = gtk_source_search_settings_new ();
	search_settings = _tmp0_;
	gtk_source_search_settings_set_regex_enabled (search_settings, TRUE);
	gtk_source_search_settings_set_search_text (search_settings, "\\r");
	_tmp1_ = gtk_source_search_context_new (buffer, search_settings);
	search_context = _tmp1_;
	{
		gtk_source_search_context_replace_all (search_context, "", 0, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_inner_error0_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_object_unref0 (search_context);
		_g_object_unref0 (search_settings);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
	_g_object_unref0 (search_context);
	_g_object_unref0 (search_settings);
}

static void
gitg_diff_view_file_renderer_text_update_highlighting_ready (GitgDiffViewFileRendererText* self)
{
	gboolean _tmp0_ = FALSE;
	GtkTextBuffer* buffer = NULL;
	GtkTextBuffer* _tmp2_;
	GtkTextBuffer* _tmp3_;
	GtkTextBuffer* _tmp4_;
	GitgDiffViewFileRendererTextRegion* _tmp5_;
	gint _tmp5__length1;
	g_return_if_fail (self != NULL);
	if (!self->priv->d_old_highlight_ready) {
		_tmp0_ = !self->priv->d_new_highlight_ready;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		return;
	} else {
		gboolean _tmp1_ = FALSE;
		if (!self->priv->d_old_highlight_ready) {
			_tmp1_ = TRUE;
		} else {
			_tmp1_ = !self->priv->d_new_highlight_ready;
		}
		if (_tmp1_) {
			return;
		}
	}
	_tmp2_ = gtk_text_view_get_buffer ((GtkTextView*) self);
	_tmp3_ = _tmp2_;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	buffer = _tmp4_;
	_tmp5_ = self->priv->d_regions;
	_tmp5__length1 = self->priv->d_regions_length1;
	{
		GitgDiffViewFileRendererTextRegion* region_collection = NULL;
		gint region_collection_length1 = 0;
		gint _region_collection_size_ = 0;
		gint region_it = 0;
		region_collection = _tmp5_;
		region_collection_length1 = _tmp5__length1;
		for (region_it = 0; region_it < region_collection_length1; region_it = region_it + 1) {
			GitgDiffViewFileRendererTextRegion region = {0};
			region = region_collection[region_it];
			{
				GtkSourceBuffer* source = NULL;
				GitgDiffViewFileRendererTextRegion _tmp6_;
				GtkSourceBuffer* _tmp11_;
				GtkTextIter buffer_iter = {0};
				GtkTextIter source_iter = {0};
				GtkTextBuffer* _tmp12_;
				GitgDiffViewFileRendererTextRegion _tmp13_;
				GtkTextIter _tmp14_ = {0};
				GtkSourceBuffer* _tmp15_;
				GitgDiffViewFileRendererTextRegion _tmp16_;
				GtkTextIter _tmp17_ = {0};
				GtkTextIter source_end_iter = {0};
				GtkTextIter _tmp18_;
				GitgDiffViewFileRendererTextRegion _tmp19_;
				GtkSourceBuffer* _tmp20_;
				GtkTextIter _tmp21_;
				GtkTextIter _tmp22_;
				GtkTextIter buffer_end_iter = {0};
				GtkTextIter _tmp23_;
				GitgDiffViewFileRendererTextRegion _tmp24_;
				GtkTextIter source_next_iter = {0};
				GtkTextIter _tmp25_;
				GSList* tags = NULL;
				GSList* _tmp26_;
				GSList* _tmp38_;
				_tmp6_ = region;
				if (_tmp6_.type == GITG_DIFF_VIEW_FILE_RENDERER_TEXT_REGION_TYPE_REMOVED) {
					GtkSourceBuffer* _tmp7_;
					GtkSourceBuffer* _tmp8_;
					_tmp7_ = self->priv->d_old_highlight_buffer;
					_tmp8_ = _g_object_ref0 (_tmp7_);
					_g_object_unref0 (source);
					source = _tmp8_;
				} else {
					GtkSourceBuffer* _tmp9_;
					GtkSourceBuffer* _tmp10_;
					_tmp9_ = self->priv->d_new_highlight_buffer;
					_tmp10_ = _g_object_ref0 (_tmp9_);
					_g_object_unref0 (source);
					source = _tmp10_;
				}
				_tmp11_ = source;
				if (_tmp11_ == NULL) {
					_g_object_unref0 (source);
					continue;
				}
				_tmp12_ = buffer;
				_tmp13_ = region;
				gtk_text_buffer_get_iter_at_line (_tmp12_, &_tmp14_, _tmp13_.buffer_line_start);
				buffer_iter = _tmp14_;
				_tmp15_ = source;
				_tmp16_ = region;
				gtk_text_buffer_get_iter_at_line ((GtkTextBuffer*) _tmp15_, &_tmp17_, _tmp16_.source_line_start);
				source_iter = _tmp17_;
				_tmp18_ = source_iter;
				source_end_iter = _tmp18_;
				_tmp19_ = region;
				gtk_text_iter_forward_lines (&source_end_iter, _tmp19_.length);
				_tmp20_ = source;
				_tmp21_ = source_iter;
				_tmp22_ = source_end_iter;
				gtk_source_buffer_ensure_highlight (_tmp20_, &_tmp21_, &_tmp22_);
				_tmp23_ = buffer_iter;
				buffer_end_iter = _tmp23_;
				_tmp24_ = region;
				gtk_text_iter_forward_lines (&buffer_end_iter, _tmp24_.length);
				_tmp25_ = source_iter;
				source_next_iter = _tmp25_;
				_tmp26_ = gtk_text_iter_get_tags (&source_iter);
				tags = _tmp26_;
				while (TRUE) {
					gboolean _tmp27_ = FALSE;
					GtkTextIter buffer_next_iter = {0};
					GtkTextIter _tmp29_;
					GSList* _tmp30_;
					GtkTextIter _tmp35_;
					GtkTextIter _tmp36_;
					GSList* _tmp37_;
					if (gtk_text_iter_forward_to_tag_toggle (&source_next_iter, NULL)) {
						GtkTextIter _tmp28_;
						_tmp28_ = source_end_iter;
						_tmp27_ = gtk_text_iter_compare (&source_next_iter, &_tmp28_) < 0;
					} else {
						_tmp27_ = FALSE;
					}
					if (!_tmp27_) {
						break;
					}
					_tmp29_ = buffer_iter;
					buffer_next_iter = _tmp29_;
					gtk_text_iter_forward_chars (&buffer_next_iter, gtk_text_iter_get_offset (&source_next_iter) - gtk_text_iter_get_offset (&source_iter));
					_tmp30_ = tags;
					{
						GSList* tag_collection = NULL;
						GSList* tag_it = NULL;
						tag_collection = _tmp30_;
						for (tag_it = tag_collection; tag_it != NULL; tag_it = tag_it->next) {
							GtkTextTag* tag = NULL;
							tag = (GtkTextTag*) tag_it->data;
							{
								GtkTextBuffer* _tmp31_;
								GtkTextTag* _tmp32_;
								GtkTextIter _tmp33_;
								GtkTextIter _tmp34_;
								_tmp31_ = buffer;
								_tmp32_ = tag;
								_tmp33_ = buffer_iter;
								_tmp34_ = buffer_next_iter;
								gtk_text_buffer_apply_tag (_tmp31_, _tmp32_, &_tmp33_, &_tmp34_);
							}
						}
					}
					_tmp35_ = source_next_iter;
					source_iter = _tmp35_;
					_tmp36_ = buffer_next_iter;
					buffer_iter = _tmp36_;
					_tmp37_ = gtk_text_iter_get_tags (&source_iter);
					(tags == NULL) ? NULL : (tags = (g_slist_free (tags), NULL));
					tags = _tmp37_;
				}
				_tmp38_ = tags;
				{
					GSList* tag_collection = NULL;
					GSList* tag_it = NULL;
					tag_collection = _tmp38_;
					for (tag_it = tag_collection; tag_it != NULL; tag_it = tag_it->next) {
						GtkTextTag* tag = NULL;
						tag = (GtkTextTag*) tag_it->data;
						{
							GtkTextBuffer* _tmp39_;
							GtkTextTag* _tmp40_;
							GtkTextIter _tmp41_;
							GtkTextIter _tmp42_;
							_tmp39_ = buffer;
							_tmp40_ = tag;
							_tmp41_ = buffer_iter;
							_tmp42_ = buffer_end_iter;
							gtk_text_buffer_apply_tag (_tmp39_, _tmp40_, &_tmp41_, &_tmp42_);
						}
					}
				}
				(tags == NULL) ? NULL : (tags = (g_slist_free (tags), NULL));
				_g_object_unref0 (source);
			}
		}
	}
	_g_object_unref0 (buffer);
}

static gboolean
gitg_diff_view_file_renderer_text_real_draw (GtkWidget* base,
                                             cairo_t* cr)
{
	GitgDiffViewFileRendererText * self;
	GdkWindow* win = NULL;
	GdkWindow* _tmp0_;
	GdkWindow* _tmp1_;
	GdkWindow* _tmp2_;
	GtkStyleContext* ctx = NULL;
	GtkStyleContext* _tmp3_;
	GtkStyleContext* _tmp4_;
	gint old_lines_width = 0;
	gint new_lines_width = 0;
	GitgDiffViewFileRendererTextStyle _tmp5_;
	gint sym_lines_width = 0;
	GitgDiffViewLinesRenderer* _tmp30_;
	gint _tmp31_;
	gint _tmp32_;
	GitgDiffViewLinesRenderer* _tmp33_;
	gint _tmp34_;
	gint _tmp35_;
	GitgDiffViewFileRendererTextStyle _tmp36_;
	GtkStyleContext* _tmp43_;
	GdkWindow* _tmp44_;
	GtkStyleContext* _tmp45_;
	GtkStyleContext* _tmp46_;
	GdkWindow* _tmp47_;
	GtkStyleContext* _tmp48_;
	gboolean result;
	self = (GitgDiffViewFileRendererText*) base;
	g_return_val_if_fail (cr != NULL, FALSE);
	GTK_WIDGET_CLASS (gitg_diff_view_file_renderer_text_parent_class)->draw ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_source_view_get_type (), GtkSourceView), cr);
	_tmp0_ = gtk_text_view_get_window ((GtkTextView*) self, GTK_TEXT_WINDOW_LEFT);
	_tmp1_ = _g_object_ref0 (_tmp0_);
	win = _tmp1_;
	_tmp2_ = win;
	if (!gtk_cairo_should_draw_window (cr, _tmp2_)) {
		result = FALSE;
		_g_object_unref0 (win);
		return result;
	}
	_tmp3_ = gtk_widget_get_style_context ((GtkWidget*) self);
	_tmp4_ = _g_object_ref0 (_tmp3_);
	ctx = _tmp4_;
	old_lines_width = 0;
	new_lines_width = 0;
	_tmp5_ = self->priv->_d_style;
	switch (_tmp5_) {
		case GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_ONE:
		{
			GitgDiffViewLinesRenderer* _tmp6_;
			gint _tmp7_;
			gint _tmp8_;
			GitgDiffViewLinesRenderer* _tmp9_;
			gint _tmp10_;
			gint _tmp11_;
			GitgDiffViewLinesRenderer* _tmp12_;
			gint _tmp13_;
			gint _tmp14_;
			GitgDiffViewLinesRenderer* _tmp15_;
			gint _tmp16_;
			gint _tmp17_;
			_tmp6_ = self->priv->d_old_lines;
			_tmp7_ = gtk_source_gutter_renderer_get_size ((GtkSourceGutterRenderer*) _tmp6_);
			_tmp8_ = _tmp7_;
			_tmp9_ = self->priv->d_old_lines;
			g_object_get ((GtkSourceGutterRenderer*) _tmp9_, "xpad", &_tmp10_, NULL);
			_tmp11_ = _tmp10_;
			old_lines_width = _tmp8_ + (_tmp11_ * 2);
			_tmp12_ = self->priv->d_new_lines;
			_tmp13_ = gtk_source_gutter_renderer_get_size ((GtkSourceGutterRenderer*) _tmp12_);
			_tmp14_ = _tmp13_;
			_tmp15_ = self->priv->d_new_lines;
			g_object_get ((GtkSourceGutterRenderer*) _tmp15_, "xpad", &_tmp16_, NULL);
			_tmp17_ = _tmp16_;
			new_lines_width = _tmp14_ + (_tmp17_ * 2);
			break;
		}
		case GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_OLD:
		{
			GitgDiffViewLinesRenderer* _tmp18_;
			gint _tmp19_;
			gint _tmp20_;
			GitgDiffViewLinesRenderer* _tmp21_;
			gint _tmp22_;
			gint _tmp23_;
			_tmp18_ = self->priv->d_old_lines;
			_tmp19_ = gtk_source_gutter_renderer_get_size ((GtkSourceGutterRenderer*) _tmp18_);
			_tmp20_ = _tmp19_;
			_tmp21_ = self->priv->d_old_lines;
			g_object_get ((GtkSourceGutterRenderer*) _tmp21_, "xpad", &_tmp22_, NULL);
			_tmp23_ = _tmp22_;
			old_lines_width = _tmp20_ + (_tmp23_ * 2);
			break;
		}
		case GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_NEW:
		{
			GitgDiffViewLinesRenderer* _tmp24_;
			gint _tmp25_;
			gint _tmp26_;
			GitgDiffViewLinesRenderer* _tmp27_;
			gint _tmp28_;
			gint _tmp29_;
			_tmp24_ = self->priv->d_new_lines;
			_tmp25_ = gtk_source_gutter_renderer_get_size ((GtkSourceGutterRenderer*) _tmp24_);
			_tmp26_ = _tmp25_;
			_tmp27_ = self->priv->d_new_lines;
			g_object_get ((GtkSourceGutterRenderer*) _tmp27_, "xpad", &_tmp28_, NULL);
			_tmp29_ = _tmp28_;
			new_lines_width = _tmp26_ + (_tmp29_ * 2);
			break;
		}
		default:
		break;
	}
	_tmp30_ = self->priv->d_sym_lines;
	_tmp31_ = gtk_source_gutter_renderer_get_size ((GtkSourceGutterRenderer*) _tmp30_);
	_tmp32_ = _tmp31_;
	_tmp33_ = self->priv->d_sym_lines;
	g_object_get ((GtkSourceGutterRenderer*) _tmp33_, "xpad", &_tmp34_, NULL);
	_tmp35_ = _tmp34_;
	sym_lines_width = _tmp32_ + (_tmp35_ * 2);
	_tmp36_ = self->priv->_d_style;
	if (_tmp36_ == GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_ONE) {
		GtkStyleContext* _tmp37_;
		GdkWindow* _tmp38_;
		GtkStyleContext* _tmp39_;
		GtkStyleContext* _tmp40_;
		GdkWindow* _tmp41_;
		GtkStyleContext* _tmp42_;
		_tmp37_ = ctx;
		gtk_style_context_save (_tmp37_);
		_tmp38_ = win;
		gtk_cairo_transform_to_window (cr, (GtkWidget*) self, _tmp38_);
		_tmp39_ = ctx;
		gtk_style_context_add_class (_tmp39_, "diff-lines-separator");
		_tmp40_ = ctx;
		_tmp41_ = win;
		gtk_render_frame (_tmp40_, cr, (gdouble) 0, (gdouble) 0, (gdouble) old_lines_width, (gdouble) gdk_window_get_height (_tmp41_));
		_tmp42_ = ctx;
		gtk_style_context_restore (_tmp42_);
	}
	_tmp43_ = ctx;
	gtk_style_context_save (_tmp43_);
	_tmp44_ = win;
	gtk_cairo_transform_to_window (cr, (GtkWidget*) self, _tmp44_);
	_tmp45_ = ctx;
	gtk_style_context_add_class (_tmp45_, "diff-lines-gutter-border");
	_tmp46_ = ctx;
	_tmp47_ = win;
	gtk_render_frame (_tmp46_, cr, (gdouble) (old_lines_width + new_lines_width), (gdouble) 0, (gdouble) sym_lines_width, (gdouble) gdk_window_get_height (_tmp47_));
	_tmp48_ = ctx;
	gtk_style_context_restore (_tmp48_);
	result = FALSE;
	_g_object_unref0 (ctx);
	_g_object_unref0 (win);
	return result;
}

static void
gitg_diff_view_file_renderer_text_update_theme (GitgDiffViewFileRendererText* self)
{
	GtkSourceMarkAttributes* header_attributes = NULL;
	GtkSourceMarkAttributes* _tmp0_;
	GtkSourceMarkAttributes* added_attributes = NULL;
	GtkSourceMarkAttributes* _tmp1_;
	GtkSourceMarkAttributes* removed_attributes = NULL;
	GtkSourceMarkAttributes* _tmp2_;
	gboolean dark = FALSE;
	GitgTheme* _tmp3_;
	GitgTheme* _tmp4_;
	gboolean _tmp5_;
	GtkSourceMarkAttributes* _tmp18_;
	GtkSourceMarkAttributes* _tmp19_;
	GtkSourceMarkAttributes* _tmp20_;
	g_return_if_fail (self != NULL);
	_tmp0_ = gtk_source_mark_attributes_new ();
	header_attributes = _tmp0_;
	_tmp1_ = gtk_source_mark_attributes_new ();
	added_attributes = _tmp1_;
	_tmp2_ = gtk_source_mark_attributes_new ();
	removed_attributes = _tmp2_;
	_tmp3_ = gitg_theme_new ();
	g_object_ref_sink (_tmp3_);
	_tmp4_ = _tmp3_;
	_tmp5_ = gitg_theme_is_theme_dark (_tmp4_);
	_g_object_unref0 (_tmp4_);
	dark = _tmp5_;
	if (dark) {
		GtkSourceMarkAttributes* _tmp6_;
		GdkRGBA _tmp7_ = {0};
		GtkSourceMarkAttributes* _tmp8_;
		GdkRGBA _tmp9_ = {0};
		GtkSourceMarkAttributes* _tmp10_;
		GdkRGBA _tmp11_ = {0};
		_tmp6_ = header_attributes;
		memset (&_tmp7_, 0, sizeof (GdkRGBA));
		_tmp7_.red = 88.0 / 255.0;
		_tmp7_.green = 88.0 / 255.0;
		_tmp7_.blue = 88.0 / 255.0;
		_tmp7_.alpha = 1.0;
		g_object_set (_tmp6_, "background", &_tmp7_, NULL);
		_tmp8_ = added_attributes;
		memset (&_tmp9_, 0, sizeof (GdkRGBA));
		_tmp9_.red = 32.0 / 255.0;
		_tmp9_.green = 68.0 / 255.0;
		_tmp9_.blue = 21.0 / 255.0;
		_tmp9_.alpha = 1.0;
		g_object_set (_tmp8_, "background", &_tmp9_, NULL);
		_tmp10_ = removed_attributes;
		memset (&_tmp11_, 0, sizeof (GdkRGBA));
		_tmp11_.red = 130.0 / 255.0;
		_tmp11_.green = 55.0 / 255.0;
		_tmp11_.blue = 53.0 / 255.0;
		_tmp11_.alpha = 1.0;
		g_object_set (_tmp10_, "background", &_tmp11_, NULL);
	} else {
		GtkSourceMarkAttributes* _tmp12_;
		GdkRGBA _tmp13_ = {0};
		GtkSourceMarkAttributes* _tmp14_;
		GdkRGBA _tmp15_ = {0};
		GtkSourceMarkAttributes* _tmp16_;
		GdkRGBA _tmp17_ = {0};
		_tmp12_ = header_attributes;
		memset (&_tmp13_, 0, sizeof (GdkRGBA));
		_tmp13_.red = 244.0 / 255.0;
		_tmp13_.green = 247.0 / 255.0;
		_tmp13_.blue = 251.0 / 255.0;
		_tmp13_.alpha = 1.0;
		g_object_set (_tmp12_, "background", &_tmp13_, NULL);
		_tmp14_ = added_attributes;
		memset (&_tmp15_, 0, sizeof (GdkRGBA));
		_tmp15_.red = 220.0 / 255.0;
		_tmp15_.green = 1.0;
		_tmp15_.blue = 220.0 / 255.0;
		_tmp15_.alpha = 1.0;
		g_object_set (_tmp14_, "background", &_tmp15_, NULL);
		_tmp16_ = removed_attributes;
		memset (&_tmp17_, 0, sizeof (GdkRGBA));
		_tmp17_.red = 1.0;
		_tmp17_.green = 220.0 / 255.0;
		_tmp17_.blue = 220.0 / 255.0;
		_tmp17_.alpha = 1.0;
		g_object_set (_tmp16_, "background", &_tmp17_, NULL);
	}
	_tmp18_ = header_attributes;
	gtk_source_view_set_mark_attributes ((GtkSourceView*) self, "header", _tmp18_, 0);
	_tmp19_ = added_attributes;
	gtk_source_view_set_mark_attributes ((GtkSourceView*) self, "added", _tmp19_, 0);
	_tmp20_ = removed_attributes;
	gtk_source_view_set_mark_attributes ((GtkSourceView*) self, "removed", _tmp20_, 0);
	_g_object_unref0 (removed_attributes);
	_g_object_unref0 (added_attributes);
	_g_object_unref0 (header_attributes);
}

static void
gitg_diff_view_file_renderer_text_real_constructed (GObject* base)
{
	GitgDiffViewFileRendererText * self;
	self = (GitgDiffViewFileRendererText*) base;
	G_OBJECT_CLASS (gitg_diff_view_file_renderer_text_parent_class)->constructed ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_source_view_get_type (), GtkSourceView));
	self->priv->d_constructed = TRUE;
	gitg_diff_view_file_renderer_text_update_highlight (self);
}

static gint
string_last_index_of (const gchar* self,
                      const gchar* needle,
                      gint start_index)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	g_return_val_if_fail (needle != NULL, -1);
	_tmp0_ = g_strrstr (((gchar*) self) + start_index, (gchar*) needle);
	_result_ = _tmp0_;
	_tmp1_ = _result_;
	if (_tmp1_ != NULL) {
		gchar* _tmp2_;
		_tmp2_ = _result_;
		result = (gint) (_tmp2_ - ((gchar*) self));
		return result;
	} else {
		result = -1;
		return result;
	}
}

static glong
string_strnlen (gchar* str,
                glong maxlen)
{
	gchar* end = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	glong result;
	_tmp0_ = memchr (str, 0, (gsize) maxlen);
	end = _tmp0_;
	_tmp1_ = end;
	if (_tmp1_ == NULL) {
		result = maxlen;
		return result;
	} else {
		gchar* _tmp2_;
		_tmp2_ = end;
		result = (glong) (_tmp2_ - str);
		return result;
	}
}

static gchar*
string_substring (const gchar* self,
                  glong offset,
                  glong len)
{
	glong string_length = 0L;
	gboolean _tmp0_ = FALSE;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (offset >= ((glong) 0)) {
		_tmp0_ = len >= ((glong) 0);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		string_length = string_strnlen ((gchar*) self, offset + len);
	} else {
		gint _tmp1_;
		gint _tmp2_;
		_tmp1_ = strlen (self);
		_tmp2_ = _tmp1_;
		string_length = (glong) _tmp2_;
	}
	if (offset < ((glong) 0)) {
		offset = string_length + offset;
		g_return_val_if_fail (offset >= ((glong) 0), NULL);
	} else {
		g_return_val_if_fail (offset <= string_length, NULL);
	}
	if (len < ((glong) 0)) {
		len = string_length - offset;
	}
	g_return_val_if_fail ((offset + len) <= string_length, NULL);
	_tmp3_ = g_strndup (((gchar*) self) + offset, (gsize) len);
	result = _tmp3_;
	return result;
}

static gchar*
string_chug (const gchar* self)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (self);
	_result_ = _tmp0_;
	g_strchug (_result_);
	result = _result_;
	return result;
}

static gchar*
string_chomp (const gchar* self)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (self);
	_result_ = _tmp0_;
	g_strchomp (_result_);
	result = _result_;
	return result;
}

static gchar*
string_replace (const gchar* self,
                const gchar* old,
                const gchar* replacement)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (old != NULL, NULL);
	g_return_val_if_fail (replacement != NULL, NULL);
	if ((*((gchar*) self)) == '\0') {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = (*((gchar*) old)) == '\0';
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = g_strcmp0 (old, replacement) == 0;
	}
	if (_tmp0_) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup (self);
		result = _tmp2_;
		return result;
	}
	{
		GRegex* regex = NULL;
		gchar* _tmp3_;
		gchar* _tmp4_;
		GRegex* _tmp5_;
		GRegex* _tmp6_;
		gchar* _tmp7_ = NULL;
		GRegex* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp3_ = g_regex_escape_string (old, -1);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_regex_new (_tmp4_, 0, 0, &_inner_error0_);
		_tmp6_ = _tmp5_;
		_g_free0 (_tmp4_);
		regex = _tmp6_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp8_ = regex;
		_tmp9_ = g_regex_replace_literal (_tmp8_, self, (gssize) -1, 0, replacement, 0, &_inner_error0_);
		_tmp7_ = _tmp9_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_regex_unref0 (regex);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp10_ = _tmp7_;
		_tmp7_ = NULL;
		result = _tmp10_;
		_g_free0 (_tmp7_);
		_g_regex_unref0 (regex);
		return result;
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		g_clear_error (&_inner_error0_);
		g_assert_not_reached ();
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
	g_clear_error (&_inner_error0_);
	return NULL;
}

static void
_vala_array_add2 (GitgDiffViewFileRendererTextRegion* * array,
                  gint* length,
                  gint* size,
                  const GitgDiffViewFileRendererTextRegion* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GitgDiffViewFileRendererTextRegion, *array, *size);
	}
	(*array)[(*length)++] = *value;
}

static guint8*
_vala_array_dup13 (guint8* self,
                   gssize length)
{
	if (length > 0) {
		return g_memdup2 (self, length * sizeof (guint8));
	}
	return NULL;
}

static gchar
string_get (const gchar* self,
            glong index)
{
	gchar _tmp0_;
	gchar result;
	g_return_val_if_fail (self != NULL, '\0');
	_tmp0_ = ((gchar*) self)[index];
	result = _tmp0_;
	return result;
}

static gchar*
string_slice (const gchar* self,
              glong start,
              glong end)
{
	glong string_length = 0L;
	gint _tmp0_;
	gint _tmp1_;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gchar* _tmp4_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	string_length = (glong) _tmp1_;
	if (start < ((glong) 0)) {
		start = string_length + start;
	}
	if (end < ((glong) 0)) {
		end = string_length + end;
	}
	if (start >= ((glong) 0)) {
		_tmp2_ = start <= string_length;
	} else {
		_tmp2_ = FALSE;
	}
	g_return_val_if_fail (_tmp2_, NULL);
	if (end >= ((glong) 0)) {
		_tmp3_ = end <= string_length;
	} else {
		_tmp3_ = FALSE;
	}
	g_return_val_if_fail (_tmp3_, NULL);
	g_return_val_if_fail (start <= end, NULL);
	_tmp4_ = g_strndup (((gchar*) self) + start, (gsize) (end - start));
	result = _tmp4_;
	return result;
}

static GitgDiffViewFileRendererTextRegionType*
_gitg_diff_view_file_renderer_text_region_type_dup (GitgDiffViewFileRendererTextRegionType* self)
{
	GitgDiffViewFileRendererTextRegionType* dup;
	dup = g_new0 (GitgDiffViewFileRendererTextRegionType, 1);
	memcpy (dup, self, sizeof (GitgDiffViewFileRendererTextRegionType));
	return dup;
}

static gpointer
__gitg_diff_view_file_renderer_text_region_type_dup0 (gpointer self)
{
	return self ? _gitg_diff_view_file_renderer_text_region_type_dup (self) : NULL;
}

static gboolean
_gitg_diff_view_file_renderer_text_region_type_equal (const GitgDiffViewFileRendererTextRegionType * s1,
                                                      const GitgDiffViewFileRendererTextRegionType * s2)
{
	if (s1 == s2) {
		return TRUE;
	}
	if (s1 == NULL) {
		return FALSE;
	}
	if (s2 == NULL) {
		return FALSE;
	}
	return (*s1) == (*s2);
}

static void
_vala_array_add3 (GitgDiffViewFileRendererTextRegion* * array,
                  gint* length,
                  gint* size,
                  const GitgDiffViewFileRendererTextRegion* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GitgDiffViewFileRendererTextRegion, *array, *size);
	}
	(*array)[(*length)++] = *value;
}

static void
gitg_diff_view_file_renderer_text_real_add_hunk (GitgDiffViewFileRenderer* base,
                                                 GgitDiffHunk* hunk,
                                                 GeeArrayList* lines)
{
	GitgDiffViewFileRendererText * self;
	GtkSourceBuffer* buffer = NULL;
	GtkTextBuffer* _tmp0_;
	GtkTextBuffer* _tmp1_;
	GtkSourceBuffer* _tmp2_;
	gchar* h = NULL;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gint pos = 0;
	const gchar* _tmp5_;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	GtkTextIter iter = {0};
	GtkSourceBuffer* _tmp12_;
	GtkTextIter _tmp13_ = {0};
	GtkSourceBuffer* _tmp15_;
	GtkTextIter _tmp16_;
	gchar* header = NULL;
	gchar* _tmp17_;
	gchar* _tmp18_;
	gchar* _tmp19_;
	gchar* _tmp20_;
	gchar* _tmp21_;
	gchar* _tmp22_;
	gchar* _tmp23_;
	gchar* _tmp24_;
	const gchar* _tmp25_;
	const gchar* _tmp26_;
	gchar* _tmp27_;
	gchar* _tmp28_;
	GtkSourceBuffer* _tmp29_;
	const gchar* _tmp30_;
	gint buffer_line = 0;
	gint line_hunk_start = 0;
	GitgDiffViewFileRendererTextRegion region = {0};
	GitgDiffViewFileRendererTextRegion _tmp31_ = {0};
	gint add_line_num = 0;
	gint remove_line_num = 0;
	gboolean in_change_line = FALSE;
	gint _tmp150_;
	gint _tmp151_;
	gboolean _tmp153_ = FALSE;
	GitgDiffViewFileRendererTextStyle _tmp154_;
	gboolean _tmp158_ = FALSE;
	GitgDiffViewFileRendererTextStyle _tmp159_;
	GitgDiffViewLinesRenderer* _tmp163_;
	GtkSourceBuffer* _tmp164_;
	self = (GitgDiffViewFileRendererText*) base;
	g_return_if_fail (hunk != NULL);
	g_return_if_fail (lines != NULL);
	_tmp0_ = gtk_text_view_get_buffer ((GtkTextView*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp1_, gtk_source_buffer_get_type ()) ? ((GtkSourceBuffer*) _tmp1_) : NULL);
	buffer = _tmp2_;
	_tmp3_ = ggit_diff_hunk_get_header (hunk);
	_tmp4_ = g_strdup (_tmp3_);
	h = _tmp4_;
	_tmp5_ = h;
	pos = string_last_index_of (_tmp5_, "@@", 0);
	if (pos >= 0) {
		const gchar* _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_;
		gchar* _tmp9_;
		_tmp6_ = h;
		_tmp7_ = string_substring (_tmp6_, (glong) (pos + 2), (glong) -1);
		_tmp8_ = _tmp7_;
		_tmp9_ = string_chug (_tmp8_);
		_g_free0 (h);
		h = _tmp9_;
		_g_free0 (_tmp8_);
	}
	_tmp10_ = h;
	_tmp11_ = string_chomp (_tmp10_);
	_g_free0 (h);
	h = _tmp11_;
	_tmp12_ = buffer;
	gtk_text_buffer_get_end_iter ((GtkTextBuffer*) _tmp12_, &_tmp13_);
	iter = _tmp13_;
	if (!gtk_text_iter_is_start (&iter)) {
		GtkSourceBuffer* _tmp14_;
		_tmp14_ = buffer;
		gtk_text_buffer_insert ((GtkTextBuffer*) _tmp14_, &iter, "\n", 1);
	}
	gtk_text_iter_set_line_offset (&iter, 0);
	_tmp15_ = buffer;
	_tmp16_ = iter;
	gtk_source_buffer_create_source_mark (_tmp15_, NULL, "header", &_tmp16_);
	_tmp17_ = g_strdup_printf ("%i", ggit_diff_hunk_get_old_start (hunk));
	_tmp18_ = _tmp17_;
	_tmp19_ = g_strdup_printf ("%i", ggit_diff_hunk_get_old_lines (hunk));
	_tmp20_ = _tmp19_;
	_tmp21_ = g_strdup_printf ("%i", ggit_diff_hunk_get_new_start (hunk));
	_tmp22_ = _tmp21_;
	_tmp23_ = g_strdup_printf ("%i", ggit_diff_hunk_get_new_lines (hunk));
	_tmp24_ = _tmp23_;
	_tmp25_ = h;
	_tmp26_ = string_to_string (_tmp25_);
	_tmp27_ = g_strconcat ("@@ -", _tmp18_, ",", _tmp20_, " +", _tmp22_, ",", _tmp24_, " @@ ", _tmp26_, "\n", NULL);
	_tmp28_ = _tmp27_;
	_g_free0 (_tmp24_);
	_g_free0 (_tmp22_);
	_g_free0 (_tmp20_);
	_g_free0 (_tmp18_);
	header = _tmp28_;
	_tmp29_ = buffer;
	_tmp30_ = header;
	gtk_text_buffer_insert ((GtkTextBuffer*) _tmp29_, &iter, _tmp30_, -1);
	buffer_line = gtk_text_iter_get_line (&iter);
	line_hunk_start = gtk_text_iter_get_line (&iter);
	memset (&_tmp31_, 0, sizeof (GitgDiffViewFileRendererTextRegion));
	_tmp31_.type = GITG_DIFF_VIEW_FILE_RENDERER_TEXT_REGION_TYPE_CONTEXT;
	_tmp31_.buffer_line_start = 0;
	_tmp31_.source_line_start = 0;
	_tmp31_.length = 0;
	region = _tmp31_;
	g_object_freeze_notify ((GObject*) self);
	add_line_num = 0;
	remove_line_num = 0;
	in_change_line = FALSE;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp32_ = FALSE;
			_tmp32_ = TRUE;
			while (TRUE) {
				gint _tmp34_;
				gint _tmp35_;
				GgitDiffLine* line = NULL;
				gpointer _tmp36_;
				gchar* text = NULL;
				GgitDiffLine* _tmp37_;
				const gchar* _tmp38_;
				gchar* _tmp39_;
				gboolean added = FALSE;
				gboolean removed = FALSE;
				GgitDiffLineType origin = 0;
				GgitDiffLine* _tmp40_;
				GitgDiffViewFileRendererTextRegionType rtype = 0;
				gboolean _tmp45_ = FALSE;
				GitgDiffViewFileRendererTextStyle _tmp51_;
				gboolean _tmp53_ = FALSE;
				gboolean _tmp69_ = FALSE;
				gboolean _tmp70_ = FALSE;
				gint _tmp71_;
				gint _tmp72_;
				GitgDiffViewFileRendererTextRegionType* rtype_check = NULL;
				gchar* mark = NULL;
				GitgDiffViewFileRendererTextStyle _tmp107_;
				GitgDiffViewFileRendererTextRegionType* _tmp114_;
				GitgDiffViewFileRendererTextStyle _tmp130_;
				GitgDiffViewFileRendererTextRegionType* _tmp135_;
				if (!_tmp32_) {
					gint _tmp33_;
					_tmp33_ = i;
					i = _tmp33_ + 1;
				}
				_tmp32_ = FALSE;
				_tmp34_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) lines);
				_tmp35_ = _tmp34_;
				if (!(i < _tmp35_)) {
					break;
				}
				_tmp36_ = gee_abstract_list_get ((GeeAbstractList*) lines, i);
				line = (GgitDiffLine*) _tmp36_;
				_tmp37_ = line;
				_tmp38_ = ggit_diff_line_get_text (_tmp37_);
				_tmp39_ = string_replace (_tmp38_, "\r", "");
				text = _tmp39_;
				added = FALSE;
				removed = FALSE;
				_tmp40_ = line;
				origin = ggit_diff_line_get_origin (_tmp40_);
				rtype = GITG_DIFF_VIEW_FILE_RENDERER_TEXT_REGION_TYPE_CONTEXT;
				switch (origin) {
					case GGIT_DIFF_LINE_ADDITION:
					{
						guint _tmp41_;
						added = TRUE;
						_tmp41_ = self->priv->_added;
						gitg_diff_view_file_renderer_text_set_added (self, _tmp41_ + 1);
						rtype = GITG_DIFF_VIEW_FILE_RENDERER_TEXT_REGION_TYPE_ADDED;
						break;
					}
					case GGIT_DIFF_LINE_DELETION:
					{
						guint _tmp42_;
						removed = TRUE;
						_tmp42_ = self->priv->_removed;
						gitg_diff_view_file_renderer_text_set_removed (self, _tmp42_ + 1);
						rtype = GITG_DIFF_VIEW_FILE_RENDERER_TEXT_REGION_TYPE_REMOVED;
						break;
					}
					case GGIT_DIFF_LINE_CONTEXT_EOFNL:
					case GGIT_DIFF_LINE_ADD_EOFNL:
					case GGIT_DIFF_LINE_DEL_EOFNL:
					{
						const gchar* _tmp43_;
						gchar* _tmp44_;
						_tmp43_ = text;
						_tmp44_ = string_substring (_tmp43_, (glong) 1, (glong) -1);
						_g_free0 (text);
						text = _tmp44_;
						break;
					}
					case GGIT_DIFF_LINE_HUNK_HDR:
					case GGIT_DIFF_LINE_BINARY:
					case GGIT_DIFF_LINE_CONTEXT:
					case GGIT_DIFF_LINE_FILE_HDR:
					{
						break;
					}
					default:
					break;
				}
				if (i == 0) {
					_tmp45_ = TRUE;
				} else {
					GitgDiffViewFileRendererTextRegion _tmp46_;
					_tmp46_ = region;
					_tmp45_ = rtype != _tmp46_.type;
				}
				if (_tmp45_) {
					gint source_line_start = 0;
					GitgDiffViewFileRendererTextRegion _tmp50_ = {0};
					if (i != 0) {
						GitgDiffViewFileRendererTextRegion _tmp47_;
						_tmp47_ = region;
						_vala_array_add2 (&self->priv->d_regions, &self->priv->d_regions_length1, &self->priv->_d_regions_size_, &_tmp47_);
					}
					if (rtype == GITG_DIFF_VIEW_FILE_RENDERER_TEXT_REGION_TYPE_REMOVED) {
						GgitDiffLine* _tmp48_;
						_tmp48_ = line;
						source_line_start = ggit_diff_line_get_old_lineno (_tmp48_) - 1;
					} else {
						GgitDiffLine* _tmp49_;
						_tmp49_ = line;
						source_line_start = ggit_diff_line_get_new_lineno (_tmp49_) - 1;
					}
					memset (&_tmp50_, 0, sizeof (GitgDiffViewFileRendererTextRegion));
					_tmp50_.type = rtype;
					_tmp50_.buffer_line_start = buffer_line;
					_tmp50_.source_line_start = source_line_start;
					_tmp50_.length = 0;
					region = _tmp50_;
				}
				_tmp51_ = self->priv->_d_style;
				if (_tmp51_ == GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_ONE) {
					gint _tmp52_;
					_tmp52_ = region.length;
					region.length = _tmp52_ + 1;
				}
				if (added) {
					_tmp53_ = TRUE;
				} else {
					_tmp53_ = removed;
				}
				if (_tmp53_) {
					gsize offset = 0UL;
					GgitDiffLine* _tmp54_;
					guint8* bytes = NULL;
					GgitDiffLine* _tmp55_;
					gsize _tmp56_ = 0;
					guint8* _tmp57_;
					guint8* _tmp58_;
					gint _tmp58__length1;
					gint bytes_length1;
					gint _bytes_size_;
					GitgPatchSetType _tmp59_ = 0;
					GitgPatchSetPatch pset = {0};
					guint8* _tmp60_;
					gint _tmp60__length1;
					GitgPatchSetPatch _tmp61_ = {0};
					GeeHashMap* _tmp64_;
					GitgPatchSetPatch _tmp65_;
					gint64 _tmp66_ = 0LL;
					_tmp54_ = line;
					offset = (gsize) ggit_diff_line_get_content_offset (_tmp54_);
					_tmp55_ = line;
					_tmp57_ = ggit_diff_line_get_content (_tmp55_, &_tmp56_);
					_tmp58_ = (_tmp57_ != NULL) ? _vala_array_dup13 (_tmp57_, _tmp56_) : _tmp57_;
					_tmp58__length1 = _tmp56_;
					bytes = _tmp58_;
					bytes_length1 = _tmp58__length1;
					_bytes_size_ = bytes_length1;
					if (added) {
						_tmp59_ = GITG_PATCH_SET_TYPE_ADD;
					} else {
						_tmp59_ = GITG_PATCH_SET_TYPE_REMOVE;
					}
					_tmp60_ = bytes;
					_tmp60__length1 = bytes_length1;
					memset (&_tmp61_, 0, sizeof (GitgPatchSetPatch));
					_tmp61_.type = _tmp59_;
					_tmp61_.old_offset = offset;
					_tmp61_.new_offset = offset;
					_tmp61_.length = (gsize) _tmp60__length1;
					pset = _tmp61_;
					if (added) {
						GitgPatchSetPatch _tmp62_;
						_tmp62_ = pset;
						pset.old_offset = (gsize) (((gint64) _tmp62_.old_offset) - self->priv->d_doffset);
					} else {
						GitgPatchSetPatch _tmp63_;
						_tmp63_ = pset;
						pset.new_offset = (gsize) (((gint64) _tmp63_.new_offset) + self->priv->d_doffset);
					}
					_tmp64_ = self->priv->d_lines;
					_tmp65_ = pset;
					gee_abstract_map_set ((GeeAbstractMap*) _tmp64_, (gpointer) ((gintptr) buffer_line), &_tmp65_);
					if (added) {
						guint8* _tmp67_;
						gint _tmp67__length1;
						_tmp67_ = bytes;
						_tmp67__length1 = bytes_length1;
						_tmp66_ = (gint64) _tmp67__length1;
					} else {
						guint8* _tmp68_;
						gint _tmp68__length1;
						_tmp68_ = bytes;
						_tmp68__length1 = bytes_length1;
						_tmp66_ = -((gint64) _tmp68__length1);
					}
					self->priv->d_doffset = self->priv->d_doffset + _tmp66_;
					bytes = (g_free (bytes), NULL);
				}
				_tmp71_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) lines);
				_tmp72_ = _tmp71_;
				if (i == (_tmp72_ - 1)) {
					const gchar* _tmp73_;
					gint _tmp74_;
					gint _tmp75_;
					_tmp73_ = text;
					_tmp74_ = strlen (_tmp73_);
					_tmp75_ = _tmp74_;
					_tmp70_ = _tmp75_ > 0;
				} else {
					_tmp70_ = FALSE;
				}
				if (_tmp70_) {
					const gchar* _tmp76_;
					const gchar* _tmp77_;
					gint _tmp78_;
					gint _tmp79_;
					_tmp76_ = text;
					_tmp77_ = text;
					_tmp78_ = strlen (_tmp77_);
					_tmp79_ = _tmp78_;
					_tmp69_ = string_get (_tmp76_, (glong) (_tmp79_ - 1)) == '\n';
				} else {
					_tmp69_ = FALSE;
				}
				if (_tmp69_) {
					const gchar* _tmp80_;
					const gchar* _tmp81_;
					gint _tmp82_;
					gint _tmp83_;
					gchar* _tmp84_;
					_tmp80_ = text;
					_tmp81_ = text;
					_tmp82_ = strlen (_tmp81_);
					_tmp83_ = _tmp82_;
					_tmp84_ = string_slice (_tmp80_, (glong) 0, (glong) (_tmp83_ - 1));
					_g_free0 (text);
					text = _tmp84_;
				}
				if (rtype == GITG_DIFF_VIEW_FILE_RENDERER_TEXT_REGION_TYPE_CONTEXT) {
					gboolean _tmp85_ = FALSE;
					GitgDiffViewFileRendererTextStyle _tmp86_;
					GtkSourceBuffer* _tmp100_;
					const gchar* _tmp101_;
					gint _tmp102_;
					gboolean _tmp103_ = FALSE;
					GitgDiffViewFileRendererTextStyle _tmp104_;
					_tmp86_ = self->priv->_d_style;
					if (_tmp86_ == GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_OLD) {
						_tmp85_ = TRUE;
					} else {
						GitgDiffViewFileRendererTextStyle _tmp87_;
						_tmp87_ = self->priv->_d_style;
						_tmp85_ = _tmp87_ == GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_NEW;
					}
					if (_tmp85_) {
						if (in_change_line == TRUE) {
							gboolean _tmp88_ = FALSE;
							GitgDiffViewFileRendererTextStyle _tmp89_;
							gboolean check = FALSE;
							_tmp89_ = self->priv->_d_style;
							if (_tmp89_ == GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_OLD) {
								_tmp88_ = add_line_num > remove_line_num;
							} else {
								_tmp88_ = remove_line_num > add_line_num;
							}
							check = _tmp88_;
							if (check) {
								gint _tmp90_ = 0;
								GitgDiffViewFileRendererTextStyle _tmp91_;
								gint end = 0;
								_tmp91_ = self->priv->_d_style;
								if (_tmp91_ == GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_OLD) {
									_tmp90_ = add_line_num - remove_line_num;
								} else {
									_tmp90_ = remove_line_num - add_line_num;
								}
								end = _tmp90_;
								{
									gint l = 0;
									l = 0;
									{
										gboolean _tmp92_ = FALSE;
										_tmp92_ = TRUE;
										while (TRUE) {
											GtkTextIter t_iter = {0};
											GtkSourceBuffer* _tmp94_;
											GtkTextIter _tmp95_ = {0};
											GtkSourceBuffer* _tmp96_;
											GtkTextIter _tmp97_;
											GtkSourceBuffer* _tmp98_;
											gint _tmp99_;
											if (!_tmp92_) {
												gint _tmp93_;
												_tmp93_ = l;
												l = _tmp93_ + 1;
											}
											_tmp92_ = FALSE;
											if (!(l < end)) {
												break;
											}
											_tmp94_ = buffer;
											gtk_text_buffer_get_end_iter ((GtkTextBuffer*) _tmp94_, &_tmp95_);
											t_iter = _tmp95_;
											_tmp96_ = buffer;
											_tmp97_ = t_iter;
											gtk_source_buffer_create_source_mark (_tmp96_, NULL, "empty", &_tmp97_);
											_tmp98_ = buffer;
											gtk_text_buffer_insert ((GtkTextBuffer*) _tmp98_, &iter, "\n", -1);
											_tmp99_ = buffer_line;
											buffer_line = _tmp99_ + 1;
											region.buffer_line_start = buffer_line;
										}
									}
								}
							}
							add_line_num = 0;
							remove_line_num = 0;
						}
						in_change_line = FALSE;
					}
					_tmp100_ = buffer;
					_tmp101_ = text;
					gtk_text_buffer_insert ((GtkTextBuffer*) _tmp100_, &iter, _tmp101_, -1);
					_tmp102_ = buffer_line;
					buffer_line = _tmp102_ + 1;
					_tmp104_ = self->priv->_d_style;
					if (_tmp104_ == GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_OLD) {
						_tmp103_ = TRUE;
					} else {
						GitgDiffViewFileRendererTextStyle _tmp105_;
						_tmp105_ = self->priv->_d_style;
						_tmp103_ = _tmp105_ == GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_NEW;
					}
					if (_tmp103_) {
						gint _tmp106_;
						_tmp106_ = region.length;
						region.length = _tmp106_ + 1;
					}
				}
				rtype_check = NULL;
				mark = NULL;
				_tmp107_ = self->priv->_d_style;
				switch (_tmp107_) {
					case GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_ONE:
					case GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_OLD:
					{
						GitgDiffViewFileRendererTextRegionType _tmp108_;
						GitgDiffViewFileRendererTextRegionType* _tmp109_;
						gchar* _tmp110_;
						_tmp108_ = GITG_DIFF_VIEW_FILE_RENDERER_TEXT_REGION_TYPE_REMOVED;
						_tmp109_ = __gitg_diff_view_file_renderer_text_region_type_dup0 (&_tmp108_);
						_g_free0 (rtype_check);
						rtype_check = _tmp109_;
						_tmp110_ = g_strdup ("removed");
						_g_free0 (mark);
						mark = _tmp110_;
						break;
					}
					case GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_NEW:
					{
						GitgDiffViewFileRendererTextRegionType _tmp111_;
						GitgDiffViewFileRendererTextRegionType* _tmp112_;
						gchar* _tmp113_;
						_tmp111_ = GITG_DIFF_VIEW_FILE_RENDERER_TEXT_REGION_TYPE_ADDED;
						_tmp112_ = __gitg_diff_view_file_renderer_text_region_type_dup0 (&_tmp111_);
						_g_free0 (rtype_check);
						rtype_check = _tmp112_;
						_tmp113_ = g_strdup ("added");
						_g_free0 (mark);
						mark = _tmp113_;
						break;
					}
					default:
					break;
				}
				_tmp114_ = rtype_check;
				if (_gitg_diff_view_file_renderer_text_region_type_equal (&rtype, _tmp114_) == TRUE) {
					GtkTextIter t_iter = {0};
					GtkSourceBuffer* _tmp115_;
					GtkTextIter _tmp116_ = {0};
					GtkSourceBuffer* _tmp117_;
					const gchar* _tmp118_;
					GtkTextIter _tmp119_;
					GtkSourceBuffer* _tmp120_;
					const gchar* _tmp121_;
					gint _tmp122_;
					gboolean _tmp123_ = FALSE;
					GitgDiffViewFileRendererTextStyle _tmp124_;
					_tmp115_ = buffer;
					gtk_text_buffer_get_end_iter ((GtkTextBuffer*) _tmp115_, &_tmp116_);
					t_iter = _tmp116_;
					_tmp117_ = buffer;
					_tmp118_ = mark;
					_tmp119_ = t_iter;
					gtk_source_buffer_create_source_mark (_tmp117_, NULL, _tmp118_, &_tmp119_);
					_tmp120_ = buffer;
					_tmp121_ = text;
					gtk_text_buffer_insert ((GtkTextBuffer*) _tmp120_, &iter, _tmp121_, -1);
					_tmp122_ = buffer_line;
					buffer_line = _tmp122_ + 1;
					_tmp124_ = self->priv->_d_style;
					if (_tmp124_ == GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_OLD) {
						_tmp123_ = TRUE;
					} else {
						GitgDiffViewFileRendererTextStyle _tmp125_;
						_tmp125_ = self->priv->_d_style;
						_tmp123_ = _tmp125_ == GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_NEW;
					}
					if (_tmp123_) {
						gint _tmp126_;
						GitgDiffViewFileRendererTextStyle _tmp127_;
						_tmp126_ = region.length;
						region.length = _tmp126_ + 1;
						_tmp127_ = self->priv->_d_style;
						if (_tmp127_ == GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_OLD) {
							gint _tmp128_;
							_tmp128_ = remove_line_num;
							remove_line_num = _tmp128_ + 1;
						} else {
							gint _tmp129_;
							_tmp129_ = add_line_num;
							add_line_num = _tmp129_ + 1;
						}
						in_change_line = TRUE;
					}
				}
				_tmp130_ = self->priv->_d_style;
				switch (_tmp130_) {
					case GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_ONE:
					case GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_OLD:
					{
						GitgDiffViewFileRendererTextRegionType _tmp131_;
						GitgDiffViewFileRendererTextRegionType* _tmp132_;
						_tmp131_ = GITG_DIFF_VIEW_FILE_RENDERER_TEXT_REGION_TYPE_ADDED;
						_tmp132_ = __gitg_diff_view_file_renderer_text_region_type_dup0 (&_tmp131_);
						_g_free0 (rtype_check);
						rtype_check = _tmp132_;
						break;
					}
					case GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_NEW:
					{
						GitgDiffViewFileRendererTextRegionType _tmp133_;
						GitgDiffViewFileRendererTextRegionType* _tmp134_;
						_tmp133_ = GITG_DIFF_VIEW_FILE_RENDERER_TEXT_REGION_TYPE_REMOVED;
						_tmp134_ = __gitg_diff_view_file_renderer_text_region_type_dup0 (&_tmp133_);
						_g_free0 (rtype_check);
						rtype_check = _tmp134_;
						break;
					}
					default:
					break;
				}
				_tmp135_ = rtype_check;
				if (_gitg_diff_view_file_renderer_text_region_type_equal (&rtype, _tmp135_) == TRUE) {
					gboolean _tmp136_ = FALSE;
					GitgDiffViewFileRendererTextStyle _tmp137_;
					_tmp137_ = self->priv->_d_style;
					if (_tmp137_ == GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_OLD) {
						_tmp136_ = TRUE;
					} else {
						GitgDiffViewFileRendererTextStyle _tmp138_;
						_tmp138_ = self->priv->_d_style;
						_tmp136_ = _tmp138_ == GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_NEW;
					}
					if (_tmp136_) {
						GitgDiffViewFileRendererTextStyle _tmp139_;
						_tmp139_ = self->priv->_d_style;
						if (_tmp139_ == GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_OLD) {
							gint _tmp140_;
							_tmp140_ = add_line_num;
							add_line_num = _tmp140_ + 1;
						} else {
							gint _tmp141_;
							_tmp141_ = remove_line_num;
							remove_line_num = _tmp141_ + 1;
						}
						in_change_line = TRUE;
					} else {
						GitgDiffViewFileRendererTextStyle _tmp142_;
						_tmp142_ = self->priv->_d_style;
						if (_tmp142_ == GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_ONE) {
							GtkTextIter t_iter = {0};
							GtkSourceBuffer* _tmp143_;
							GtkTextIter _tmp144_ = {0};
							GtkSourceBuffer* _tmp145_;
							GtkTextIter _tmp146_;
							GtkSourceBuffer* _tmp147_;
							const gchar* _tmp148_;
							gint _tmp149_;
							_tmp143_ = buffer;
							gtk_text_buffer_get_end_iter ((GtkTextBuffer*) _tmp143_, &_tmp144_);
							t_iter = _tmp144_;
							_tmp145_ = buffer;
							_tmp146_ = t_iter;
							gtk_source_buffer_create_source_mark (_tmp145_, NULL, "added", &_tmp146_);
							_tmp147_ = buffer;
							_tmp148_ = text;
							gtk_text_buffer_insert ((GtkTextBuffer*) _tmp147_, &iter, _tmp148_, -1);
							_tmp149_ = buffer_line;
							buffer_line = _tmp149_ + 1;
						}
					}
				}
				_g_free0 (mark);
				_g_free0 (rtype_check);
				_g_free0 (text);
				_ggit_diff_line_unref0 (line);
			}
		}
	}
	_tmp150_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) lines);
	_tmp151_ = _tmp150_;
	if (_tmp151_ != 0) {
		GitgDiffViewFileRendererTextRegion _tmp152_;
		_tmp152_ = region;
		_vala_array_add3 (&self->priv->d_regions, &self->priv->d_regions_length1, &self->priv->_d_regions_size_, &_tmp152_);
	}
	_tmp154_ = self->priv->_d_style;
	if (_tmp154_ == GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_ONE) {
		_tmp153_ = TRUE;
	} else {
		GitgDiffViewFileRendererTextStyle _tmp155_;
		_tmp155_ = self->priv->_d_style;
		_tmp153_ = _tmp155_ == GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_OLD;
	}
	if (_tmp153_) {
		GitgDiffViewLinesRenderer* _tmp156_;
		GtkSourceBuffer* _tmp157_;
		_tmp156_ = self->priv->d_old_lines;
		_tmp157_ = buffer;
		gitg_diff_view_lines_renderer_add_hunk (_tmp156_, line_hunk_start, gtk_text_iter_get_line (&iter), hunk, _tmp157_);
	}
	_tmp159_ = self->priv->_d_style;
	if (_tmp159_ == GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_ONE) {
		_tmp158_ = TRUE;
	} else {
		GitgDiffViewFileRendererTextStyle _tmp160_;
		_tmp160_ = self->priv->_d_style;
		_tmp158_ = _tmp160_ == GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_NEW;
	}
	if (_tmp158_) {
		GitgDiffViewLinesRenderer* _tmp161_;
		GtkSourceBuffer* _tmp162_;
		_tmp161_ = self->priv->d_new_lines;
		_tmp162_ = buffer;
		gitg_diff_view_lines_renderer_add_hunk (_tmp161_, line_hunk_start, gtk_text_iter_get_line (&iter), hunk, _tmp162_);
	}
	_tmp163_ = self->priv->d_sym_lines;
	_tmp164_ = buffer;
	gitg_diff_view_lines_renderer_add_hunk (_tmp163_, line_hunk_start, gtk_text_iter_get_line (&iter), hunk, _tmp164_);
	g_object_thaw_notify ((GObject*) self);
	gtk_widget_set_sensitive ((GtkWidget*) self, TRUE);
	_g_free0 (header);
	_g_free0 (h);
	_g_object_unref0 (buffer);
}

guint
gitg_diff_view_file_renderer_text_get_added (GitgDiffViewFileRendererText* self)
{
	guint result;
	g_return_val_if_fail (self != NULL, 0U);
	result = self->priv->_added;
	return result;
}

void
gitg_diff_view_file_renderer_text_set_added (GitgDiffViewFileRendererText* self,
                                             guint value)
{
	guint old_value;
	g_return_if_fail (self != NULL);
	old_value = gitg_diff_view_file_renderer_text_get_added (self);
	if (old_value != value) {
		self->priv->_added = value;
		g_object_notify_by_pspec ((GObject *) self, gitg_diff_view_file_renderer_text_properties[GITG_DIFF_VIEW_FILE_RENDERER_TEXT_ADDED_PROPERTY]);
	}
}

guint
gitg_diff_view_file_renderer_text_get_removed (GitgDiffViewFileRendererText* self)
{
	guint result;
	g_return_val_if_fail (self != NULL, 0U);
	result = self->priv->_removed;
	return result;
}

void
gitg_diff_view_file_renderer_text_set_removed (GitgDiffViewFileRendererText* self,
                                               guint value)
{
	guint old_value;
	g_return_if_fail (self != NULL);
	old_value = gitg_diff_view_file_renderer_text_get_removed (self);
	if (old_value != value) {
		self->priv->_removed = value;
		g_object_notify_by_pspec ((GObject *) self, gitg_diff_view_file_renderer_text_properties[GITG_DIFF_VIEW_FILE_RENDERER_TEXT_REMOVED_PROPERTY]);
	}
}

GitgDiffViewFileRendererTextStyle
gitg_diff_view_file_renderer_text_get_d_style (GitgDiffViewFileRendererText* self)
{
	GitgDiffViewFileRendererTextStyle result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_d_style;
	return result;
}

void
gitg_diff_view_file_renderer_text_set_d_style (GitgDiffViewFileRendererText* self,
                                               GitgDiffViewFileRendererTextStyle value)
{
	GitgDiffViewFileRendererTextStyle old_value;
	g_return_if_fail (self != NULL);
	old_value = gitg_diff_view_file_renderer_text_get_d_style (self);
	if (old_value != value) {
		self->priv->_d_style = value;
		g_object_notify_by_pspec ((GObject *) self, gitg_diff_view_file_renderer_text_properties[GITG_DIFF_VIEW_FILE_RENDERER_TEXT_D_STYLE_PROPERTY]);
	}
}

gboolean
gitg_diff_view_file_renderer_text_get_new_is_workdir (GitgDiffViewFileRendererText* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_new_is_workdir;
	return result;
}

void
gitg_diff_view_file_renderer_text_set_new_is_workdir (GitgDiffViewFileRendererText* self,
                                                      gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = gitg_diff_view_file_renderer_text_get_new_is_workdir (self);
	if (old_value != value) {
		self->priv->_new_is_workdir = value;
		g_object_notify_by_pspec ((GObject *) self, gitg_diff_view_file_renderer_text_properties[GITG_DIFF_VIEW_FILE_RENDERER_TEXT_NEW_IS_WORKDIR_PROPERTY]);
	}
}

static gboolean
gitg_diff_view_file_renderer_text_real_get_wrap_lines (GitgDiffViewFileRendererTextable* base)
{
	gboolean result;
	GitgDiffViewFileRendererText* self;
	GtkWrapMode _tmp0_;
	GtkWrapMode _tmp1_;
	self = (GitgDiffViewFileRendererText*) base;
	_tmp0_ = gtk_text_view_get_wrap_mode ((GtkTextView*) self);
	_tmp1_ = _tmp0_;
	result = _tmp1_ != GTK_WRAP_NONE;
	return result;
}

static void
gitg_diff_view_file_renderer_text_real_set_wrap_lines (GitgDiffViewFileRendererTextable* base,
                                                       gboolean value)
{
	GitgDiffViewFileRendererText* self;
	self = (GitgDiffViewFileRendererText*) base;
	if (value) {
		gtk_text_view_set_wrap_mode ((GtkTextView*) self, GTK_WRAP_WORD_CHAR);
	} else {
		gtk_text_view_set_wrap_mode ((GtkTextView*) self, GTK_WRAP_NONE);
	}
	g_object_notify_by_pspec ((GObject *) self, gitg_diff_view_file_renderer_text_properties[GITG_DIFF_VIEW_FILE_RENDERER_TEXT_WRAP_LINES_PROPERTY]);
}

static gint
gitg_diff_view_file_renderer_text_real_get_tab_width (GitgDiffViewFileRendererTextable* base)
{
	gint result;
	GitgDiffViewFileRendererText* self;
	self = (GitgDiffViewFileRendererText*) base;
	result = (gint) gtk_source_view_get_tab_width ((GtkSourceView*) self);
	return result;
}

static void
gitg_diff_view_file_renderer_text_real_set_tab_width (GitgDiffViewFileRendererTextable* base,
                                                      gint value)
{
	GitgDiffViewFileRendererText* self;
	self = (GitgDiffViewFileRendererText*) base;
	gtk_source_view_set_tab_width ((GtkSourceView*) self, (guint) value);
	g_object_notify_by_pspec ((GObject *) self, gitg_diff_view_file_renderer_text_properties[GITG_DIFF_VIEW_FILE_RENDERER_TEXT_TAB_WIDTH_PROPERTY]);
}

static gint
gitg_diff_view_file_renderer_text_real_get_maxlines (GitgDiffViewFileRendererTextable* base)
{
	gint result;
	GitgDiffViewFileRendererText* self;
	self = (GitgDiffViewFileRendererText*) base;
	result = self->priv->_maxlines;
	return result;
}

static void
gitg_diff_view_file_renderer_text_real_set_maxlines (GitgDiffViewFileRendererTextable* base,
                                                     gint value)
{
	GitgDiffViewFileRendererText* self;
	gint old_value;
	self = (GitgDiffViewFileRendererText*) base;
	old_value = gitg_diff_view_file_renderer_text_real_get_maxlines (base);
	if (old_value != value) {
		self->priv->_maxlines = value;
		g_object_notify_by_pspec ((GObject *) self, gitg_diff_view_file_renderer_text_properties[GITG_DIFF_VIEW_FILE_RENDERER_TEXT_MAXLINES_PROPERTY]);
	}
}

GitgDiffViewFileInfo*
gitg_diff_view_file_renderer_text_get_info (GitgDiffViewFileRendererText* self)
{
	GitgDiffViewFileInfo* result;
	GitgDiffViewFileInfo* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_info;
	result = _tmp0_;
	return result;
}

void
gitg_diff_view_file_renderer_text_set_info (GitgDiffViewFileRendererText* self,
                                            GitgDiffViewFileInfo* value)
{
	GitgDiffViewFileInfo* old_value;
	g_return_if_fail (self != NULL);
	old_value = gitg_diff_view_file_renderer_text_get_info (self);
	if (old_value != value) {
		GitgDiffViewFileInfo* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_info);
		self->priv->_info = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, gitg_diff_view_file_renderer_text_properties[GITG_DIFF_VIEW_FILE_RENDERER_TEXT_INFO_PROPERTY]);
	}
}

GgitDiffDelta*
gitg_diff_view_file_renderer_text_get_delta (GitgDiffViewFileRendererText* self)
{
	GgitDiffDelta* result;
	GitgDiffViewFileInfo* _tmp0_;
	GgitDiffDelta* _tmp1_;
	GgitDiffDelta* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_info;
	_tmp1_ = gitg_diff_view_file_info_get_delta (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

GitgRepository*
gitg_diff_view_file_renderer_text_get_repository (GitgDiffViewFileRendererText* self)
{
	GitgRepository* result;
	GitgDiffViewFileInfo* _tmp0_;
	GitgRepository* _tmp1_;
	GitgRepository* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_info;
	_tmp1_ = gitg_diff_view_file_info_get_repository (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

static gboolean
gitg_diff_view_file_renderer_text_real_get_highlight (GitgDiffViewFileRendererTextable* base)
{
	gboolean result;
	GitgDiffViewFileRendererText* self;
	self = (GitgDiffViewFileRendererText*) base;
	result = self->priv->d_highlight;
	return result;
}

static void
gitg_diff_view_file_renderer_text_real_set_highlight (GitgDiffViewFileRendererTextable* base,
                                                      gboolean value)
{
	GitgDiffViewFileRendererText* self;
	self = (GitgDiffViewFileRendererText*) base;
	if (self->priv->d_highlight != value) {
		self->priv->d_highlight = value;
		gitg_diff_view_file_renderer_text_update_highlight (self);
	}
	g_object_notify_by_pspec ((GObject *) self, gitg_diff_view_file_renderer_text_properties[GITG_DIFF_VIEW_FILE_RENDERER_TEXT_HIGHLIGHT_PROPERTY]);
}

static gboolean
gitg_diff_view_file_renderer_text_real_get_has_selection (GitgDiffSelectable* base)
{
	gboolean result;
	GitgDiffViewFileRendererText* self;
	self = (GitgDiffViewFileRendererText*) base;
	result = self->priv->d_has_selection;
	return result;
}

static gboolean
gitg_diff_view_file_renderer_text_real_get_can_select (GitgDiffSelectable* base)
{
	gboolean result;
	GitgDiffViewFileRendererText* self;
	self = (GitgDiffViewFileRendererText*) base;
	result = self->priv->_can_select;
	return result;
}

static void
gitg_diff_view_file_renderer_text_real_set_can_select (GitgDiffSelectable* base,
                                                       gboolean value)
{
	GitgDiffViewFileRendererText* self;
	gboolean old_value;
	self = (GitgDiffViewFileRendererText*) base;
	old_value = gitg_diff_view_file_renderer_text_real_get_can_select (base);
	if (old_value != value) {
		self->priv->_can_select = value;
		g_object_notify_by_pspec ((GObject *) self, gitg_diff_view_file_renderer_text_properties[GITG_DIFF_VIEW_FILE_RENDERER_TEXT_CAN_SELECT_PROPERTY]);
	}
}

static void
_vala_array_add4 (GitgPatchSetPatch* * array,
                  gint* length,
                  gint* size,
                  const GitgPatchSetPatch* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GitgPatchSetPatch, *array, *size);
	}
	(*array)[(*length)++] = *value;
}

static void
_vala_array_add5 (GitgPatchSetPatch* * array,
                  gint* length,
                  gint* size,
                  const GitgPatchSetPatch* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GitgPatchSetPatch, *array, *size);
	}
	(*array)[(*length)++] = *value;
}

static GitgPatchSetPatch*
_vala_array_dup14 (GitgPatchSetPatch* self,
                   gssize length)
{
	if (length > 0) {
		return g_memdup2 (self, length * sizeof (GitgPatchSetPatch));
	}
	return NULL;
}

static GitgPatchSet*
gitg_diff_view_file_renderer_text_real_get_selection (GitgDiffSelectable* base)
{
	GitgPatchSet* result;
	GitgDiffViewFileRendererText* self;
	GitgPatchSet* ret = NULL;
	GitgPatchSet* _tmp0_;
	GitgPatchSet* _tmp1_;
	GgitDiffDelta* _tmp2_;
	GgitDiffDelta* _tmp3_;
	GgitDiffFile* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	GitgPatchSetPatch* patches = NULL;
	GitgPatchSetPatch* _tmp7_;
	gint patches_length1;
	gint _patches_size_;
	gboolean _tmp8_;
	gboolean _tmp9_;
	gint* selected = NULL;
	GitgDiffViewFileSelectable* _tmp10_;
	gint _tmp11_ = 0;
	gint* _tmp12_;
	gint selected_length1;
	gint _selected_size_;
	GitgPatchSet* _tmp37_;
	GitgPatchSetPatch* _tmp38_;
	gint _tmp38__length1;
	GitgPatchSetPatch* _tmp39_;
	gint _tmp39__length1;
	self = (GitgDiffViewFileRendererText*) base;
	_tmp0_ = gitg_patch_set_new ();
	ret = _tmp0_;
	_tmp1_ = ret;
	_tmp2_ = gitg_diff_view_file_renderer_text_get_delta (self);
	_tmp3_ = _tmp2_;
	_tmp4_ = ggit_diff_delta_get_new_file (_tmp3_);
	_tmp5_ = ggit_diff_file_get_path (_tmp4_);
	_tmp6_ = g_strdup (_tmp5_);
	_g_free0 (_tmp1_->filename);
	_tmp1_->filename = _tmp6_;
	_tmp7_ = g_new0 (GitgPatchSetPatch, 0);
	patches = _tmp7_;
	patches_length1 = 0;
	_patches_size_ = patches_length1;
	_tmp8_ = gitg_diff_selectable_get_can_select ((GitgDiffSelectable*) self);
	_tmp9_ = _tmp8_;
	if (!_tmp9_) {
		result = ret;
		patches = (g_free (patches), NULL);
		return result;
	}
	_tmp10_ = self->priv->d_selectable;
	_tmp12_ = gitg_diff_view_file_selectable_get_selected_lines (_tmp10_, &_tmp11_);
	selected = _tmp12_;
	selected_length1 = _tmp11_;
	_selected_size_ = selected_length1;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp13_ = FALSE;
			_tmp13_ = TRUE;
			while (TRUE) {
				gint* _tmp15_;
				gint _tmp15__length1;
				gint line = 0;
				gint* _tmp16_;
				gint _tmp16__length1;
				gint _tmp17_;
				GitgPatchSetPatch* pset = NULL;
				GeeHashMap* _tmp18_;
				gpointer _tmp19_;
				GitgPatchSetPatch last = {0};
				GitgPatchSetPatch* _tmp22_;
				gint _tmp22__length1;
				GitgPatchSetPatch* _tmp23_;
				gint _tmp23__length1;
				GitgPatchSetPatch _tmp24_;
				gboolean _tmp25_ = FALSE;
				GitgPatchSetPatch _tmp26_;
				GitgPatchSetPatch _tmp27_;
				GitgPatchSetPatch* _tmp28_;
				if (!_tmp13_) {
					gint _tmp14_;
					_tmp14_ = i;
					i = _tmp14_ + 1;
				}
				_tmp13_ = FALSE;
				_tmp15_ = selected;
				_tmp15__length1 = selected_length1;
				if (!(i < _tmp15__length1)) {
					break;
				}
				_tmp16_ = selected;
				_tmp16__length1 = selected_length1;
				_tmp17_ = _tmp16_[i];
				line = _tmp17_;
				_tmp18_ = self->priv->d_lines;
				_tmp19_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp18_, (gpointer) ((gintptr) line));
				pset = (GitgPatchSetPatch*) _tmp19_;
				if (i == 0) {
					GitgPatchSetPatch* _tmp20_;
					GitgPatchSetPatch _tmp21_;
					_tmp20_ = pset;
					_tmp21_ = *_tmp20_;
					_vala_array_add4 (&patches, &patches_length1, &_patches_size_, &_tmp21_);
					_gitg_patch_set_patch_free0 (pset);
					continue;
				}
				_tmp22_ = patches;
				_tmp22__length1 = patches_length1;
				_tmp23_ = patches;
				_tmp23__length1 = patches_length1;
				_tmp24_ = _tmp22_[_tmp23__length1 - 1];
				last = _tmp24_;
				_tmp26_ = last;
				_tmp27_ = last;
				_tmp28_ = pset;
				if ((_tmp26_.new_offset + _tmp27_.length) == (*_tmp28_).new_offset) {
					GitgPatchSetPatch _tmp29_;
					GitgPatchSetPatch* _tmp30_;
					_tmp29_ = last;
					_tmp30_ = pset;
					_tmp25_ = _tmp29_.type == (*_tmp30_).type;
				} else {
					_tmp25_ = FALSE;
				}
				if (_tmp25_) {
					GitgPatchSetPatch* _tmp31_;
					GitgPatchSetPatch* _tmp32_;
					gint _tmp32__length1;
					GitgPatchSetPatch* _tmp33_;
					gint _tmp33__length1;
					GitgPatchSetPatch _tmp34_;
					_tmp31_ = pset;
					last.length = last.length + (*_tmp31_).length;
					_tmp32_ = patches;
					_tmp32__length1 = patches_length1;
					_tmp33_ = patches;
					_tmp33__length1 = patches_length1;
					_tmp34_ = last;
					_tmp32_[_tmp33__length1 - 1] = _tmp34_;
				} else {
					GitgPatchSetPatch* _tmp35_;
					GitgPatchSetPatch _tmp36_;
					_tmp35_ = pset;
					_tmp36_ = *_tmp35_;
					_vala_array_add5 (&patches, &patches_length1, &_patches_size_, &_tmp36_);
				}
				_gitg_patch_set_patch_free0 (pset);
			}
		}
	}
	_tmp37_ = ret;
	_tmp38_ = patches;
	_tmp38__length1 = patches_length1;
	_tmp39_ = (_tmp38_ != NULL) ? _vala_array_dup14 (_tmp38_, _tmp38__length1) : _tmp38_;
	_tmp39__length1 = _tmp38__length1;
	_tmp37_->patches = (g_free (_tmp37_->patches), NULL);
	_tmp37_->patches = _tmp39_;
	_tmp37_->patches_length1 = _tmp39__length1;
	result = ret;
	selected = (g_free (selected), NULL);
	patches = (g_free (patches), NULL);
	return result;
}

static GitgDiffViewFileRendererTextRegion*
gitg_diff_view_file_renderer_text_region_dup (const GitgDiffViewFileRendererTextRegion* self)
{
	GitgDiffViewFileRendererTextRegion* dup;
	dup = g_new0 (GitgDiffViewFileRendererTextRegion, 1);
	memcpy (dup, self, sizeof (GitgDiffViewFileRendererTextRegion));
	return dup;
}

static void
gitg_diff_view_file_renderer_text_region_free (GitgDiffViewFileRendererTextRegion* self)
{
	g_free (self);
}

 G_GNUC_NO_INLINE static GType
gitg_diff_view_file_renderer_text_region_get_type_once (void)
{
	GType gitg_diff_view_file_renderer_text_region_type_id;
	gitg_diff_view_file_renderer_text_region_type_id = g_boxed_type_register_static ("GitgDiffViewFileRendererTextRegion", (GBoxedCopyFunc) gitg_diff_view_file_renderer_text_region_dup, (GBoxedFreeFunc) gitg_diff_view_file_renderer_text_region_free);
	return gitg_diff_view_file_renderer_text_region_type_id;
}

static GType
gitg_diff_view_file_renderer_text_region_get_type (void)
{
	static gsize gitg_diff_view_file_renderer_text_region_type_id__once = 0;
	if (g_once_init_enter (&gitg_diff_view_file_renderer_text_region_type_id__once)) {
		GType gitg_diff_view_file_renderer_text_region_type_id;
		gitg_diff_view_file_renderer_text_region_type_id = gitg_diff_view_file_renderer_text_region_get_type_once ();
		g_once_init_leave (&gitg_diff_view_file_renderer_text_region_type_id__once, gitg_diff_view_file_renderer_text_region_type_id);
	}
	return gitg_diff_view_file_renderer_text_region_type_id__once;
}

static void
_gitg_diff_view_file_renderer_text_update_theme_g_object_notify (GObject* _sender,
                                                                 GParamSpec* pspec,
                                                                 gpointer self)
{
	gitg_diff_view_file_renderer_text_update_theme ((GitgDiffViewFileRendererText*) self);
}

static void
_gitg_diff_view_file_renderer_text____lambda60_ (GitgDiffViewFileRendererText* self)
{
	GitgDiffViewFileSelectable* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	_tmp0_ = self->priv->d_selectable;
	_tmp1_ = gitg_diff_view_file_selectable_get_has_selection (_tmp0_);
	_tmp2_ = _tmp1_;
	self->priv->d_has_selection = _tmp2_;
	g_object_notify ((GObject*) self, "has-selection");
}

static void
__gitg_diff_view_file_renderer_text____lambda60__g_object_notify (GObject* _sender,
                                                                  GParamSpec* pspec,
                                                                  gpointer self)
{
	_gitg_diff_view_file_renderer_text____lambda60_ ((GitgDiffViewFileRendererText*) self);
}

static GObject *
gitg_diff_view_file_renderer_text_constructor (GType type,
                                               guint n_construct_properties,
                                               GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GitgDiffViewFileRendererText * self;
	GtkSourceGutter* gutter = NULL;
	GtkSourceGutter* _tmp0_;
	GtkSourceGutter* _tmp1_;
	GitgDiffViewFileRendererTextStyle _tmp2_;
	GtkSettings* settings = NULL;
	GtkSettings* _tmp37_;
	GtkSettings* _tmp38_;
	GtkSettings* _tmp39_;
	GitgFontManager* _tmp40_;
	gboolean _tmp41_;
	gboolean _tmp42_;
	GeeHashMap* _tmp45_;
	parent_class = G_OBJECT_CLASS (gitg_diff_view_file_renderer_text_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GITG_TYPE_DIFF_VIEW_FILE_RENDERER_TEXT, GitgDiffViewFileRendererText);
	_tmp0_ = gtk_source_view_get_gutter ((GtkSourceView*) self, GTK_TEXT_WINDOW_LEFT);
	_tmp1_ = _g_object_ref0 (_tmp0_);
	gutter = _tmp1_;
	_tmp2_ = self->priv->_d_style;
	if (_tmp2_ == GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_ONE) {
		GitgDiffViewLinesRenderer* _tmp3_;
		GitgDiffViewLinesRenderer* _tmp4_;
		GitgDiffViewLinesRenderer* _tmp5_;
		GitgDiffViewLinesRenderer* _tmp6_;
		GitgDiffViewLinesRenderer* _tmp7_;
		GitgDiffViewLinesRenderer* _tmp8_;
		GitgDiffViewLinesRenderer* _tmp9_;
		GitgDiffViewLinesRenderer* _tmp10_;
		GtkSourceGutter* _tmp11_;
		GitgDiffViewLinesRenderer* _tmp12_;
		GtkSourceGutter* _tmp13_;
		GitgDiffViewLinesRenderer* _tmp14_;
		GtkSourceGutter* _tmp15_;
		GitgDiffViewLinesRenderer* _tmp16_;
		_tmp3_ = gitg_diff_view_lines_renderer_new (GITG_DIFF_VIEW_LINES_RENDERER_STYLE_OLD);
		g_object_ref_sink (_tmp3_);
		_g_object_unref0 (self->priv->d_old_lines);
		self->priv->d_old_lines = _tmp3_;
		_tmp4_ = gitg_diff_view_lines_renderer_new (GITG_DIFF_VIEW_LINES_RENDERER_STYLE_NEW);
		g_object_ref_sink (_tmp4_);
		_g_object_unref0 (self->priv->d_new_lines);
		self->priv->d_new_lines = _tmp4_;
		_tmp5_ = gitg_diff_view_lines_renderer_new (GITG_DIFF_VIEW_LINES_RENDERER_STYLE_SYMBOL);
		g_object_ref_sink (_tmp5_);
		_g_object_unref0 (self->priv->d_sym_lines);
		self->priv->d_sym_lines = _tmp5_;
		_tmp6_ = self->priv->d_old_lines;
		g_object_bind_property_with_closures ((GObject*) self, "maxlines", (GObject*) _tmp6_, "maxlines", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
		_tmp7_ = self->priv->d_new_lines;
		g_object_bind_property_with_closures ((GObject*) self, "maxlines", (GObject*) _tmp7_, "maxlines", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
		_tmp8_ = self->priv->d_old_lines;
		g_object_set ((GtkSourceGutterRenderer*) _tmp8_, "xpad", 8, NULL);
		_tmp9_ = self->priv->d_new_lines;
		g_object_set ((GtkSourceGutterRenderer*) _tmp9_, "xpad", 8, NULL);
		_tmp10_ = self->priv->d_sym_lines;
		g_object_set ((GtkSourceGutterRenderer*) _tmp10_, "xpad", 6, NULL);
		_tmp11_ = gutter;
		_tmp12_ = self->priv->d_old_lines;
		gtk_source_gutter_insert (_tmp11_, (GtkSourceGutterRenderer*) _tmp12_, 0);
		_tmp13_ = gutter;
		_tmp14_ = self->priv->d_new_lines;
		gtk_source_gutter_insert (_tmp13_, (GtkSourceGutterRenderer*) _tmp14_, 1);
		_tmp15_ = gutter;
		_tmp16_ = self->priv->d_sym_lines;
		gtk_source_gutter_insert (_tmp15_, (GtkSourceGutterRenderer*) _tmp16_, 2);
	} else {
		GitgDiffViewFileRendererTextStyle _tmp17_;
		_tmp17_ = self->priv->_d_style;
		if (_tmp17_ == GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_OLD) {
			GitgDiffViewLinesRenderer* _tmp18_;
			GitgDiffViewLinesRenderer* _tmp19_;
			GitgDiffViewLinesRenderer* _tmp20_;
			GitgDiffViewLinesRenderer* _tmp21_;
			GitgDiffViewLinesRenderer* _tmp22_;
			GtkSourceGutter* _tmp23_;
			GitgDiffViewLinesRenderer* _tmp24_;
			GtkSourceGutter* _tmp25_;
			GitgDiffViewLinesRenderer* _tmp26_;
			_tmp18_ = gitg_diff_view_lines_renderer_new (GITG_DIFF_VIEW_LINES_RENDERER_STYLE_OLD);
			g_object_ref_sink (_tmp18_);
			_g_object_unref0 (self->priv->d_old_lines);
			self->priv->d_old_lines = _tmp18_;
			_tmp19_ = gitg_diff_view_lines_renderer_new (GITG_DIFF_VIEW_LINES_RENDERER_STYLE_SYMBOL_OLD);
			g_object_ref_sink (_tmp19_);
			_g_object_unref0 (self->priv->d_sym_lines);
			self->priv->d_sym_lines = _tmp19_;
			_tmp20_ = self->priv->d_old_lines;
			g_object_bind_property_with_closures ((GObject*) self, "maxlines", (GObject*) _tmp20_, "maxlines", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
			_tmp21_ = self->priv->d_old_lines;
			g_object_set ((GtkSourceGutterRenderer*) _tmp21_, "xpad", 8, NULL);
			_tmp22_ = self->priv->d_sym_lines;
			g_object_set ((GtkSourceGutterRenderer*) _tmp22_, "xpad", 6, NULL);
			_tmp23_ = gutter;
			_tmp24_ = self->priv->d_old_lines;
			gtk_source_gutter_insert (_tmp23_, (GtkSourceGutterRenderer*) _tmp24_, 0);
			_tmp25_ = gutter;
			_tmp26_ = self->priv->d_sym_lines;
			gtk_source_gutter_insert (_tmp25_, (GtkSourceGutterRenderer*) _tmp26_, 1);
		} else {
			GitgDiffViewFileRendererTextStyle _tmp27_;
			_tmp27_ = self->priv->_d_style;
			if (_tmp27_ == GITG_DIFF_VIEW_FILE_RENDERER_TEXT_STYLE_NEW) {
				GitgDiffViewLinesRenderer* _tmp28_;
				GitgDiffViewLinesRenderer* _tmp29_;
				GitgDiffViewLinesRenderer* _tmp30_;
				GitgDiffViewLinesRenderer* _tmp31_;
				GitgDiffViewLinesRenderer* _tmp32_;
				GtkSourceGutter* _tmp33_;
				GitgDiffViewLinesRenderer* _tmp34_;
				GtkSourceGutter* _tmp35_;
				GitgDiffViewLinesRenderer* _tmp36_;
				_tmp28_ = gitg_diff_view_lines_renderer_new (GITG_DIFF_VIEW_LINES_RENDERER_STYLE_NEW);
				g_object_ref_sink (_tmp28_);
				_g_object_unref0 (self->priv->d_new_lines);
				self->priv->d_new_lines = _tmp28_;
				_tmp29_ = gitg_diff_view_lines_renderer_new (GITG_DIFF_VIEW_LINES_RENDERER_STYLE_SYMBOL_NEW);
				g_object_ref_sink (_tmp29_);
				_g_object_unref0 (self->priv->d_sym_lines);
				self->priv->d_sym_lines = _tmp29_;
				_tmp30_ = self->priv->d_new_lines;
				g_object_bind_property_with_closures ((GObject*) self, "maxlines", (GObject*) _tmp30_, "maxlines", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
				_tmp31_ = self->priv->d_new_lines;
				g_object_set ((GtkSourceGutterRenderer*) _tmp31_, "xpad", 8, NULL);
				_tmp32_ = self->priv->d_sym_lines;
				g_object_set ((GtkSourceGutterRenderer*) _tmp32_, "xpad", 6, NULL);
				_tmp33_ = gutter;
				_tmp34_ = self->priv->d_new_lines;
				gtk_source_gutter_insert (_tmp33_, (GtkSourceGutterRenderer*) _tmp34_, 0);
				_tmp35_ = gutter;
				_tmp36_ = self->priv->d_sym_lines;
				gtk_source_gutter_insert (_tmp35_, (GtkSourceGutterRenderer*) _tmp36_, 1);
			}
		}
	}
	gtk_text_view_set_border_window_size ((GtkTextView*) self, GTK_TEXT_WINDOW_TOP, 1);
	_tmp37_ = gtk_settings_get_default ();
	_tmp38_ = _g_object_ref0 (_tmp37_);
	settings = _tmp38_;
	_tmp39_ = settings;
	g_signal_connect_object ((GObject*) _tmp39_, "notify::gtk-application-prefer-dark-theme", (GCallback) _gitg_diff_view_file_renderer_text_update_theme_g_object_notify, self, 0);
	_tmp40_ = gitg_font_manager_new ((GtkTextView*) self, TRUE);
	_g_object_unref0 (self->priv->d_font_manager);
	self->priv->d_font_manager = _tmp40_;
	gitg_diff_view_file_renderer_text_update_theme (self);
	_tmp41_ = gitg_diff_selectable_get_can_select ((GitgDiffSelectable*) self);
	_tmp42_ = _tmp41_;
	if (_tmp42_) {
		GitgDiffViewFileSelectable* _tmp43_;
		GitgDiffViewFileSelectable* _tmp44_;
		_tmp43_ = gitg_diff_view_file_selectable_new ((GtkSourceView*) self);
		_g_object_unref0 (self->priv->d_selectable);
		self->priv->d_selectable = _tmp43_;
		_tmp44_ = self->priv->d_selectable;
		g_signal_connect_object ((GObject*) _tmp44_, "notify::has-selection", (GCallback) __gitg_diff_view_file_renderer_text____lambda60__g_object_notify, self, 0);
	}
	_tmp45_ = gee_hash_map_new (G_TYPE_INT, NULL, NULL, GITG_PATCH_SET_TYPE_PATCH, (GBoxedCopyFunc) gitg_patch_set_patch_dup, (GDestroyNotify) gitg_patch_set_patch_free, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->d_lines);
	self->priv->d_lines = _tmp45_;
	gitg_diff_view_file_renderer_textable_set_highlight ((GitgDiffViewFileRendererTextable*) self, TRUE);
	_g_object_unref0 (settings);
	_g_object_unref0 (gutter);
	return obj;
}

static void
gitg_diff_view_file_renderer_text_class_init (GitgDiffViewFileRendererTextClass * klass,
                                              gpointer klass_data)
{
	gitg_diff_view_file_renderer_text_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GitgDiffViewFileRendererText_private_offset);
	((GObjectClass *) klass)->dispose = (void (*) (GObject*)) gitg_diff_view_file_renderer_text_real_dispose;
	((GtkWidgetClass *) klass)->draw = (gboolean (*) (GtkWidget*, cairo_t*)) gitg_diff_view_file_renderer_text_real_draw;
	((GObjectClass *) klass)->constructed = (void (*) (GObject*)) gitg_diff_view_file_renderer_text_real_constructed;
	G_OBJECT_CLASS (klass)->get_property = _vala_gitg_diff_view_file_renderer_text_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_gitg_diff_view_file_renderer_text_set_property;
	G_OBJECT_CLASS (klass)->constructor = gitg_diff_view_file_renderer_text_constructor;
	G_OBJECT_CLASS (klass)->finalize = gitg_diff_view_file_renderer_text_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_DIFF_VIEW_FILE_RENDERER_TEXT_ADDED_PROPERTY, gitg_diff_view_file_renderer_text_properties[GITG_DIFF_VIEW_FILE_RENDERER_TEXT_ADDED_PROPERTY] = g_param_spec_uint ("added", "added", "added", 0, G_MAXUINT, 0U, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_DIFF_VIEW_FILE_RENDERER_TEXT_REMOVED_PROPERTY, gitg_diff_view_file_renderer_text_properties[GITG_DIFF_VIEW_FILE_RENDERER_TEXT_REMOVED_PROPERTY] = g_param_spec_uint ("removed", "removed", "removed", 0, G_MAXUINT, 0U, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_DIFF_VIEW_FILE_RENDERER_TEXT_D_STYLE_PROPERTY, gitg_diff_view_file_renderer_text_properties[GITG_DIFF_VIEW_FILE_RENDERER_TEXT_D_STYLE_PROPERTY] = g_param_spec_enum ("d-style", "d-style", "d-style", GITG_DIFF_VIEW_FILE_RENDERER_TEXT_TYPE_STYLE, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_DIFF_VIEW_FILE_RENDERER_TEXT_NEW_IS_WORKDIR_PROPERTY, gitg_diff_view_file_renderer_text_properties[GITG_DIFF_VIEW_FILE_RENDERER_TEXT_NEW_IS_WORKDIR_PROPERTY] = g_param_spec_boolean ("new-is-workdir", "new-is-workdir", "new-is-workdir", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_DIFF_VIEW_FILE_RENDERER_TEXT_WRAP_LINES_PROPERTY, gitg_diff_view_file_renderer_text_properties[GITG_DIFF_VIEW_FILE_RENDERER_TEXT_WRAP_LINES_PROPERTY] = g_param_spec_boolean ("wrap-lines", "wrap-lines", "wrap-lines", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_DIFF_VIEW_FILE_RENDERER_TEXT_TAB_WIDTH_PROPERTY, gitg_diff_view_file_renderer_text_properties[GITG_DIFF_VIEW_FILE_RENDERER_TEXT_TAB_WIDTH_PROPERTY] = g_param_spec_int ("tab-width", "tab-width", "tab-width", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_DIFF_VIEW_FILE_RENDERER_TEXT_MAXLINES_PROPERTY, gitg_diff_view_file_renderer_text_properties[GITG_DIFF_VIEW_FILE_RENDERER_TEXT_MAXLINES_PROPERTY] = g_param_spec_int ("maxlines", "maxlines", "maxlines", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_DIFF_VIEW_FILE_RENDERER_TEXT_INFO_PROPERTY, gitg_diff_view_file_renderer_text_properties[GITG_DIFF_VIEW_FILE_RENDERER_TEXT_INFO_PROPERTY] = g_param_spec_object ("info", "info", "info", GITG_TYPE_DIFF_VIEW_FILE_INFO, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_DIFF_VIEW_FILE_RENDERER_TEXT_DELTA_PROPERTY, gitg_diff_view_file_renderer_text_properties[GITG_DIFF_VIEW_FILE_RENDERER_TEXT_DELTA_PROPERTY] = g_param_spec_boxed ("delta", "delta", "delta", ggit_diff_delta_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_DIFF_VIEW_FILE_RENDERER_TEXT_REPOSITORY_PROPERTY, gitg_diff_view_file_renderer_text_properties[GITG_DIFF_VIEW_FILE_RENDERER_TEXT_REPOSITORY_PROPERTY] = g_param_spec_object ("repository", "repository", "repository", GITG_TYPE_REPOSITORY, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_DIFF_VIEW_FILE_RENDERER_TEXT_HIGHLIGHT_PROPERTY, gitg_diff_view_file_renderer_text_properties[GITG_DIFF_VIEW_FILE_RENDERER_TEXT_HIGHLIGHT_PROPERTY] = g_param_spec_boolean ("highlight", "highlight", "highlight", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_DIFF_VIEW_FILE_RENDERER_TEXT_HAS_SELECTION_PROPERTY, gitg_diff_view_file_renderer_text_properties[GITG_DIFF_VIEW_FILE_RENDERER_TEXT_HAS_SELECTION_PROPERTY] = g_param_spec_boolean ("has-selection", "has-selection", "has-selection", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_DIFF_VIEW_FILE_RENDERER_TEXT_CAN_SELECT_PROPERTY, gitg_diff_view_file_renderer_text_properties[GITG_DIFF_VIEW_FILE_RENDERER_TEXT_CAN_SELECT_PROPERTY] = g_param_spec_boolean ("can-select", "can-select", "can-select", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_DIFF_VIEW_FILE_RENDERER_TEXT_SELECTION_PROPERTY, gitg_diff_view_file_renderer_text_properties[GITG_DIFF_VIEW_FILE_RENDERER_TEXT_SELECTION_PROPERTY] = gitg_param_spec_patch_set ("selection", "selection", "selection", GITG_TYPE_PATCH_SET, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/gitg/ui/gitg-diff-view-file-renderer-text.ui");
}

static void
gitg_diff_view_file_renderer_text_gitg_diff_selectable_interface_init (GitgDiffSelectableIface * iface,
                                                                       gpointer iface_data)
{
	gitg_diff_view_file_renderer_text_gitg_diff_selectable_parent_iface = g_type_interface_peek_parent (iface);
	iface->clear_selection = (void (*) (GitgDiffSelectable*)) gitg_diff_view_file_renderer_text_real_clear_selection;
	iface->get_has_selection = gitg_diff_view_file_renderer_text_real_get_has_selection;
	iface->get_can_select = gitg_diff_view_file_renderer_text_real_get_can_select;
	iface->set_can_select = gitg_diff_view_file_renderer_text_real_set_can_select;
	iface->get_selection = gitg_diff_view_file_renderer_text_real_get_selection;
}

static void
gitg_diff_view_file_renderer_text_gitg_diff_view_file_renderer_interface_init (GitgDiffViewFileRendererIface * iface,
                                                                               gpointer iface_data)
{
	gitg_diff_view_file_renderer_text_gitg_diff_view_file_renderer_parent_iface = g_type_interface_peek_parent (iface);
	iface->add_hunk = (void (*) (GitgDiffViewFileRenderer*, GgitDiffHunk*, GeeArrayList*)) gitg_diff_view_file_renderer_text_real_add_hunk;
}

static void
gitg_diff_view_file_renderer_text_gitg_diff_view_file_renderer_textable_interface_init (GitgDiffViewFileRendererTextableIface * iface,
                                                                                        gpointer iface_data)
{
	gitg_diff_view_file_renderer_text_gitg_diff_view_file_renderer_textable_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_wrap_lines = gitg_diff_view_file_renderer_text_real_get_wrap_lines;
	iface->set_wrap_lines = gitg_diff_view_file_renderer_text_real_set_wrap_lines;
	iface->get_tab_width = gitg_diff_view_file_renderer_text_real_get_tab_width;
	iface->set_tab_width = gitg_diff_view_file_renderer_text_real_set_tab_width;
	iface->get_maxlines = gitg_diff_view_file_renderer_text_real_get_maxlines;
	iface->set_maxlines = gitg_diff_view_file_renderer_text_real_set_maxlines;
	iface->get_highlight = gitg_diff_view_file_renderer_text_real_get_highlight;
	iface->set_highlight = gitg_diff_view_file_renderer_text_real_set_highlight;
}

static void
gitg_diff_view_file_renderer_text_instance_init (GitgDiffViewFileRendererText * self,
                                                 gpointer klass)
{
	self->priv = gitg_diff_view_file_renderer_text_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
gitg_diff_view_file_renderer_text_finalize (GObject * obj)
{
	GitgDiffViewFileRendererText * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GITG_TYPE_DIFF_VIEW_FILE_RENDERER_TEXT, GitgDiffViewFileRendererText);
	_g_object_unref0 (self->priv->d_lines);
	_g_object_unref0 (self->priv->d_selectable);
	_g_object_unref0 (self->priv->d_old_lines);
	_g_object_unref0 (self->priv->d_new_lines);
	_g_object_unref0 (self->priv->d_sym_lines);
	_g_object_unref0 (self->priv->d_higlight_cancellable);
	_g_object_unref0 (self->priv->d_old_highlight_buffer);
	_g_object_unref0 (self->priv->d_new_highlight_buffer);
	self->priv->d_regions = (g_free (self->priv->d_regions), NULL);
	_g_object_unref0 (self->priv->d_stylesettings);
	_g_object_unref0 (self->priv->d_font_manager);
	_g_object_unref0 (self->priv->_info);
	G_OBJECT_CLASS (gitg_diff_view_file_renderer_text_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
gitg_diff_view_file_renderer_text_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GitgDiffViewFileRendererTextClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gitg_diff_view_file_renderer_text_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GitgDiffViewFileRendererText), 0, (GInstanceInitFunc) gitg_diff_view_file_renderer_text_instance_init, NULL };
	static const GInterfaceInfo gitg_diff_selectable_info = { (GInterfaceInitFunc) gitg_diff_view_file_renderer_text_gitg_diff_selectable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo gitg_diff_view_file_renderer_info = { (GInterfaceInitFunc) gitg_diff_view_file_renderer_text_gitg_diff_view_file_renderer_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo gitg_diff_view_file_renderer_textable_info = { (GInterfaceInitFunc) gitg_diff_view_file_renderer_text_gitg_diff_view_file_renderer_textable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType gitg_diff_view_file_renderer_text_type_id;
	gitg_diff_view_file_renderer_text_type_id = g_type_register_static (gtk_source_view_get_type (), "GitgDiffViewFileRendererText", &g_define_type_info, 0);
	g_type_add_interface_static (gitg_diff_view_file_renderer_text_type_id, GITG_TYPE_DIFF_SELECTABLE, &gitg_diff_selectable_info);
	g_type_add_interface_static (gitg_diff_view_file_renderer_text_type_id, GITG_TYPE_DIFF_VIEW_FILE_RENDERER, &gitg_diff_view_file_renderer_info);
	g_type_add_interface_static (gitg_diff_view_file_renderer_text_type_id, GITG_TYPE_DIFF_VIEW_FILE_RENDERER_TEXTABLE, &gitg_diff_view_file_renderer_textable_info);
	GitgDiffViewFileRendererText_private_offset = g_type_add_instance_private (gitg_diff_view_file_renderer_text_type_id, sizeof (GitgDiffViewFileRendererTextPrivate));
	return gitg_diff_view_file_renderer_text_type_id;
}

GType
gitg_diff_view_file_renderer_text_get_type (void)
{
	static gsize gitg_diff_view_file_renderer_text_type_id__once = 0;
	if (g_once_init_enter (&gitg_diff_view_file_renderer_text_type_id__once)) {
		GType gitg_diff_view_file_renderer_text_type_id;
		gitg_diff_view_file_renderer_text_type_id = gitg_diff_view_file_renderer_text_get_type_once ();
		g_once_init_leave (&gitg_diff_view_file_renderer_text_type_id__once, gitg_diff_view_file_renderer_text_type_id);
	}
	return gitg_diff_view_file_renderer_text_type_id__once;
}

static void
_vala_gitg_diff_view_file_renderer_text_get_property (GObject * object,
                                                      guint property_id,
                                                      GValue * value,
                                                      GParamSpec * pspec)
{
	GitgDiffViewFileRendererText * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GITG_TYPE_DIFF_VIEW_FILE_RENDERER_TEXT, GitgDiffViewFileRendererText);
	switch (property_id) {
		case GITG_DIFF_VIEW_FILE_RENDERER_TEXT_ADDED_PROPERTY:
		g_value_set_uint (value, gitg_diff_view_file_renderer_text_get_added (self));
		break;
		case GITG_DIFF_VIEW_FILE_RENDERER_TEXT_REMOVED_PROPERTY:
		g_value_set_uint (value, gitg_diff_view_file_renderer_text_get_removed (self));
		break;
		case GITG_DIFF_VIEW_FILE_RENDERER_TEXT_D_STYLE_PROPERTY:
		g_value_set_enum (value, gitg_diff_view_file_renderer_text_get_d_style (self));
		break;
		case GITG_DIFF_VIEW_FILE_RENDERER_TEXT_NEW_IS_WORKDIR_PROPERTY:
		g_value_set_boolean (value, gitg_diff_view_file_renderer_text_get_new_is_workdir (self));
		break;
		case GITG_DIFF_VIEW_FILE_RENDERER_TEXT_WRAP_LINES_PROPERTY:
		g_value_set_boolean (value, gitg_diff_view_file_renderer_textable_get_wrap_lines ((GitgDiffViewFileRendererTextable*) self));
		break;
		case GITG_DIFF_VIEW_FILE_RENDERER_TEXT_TAB_WIDTH_PROPERTY:
		g_value_set_int (value, gitg_diff_view_file_renderer_textable_get_tab_width ((GitgDiffViewFileRendererTextable*) self));
		break;
		case GITG_DIFF_VIEW_FILE_RENDERER_TEXT_MAXLINES_PROPERTY:
		g_value_set_int (value, gitg_diff_view_file_renderer_textable_get_maxlines ((GitgDiffViewFileRendererTextable*) self));
		break;
		case GITG_DIFF_VIEW_FILE_RENDERER_TEXT_INFO_PROPERTY:
		g_value_set_object (value, gitg_diff_view_file_renderer_text_get_info (self));
		break;
		case GITG_DIFF_VIEW_FILE_RENDERER_TEXT_DELTA_PROPERTY:
		g_value_set_boxed (value, gitg_diff_view_file_renderer_text_get_delta (self));
		break;
		case GITG_DIFF_VIEW_FILE_RENDERER_TEXT_REPOSITORY_PROPERTY:
		g_value_set_object (value, gitg_diff_view_file_renderer_text_get_repository (self));
		break;
		case GITG_DIFF_VIEW_FILE_RENDERER_TEXT_HIGHLIGHT_PROPERTY:
		g_value_set_boolean (value, gitg_diff_view_file_renderer_textable_get_highlight ((GitgDiffViewFileRendererTextable*) self));
		break;
		case GITG_DIFF_VIEW_FILE_RENDERER_TEXT_HAS_SELECTION_PROPERTY:
		g_value_set_boolean (value, gitg_diff_selectable_get_has_selection ((GitgDiffSelectable*) self));
		break;
		case GITG_DIFF_VIEW_FILE_RENDERER_TEXT_CAN_SELECT_PROPERTY:
		g_value_set_boolean (value, gitg_diff_selectable_get_can_select ((GitgDiffSelectable*) self));
		break;
		case GITG_DIFF_VIEW_FILE_RENDERER_TEXT_SELECTION_PROPERTY:
		gitg_value_take_patch_set (value, gitg_diff_selectable_get_selection ((GitgDiffSelectable*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_gitg_diff_view_file_renderer_text_set_property (GObject * object,
                                                      guint property_id,
                                                      const GValue * value,
                                                      GParamSpec * pspec)
{
	GitgDiffViewFileRendererText * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GITG_TYPE_DIFF_VIEW_FILE_RENDERER_TEXT, GitgDiffViewFileRendererText);
	switch (property_id) {
		case GITG_DIFF_VIEW_FILE_RENDERER_TEXT_ADDED_PROPERTY:
		gitg_diff_view_file_renderer_text_set_added (self, g_value_get_uint (value));
		break;
		case GITG_DIFF_VIEW_FILE_RENDERER_TEXT_REMOVED_PROPERTY:
		gitg_diff_view_file_renderer_text_set_removed (self, g_value_get_uint (value));
		break;
		case GITG_DIFF_VIEW_FILE_RENDERER_TEXT_D_STYLE_PROPERTY:
		gitg_diff_view_file_renderer_text_set_d_style (self, g_value_get_enum (value));
		break;
		case GITG_DIFF_VIEW_FILE_RENDERER_TEXT_NEW_IS_WORKDIR_PROPERTY:
		gitg_diff_view_file_renderer_text_set_new_is_workdir (self, g_value_get_boolean (value));
		break;
		case GITG_DIFF_VIEW_FILE_RENDERER_TEXT_WRAP_LINES_PROPERTY:
		gitg_diff_view_file_renderer_textable_set_wrap_lines ((GitgDiffViewFileRendererTextable*) self, g_value_get_boolean (value));
		break;
		case GITG_DIFF_VIEW_FILE_RENDERER_TEXT_TAB_WIDTH_PROPERTY:
		gitg_diff_view_file_renderer_textable_set_tab_width ((GitgDiffViewFileRendererTextable*) self, g_value_get_int (value));
		break;
		case GITG_DIFF_VIEW_FILE_RENDERER_TEXT_MAXLINES_PROPERTY:
		gitg_diff_view_file_renderer_textable_set_maxlines ((GitgDiffViewFileRendererTextable*) self, g_value_get_int (value));
		break;
		case GITG_DIFF_VIEW_FILE_RENDERER_TEXT_INFO_PROPERTY:
		gitg_diff_view_file_renderer_text_set_info (self, g_value_get_object (value));
		break;
		case GITG_DIFF_VIEW_FILE_RENDERER_TEXT_HIGHLIGHT_PROPERTY:
		gitg_diff_view_file_renderer_textable_set_highlight ((GitgDiffViewFileRendererTextable*) self, g_value_get_boolean (value));
		break;
		case GITG_DIFF_VIEW_FILE_RENDERER_TEXT_CAN_SELECT_PROPERTY:
		gitg_diff_selectable_set_can_select ((GitgDiffSelectable*) self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

