/// <returns>移動後のキャレット位置</returns>
public TextPoint GetTextPointAfterMoveLine(int count, TextPoint current)
{
- int row = current.row + count;
+ if(this.Document.LineBreak == LineBreakMethod.None)
+ {
+ int row = current.row + count;
- if (row < 0)
- row = 0;
- else if (row >= this.View.LayoutLines.Count)
- row = this.View.LayoutLines.Count - 1;
+ if (row < 0)
+ row = 0;
+ else if (row >= this.View.LayoutLines.Count)
+ row = this.View.LayoutLines.Count - 1;
- row = this.View.AdjustRow(row, count > 0);
+ row = this.View.AdjustRow(row, count > 0);
- Point pos = this.View.LayoutLines.GetLayout(current.row).GetPostionFromIndex(current.col);
- int col = this.View.LayoutLines.GetLayout(row).GetIndexFromPostion(pos.X, pos.Y);
+ Point pos = this.View.LayoutLines.GetLayout(current.row).GetPostionFromIndex(current.col);
+ int col = this.View.LayoutLines.GetLayout(row).GetIndexFromPostion(pos.X, pos.Y);
+ return new TextPoint(row, col);
+ }
+ else
+ {
+ Point pos = this.View.GetPostionFromTextPoint(current);
+ pos.Y += this.View.render.emSize.Height * count;
+ //この値を足さないとうまく動作しない
+ pos.Y += this.View.render.emSize.Height / 2;
+ var new_tp = this.View.GetTextPointFromPostion(pos,TextPointSearchRange.Full);
+ return new_tp;
- return new TextPoint(row, col);
+ }
}