Permalink
Browse files

URL labeling

  • Loading branch information...
1 parent 758e368 commit 3db8a99980afbf15e8fe94972ec7abd909208b29 Zachary Schneirov committed Feb 4, 2010
Showing with 13 additions and 5 deletions.
  1. +6 −1 DualField.m
  2. +2 −0 GlobalPrefs.m
  3. +5 −4 NSCollection_utils.m
View
7 DualField.m
@@ -312,7 +312,12 @@ - (BOOL)showsDocumentIcon {
}
- (BOOL)textView:(NSTextView *)aTextView shouldChangeTextInRange:(NSRange)affectedCharRange replacementString:(NSString *)replacementString {
-
+
+ //if ([replacementString rangeOfString:@"\n" options:NSLiteralSearch].location != NSNotFound) {
+// //NO! you cannot paste line feeds.
+// return NO;
+// }
+
lastLengthReplaced = [replacementString length];
return YES;
View
2 GlobalPrefs.m
@@ -497,6 +497,8 @@ - (NSParagraphStyle*)noteBodyParagraphStyle {
while ((textTabToBeRemoved = [enumerator nextObject])) {
[noteBodyParagraphStyle removeTabStop:textTabToBeRemoved];
}
+ //[paragraphStyle setHeadIndent:sizeOfTab]; //for soft-indents, this would probably have to be applied contextually, and heaven help us for soft tabs
+
[noteBodyParagraphStyle setDefaultTabInterval:sizeOfTab];
}
View
9 NSCollection_utils.m
@@ -180,16 +180,17 @@ - (void)addMenuItemsForURLsInNotes:(NSMenu*)urlsMenu {
NSURL *url = [urls objectAtIndex:j];
NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Copy URL",@"contextual menu item title to copy urls")
action:@selector(copyItemToPasteboard:) keyEquivalent:@""];
- NSString *urlString = [url absoluteString];
- if ([urlString length] > 60) urlString = [[urlString substringToIndex: 60] stringByAppendingString:NSLocalizedString(@"...", @"ellipsis character")];
- NSMutableAttributedString *titleString = [[NSMutableAttributedString alloc] initWithString:[NSLocalizedString(@"Copy ",@"menu item prefix to copy a URL") stringByAppendingString:urlString] attributes:blackAttrs];
+ //_other_ people would use "_web_userVisibleString" here, but resourceSpecifier looks like it's good enough
+ NSString *urlString = [[url scheme] isEqualToString:@"mailto"] ? [url resourceSpecifier] : [url absoluteString];
+ NSString *truncatedURLString = [urlString length] > 60 ? [[urlString substringToIndex: 60] stringByAppendingString:NSLocalizedString(@"...", @"ellipsis character")] : urlString;
+ NSMutableAttributedString *titleString = [[NSMutableAttributedString alloc] initWithString:[NSLocalizedString(@"Copy ",@"menu item prefix to copy a URL") stringByAppendingString:truncatedURLString] attributes:blackAttrs];
NSAttributedString *titleDesc = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@" (%@)", titleOfNote(aNote)] attributes:grayAttrs];
[titleString appendAttributedString:titleDesc];
[item setAttributedTitle:titleString];
[titleDesc release];
[titleString release];
- [item setRepresentedObject:[url absoluteString]];
+ [item setRepresentedObject:urlString];
[item setTarget:[item representedObject]];
[urlsMenu addItem:item];
[item release];

0 comments on commit 3db8a99

Please sign in to comment.