Skip to content

Add ForceUpperCase property #180

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions FastColoredTextBox/FastColoredTextBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,13 @@ public char[] AutoCompleteBracketsList
[Description("AutoComplete brackets.")]
public bool AutoCompleteBrackets { get; set; }

/// <summary>
/// Force inserted string or char to be uppercase
/// </summary>
[DefaultValue(false)]
[Description("Force upper case.")]
public bool ForceUpperCase { get; set; }

/// <summary>
/// Colors of some service visual markers
/// </summary>
Expand Down Expand Up @@ -2729,7 +2736,7 @@ public virtual void InsertText(string text, bool jumpToCaret)
if (Selection.IsEmpty && Selection.Start.iChar > GetLineLength(Selection.Start.iLine) && VirtualSpace)
InsertVirtualSpaces();

lines.Manager.ExecuteCommand(new InsertTextCommand(TextSource, text));
lines.Manager.ExecuteCommand(new InsertTextCommand(TextSource, ForceUpperCase ? text.ToUpper() : text));
if (updating <= 0 && jumpToCaret)
DoCaretVisible();
}
Expand Down Expand Up @@ -2988,7 +2995,7 @@ protected virtual void InsertChar(char c)
InsertVirtualSpaces();

//insert char
lines.Manager.ExecuteCommand(new InsertCharCommand(TextSource, c));
lines.Manager.ExecuteCommand(new InsertCharCommand(TextSource, ForceUpperCase ? char.ToUpper(c) : c));
}
finally
{
Expand Down