当前位置: 首页>>代码示例>>C#>>正文


C# TextEditor.GetCharAt方法代码示例

本文整理汇总了C#中MonoDevelop.Ide.Gui.TextEditor.GetCharAt方法的典型用法代码示例。如果您正苦于以下问题:C# TextEditor.GetCharAt方法的具体用法?C# TextEditor.GetCharAt怎么用?C# TextEditor.GetCharAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MonoDevelop.Ide.Gui.TextEditor的用法示例。


在下文中一共展示了TextEditor.GetCharAt方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetWhitespaces

		public static string GetWhitespaces (TextEditor editor, int insertionOffset)
		{
			StringBuilder result = new StringBuilder ();
			for (int i = insertionOffset; i < editor.Length; i++) {
				char ch = editor.GetCharAt (i);
				if (ch == ' ' || ch == '\t') {
					result.Append (ch);
				} else {
					break;
				}
			}
			return result.ToString ();
		}
开发者ID:sushihangover,项目名称:monodevelop,代码行数:13,代码来源:RefactoringOptions.cs

示例2: FindPrevWordStart

		static int FindPrevWordStart (TextEditor editor, int offset)
		{
			while (--offset >= 0) {
				var c = editor.GetCharAt (offset);
				//Only legal characters in template Shortcut
				//LetterOrDigit make sense
				//_ to allow underscore naming convention
				//# is because there are #if templates
				//~ because disctructor template
				//@ some Razor templates start with @
				//in theory we should probably just support LetterOrDigit and _
				if (!char.IsLetterOrDigit (c) && c != '_' && c != '#' && c != '~' && c != '@') {
					break;
				}
			}
			return ++offset;
		}
开发者ID:ZZHGit,项目名称:monodevelop,代码行数:17,代码来源:CodeTemplate.cs

示例3: IsMatchAt

		static bool IsMatchAt (TextEditor editor, int offset, string abbrevWord)
		{
			if (offset + abbrevWord.Length >= editor.Length)
				return false;
			if (offset > 0 && IsIdentifierPart (editor.GetCharAt (offset - 1)))
				return false;
			if (offset + abbrevWord.Length < editor.Length && !IsIdentifierPart (editor.GetCharAt (offset + abbrevWord.Length)))
				return false;
			return editor.GetTextAt (offset, abbrevWord.Length) == abbrevWord;
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:10,代码来源:DynamicAbbrevHandler.cs

示例4: SearchEndPos

		static int SearchEndPos (int offset, TextEditor editor)
		{
			while (offset < editor.Length && IsIdentifierPart (editor.GetCharAt (offset))) {
				offset++;
			}
			return offset;
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:7,代码来源:DynamicAbbrevHandler.cs

示例5: GetWordBeforeCaret

		static string GetWordBeforeCaret (TextEditor editor)
		{
			int startOffset = editor.CaretOffset;
			int offset = startOffset - 1;
			while (offset > 0) {
				char ch = editor.GetCharAt (offset);
				if (!IsIdentifierPart (ch)) {
					offset++;
					break;
				}
				offset--;
			}
			if (offset >= startOffset)
				return "";
			return editor.GetTextBetween (offset, startOffset);
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:16,代码来源:DynamicAbbrevHandler.cs

示例6: SearchMatchingBracket

		static int SearchMatchingBracket (TextEditor editor, int offset, char openBracket, char closingBracket, int direction)
		{
			bool isInString       = false;
			bool isInChar         = false;	
			bool isInBlockComment = false;
			int depth = -1;
			while (offset >= 0 && offset < editor.TextLength) {
				char ch = editor.GetCharAt (offset);
				switch (ch) {
					case '/':
						if (isInBlockComment) 
							isInBlockComment = editor.GetCharAt (offset + direction) != '*';
						if (!isInString && !isInChar && offset - direction < editor.TextLength) 
							isInBlockComment = offset > 0 && editor.GetCharAt (offset - direction) == '*';
						break;
					case '"':
						if (!isInChar && !isInBlockComment) 
							isInString = !isInString;
						break;
					case '\'':
						if (!isInString && !isInBlockComment) 
							isInChar = !isInChar;
						break;
					default :
						if (ch == closingBracket) {
							if (!(isInString || isInChar || isInBlockComment)) 
								--depth;
						} else if (ch == openBracket) {
							if (!(isInString || isInChar || isInBlockComment)) {
								++depth;
								if (depth == 0) 
									return offset;
							}
						}
						break;
				}
				offset += direction;
			}
			return -1;
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:40,代码来源:CTextEditorExtension.cs


注:本文中的MonoDevelop.Ide.Gui.TextEditor.GetCharAt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。