diff options
author | Mike Krüger <mkrueger@novell.com> | 2010-11-12 14:11:31 +0300 |
---|---|---|
committer | Mike Krüger <mkrueger@novell.com> | 2010-11-12 14:13:55 +0300 |
commit | a0ba196a9fc915246eacd57e03932dde089abacc (patch) | |
tree | aa86ca950fccf8bf45e7919f3376eba86430db58 /main/src/addins/ChangeLogAddIn | |
parent | 82ef0b4cf869871c29e18d0bbddd42f46609fc28 (diff) |
Added fix from levi bard for 'Bug 353505 - Added lines in the
Changelog are always with linux-style endlines'.
Diffstat (limited to 'main/src/addins/ChangeLogAddIn')
-rw-r--r-- | main/src/addins/ChangeLogAddIn/ChangeLogAddIn.cs | 11 | ||||
-rw-r--r-- | main/src/addins/ChangeLogAddIn/ChangeLogAddIn.csproj | 4 | ||||
-rw-r--r-- | main/src/addins/ChangeLogAddIn/Makefile.am | 1 |
3 files changed, 12 insertions, 4 deletions
diff --git a/main/src/addins/ChangeLogAddIn/ChangeLogAddIn.cs b/main/src/addins/ChangeLogAddIn/ChangeLogAddIn.cs index 14332c4d66..14f97ecbd6 100644 --- a/main/src/addins/ChangeLogAddIn/ChangeLogAddIn.cs +++ b/main/src/addins/ChangeLogAddIn/ChangeLogAddIn.cs @@ -89,12 +89,13 @@ namespace MonoDevelop.ChangeLogAddIn string changeLogFileNameDirectory = Path.GetDirectoryName(changeLogFileName); string selectedFileName = GetSelectedFile(); string selectedFileNameDirectory = Path.GetDirectoryName(selectedFileName); + string eol = document.Editor != null ? document.Editor.EolMarker : Environment.NewLine; int pos = GetHeaderEndPosition (document); if (pos > 0 && selectedFileNameDirectory.StartsWith(changeLogFileNameDirectory)) { string text = "\t* " + selectedFileName.Substring(changeLogFileNameDirectory.Length + 1) + ": " - + Environment.NewLine + Environment.NewLine; + + eol + eol; int insertPos = Math.Min (pos + 2, textBuffer.Length); textBuffer.InsertText (insertPos, text); @@ -119,10 +120,10 @@ namespace MonoDevelop.ChangeLogAddIn MessageService.ShowError (title, detail); return false; } - + string eol = document.Editor != null ? document.Editor.EolMarker : Environment.NewLine; string date = DateTime.Now.ToString("yyyy-MM-dd"); string text = date + " " + userInfo.Name + " <" + userInfo.Email + ">" - + Environment.NewLine + Environment.NewLine; + + eol + eol; // Read the first line and compare it with the header: if they are // the same don't insert a new header. @@ -140,7 +141,9 @@ namespace MonoDevelop.ChangeLogAddIn // This is less than optimal, we simply read 1024 chars hoping to // find a newline there: if we don't find it we just return 0. string text = textBuffer.GetText (0, Math.Min (textBuffer.Length, 1023)); - return text.IndexOf (Environment.NewLine + Environment.NewLine); + string eol = document.Editor != null ? document.Editor.EolMarker : Environment.NewLine; + + return text.IndexOf (eol + eol); } private Document GetActiveChangeLogDocument() diff --git a/main/src/addins/ChangeLogAddIn/ChangeLogAddIn.csproj b/main/src/addins/ChangeLogAddIn/ChangeLogAddIn.csproj index 73669bc92c..57b16d8e0b 100644 --- a/main/src/addins/ChangeLogAddIn/ChangeLogAddIn.csproj +++ b/main/src/addins/ChangeLogAddIn/ChangeLogAddIn.csproj @@ -50,6 +50,10 @@ <Name>MonoDevelop.VersionControl</Name> <Private>False</Private> </ProjectReference> + <ProjectReference Include="..\..\core\Mono.Texteditor\Mono.TextEditor.csproj"> + <Project>{A2329308-3751-4DBD-9A75-5F7B8B024625}</Project> + <Name>Mono.TextEditor</Name> + </ProjectReference> </ItemGroup> <ItemGroup> <Reference Include="Mono.Posix" /> diff --git a/main/src/addins/ChangeLogAddIn/Makefile.am b/main/src/addins/ChangeLogAddIn/Makefile.am index d1692a62c9..c58c3d7944 100644 --- a/main/src/addins/ChangeLogAddIn/Makefile.am +++ b/main/src/addins/ChangeLogAddIn/Makefile.am @@ -3,6 +3,7 @@ ASSEMBLY = $(ADDIN_BUILD)/ChangeLogAddIn.dll DEPS = \ $(top_builddir)/build/AddIns/VersionControl/MonoDevelop.VersionControl.dll \ + $(top_builddir)/build/bin/Mono.TextEditor.dll \ $(top_builddir)/build/bin/MonoDevelop.Core.dll \ $(top_builddir)/build/bin/MonoDevelop.Ide.dll |