コミットメタ情報

リビジョンa9667168c1d131d02ad19d1f443d5efa4fdf98cc (tree)
日時2017-10-12 18:51:52
作者gdkhd812 <test@yaho...>
コミッターgdkhd812

ログメッセージ

選択時のレイアウトキャッシュの削除はさらに最適化できた

変更サマリ

差分

--- a/Core/Document.cs
+++ b/Core/Document.cs
@@ -792,27 +792,26 @@ namespace FooEditEngine
792792 if (start < 0 || start + length < 0 || start + length > this.Length)
793793 throw new ArgumentOutOfRangeException("startかendが指定できる範囲を超えてます");
794794 //選択範囲が消されたとき
795- if(this.Selections.Count > 0 && length == 0)
796- this.LayoutLines.ClearLayoutCache();
795+ foreach (Selection sel in this.Selections)
796+ this.LayoutLines.ClearLayoutCache(sel.start, sel.length);
797797 this.Selections.Clear();
798798 if (length < 0)
799799 {
800800 int oldStart = start;
801801 start += length;
802802 length = oldStart - start;
803- this.LayoutLines.ClearLayoutCache();
804803 }
805804 if (this.RectSelection && length != 0)
806805 {
807806 TextPoint startTextPoint = this.LayoutLines.GetTextPointFromIndex(start);
808807 TextPoint endTextPoint = this.LayoutLines.GetTextPointFromIndex(start + length);
809808 this.SelectByRectangle(new TextRectangle(startTextPoint, endTextPoint));
810- this.LayoutLines.ClearLayoutCache();
809+ this.LayoutLines.ClearLayoutCache(start, length);
811810 }
812811 else if (length != 0)
813812 {
814813 this.Selections.Add(Selection.Create(start, length));
815- this.LayoutLines.ClearLayoutCache();
814+ this.LayoutLines.ClearLayoutCache(start, length);
816815 }
817816 this.SelectionChanged(this, null);
818817 }
--- a/Core/LineToIndex.cs
+++ b/Core/LineToIndex.cs
@@ -330,6 +330,17 @@ namespace FooEditEngine
330330 }
331331
332332 /// <summary>
333+ /// 保持しているレイアウトキャッシュをクリアーする
334+ /// </summary>
335+ public void ClearLayoutCache(int index,int length)
336+ {
337+ int startRow = this.GetLineNumberFromIndex(index);
338+ int endRow = this.GetLineNumberFromIndex(index + length - 1);
339+ for (int i = startRow; i <= endRow; i++)
340+ this.Lines[i].Dispose();
341+ }
342+
343+ /// <summary>
333344 /// 行番号に対応する文字列を返します
334345 /// </summary>
335346 /// <param name="n"></param>
旧リポジトリブラウザで表示