リビジョン | a9667168c1d131d02ad19d1f443d5efa4fdf98cc (tree) |
---|---|
日時 | 2017-10-12 18:51:52 |
作者 | gdkhd812 <test@yaho...> |
コミッター | gdkhd812 |
選択時のレイアウトキャッシュの削除はさらに最適化できた
@@ -792,27 +792,26 @@ namespace FooEditEngine | ||
792 | 792 | if (start < 0 || start + length < 0 || start + length > this.Length) |
793 | 793 | throw new ArgumentOutOfRangeException("startかendが指定できる範囲を超えてます"); |
794 | 794 | //選択範囲が消されたとき |
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); | |
797 | 797 | this.Selections.Clear(); |
798 | 798 | if (length < 0) |
799 | 799 | { |
800 | 800 | int oldStart = start; |
801 | 801 | start += length; |
802 | 802 | length = oldStart - start; |
803 | - this.LayoutLines.ClearLayoutCache(); | |
804 | 803 | } |
805 | 804 | if (this.RectSelection && length != 0) |
806 | 805 | { |
807 | 806 | TextPoint startTextPoint = this.LayoutLines.GetTextPointFromIndex(start); |
808 | 807 | TextPoint endTextPoint = this.LayoutLines.GetTextPointFromIndex(start + length); |
809 | 808 | this.SelectByRectangle(new TextRectangle(startTextPoint, endTextPoint)); |
810 | - this.LayoutLines.ClearLayoutCache(); | |
809 | + this.LayoutLines.ClearLayoutCache(start, length); | |
811 | 810 | } |
812 | 811 | else if (length != 0) |
813 | 812 | { |
814 | 813 | this.Selections.Add(Selection.Create(start, length)); |
815 | - this.LayoutLines.ClearLayoutCache(); | |
814 | + this.LayoutLines.ClearLayoutCache(start, length); | |
816 | 815 | } |
817 | 816 | this.SelectionChanged(this, null); |
818 | 817 | } |
@@ -330,6 +330,17 @@ namespace FooEditEngine | ||
330 | 330 | } |
331 | 331 | |
332 | 332 | /// <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> | |
333 | 344 | /// 行番号に対応する文字列を返します |
334 | 345 | /// </summary> |
335 | 346 | /// <param name="n"></param> |