From a9667168c1d131d02ad19d1f443d5efa4fdf98cc Mon Sep 17 00:00:00 2001 From: gdkhd812 Date: Thu, 12 Oct 2017 18:51:52 +0900 Subject: [PATCH] =?utf8?q?=E9=81=B8=E6=8A=9E=E6=99=82=E3=81=AE=E3=83=AC?= =?utf8?q?=E3=82=A4=E3=82=A2=E3=82=A6=E3=83=88=E3=82=AD=E3=83=A3=E3=83=83?= =?utf8?q?=E3=82=B7=E3=83=A5=E3=81=AE=E5=89=8A=E9=99=A4=E3=81=AF=E3=81=95?= =?utf8?q?=E3=82=89=E3=81=AB=E6=9C=80=E9=81=A9=E5=8C=96=E3=81=A7=E3=81=8D?= =?utf8?q?=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Core/Document.cs | 9 ++++----- Core/LineToIndex.cs | 11 +++++++++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Core/Document.cs b/Core/Document.cs index 449e7ee..0a42405 100644 --- a/Core/Document.cs +++ b/Core/Document.cs @@ -792,27 +792,26 @@ namespace FooEditEngine if (start < 0 || start + length < 0 || start + length > this.Length) throw new ArgumentOutOfRangeException("startかendが指定できる範囲を超えてます"); //選択範囲が消されたとき - if(this.Selections.Count > 0 && length == 0) - this.LayoutLines.ClearLayoutCache(); + foreach (Selection sel in this.Selections) + this.LayoutLines.ClearLayoutCache(sel.start, sel.length); this.Selections.Clear(); if (length < 0) { int oldStart = start; start += length; length = oldStart - start; - this.LayoutLines.ClearLayoutCache(); } if (this.RectSelection && length != 0) { TextPoint startTextPoint = this.LayoutLines.GetTextPointFromIndex(start); TextPoint endTextPoint = this.LayoutLines.GetTextPointFromIndex(start + length); this.SelectByRectangle(new TextRectangle(startTextPoint, endTextPoint)); - this.LayoutLines.ClearLayoutCache(); + this.LayoutLines.ClearLayoutCache(start, length); } else if (length != 0) { this.Selections.Add(Selection.Create(start, length)); - this.LayoutLines.ClearLayoutCache(); + this.LayoutLines.ClearLayoutCache(start, length); } this.SelectionChanged(this, null); } diff --git a/Core/LineToIndex.cs b/Core/LineToIndex.cs index e64d8be..f82be4e 100644 --- a/Core/LineToIndex.cs +++ b/Core/LineToIndex.cs @@ -330,6 +330,17 @@ namespace FooEditEngine } /// + /// 保持しているレイアウトキャッシュをクリアーする + /// + public void ClearLayoutCache(int index,int length) + { + int startRow = this.GetLineNumberFromIndex(index); + int endRow = this.GetLineNumberFromIndex(index + length - 1); + for (int i = startRow; i <= endRow; i++) + this.Lines[i].Dispose(); + } + + /// /// 行番号に対応する文字列を返します /// /// -- 2.11.0