From f4c69b01b4d9dfe6a3740e33827cfc75ab7511e4 Mon Sep 17 00:00:00 2001 From: test Date: Mon, 14 Dec 2020 20:46:14 +0900 Subject: [PATCH] =?utf8?q?=E6=A1=81=E6=8A=98=E3=83=A2=E3=83=BC=E3=83=89?= =?utf8?q?=E6=9C=89=E5=8A=B9=E6=99=82=E3=81=AB=E8=A1=8C=E5=8D=98=E4=BD=8D?= =?utf8?q?=E3=81=A7=E7=A7=BB=E5=8B=95=E3=81=99=E3=82=8B=E3=82=88=E3=81=86?= =?utf8?q?=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Core/Controller.cs | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/Core/Controller.cs b/Core/Controller.cs index 3907808..f2a8f4c 100644 --- a/Core/Controller.cs +++ b/Core/Controller.cs @@ -854,19 +854,31 @@ namespace FooEditEngine /// 移動後のキャレット位置 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); + } } -- 2.11.0