mirror of
https://gitlab.gnome.org/GNOME/gitg
synced 2024-11-05 16:43:26 +00:00
Remove carriage returns in diff view
This commit is contained in:
parent
85d0822a57
commit
3ca15914e5
1 changed files with 17 additions and 1 deletions
|
@ -339,6 +339,7 @@ class Gitg.DiffViewFileRendererText : Gtk.SourceView, DiffSelectable, DiffViewFi
|
|||
try
|
||||
{
|
||||
yield loader.load_async(GLib.Priority.LOW, cancellable, null);
|
||||
this.strip_carriage_returns(buffer);
|
||||
}
|
||||
catch (Error e)
|
||||
{
|
||||
|
@ -353,6 +354,21 @@ class Gitg.DiffViewFileRendererText : Gtk.SourceView, DiffSelectable, DiffViewFi
|
|||
return buffer;
|
||||
}
|
||||
|
||||
private void strip_carriage_returns(Gtk.SourceBuffer buffer)
|
||||
{
|
||||
var search_settings = new Gtk.SourceSearchSettings();
|
||||
|
||||
search_settings.regex_enabled = true;
|
||||
search_settings.search_text = "\\r";
|
||||
|
||||
var search_context = new Gtk.SourceSearchContext(buffer, search_settings);
|
||||
|
||||
try
|
||||
{
|
||||
search_context.replace_all("", 0);
|
||||
} catch (Error e) {}
|
||||
}
|
||||
|
||||
private void update_highlighting_ready()
|
||||
{
|
||||
if (!d_old_highlight_ready && !d_new_highlight_ready)
|
||||
|
@ -542,7 +558,7 @@ class Gitg.DiffViewFileRendererText : Gtk.SourceView, DiffSelectable, DiffViewFi
|
|||
for (var i = 0; i < lines.size; i++)
|
||||
{
|
||||
var line = lines[i];
|
||||
var text = line.get_text();
|
||||
var text = line.get_text().replace("\r", "");
|
||||
var added = false;
|
||||
var removed = false;
|
||||
var origin = line.get_origin();
|
||||
|
|
Loading…
Reference in a new issue