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


C# TextArea.SetDesiredColumn方法代码示例

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


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

示例1: Execute

        public override void Execute(TextArea textArea)
        {
            Point position = textArea.Caret.Position;
            List<FoldMarker> foldings = textArea.Document.FoldingManager.GetFoldedFoldingsWithEnd(position.Y);
            FoldMarker justBeforeCaret = null;
            foreach (FoldMarker fm in foldings) {
                if (fm.EndColumn == position.X) {
                    justBeforeCaret = fm;
                    break; // the first folding found is the folding with the smallest Startposition
                }
            }

            if (justBeforeCaret != null) {
                position.Y = justBeforeCaret.StartLine;
                position.X = justBeforeCaret.StartColumn;
            } else {
                if (position.X > 0) {
                    --position.X;
                } else if (position.Y  > 0) {
                    LineSegment lineAbove = textArea.Document.GetLineSegment(position.Y - 1);
                    position = new Point(lineAbove.Length, position.Y - 1);
                }
            }

            textArea.Caret.Position = position;
            textArea.SetDesiredColumn();
        }
开发者ID:jumpinjackie,项目名称:fdotoolbox,代码行数:27,代码来源:CaretActions.cs

示例2: Execute

        /// <summary>
        /// Executes the action on a certain <see cref="TextArea"/>.
        /// </summary>
        /// <param name="textArea">The text area on which to execute the action.</param>
        public override void Execute(TextArea textArea)
        {
            LineSegment curLine;
              TextLocation newPos = textArea.Caret.Position;
              bool jumpedIntoFolding;
              do
              {
            curLine = textArea.Document.GetLineSegment(newPos.Y);
            newPos.X = curLine.Length;

            List<Fold> foldings = textArea.Document.FoldingManager.GetFoldsFromPosition(newPos.Y, newPos.X);
            jumpedIntoFolding = false;
            foreach (Fold fold in foldings)
            {
              if (fold.IsFolded)
              {
            newPos = new TextLocation(fold.EndColumn, fold.EndLine);
            jumpedIntoFolding = true;
            break;
              }
            }
              } while (jumpedIntoFolding);

              if (newPos != textArea.Caret.Position)
              {
            textArea.Caret.Position = newPos;
            textArea.SetDesiredColumn();
              }
        }
开发者ID:cavaliercoder,项目名称:expression-lab,代码行数:33,代码来源:HomeEndActions.cs

