Add tabKeyAlwaysIndentsOutdents property

This commit is contained in:
Michael Babienco
2020-12-08 09:28:48 -05:00
parent a5b3731db0
commit 19b63ff242
4 changed files with 31 additions and 0 deletions
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
@@ -129,6 +129,10 @@ typedef NS_OPTIONS(NSUInteger, RichTextEditorShortcut) {
/// Minimum font size. Defaults to 10.0f.
@property CGFloat minFontSize;
/// true if tab should always indent and shift+tab should always outdent the current paragraph(s);
/// false to let the tab key be used as normal
@property BOOL tabKeyAlwaysIndentsOutdents;
/// Pasteboard type string used when copying text from this NSTextView.
+(NSString*)pasteboardDataType;
@@ -184,6 +184,10 @@ typedef NS_ENUM(NSInteger, ParagraphIndentation) {
if (self.delegate_interceptor.receiver && [self.delegate_interceptor.receiver respondsToSelector:@selector(textView:shouldChangeTextInRange:replacementString:)]) {
return [self.delegate_interceptor.receiver textView:textView shouldChangeTextInRange:affectedCharRange replacementString:replacementString];
}
if (self.tabKeyAlwaysIndentsOutdents && [replacementString isEqualToString:@"\t"] && affectedCharRange.length == 0) {
//[self userSelectedIncreaseIndent];
//return NO;
}
return YES;
}
@@ -1392,6 +1396,14 @@ typedef NS_ENUM(NSInteger, ParagraphIndentation) {
(enabledShortcuts == RichTextEditorShortcutAll || enabledShortcuts & RichTextEditorShortcutIncreaseIndent)) {
[self userSelectedIncreaseIndent];
}
else if (self.tabKeyAlwaysIndentsOutdents && keyChar == '\t' && !commandKeyDown && !shiftKeyDown &&
(enabledShortcuts == RichTextEditorShortcutAll || enabledShortcuts & RichTextEditorShortcutIncreaseIndent)) {
[self userSelectedIncreaseIndent];
}
else if (self.tabKeyAlwaysIndentsOutdents && (keyChar == '\t' || keyChar == 25) && !commandKeyDown && shiftKeyDown &&
(enabledShortcuts == RichTextEditorShortcutAll || enabledShortcuts & RichTextEditorShortcutIncreaseIndent)) {
[self userSelectedDecreaseIndent];
}
else if (!([self.rteDelegate respondsToSelector:@selector(richTextEditor:keyDownEvent:)] && [self.rteDelegate richTextEditor:self keyDownEvent:event])) {
[self sendDelegatePreviewChangeOfType:RichTextEditorPreviewChangeKeyDown];
[super keyDown:event];