Adium

Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#16200 closed defect (fixed)

"Add Link" cannot be used at arbitrary places within an instant message.

Reported by: brbiv Owned by:
Milestone: Adium 1.5.5 Component: Adium Core
Version: 1.5.4b4 Severity: regression
Keywords: Cc:
Patch Status: Accepted

Description

Summary

If "Add Link" is attempted when cursor is not at start of line, add link fails. Appears to be IM protocol agnostic.

Steps to reproduce

Option 1.

  1. Open chat window
  2. Hit Space
  3. Attempt to add link (any method) silently fails
  4. Move to first character of entry box and add link will succeed.

Expected results

In previous versions of Adium and other IM clients, you can insert links into a sentence. The sentence can be read naturally, while providing supporting info contextually.

Actual results

Silent failure.

Regression

Function stopped working as expected somewhere in the 1.5 tree. It fails with 1.5.3 and 1.5b4. Have not tested previous versions.

Notes

Any of the three "add link" options fail: Menu item, command-k, and toolbar.

Attachments (1)

patch-16200.diff (817 bytes) - added by Detmud 4 years ago.
Patch Ver.1

Download all attachments as: .zip

Change History (7)

comment:1 Changed 4 years ago by Robby

  • Severity changed from normal to regression

comment:2 Changed 4 years ago by Detmud

Xcode output, this raises an exception.

Patch is on the way.


2013-02-05 20:39:04.896 Adium[11854:303] Exception was raised: *** -[NSConcreteTextStorage attribute:atIndex:effectiveRange:]: Range or index out of bounds
2013-02-05 20:39:04.897 Adium[11854:303] *** -[NSConcreteTextStorage attribute:atIndex:effectiveRange:]: Range or index out of bounds
2013-02-05 20:39:04.898 Adium[11854:303] (
	0   CoreFoundation                      0x00007fff8d0ae0a6 __exceptionPreprocess + 198
	1   libobjc.A.dylib                     0x00007fff8ed653f0 objc_exception_throw + 43
	2   CoreFoundation                      0x00007fff8d0ade7c +[NSException raise:format:] + 204
	3   AppKit                              0x00007fff91151da5 -[NSConcreteTextStorage attribute:atIndex:effectiveRange:] + 129
	4   Adium                               0x0000000100074da8 -[SHLinkEditorWindowController windowDidLoad] + 1208
	5   AppKit                              0x00007fff91182062 -[NSWindowController _windowDidLoad] + 448
	6   AppKit                              0x00007fff911533ba -[NSWindowController window] + 114
	7   Adium                               0x0000000100074711 -[SHLinkEditorWindowController showOnWindow:] + 81
	8   Adium                               0x0000000100076c00 -[SHLinkManagementPlugin editFormattedLink:] + 320
	9   AppKit                              0x00007fff9111ea59 -[NSApplication sendAction:to:from:] + 342
	10  AppKit                              0x00007fff9125444c -[NSMenuItem _corePerformAction] + 406
	11  AppKit                              0x00007fff9125413a -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] + 133
	12  AppKit                              0x00007fff91252dc0 -[NSMenu performKeyEquivalent:] + 271
	13  AppKit                              0x00007fff91252283 -[NSApplication _handleKeyEquivalent:] + 829
	14  AppKit                              0x00007fff9110f243 -[NSApplication sendEvent:] + 4480
	15  AppKit                              0x00007fff910252fa -[NSApplication run] + 636
	16  AppKit                              0x00007fff90fc9cb6 NSApplicationMain + 869
	17  Adium                               0x0000000100046fb2 main + 34
	18  Adium                               0x0000000100002614 start + 52
	19  ???                                 0x0000000000000003 0x0 + 3
)
Last edited 4 years ago by Robby (previous) (diff)

Changed 4 years ago by Detmud

Patch Ver.1

comment:3 Changed 4 years ago by Detmud

Error in 1.5 ~

// Get the selected link (We have to be careful when the selection is at the very end of our text view)
if ([[textView textStorage] length] > 0 && 
    selectedRange.location != NSNotFound && 
    NSMaxRange(selectedRange) <= [[textView textStorage] length])

Commit Introducing Bug
Related Bug

Working Version in < 1.5

// Get the selected link (We have to be careful when the selection is at the very end of our text view)
if (selectedRange.location >= 0 && 
    NSMaxRange(selectedRange) < [[textView textStorage] length]) {

I don't understand why there is a check on the lenght of the textStorage, it make no sense to me to check the Lenght of the textStorage instant of Checking the lengt of the Selected Range, if no Text is selectet the Range will be 0.

Last edited 4 years ago by Detmud (previous) (diff)

comment:4 Changed 4 years ago by Thijs Alkemade <me@…>

  • Resolution set to fixed
  • Status changed from new to closed

(In 1ed591fb982c) Patch from Detmud: fix "add link" when the cursor is at the end of the line.

Fixes #16200

comment:5 Changed 4 years ago by Robby

  • Milestone set to Adium 1.5.5
  • Patch Status set to Accepted

I will backport the patch to 1.5.5.

comment:6 Changed 4 years ago by Robert Vehse <robertvehse@…>

(In 1432212c1d40) Patch from Detmud: fix "add link" when the cursor is at the end of the line. Fixes #16200.

Note: See TracTickets for help on using tickets.