155 references to RichTextBoxFinds
System.Windows.Forms (18)
System\Windows\Forms\Controls\RichTextBox\RichTextBox.cs (17)
1766return Find(str, 0, 0, RichTextBoxFinds.None); 1772public int Find(string str, RichTextBoxFinds options) 1780public int Find(string str, int start, RichTextBoxFinds options) 1788public unsafe int Find(string str, int start, int end, RichTextBoxFinds options) 1797bool selectWord = (options & RichTextBoxFinds.NoHighlight) != RichTextBoxFinds.NoHighlight; 1844unsafe int FindInternal(ReadOnlySpan<char> str, int start, int end, RichTextBoxFinds options) 1866if ((options & RichTextBoxFinds.Reverse) != RichTextBoxFinds.Reverse) 1882if ((options & RichTextBoxFinds.Reverse) != RichTextBoxFinds.Reverse) 1896if ((options & RichTextBoxFinds.WholeWord) == RichTextBoxFinds.WholeWord) 1901if ((options & RichTextBoxFinds.MatchCase) == RichTextBoxFinds.MatchCase) 1906if ((options & RichTextBoxFinds.Reverse) != RichTextBoxFinds.Reverse)
System\Windows\Forms\Controls\RichTextBox\RichTextBoxFinds.cs (1)
7/// Specifies how the <see cref="RichTextBox.Find(string, RichTextBoxFinds)"/> method works.
System.Windows.Forms.Tests (137)
System\Windows\Forms\RichTextBoxTests.cs (137)
7967yield return new object[] { string.Empty, string.Empty, RichTextBoxFinds.None, -1 }; 7968yield return new object[] { string.Empty, "abc", RichTextBoxFinds.None, -1 }; 7969yield return new object[] { string.Empty, string.Empty, RichTextBoxFinds.Reverse, -1 }; 7970yield return new object[] { string.Empty, "abc", RichTextBoxFinds.Reverse, -1 }; 7972yield return new object[] { "abc", string.Empty, RichTextBoxFinds.None, -1 }; 7973yield return new object[] { "abc", "a", RichTextBoxFinds.None, 0 }; 7974yield return new object[] { "abc", "a", RichTextBoxFinds.Reverse, 0 }; 7975yield return new object[] { "abc", "ab", RichTextBoxFinds.None, 0 }; 7976yield return new object[] { "abc", "abc", RichTextBoxFinds.None, 0 }; 7977yield return new object[] { "abc", "abcd", RichTextBoxFinds.None, -1 }; 7978yield return new object[] { "abc", "b", RichTextBoxFinds.None, 1 }; 7979yield return new object[] { "abc", "d", RichTextBoxFinds.None, -1 }; 7981yield return new object[] { "abc", "ABC", RichTextBoxFinds.None, 0 }; 7982yield return new object[] { "abc", "abc", RichTextBoxFinds.MatchCase, 0 }; 7983yield return new object[] { "abc", "ABC", RichTextBoxFinds.MatchCase, -1 }; 7985yield return new object[] { "aa", "a", RichTextBoxFinds.None, 0 }; 7986yield return new object[] { "aa", "a", RichTextBoxFinds.Reverse, 1 }; 7987yield return new object[] { "aa", string.Empty, RichTextBoxFinds.Reverse, -1 }; 7988yield return new object[] { "abc def", "ef", RichTextBoxFinds.None, 5 }; 7989yield return new object[] { "abc def", "def", RichTextBoxFinds.None, 4 }; 7990yield return new object[] { "abc def", " ", RichTextBoxFinds.None, 3 }; 7991yield return new object[] { "abc def", "ef", RichTextBoxFinds.WholeWord, -1 }; 7992yield return new object[] { "abc def", "def", RichTextBoxFinds.WholeWord, 4 }; 7993yield return new object[] { "abc def", " ", RichTextBoxFinds.WholeWord, -1 }; 7995yield return new object[] { "ab\u0640cd", "abcd", RichTextBoxFinds.None, 0 }; 7996yield return new object[] { "ab\u0640cd", "\u0640", RichTextBoxFinds.None, 2 }; 7997yield return new object[] { "ab\u0640cd", "bc", RichTextBoxFinds.None, 1 }; 7998yield return new object[] { "ab\u0640cd", "abcd", RichTextBoxFinds.NoHighlight, 0 }; 7999yield return new object[] { "ab\u0640cd", "\u0640", RichTextBoxFinds.NoHighlight, 2 }; 8000yield return new object[] { "ab\u0640cd", "bc", RichTextBoxFinds.NoHighlight, 1 }; 8001yield return new object[] { "abcd", "abcd", RichTextBoxFinds.NoHighlight, 0 }; 8006public void RichTextBox_Find_StringRichTextBoxFinds_ReturnsExpected(string text, string str, RichTextBoxFinds options, int expected) 8018yield return new object[] { string.Empty, string.Empty, 0, RichTextBoxFinds.None, -1 }; 8019yield return new object[] { string.Empty, "abc", 0, RichTextBoxFinds.None, -1 }; 8020yield return new object[] { string.Empty, string.Empty, 0, RichTextBoxFinds.Reverse, -1 }; 8021yield return new object[] { string.Empty, "abc", 0, RichTextBoxFinds.Reverse, -1 }; 8023yield return new object[] { "abc", string.Empty, 0, RichTextBoxFinds.None, -1 }; 8024yield return new object[] { "abc", "a", 0, RichTextBoxFinds.None, 0 }; 8025yield return new object[] { "abc", "a", 0, RichTextBoxFinds.Reverse, 0 }; 8026yield return new object[] { "abc", "ab", 0, RichTextBoxFinds.None, 0 }; 8027yield return new object[] { "abc", "abc", 0, RichTextBoxFinds.None, 0 }; 8028yield return new object[] { "abc", "abcd", 0, RichTextBoxFinds.None, -1 }; 8029yield return new object[] { "abc", "b", 0, RichTextBoxFinds.None, 1 }; 8030yield return new object[] { "abc", "d", 0, RichTextBoxFinds.None, -1 }; 8032yield return new object[] { "abc", "ABC", 0, RichTextBoxFinds.None, 0 }; 8033yield return new object[] { "abc", "abc", 0, RichTextBoxFinds.MatchCase, 0 }; 8034yield return new object[] { "abc", "ABC", 0, RichTextBoxFinds.MatchCase, -1 }; 8036yield return new object[] { "aa", "a", 0, RichTextBoxFinds.None, 0 }; 8037yield return new object[] { "aa", "a", 0, RichTextBoxFinds.Reverse, 1 }; 8038yield return new object[] { "aa", string.Empty, 0, RichTextBoxFinds.Reverse, -1 }; 8039yield return new object[] { "abc def", "ef", 0, RichTextBoxFinds.None, 5 }; 8040yield return new object[] { "abc def", "def", 0, RichTextBoxFinds.None, 4 }; 8041yield return new object[] { "abc def", " ", 0, RichTextBoxFinds.None, 3 }; 8042yield return new object[] { "abc def", "ef", 0, RichTextBoxFinds.WholeWord, -1 }; 8043yield return new object[] { "abc def", "def", 0, RichTextBoxFinds.WholeWord, 4 }; 8044yield return new object[] { "abc def", " ", 0, RichTextBoxFinds.WholeWord, -1 }; 8046yield return new object[] { "abc", "a", 1, RichTextBoxFinds.None, -1 }; 8047yield return new object[] { "abc", "a", 2, RichTextBoxFinds.None, -1 }; 8048yield return new object[] { "abc", "c", 2, RichTextBoxFinds.None, 2 }; 8049yield return new object[] { "abc", "a", 1, RichTextBoxFinds.Reverse, -1 }; 8050yield return new object[] { "abc", "a", 2, RichTextBoxFinds.Reverse, -1 }; 8051yield return new object[] { "abc", "c", 2, RichTextBoxFinds.Reverse, 2 }; 8053yield return new object[] { "ab\u0640cd", "abcd", 0, RichTextBoxFinds.None, 0 }; 8054yield return new object[] { "ab\u0640cd", "\u0640", 0, RichTextBoxFinds.None, 2 }; 8055yield return new object[] { "ab\u0640cd", "bc", 0, RichTextBoxFinds.None, 1 }; 8056yield return new object[] { "ab\u0640cd", "abcd", 0, RichTextBoxFinds.NoHighlight, 0 }; 8057yield return new object[] { "ab\u0640cd", "\u0640", 0, RichTextBoxFinds.NoHighlight, 2 }; 8058yield return new object[] { "ab\u0640cd", "bc", 0, RichTextBoxFinds.NoHighlight, 1 }; 8059yield return new object[] { "abcd", "abcd", 0, RichTextBoxFinds.NoHighlight, 0 }; 8064public void RichTextBox_Find_StringIntRichTextBoxFinds_ReturnsExpected(string text, string str, int start, RichTextBoxFinds options, int expected) 8078yield return new object[] { string.Empty, string.Empty, 0, end, RichTextBoxFinds.None, -1 }; 8079yield return new object[] { string.Empty, "abc", 0, end, RichTextBoxFinds.None, -1 }; 8080yield return new object[] { string.Empty, string.Empty, 0, end, RichTextBoxFinds.Reverse, -1 }; 8081yield return new object[] { string.Empty, "abc", 0, end, RichTextBoxFinds.Reverse, -1 }; 8083yield return new object[] { "abc", string.Empty, 0, end, RichTextBoxFinds.None, -1 }; 8084yield return new object[] { "abc", "a", 0, end, RichTextBoxFinds.None, 0 }; 8085yield return new object[] { "abc", "a", 0, end, RichTextBoxFinds.Reverse, 0 }; 8086yield return new object[] { "abc", "ab", 0, end, RichTextBoxFinds.None, 0 }; 8087yield return new object[] { "abc", "abc", 0, end, RichTextBoxFinds.None, 0 }; 8088yield return new object[] { "abc", "abcd", 0, end, RichTextBoxFinds.None, -1 }; 8089yield return new object[] { "abc", "b", 0, end, RichTextBoxFinds.None, 1 }; 8090yield return new object[] { "abc", "d", 0, end, RichTextBoxFinds.None, -1 }; 8092yield return new object[] { "abc", "ABC", 0, end, RichTextBoxFinds.None, 0 }; 8093yield return new object[] { "abc", "abc", 0, end, RichTextBoxFinds.MatchCase, 0 }; 8094yield return new object[] { "abc", "ABC", 0, end, RichTextBoxFinds.MatchCase, -1 }; 8096yield return new object[] { "aa", "a", 0, end, RichTextBoxFinds.None, 0 }; 8097yield return new object[] { "aa", "a", 0, end, RichTextBoxFinds.Reverse, 1 }; 8098yield return new object[] { "abc", string.Empty, 0, end, RichTextBoxFinds.Reverse, -1 }; 8099yield return new object[] { "abc def", "ef", 0, end, RichTextBoxFinds.None, 5 }; 8100yield return new object[] { "abc def", "def", 0, end, RichTextBoxFinds.None, 4 }; 8101yield return new object[] { "abc def", " ", 0, end, RichTextBoxFinds.None, 3 }; 8102yield return new object[] { "abc def", "ef", 0, end, RichTextBoxFinds.WholeWord, -1 }; 8103yield return new object[] { "abc def", "def", 0, end, RichTextBoxFinds.WholeWord, 4 }; 8104yield return new object[] { "abc def", " ", 0, end, RichTextBoxFinds.WholeWord, -1 }; 8106yield return new object[] { "ab\u0640cd", "abcd", 0, end, RichTextBoxFinds.None, 0 }; 8107yield return new object[] { "ab\u0640cd", "\u0640", 0, end, RichTextBoxFinds.None, 2 }; 8108yield return new object[] { "ab\u0640cd", "bc", 0, end, RichTextBoxFinds.None, 1 }; 8109yield return new object[] { "ab\u0640cd", "abcd", 0, end, RichTextBoxFinds.NoHighlight, 0 }; 8110yield return new object[] { "ab\u0640cd", "\u0640", 0, end, RichTextBoxFinds.NoHighlight, 2 }; 8111yield return new object[] { "ab\u0640cd", "bc", 0, end, RichTextBoxFinds.NoHighlight, 1 }; 8112yield return new object[] { "abcd", "abcd", 0, end, RichTextBoxFinds.NoHighlight, 0 }; 8115yield return new object[] { "abc", "a", 1, 3, RichTextBoxFinds.None, -1 }; 8116yield return new object[] { "abc", "a", 2, 3, RichTextBoxFinds.None, -1 }; 8117yield return new object[] { "abc", "c", 2, 3, RichTextBoxFinds.None, 2 }; 8118yield return new object[] { "abc", "a", 1, 3, RichTextBoxFinds.Reverse, -1 }; 8119yield return new object[] { "abc", "a", 2, 3, RichTextBoxFinds.Reverse, -1 }; 8120yield return new object[] { "abc", "c", 2, 3, RichTextBoxFinds.Reverse, 2 }; 8122yield return new object[] { "abc", "c", 0, 5, RichTextBoxFinds.None, 2 }; 8123yield return new object[] { "abc", "c", 0, 2, RichTextBoxFinds.None, -1 }; 8128public void RichTextBox_Find_StringIntIntRichTextBoxFinds_ReturnsExpected(string text, string str, int start, int end, RichTextBoxFinds options, int expected) 8163public void RichTextBox_Find_StringRichTextBoxFindsWithHandle_ReturnsExpected(string text, string str, RichTextBoxFinds options, int expected) 8186public void RichTextBox_Find_StringIntRichTextBoxFindsWithHandle_ReturnsExpected(string text, string str, int start, RichTextBoxFinds options, int expected) 8209public void RichTextBox_Find_StringIntIntRichTextBoxFindsWithHandle_ReturnsExpected(string text, string str, int start, int end, RichTextBoxFinds options, int expected) 8432Assert.Throws<ArgumentNullException>("str", () => control.Find(null, RichTextBoxFinds.None)); 8433Assert.Throws<ArgumentNullException>("str", () => control.Find(null, 0, RichTextBoxFinds.None)); 8434Assert.Throws<ArgumentNullException>("str", () => control.Find(null, -1, RichTextBoxFinds.None)); 8435Assert.Throws<ArgumentNullException>("str", () => control.Find(null, 1, RichTextBoxFinds.None)); 8436Assert.Throws<ArgumentNullException>("str", () => control.Find(null, 0, 0, RichTextBoxFinds.None)); 8437Assert.Throws<ArgumentNullException>("str", () => control.Find(null, -1, 0, RichTextBoxFinds.None)); 8438Assert.Throws<ArgumentNullException>("str", () => control.Find(null, 1, 0, RichTextBoxFinds.None)); 8439Assert.Throws<ArgumentNullException>("str", () => control.Find(null, 0, -2, RichTextBoxFinds.None)); 8450Assert.Throws<ArgumentNullException>("str", () => control.Find(null, RichTextBoxFinds.None)); 8451Assert.Throws<ArgumentNullException>("str", () => control.Find(null, 0, RichTextBoxFinds.None)); 8452Assert.Throws<ArgumentNullException>("str", () => control.Find(null, -1, RichTextBoxFinds.None)); 8453Assert.Throws<ArgumentNullException>("str", () => control.Find(null, 2, RichTextBoxFinds.None)); 8454Assert.Throws<ArgumentNullException>("str", () => control.Find(null, 0, 0, RichTextBoxFinds.None)); 8455Assert.Throws<ArgumentNullException>("str", () => control.Find(null, -1, 0, RichTextBoxFinds.None)); 8456Assert.Throws<ArgumentNullException>("str", () => control.Find(null, 2, 0, RichTextBoxFinds.None)); 8457Assert.Throws<ArgumentNullException>("str", () => control.Find(null, 0, -2, RichTextBoxFinds.None)); 8497Assert.Throws<ArgumentOutOfRangeException>("start", () => control.Find("s", start, RichTextBoxFinds.NoHighlight)); 8498Assert.Throws<ArgumentOutOfRangeException>("start", () => control.Find("s", start, 0, RichTextBoxFinds.NoHighlight)); 8512Assert.Throws<ArgumentOutOfRangeException>("start", () => control.Find("s", start, RichTextBoxFinds.NoHighlight)); 8513Assert.Throws<ArgumentOutOfRangeException>("start", () => control.Find("s", start, 0, RichTextBoxFinds.NoHighlight)); 8522Assert.Throws<ArgumentOutOfRangeException>("end", () => control.Find("s", 0, -2, RichTextBoxFinds.NoHighlight)); 8533Assert.Throws<ArgumentOutOfRangeException>("end", () => control.Find("s", 0, -2, RichTextBoxFinds.NoHighlight)); 8544Assert.Throws<ArgumentException>(() => control.Find("s", 1, 0, RichTextBoxFinds.None)); 8545Assert.Throws<ArgumentException>(() => control.Find("s", 1, 0, RichTextBoxFinds.Reverse));