Skip to content

Commit 94f72de

Browse files
Plamen TodorovPlamen Todorov
authored andcommitted
Fix line duplication selected range to stay on the right place
1 parent 321fbb2 commit 94f72de

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

XcodeKit/XcodeKit.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,11 @@ -(void)duplicateSelection
139139
[codeEditor insertText:copy];
140140
}
141141
else {
142-
NSString *lineContent = [codeEditor.textStorage.string substringWithRange:currentLineRange];
142+
NSString *lineContent = [NSString stringWithFormat:@"%@", [codeEditor.textStorage.string substringWithRange:currentLineRange]];
143143

144144
[codeEditor setSelectedRange:NSMakeRange(currentLineRange.location + currentLineRange.length, 0)];
145145
[codeEditor insertText:lineContent];
146+
[codeEditor setSelectedRange:NSMakeRange(currentLineRange.location - 1, 0)];
146147
}
147148
}
148149
}

0 commit comments

Comments
 (0)