From 8390a457e2cc9f50e97c551dfd6d6244ac6970c5 Mon Sep 17 00:00:00 2001 From: handa Date: Fri, 16 Jan 2009 09:23:41 +0000 Subject: [PATCH] *** empty log message *** --- MText.cs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/MText.cs b/MText.cs index 836c4f4..1fbb3f0 100644 --- a/MText.cs +++ b/MText.cs @@ -313,14 +313,27 @@ namespace M17N.Core this.depth = 1; } - public MInterval Copy (int start, int end, MInterval interval) + private MInterval find (int pos) { - MInterval new_interval; + if (pos < total_start || total_end < pos) + return null; + if (pos < Start) + return left.find (pos); + if (End < pos) + return right.find (pos); + return this; + } + + public MInterval Copy (int start, int end) + { + MInterval interval_start = find (start); + MInterval interval_end = find (end); + MInterval interval; start = adjust_position (start, true); end = adjust_position (end, true); - new_interval = new MInterval (start, end, interval.stack); - return new_interval; + interval = new MInterval (start, end, stack); + return interval; } private MInterval Copy () -- 1.7.10.4