示例3: Execute

		public override void Execute(TextArea textArea)
		{
			LineSegment curLine = textArea.Document.GetLineSegment(textArea.Caret.Line);
			TextLocation position = textArea.Caret.Position;
			List<FoldMarker> foldings = textArea.Document.FoldingManager.GetFoldedFoldingsWithStart(position.Y);
			FoldMarker justBehindCaret = null;
			foreach (FoldMarker fm in foldings) {
				if (fm.StartColumn == position.X) {
					justBehindCaret = fm;
					break;
				}
			}
			if (justBehindCaret != null) {
				position.Y = justBehindCaret.EndLine;
				position.X = justBehindCaret.EndColumn;
			} else { // no folding is interesting
				if (position.X < curLine.Length || textArea.TextEditorProperties.AllowCaretBeyondEOL) {
					++position.X;
				} else if (position.Y + 1 < textArea.Document.TotalNumberOfLines) {
					++position.Y;
					position.X = 0;
				}
			}
			textArea.Caret.Position = position;
			textArea.SetDesiredColumn();
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:26,代码来源:CaretActions.cs

示例4: Execute

 public override void Execute(TextArea textArea)
 {
     Point endPos = textArea.Document.OffsetToPosition(textArea.Document.TextLength);
     if (textArea.Caret.Position != endPos) {
         textArea.Caret.Position = endPos;
         textArea.SetDesiredColumn();
     }
 }
开发者ID:slluis,项目名称:monodevelop-prehistoric,代码行数:8,代码来源:HomeEndActions.cs

示例5: Execute

		public override void Execute(TextArea textArea)
		{
			Bookmark mark = textArea.Document.BookmarkManager.GetNextMark(textArea.Caret.Line, predicate);
			if (mark != null) {
				textArea.Caret.Position = mark.Location;
				textArea.SelectionManager.ClearSelection();
				textArea.SetDesiredColumn();
			}
		}
开发者ID:Shaykh,项目名称:Loyc,代码行数:9,代码来源:BookmarkActions.cs

示例6: Execute

 public override void Execute(TextArea textArea)
 {
     LineSegment curLine = textArea.Document.GetLineSegment(textArea.Caret.Line);
     if (textArea.Caret.Column < curLine.Length || textArea.TextEditorProperties.AllowCaretBeyondEOL) {
         ++textArea.Caret.Column;
     } else if (textArea.Caret.Line + 1 < textArea.Document.TotalNumberOfLines) {
         textArea.Caret.Position = new Point(0, textArea.Caret.Line + 1);
     }
     textArea.SetDesiredColumn();
 }
开发者ID:slluis,项目名称:monodevelop-prehistoric,代码行数:10,代码来源:CaretActions.cs

示例7: Execute

        public override void Execute(TextArea textArea)
        {
            LineSegment curLine;
            TextLocation       newPos = textArea.Caret.Position;
            bool        jumpedIntoFolding = false;
            do
            {
                curLine = textArea.Document.GetLineSegment(newPos.Y);

                if (TextUtilities.IsEmptyLine(textArea.Document, newPos.Y))
                {
                    if (newPos.X != 0)
                    {
                        newPos.X = 0;
                    }
                    else
                    {
                        newPos.X = curLine.Length;
                    }
                }
                else
                {
                    int firstCharOffset = TextUtilities.GetFirstNonWSChar(textArea.Document, curLine.Offset);
                    int firstCharColumn = firstCharOffset - curLine.Offset;

                    if (newPos.X == firstCharColumn)
                    {
                        newPos.X = 0;
                    }
                    else
                    {
                        newPos.X = firstCharColumn;
                    }
                }
                List<FoldMarker> foldings = textArea.Document.FoldingManager.GetFoldingsFromPosition(newPos.Y, newPos.X);
                jumpedIntoFolding = false;
                foreach (FoldMarker foldMarker in foldings)
                {
                    if (foldMarker.IsFolded)
                    {
                        newPos = new TextLocation(foldMarker.StartColumn, foldMarker.StartLine);
                        jumpedIntoFolding = true;
                        break;
                    }
                }

            }
            while (jumpedIntoFolding);

            if (newPos != textArea.Caret.Position)
            {
                textArea.Caret.Position = newPos;
                textArea.SetDesiredColumn();
            }
        }
开发者ID:KindDragon,项目名称:ICSharpCode.TextEditor.V4,代码行数:55,代码来源:HomeEndActions.cs

示例8: InsertTabAtCaretPosition

		void InsertTabAtCaretPosition(TextArea textArea)
		{
			switch (textArea.Caret.CaretMode) {
				case CaretMode.InsertMode:
					textArea.InsertString(GetIndentationString(textArea.Document, textArea));
					break;
				case CaretMode.OverwriteMode:
					string indentStr = GetIndentationString(textArea.Document, textArea);
					textArea.ReplaceChar(indentStr[0]);
					if (indentStr.Length > 1) {
						textArea.InsertString(indentStr.Substring(1));
					}
					break;
			}
			textArea.SetDesiredColumn();
		}
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:16,代码来源:MiscActions.cs

示例9: Execute

 public override void Execute(TextArea textArea)
 {
     textArea.AutoClearSelection = false;
     TextLocation startPoint = new TextLocation(0, 0);
     TextLocation endPoint   = textArea.Document.OffsetToPosition(textArea.Document.TextLength);
     if (textArea.SelectionManager.HasSomethingSelected) {
         if (textArea.SelectionManager.SelectionCollection[0].StartPosition == startPoint &&
             textArea.SelectionManager.SelectionCollection[0].EndPosition   == endPoint) {
             return;
         }
     }
     textArea.Caret.Position = textArea.SelectionManager.NextValidPosition(endPoint.Y);
     textArea.SelectionManager.ExtendSelection(startPoint, endPoint);
     // after a SelectWholeDocument selection, the caret is placed correctly,
     // but it is not positioned internally.  The effect is when the cursor
     // is moved up or down a line, the caret will take on the column that
     // it was in before the SelectWholeDocument
     textArea.SetDesiredColumn();
 }
开发者ID:umabiel,项目名称:WsdlUI,代码行数:19,代码来源:SelectionActions.cs

示例10: Execute

    /// <summary>
    /// Executes the action on a certain <see cref="TextArea"/>.
    /// </summary>
    /// <param name="textArea">The text area on which to execute the action.</param>
    public override void Execute(TextArea textArea)
    {
      LineSegment curLine;
      TextLocation newPos = textArea.Caret.Position;
      bool jumpedIntoFolding;
      do
      {
        curLine = textArea.Document.GetLineSegment(newPos.Y);

        if (TextHelper.IsEmptyLine(textArea.Document, newPos.Y))
        {
          newPos.X = newPos.X != 0 ? 0 : curLine.Length;
        }
        else
        {
          int firstCharOffset = TextHelper.FindFirstNonWhitespace(textArea.Document, curLine.Offset);
          int firstCharColumn = firstCharOffset - curLine.Offset;
          newPos.X = newPos.X == firstCharColumn ? 0 : firstCharColumn;
        }
        List<Fold> foldings = textArea.Document.FoldingManager.GetFoldsFromPosition(newPos.Y, newPos.X);
        jumpedIntoFolding = false;
        foreach (Fold fold in foldings)
        {
          if (fold.IsFolded)
          {
            newPos = new TextLocation(fold.StartColumn, fold.StartLine);
            jumpedIntoFolding = true;
            break;
          }
        }

      } while (jumpedIntoFolding);

      if (newPos != textArea.Caret.Position)
      {
        textArea.Caret.Position = newPos;
        textArea.SetDesiredColumn();
      }
    }
开发者ID:sanyaade-fintechnology,项目名称:SquareOne,代码行数:43,代码来源:HomeEndActions.cs

示例11: Execute

		public override void Execute(TextArea textArea)
		{
			Point position = textArea.Caret.Position;
			ArrayList foldings = textArea.Document.FoldingManager.GetFoldedFoldingsWithEnd(position.Y);
			FoldMarker justBeforeCaret = null;
			foreach (FoldMarker fm in foldings) {
				if (fm.EndColumn == position.X) {
					justBeforeCaret = fm;
					break; // the first folding found is the folding with the smallest Startposition
				}
			}
			
			if (justBeforeCaret != null) {
				position.Y = justBeforeCaret.StartLine;
				position.X = justBeforeCaret.StartColumn;
//				Console.WriteLine("position set to " + position);
			} else {
				if (position.X > 0) {
					--position.X;
				} else if (position.Y  > 0) {
					LineSegment lineAbove = textArea.Document.GetLineSegment(position.Y - 1);
					position = new Point(lineAbove.Length, position.Y - 1);
				}
			}
//			Console.WriteLine(position);
//			ArrayList foldings = textArea.Document.FoldingManager.GetFoldingsFromPosition(position.Y, position.X);
//			foreach (FoldMarker foldMarker in foldings) {
//				if (foldMarker.IsFolded) {
//					if (foldMarker.StartLine < position.Y || foldMarker.StartLine == position.Y && foldMarker.StartColumn < position.X) {
//						position = new Point(foldMarker.StartColumn, foldMarker.StartLine);
//					}
//				}
//			}
			textArea.Caret.Position = position;
			textArea.SetDesiredColumn();
		}
开发者ID:BackupTheBerlios,项目名称:ch3etah-svn,代码行数:36,代码来源:CaretActions.cs

示例12: Execute

        /// <remarks>
        /// Executes this edit action
        /// </remarks>
        /// <param name="textArea">The <see cref="ItextArea"/> which is used for callback purposes</param>
        public override void Execute(TextArea textArea)
        {
            // if anything is selected we will just delete it first
            if (textArea.SelectionManager.HasSomethingSelected)
            {
                Delete.DeleteSelection(textArea);
                return;
            }

            textArea.BeginUpdate();
            // now delete from the caret to the beginning of the word
            LineSegment line = textArea.Document.GetLineSegmentForOffset(textArea.Caret.Offset);
            // if we are not at the beginning of a line
            if (textArea.Caret.Offset > line.Offset)
            {
                int prevWordStart = TextUtilities.FindPrevWordStart(textArea.Document, textArea.Caret.Offset);
                if (prevWordStart < textArea.Caret.Offset)
                {
                    if (!textArea.IsReadOnly(prevWordStart, textArea.Caret.Offset - prevWordStart))
                    {
                        textArea.Document.Remove(prevWordStart, textArea.Caret.Offset - prevWordStart);
                        textArea.Caret.Position = textArea.Document.OffsetToPosition(prevWordStart);
                    }
                }
            }

            // if we are now at the beginning of a line
            if (textArea.Caret.Offset == line.Offset)
            {
                // if we are not on the first line
                int curLineNr = textArea.Document.GetLineNumberForOffset(textArea.Caret.Offset);
                if (curLineNr > 0)
                {
                    // move to the end of the line above
                    LineSegment lineAbove = textArea.Document.GetLineSegment(curLineNr - 1);
                    int endOfLineAbove = lineAbove.Offset + lineAbove.Length;
                    int charsToDelete = textArea.Caret.Offset - endOfLineAbove;
                    if (!textArea.IsReadOnly(endOfLineAbove, charsToDelete))
                    {
                        textArea.Document.Remove(endOfLineAbove, charsToDelete);
                        textArea.Caret.Position = textArea.Document.OffsetToPosition(endOfLineAbove);
                    }
                }
            }
            textArea.SetDesiredColumn();
            textArea.EndUpdate();
            // if there are now less lines, we need this or there are redraw problems
            textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.PositionToEnd, new TextLocation(0, textArea.Document.GetLineNumberForOffset(textArea.Caret.Offset))));
            textArea.Document.CommitUpdate();
        }
