Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
2022-10-11 Riccardo Mottola <[email protected]>

* Source/NSTextView.m
Fix click on TextAttachmentCells, where the left side was not respected.
This was because index was respecting fraction and thus loosing the
attachment when clicking on the right part, only for this case,
recalculate character index without respectFraction.

2022-09-01 Gregory John Casamento <[email protected]>

* Source/NSButtonCell.m: Move method to detect if button is a
Expand Down
14 changes: 10 additions & 4 deletions Source/NSTextView.m
Original file line number Diff line number Diff line change
Expand Up @@ -5554,12 +5554,18 @@ - (void) mouseDown: (NSEvent *)theEvent
if (granularity == NSSelectByCharacter)
{
NSTextAttachment *attachment;
NSInteger startIndexNoFraction;

/* since we look for an attachment with by-character granularity,
recalculate the index without resepecting fraction */
startIndexNoFraction = [self _characterIndexForPoint: startPoint
respectFraction: NO];

/* Check if the click was on an attachment cell. */
attachment = [_textStorage attribute: NSAttachmentAttributeName
atIndex: startIndex
atIndex: startIndexNoFraction
effectiveRange: NULL];

if (attachment != nil)
{
id <NSTextAttachmentCell> cell = [attachment attachmentCell];
Expand Down Expand Up @@ -5594,11 +5600,11 @@ - (void) mouseDown: (NSEvent *)theEvent
if ([cell wantsToTrackMouseForEvent: theEvent
inRect: cellFrame
ofView: self
atCharacterIndex: startIndex]
atCharacterIndex: startIndexNoFraction]
&& [cell trackMouse: theEvent
inRect: cellFrame
ofView: self
atCharacterIndex: startIndex
atCharacterIndex: startIndexNoFraction
untilMouseUp: NO])
{
return;
Expand Down