|
|
@@ -5,10 +5,10 @@
|
|
|
// distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
// permit persons to whom the Software is furnished to do so, subject to
|
|
|
// the following conditions:
|
|
|
-//
|
|
|
+//
|
|
|
// The above copyright notice and this permission notice shall be
|
|
|
// included in all copies or substantial portions of the Software.
|
|
|
-//
|
|
|
+//
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
@@ -376,15 +376,15 @@ namespace System.Windows.Forms {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public override string Text {
|
|
|
- get {
|
|
|
- if (document == null || document.Root == null || document.Root.text == null) {
|
|
|
- return string.Empty;
|
|
|
- }
|
|
|
-
|
|
|
- if (!multiline) {
|
|
|
- return document.Root.text.ToString();
|
|
|
- } else {
|
|
|
+ public override string Text {
|
|
|
+ get {
|
|
|
+ if (document == null || document.Root == null || document.Root.text == null) {
|
|
|
+ return string.Empty;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!multiline) {
|
|
|
+ return document.Root.text.ToString();
|
|
|
+ } else {
|
|
|
StringBuilder sb;
|
|
|
int i;
|
|
|
|
|
|
@@ -395,10 +395,10 @@ namespace System.Windows.Forms {
|
|
|
}
|
|
|
|
|
|
return sb.ToString();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- set {
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ set {
|
|
|
Line line;
|
|
|
|
|
|
if (multiline) {
|
|
|
@@ -429,19 +429,19 @@ namespace System.Windows.Forms {
|
|
|
}
|
|
|
base.Text = value;
|
|
|
OnTextChanged(EventArgs.Empty);
|
|
|
- }
|
|
|
- }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
public virtual int TextLength {
|
|
|
get {
|
|
|
- if (document == null || document.Root == null || document.Root.text == null) {
|
|
|
- return 0;
|
|
|
- }
|
|
|
-
|
|
|
- if (!multiline) {
|
|
|
- return document.Root.text.Length;
|
|
|
- } else {
|
|
|
- int total;
|
|
|
+ if (document == null || document.Root == null || document.Root.text == null) {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!multiline) {
|
|
|
+ return document.Root.text.Length;
|
|
|
+ } else {
|
|
|
+ int total;
|
|
|
int i;
|
|
|
|
|
|
total = 0;
|
|
|
@@ -450,7 +450,7 @@ namespace System.Windows.Forms {
|
|
|
}
|
|
|
|
|
|
return total;
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -588,24 +588,24 @@ namespace System.Windows.Forms {
|
|
|
base.CreateHandle ();
|
|
|
}
|
|
|
|
|
|
- protected override bool IsInputKey(Keys keyData) {
|
|
|
- switch (keyData) {
|
|
|
- case Keys.Enter: {
|
|
|
+ protected override bool IsInputKey(Keys keyData) {
|
|
|
+ switch (keyData) {
|
|
|
+ case Keys.Enter: {
|
|
|
if (multiline && (accepts_return || ((keyData & Keys.Control) != 0))) {
|
|
|
return true;
|
|
|
}
|
|
|
return false;
|
|
|
- }
|
|
|
-
|
|
|
- case Keys.Tab: {
|
|
|
- if (accepts_tab) {
|
|
|
- return true;
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
+ }
|
|
|
+
|
|
|
+ case Keys.Tab: {
|
|
|
+ if (accepts_tab) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
protected virtual void OnAcceptsTabChanged(EventArgs e) {
|
|
|
@@ -678,7 +678,7 @@ namespace System.Windows.Forms {
|
|
|
if (!multiline) {
|
|
|
if (height > PreferredHeight) {
|
|
|
text_bounds = new Rectangle(x, y, width, height);
|
|
|
- height = PreferredHeight;
|
|
|
+ text_bounds.Height = PreferredHeight;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -1075,21 +1075,21 @@ static int current;
|
|
|
document.SetSelectionToCaret(false);
|
|
|
document.DisplayCaret();
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- private void TextBoxBase_FontOrColorChanged(object sender, EventArgs e) {
|
|
|
- if (!richtext) {
|
|
|
- Line line;
|
|
|
-
|
|
|
- // Font changes apply to the whole document
|
|
|
- for (int i = 1; i <= document.Lines; i++) {
|
|
|
- line = document.GetLine(i);
|
|
|
- LineTag.FormatText(line, 1, line.text.Length, Font, ThemeEngine.Current.ResPool.GetSolidBrush(ForeColor));
|
|
|
+ }
|
|
|
+
|
|
|
+ private void TextBoxBase_FontOrColorChanged(object sender, EventArgs e) {
|
|
|
+ if (!richtext) {
|
|
|
+ Line line;
|
|
|
+
|
|
|
+ // Font changes apply to the whole document
|
|
|
+ for (int i = 1; i <= document.Lines; i++) {
|
|
|
+ line = document.GetLine(i);
|
|
|
+ LineTag.FormatText(line, 1, line.text.Length, Font, ThemeEngine.Current.ResPool.GetSolidBrush(ForeColor));
|
|
|
document.UpdateView(line, 0);
|
|
|
- }
|
|
|
- // Make sure the caret height is matching the new font height
|
|
|
- document.AlignCaret();
|
|
|
- }
|
|
|
- }
|
|
|
+ }
|
|
|
+ // Make sure the caret height is matching the new font height
|
|
|
+ document.AlignCaret();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|