From dbd1ec43e05c4128a0af1ec5b51313620edb3b51 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Tue, 16 Mar 2010 18:23:21 +0000 Subject: =?UTF-8?q?=E2=80=A2=20fixed=20bug=20while=20presetting=20the=20mi?= =?UTF-8?q?rrored=20snippets=20to=20their=20counterparts;=20take=20into=20?= =?UTF-8?q?account=20the=20relative=20position=20of=20the=20insertion=20po?= =?UTF-8?q?int=20(tab=20trigger)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/CMTextView.m | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/CMTextView.m b/Source/CMTextView.m index ffd74834..bfc119bd 100644 --- a/Source/CMTextView.m +++ b/Source/CMTextView.m @@ -1609,10 +1609,10 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) // Preset mirrored snippets with according snippet content if(mirroredCounter > -1) { for(i=0; i<=mirroredCounter; i++) { - if(snippetControlArray[snippetMirroredControlArray[i][0]][0] > -1 && snippetControlArray[snippetMirroredControlArray[i][0]][1]) { - [snip replaceCharactersInRange:NSMakeRange(snippetMirroredControlArray[i][1], snippetMirroredControlArray[i][2]) - withString:[snip substringWithRange:NSMakeRange(snippetControlArray[snippetMirroredControlArray[i][0]][0], snippetControlArray[snippetMirroredControlArray[i][0]][1])]]; - snippetMirroredControlArray[i][2] = snippetControlArray[snippetMirroredControlArray[i][0]][1]; + if(snippetControlArray[snippetMirroredControlArray[i][0]][0] > -1 && snippetControlArray[snippetMirroredControlArray[i][0]][1] > 0) { + [snip replaceCharactersInRange:NSMakeRange(snippetMirroredControlArray[i][1]-targetRange.location, snippetMirroredControlArray[i][2]) + withString:[snip substringWithRange:NSMakeRange(snippetControlArray[snippetMirroredControlArray[i][0]][0]-targetRange.location, snippetControlArray[snippetMirroredControlArray[i][0]][1])]]; + snippetMirroredControlArray[i][2] = snippetControlArray[snippetMirroredControlArray[i][0]][1]; } // Adjust successive snippets for(j=0; j<20; j++) @@ -1620,7 +1620,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) snippetControlArray[j][0] += snippetControlArray[snippetMirroredControlArray[i][0]][1]; // Adjust successive mirrored snippets for(j=0; j<=mirroredCounter; j++) - if(i != j && snippetMirroredControlArray[j][1] > snippetMirroredControlArray[i][1]) + if(snippetMirroredControlArray[j][1] > snippetMirroredControlArray[i][1]) snippetMirroredControlArray[j][1] += snippetControlArray[snippetMirroredControlArray[i][0]][1]; } } -- cgit v1.2.3