开发者ID:KindDragon,项目名称:ICSharpCode.TextEditor.V4,代码行数:54,代码来源:MiscActions.cs

示例13: Execute

        /// <remarks>
        /// Executes this edit action
        /// </remarks>
        /// <param name="textArea">The <see cref="ItextArea"/> which is used for callback purposes</param>
        public override void Execute(TextArea textArea)
        {
            IDocument d = textArea.Document;

            if (d.ReadOnly)
                return;

            textArea.BeginUpdate();
            textArea.InsertChar('\n');

            ++textArea.Caret.Line;
            int curLineNr = textArea.Caret.Line;
            textArea.Caret.Column = d.FormattingStrategy.FormatLine (d, curLineNr, textArea.Caret.Offset, '\n');
            textArea.SetDesiredColumn();

            textArea.Document.UpdateQueue.Clear();
            textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.PositionToEnd, new Point(0, curLineNr - 1)));
            textArea.EndUpdate();
        }
开发者ID:slluis,项目名称:monodevelop-prehistoric,代码行数:23,代码来源:MiscActions.cs

示例14: Execute

 public override void Execute(TextArea textArea)
 {
     textArea.AutoClearSelection = false;
     TextLocation endPoint = textArea.Document.OffsetToPosition(textArea.Document.TextLength);
     textArea.SelectionManager.SetSelection(new TextLocation(0, 0), endPoint, false);
     textArea.Caret.Position = textArea.SelectionManager.NextValidPosition(endPoint.Y);
     // after a SelectWholeDocument selection, the caret is placed correctly,
     // but it is not positioned internally.  The effect is when the cursor
     // is moved up or down a line, the caret will take on the column that
     // it was in before the SelectWholeDocument
     textArea.SetDesiredColumn();
 }
开发者ID:KindDragon,项目名称:ICSharpCode.TextEditor.V4,代码行数:12,代码来源:SelectionActions.cs

示例15: Execute

		/// <remarks>
		/// Executes this edit action
		/// </remarks>
		/// <param name="textArea">The <see cref="ItextArea"/> which is used for callback purposes</param>
		public override void Execute(TextArea textArea)
		{
			if (textArea.Document.ReadOnly) {
				return;
			}
			textArea.BeginUpdate();
			
			textArea.InsertString(Environment.NewLine); 
			
			int curLineNr = textArea.Caret.Line;
			textArea.Caret.Column = textArea.Document.FormattingStrategy.FormatLine(textArea, curLineNr, textArea.Caret.Offset, '\n');
			textArea.SetDesiredColumn();
			
			textArea.Document.UpdateQueue.Clear();
			textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.PositionToEnd, new Point(0, curLineNr - 1)));
			textArea.EndUpdate();
		}
开发者ID:tangxuehua,项目名称:DataStructure,代码行数:21,代码来源:MiscActions.cs


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