mirror of
https://github.com/coteditor/CotEditor.git
synced 2024-09-11 11:25:57 +03:00
Apply indent conversion to whole document if no text selected (#533)
This commit is contained in:
parent
daa56552dc
commit
2444ae121c
@ -23,7 +23,11 @@ develop
|
||||
- Fix an issue where font-size changing could remove hanging indent.
|
||||
- Fix an issue where layout of split editors will be broken if the font of one of the other split editors is changed.
|
||||
- Add “Copy as Rich Text” action to the contextual menu.
|
||||
- Apply “Sort”, “Reverse” or “Delete Duplicates” actions for text lines to whole document if no text is selected.
|
||||
- Apply the following text actions to whole document if no text is selected:
|
||||
- Indentation > Convert Indentation to Tab / Spaces
|
||||
- Lines > Sort
|
||||
- Lines > Reverse
|
||||
- Lines > Delete Duplicates
|
||||
- Improve recovering status of unsaved documents on window resume.
|
||||
- Improve line number view drawing with selection on vertical text mode.
|
||||
- Improve invisibles drawing:
|
||||
|
@ -165,9 +165,14 @@
|
||||
- (IBAction)convertIndentationToSpaces:(nullable id)sender
|
||||
// ------------------------------------------------------
|
||||
{
|
||||
if ([self selectedRange].length == 0) { return; }
|
||||
NSArray<NSValue *> *ranges;
|
||||
if ([self selectedRange].length == 0) {
|
||||
ranges = @[[NSValue valueWithRange:NSMakeRange(0, [[self string] length])]];
|
||||
} else {
|
||||
ranges = [self selectedRanges];
|
||||
}
|
||||
|
||||
[self convertIndentation:CEIndentStyleSpace inRanges:[self selectedRanges]];
|
||||
[self convertIndentation:CEIndentStyleSpace inRanges:ranges];
|
||||
}
|
||||
|
||||
|
||||
@ -176,9 +181,14 @@
|
||||
- (IBAction)convertIndentationToTabs:(nullable id)sender
|
||||
// ------------------------------------------------------
|
||||
{
|
||||
if ([self selectedRange].length == 0) { return; }
|
||||
NSArray<NSValue *> *ranges;
|
||||
if ([self selectedRange].length == 0) {
|
||||
ranges = @[[NSValue valueWithRange:NSMakeRange(0, [[self string] length])]];
|
||||
} else {
|
||||
ranges = [self selectedRanges];
|
||||
}
|
||||
|
||||
[self convertIndentation:CEIndentStyleTab inRanges:[self selectedRanges]];
|
||||
[self convertIndentation:CEIndentStyleTab inRanges:ranges];
|
||||
}
|
||||
|
||||
|
||||
@ -190,6 +200,8 @@
|
||||
- (void)convertIndentation:(CEIndentStyle)indentStyle inRanges:(nonnull NSArray<NSValue *> *)ranges
|
||||
// ------------------------------------------------------
|
||||
{
|
||||
if ([[self string] length] == 0) { return; }
|
||||
|
||||
NSMutableArray<NSValue *> *replacementRanges = [NSMutableArray arrayWithCapacity:[ranges count]];
|
||||
NSMutableArray<NSString *> *replacementStrings = [NSMutableArray arrayWithCapacity:[ranges count]];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user