Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optionally show EOL markers as glyph instead of textually #10697

Merged
merged 3 commits into from
Feb 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions GitCommands/Settings/AppSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1473,6 +1473,12 @@ public static Font ConEmuConsoleFont
set => SetFont("conemuconsolefont", value);
}

public static bool ShowEolMarkerAsGlyph
{
get => GetBool("ShowEolMarkerAsGlyph", false);
set => SetBool("ShowEolMarkerAsGlyph", value);
}

#endregion

public static bool MulticolorBranches
Expand Down
2 changes: 2 additions & 0 deletions GitUI/CommandsDialogs/FormSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,8 @@ private void FormSettings_Shown(object sender, EventArgs e)
}

settingsTreeView.GotoPage(_initialPage);

settingsTreeView.Focus();
}
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ protected override void SettingsToPage()
SetCurrentCommitFont(AppSettings.CommitFont);
SetCurrentMonospaceFont(AppSettings.MonospaceFont);

ShowEolMarkerAsGlyph.Checked = AppSettings.ShowEolMarkerAsGlyph;

base.SettingsToPage();
}

Expand All @@ -39,6 +41,8 @@ protected override void PageToSettings()
AppSettings.CommitFont = _commitFont;
AppSettings.MonospaceFont = _monospaceFont;

AppSettings.ShowEolMarkerAsGlyph = ShowEolMarkerAsGlyph.Checked;

base.PageToSettings();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,64 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema

Version 2.0

The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.

Example:

... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>

There are any number of "resheader" rows that contain simple
name/value pairs.

Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.

The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:

Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.

mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
Expand Down Expand Up @@ -118,12 +58,15 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="diffFontDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>196, 17</value>
<value>345, 17</value>
</metadata>
<metadata name="applicationDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>346, 17</value>
<value>474, 17</value>
</metadata>
<metadata name="commitFontDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="monospaceFontDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="commitFontDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>192, 17</value>
</metadata>
</root>
2 changes: 1 addition & 1 deletion GitUI/Editor/FileViewer.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion GitUI/Editor/FileViewer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1191,7 +1191,11 @@ private void SetStateOfContextLinesButtons()

private void ToggleNonPrintingChars(bool show)
{
internalFileViewer.ShowEOLMarkers = show;
internalFileViewer.EolMarkerStyle = show
? AppSettings.ShowEolMarkerAsGlyph
? ICSharpCode.TextEditor.Document.EolMarkerStyle.Glyph
: ICSharpCode.TextEditor.Document.EolMarkerStyle.Text
: ICSharpCode.TextEditor.Document.EolMarkerStyle.None;
internalFileViewer.ShowSpaces = show;
internalFileViewer.ShowTabs = show;
}
Expand Down
6 changes: 3 additions & 3 deletions GitUI/Editor/FileViewerInternal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -399,10 +399,10 @@ public int VScrollPosition
}
}

public bool ShowEOLMarkers
public EolMarkerStyle EolMarkerStyle
{
get => TextEditor.ShowEOLMarkers;
set => TextEditor.ShowEOLMarkers = value;
get => TextEditor.EolMarkerStyle;
set => TextEditor.EolMarkerStyle = value;
}

public bool ShowSpaces
Expand Down
6 changes: 4 additions & 2 deletions GitUI/Editor/IFileViewer.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace GitUI.Editor
using ICSharpCode.TextEditor.Document;

namespace GitUI.Editor
{
public class SelectedLineEventArgs : EventArgs
{
Expand Down Expand Up @@ -42,7 +44,7 @@ public interface IFileViewer
int VScrollPosition { get; set; }

bool? ShowLineNumbers { get; set; }
bool ShowEOLMarkers { get; set; }
EolMarkerStyle EolMarkerStyle { get; set; }
bool ShowSpaces { get; set; }
bool ShowTabs { get; set; }
int VRulerPosition { get; set; }
Expand Down
6 changes: 5 additions & 1 deletion GitUI/Translation/English.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ This action will be performed without warning while checking out branch.</source
<source>Fonts</source>
<target />
</trans-unit>
<trans-unit id="ShowEolMarkerAsGlyph.Text">
<source>Show end-of-line markers as glyph instead of "\r\n" etc.</source>
<target />
</trans-unit>
<trans-unit id="applicationFontChangeButton.Text">
<source>font name</source>
<target />
Expand All @@ -98,7 +102,7 @@ This action will be performed without warning while checking out branch.</source
<target />
</trans-unit>
<trans-unit id="gbFonts.Text">
<source>Fonts</source>
<source>Fonts (restart required)</source>
<target />
</trans-unit>
<trans-unit id="label26.Text">
Expand Down