diff options
author | Mike Krüger <mkrueger@xamarin.com> | 2011-10-18 09:59:14 +0400 |
---|---|---|
committer | Mike Krüger <mkrueger@xamarin.com> | 2011-10-18 09:59:14 +0400 |
commit | a6e1400af37feff0af739bdf7f4fa788016cc7b3 (patch) | |
tree | d6517af93b46326d3b680674e429fceb76697c09 /main/src/addins/MonoDevelop.HexEditor | |
parent | ad63357a0aa97c8b10f01ec3c1e54c54ec1f6f68 (diff) | |
parent | a4954f61e72d18c33e4803e20105407830ad623d (diff) |
Merge branch 'master' into newresolver
Conflicts:
main/src/addins/MonoDevelop.MacDev/Makefile.am
main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoryCommands.cs
main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Dom.Parser/TypeResolverVisitor.cs
main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Dom/DomType.cs
main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.NavigateToDialog/SearchResult.cs
main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs
Diffstat (limited to 'main/src/addins/MonoDevelop.HexEditor')
5 files changed, 17 insertions, 7 deletions
diff --git a/main/src/addins/MonoDevelop.HexEditor/Mono.MHex.Data/HexEditorData.cs b/main/src/addins/MonoDevelop.HexEditor/Mono.MHex.Data/HexEditorData.cs index 7a48acc053..83b779ca78 100644 --- a/main/src/addins/MonoDevelop.HexEditor/Mono.MHex.Data/HexEditorData.cs +++ b/main/src/addins/MonoDevelop.HexEditor/Mono.MHex.Data/HexEditorData.cs @@ -75,6 +75,12 @@ namespace Mono.MHex.Data } } + public byte[] Bytes { + get { + return GetBytes (0, (int)Length); + } + } + public byte[] GetBytes (long offset, int count) { if (count == 0) @@ -172,6 +178,8 @@ namespace Mono.MHex.Data OnReplaced (new ReplaceEventArgs (offset, count, null)); if (!isInUndo) EndAtomicUndo (); + if (Length == 0) + Insert (0, new byte[] {0}); } public void UpdateLine (long line) diff --git a/main/src/addins/MonoDevelop.HexEditor/Mono.MHex.Data/PieceTable.cs b/main/src/addins/MonoDevelop.HexEditor/Mono.MHex.Data/PieceTable.cs index 8c5d7cca77..7926a3639c 100644 --- a/main/src/addins/MonoDevelop.HexEditor/Mono.MHex.Data/PieceTable.cs +++ b/main/src/addins/MonoDevelop.HexEditor/Mono.MHex.Data/PieceTable.cs @@ -272,7 +272,7 @@ namespace Mono.MHex.Data return; } - long endSegmentLength = offset + length - endNode.value.CalcOffset (endNode); + long endSegmentLength = endNode != null ? offset + length - endNode.value.CalcOffset (endNode) : 0; RedBlackTree<TreeNode>.RedBlackTreeIterator iter = new RedBlackTree<TreeNode>.RedBlackTreeIterator (startNode); RedBlackTree<TreeNode>.RedBlackTreeNode node; do { diff --git a/main/src/addins/MonoDevelop.HexEditor/Mono.MHex/SimpleEditMode.cs b/main/src/addins/MonoDevelop.HexEditor/Mono.MHex/SimpleEditMode.cs index 952c1d4959..51db523d7b 100644 --- a/main/src/addins/MonoDevelop.HexEditor/Mono.MHex/SimpleEditMode.cs +++ b/main/src/addins/MonoDevelop.HexEditor/Mono.MHex/SimpleEditMode.cs @@ -206,6 +206,8 @@ namespace Mono.MHex string hex = "0123456789ABCDEF"; int idx = hex.IndexOf (char.ToUpper (ch)); if (idx >= 0) { + if (HexEditorData.Caret.Offset >= HexEditorData.Length) + HexEditorData.Insert (HexEditorData.Length, 0); if (HexEditorData.Caret.IsInsertMode && HexEditorData.Caret.SubPosition == 0) { HexEditorData.Insert (HexEditorData.Caret.Offset, (byte)(idx * 0x10)); } else { diff --git a/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor.addin.xml b/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor.addin.xml index 2fd3fcc10e..5a16ae93d0 100644 --- a/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor.addin.xml +++ b/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor.addin.xml @@ -6,16 +6,16 @@ url = "" description = "Provides a hex editor for MonoDevelop" category = "IDE extensions" - version = "2.8"> + version = "2.8.1"> <Runtime> <Import assembly="MonoDevelop.HexEditor.dll"/> </Runtime> <Dependencies> - <Addin id="Core" version="2.8"/> - <Addin id="Ide" version="2.8"/> - <Addin id="AssemblyBrowser" version="2.8"/> + <Addin id="Core" version="2.8.1"/> + <Addin id="Ide" version="2.8.1"/> + <Addin id="AssemblyBrowser" version="2.8.1"/> </Dependencies> <!-- <Extension path = "/MonoDevelop/Ide/Commands"> diff --git a/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor/HexEditorView.cs b/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor/HexEditorView.cs index 05dc9e8c45..808c545a80 100644 --- a/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor/HexEditorView.cs +++ b/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor/HexEditorView.cs @@ -67,11 +67,11 @@ namespace MonoDevelop.HexEditor public override void Save (string fileName) { - File.WriteAllBytes (fileName, hexEditor.HexEditorData.Buffer.Bytes); + File.WriteAllBytes (fileName, hexEditor.HexEditorData.Bytes); ContentName = fileName; this.IsDirty = false; } - + public override void Load (string fileName) { using (Stream stream = File.OpenRead (fileName)) { |