{
EditView View;
Document _Document;
+ bool keepAnchor = false;
public Controller(Document doc, EditView view)
{
private void _Document_CaretChanged(object sender, EventArgs e)
{
+ if (keepAnchor)
+ return;
TextPoint pos = this.Document.CaretPostion;
this.JumpCaret(pos.row, pos.col);
}
/// <param name="alignWord">単語単位で移動するなら真。そうでないなら偽</param>
public void MoveCaretHorizontical(int realLength, bool isSelected,bool alignWord = false)
{
+ keepAnchor = true;
for (int i = Math.Abs(realLength); i > 0; i--)
{
bool MoveFlow = realLength > 0;
}
this.View.AdjustCaretAndSrc(AdjustFlow.Col);
this.SelectWithMoveCaret(isSelected);
+ keepAnchor = false;
}
void AlignNearestWord(bool MoveFlow)
/// <param name="isSelected"></param>
public void MoveCaretVertical(int deltarow,bool isSelected)
{
+ keepAnchor = true;
for (int i = Math.Abs(deltarow); i > 0; i--)
this.MoveCaretVertical(deltarow > 0);
this.View.AdjustCaretAndSrc(AdjustFlow.Both);
this.SelectWithMoveCaret(isSelected);
+ keepAnchor = false;
}
/// <summary>
/// <param name="tp"></param>
public void MoveCaretAndSelect(TextPoint tp)
{
+ keepAnchor = true;
int CaretPostion = this.View.GetIndexFromLayoutLine(tp);
- //キャレットを移動するとアンカーインデックスが再設定されてしまうので覚えておく
- int oldAnchorIndex = this.Document.AnchorIndex;
this.Document.Select(this.Document.AnchorIndex, CaretPostion - this.Document.AnchorIndex);
this.View.JumpCaret(tp.row, tp.col);
this.View.AdjustCaretAndSrc();
- this.Document.AnchorIndex = oldAnchorIndex;
+ keepAnchor = false;
}
/// <summary>
throw new InvalidOperationException("");
TextPoint nextPoint = this.GetTextPointAfterMoveLine(isMoveNext ? 1 : -1, this.Document.CaretPostion);
-
+
this.View.JumpCaret(nextPoint.row, nextPoint.col,false);
}