diff --git a/src/AddIns/BackendBindings/VBNetBinding/Project/Src/FormattingStrategy/VBNetFormattingStrategy.cs b/src/AddIns/BackendBindings/VBNetBinding/Project/Src/FormattingStrategy/VBNetFormattingStrategy.cs index 994bc7b536..71b32f742c 100644 --- a/src/AddIns/BackendBindings/VBNetBinding/Project/Src/FormattingStrategy/VBNetFormattingStrategy.cs +++ b/src/AddIns/BackendBindings/VBNetBinding/Project/Src/FormattingStrategy/VBNetFormattingStrategy.cs @@ -148,8 +148,10 @@ namespace VBNetBinding.FormattingStrategy for (int i = 0; i < statement.IndentPlus; ++i) { RemoveIndent(b); } - if (doCasing && !statement.EndStatement.EndsWith(" ")) - curLineText = statement.EndStatement; + // We cannot reset curLineText like this - it would remove + // comments after the EndStatement, see SD2-1142 + //if (doCasing && !statement.EndStatement.EndsWith(" ")) + // curLineText = statement.EndStatement; matched = true; } if (Regex.IsMatch(texttoreplace, statement.StartRegex, RegexOptions.IgnoreCase)) { diff --git a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/HRuler.cs b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/HRuler.cs index a3b17affac..020a908245 100644 --- a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/HRuler.cs +++ b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/HRuler.cs @@ -12,11 +12,11 @@ using System.Windows.Forms; namespace ICSharpCode.TextEditor { /// - /// Description of HRuler. + /// Horizontal ruler - text column measuring ruler at the top of the text area. /// - public class HRuler : UserControl + public class HRuler : Control { - TextArea textArea; + TextArea textArea; public HRuler(TextArea textArea) { @@ -49,10 +49,6 @@ namespace ICSharpCode.TextEditor 0, Width, Height)); - } - - - } } diff --git a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextArea.cs b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextArea.cs index c9ed7a1f6f..c573637db9 100644 --- a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextArea.cs +++ b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextArea.cs @@ -547,6 +547,7 @@ namespace ICSharpCode.TextEditor return false; } + // Fixes SD2-747: Form containing the text editor and a button with a shortcut protected override bool IsInputChar(char charCode) { return true; diff --git a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextView.cs b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextView.cs index 0cd760a1ae..f2870f7c48 100644 --- a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextView.cs +++ b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextView.cs @@ -632,6 +632,7 @@ namespace ICSharpCode.TextEditor // split words after 1000 characters. Fixes GDI+ crash on very longs words, for example // a 100 KB Base64-file without any line breaks. const int MaximumWordLength = 1000; + const int MaximumCacheSize = 2000; int MeasureStringWidth(Graphics g, string word, Font font) { @@ -652,7 +653,7 @@ namespace ICSharpCode.TextEditor if (measureCache.TryGetValue(new WordFontPair(word, font), out width)) { return width; } - if (measureCache.Count > 1000) { + if (measureCache.Count > MaximumCacheSize) { measureCache.Clear(); } @@ -661,11 +662,15 @@ namespace ICSharpCode.TextEditor // txt.GetPositionFromCharIndex(txt.SelectionStart) // (Verdana 10, highlighting makes GetP... bold) -> note the space between 'x' and '(' // this also fixes "jumping" characters when selecting in non-monospace fonts + // [...] + // Replaced GDI+ measurement with GDI measurement: faster and even more exact width = TextRenderer.MeasureText(g, word, font, new Size(short.MaxValue, short.MaxValue), textFormatFlags).Width; measureCache.Add(new WordFontPair(word, font), width); return width; } + // Important: Some flags combinations work on WinXP, but not on Win2000. + // Make sure to test changes here on all operating systems. const TextFormatFlags textFormatFlags = TextFormatFlags.NoPadding | TextFormatFlags.NoPrefix | TextFormatFlags.PreserveGraphicsClipping; #endregion