XVimProject/XVim

Crash when deleting in beginning of the file

Closed this issue · 4 comments

Description

Line selection (cc, dd) in beginning of the file will crash Xcode

Operation

Go the beginning of the file and press cc or dd.
This crash can also be seen by the automatic tests.

Expected behaviour

Should not crash :)

Environments

  • Xcode Version [8.2.1 ]
  • XVim branch and revision [develop]
  • Keyboard Language [Swedish]
  • Input source language [Swift ]

Crash log (if any)

2017-01-05 15:25:30.197292 Xcode[41320:4540393] [MT] DVTAssertions: UNCAUGHT EXCEPTION (NSRangeException): *** -[NSBigMutableString characterAtIndex:]: Index 18446744073709551615 out of bounds; string length 390 UserInfo: (null) Hints: None 2017-01-05 15:25:30.485451 Xcode[41320:4540393] [MT] DVTAssertions: Backtrace: 0 __exceptionPreprocess (in CoreFoundation) 1 DVTFailureHintExceptionPreprocessor (in DVTFoundation) 2 objc_exception_throw (in libobjc.A.dylib) 3 +[NSException raise:format:] (in CoreFoundation) 4 -[NSBigMutableString characterAtIndex:] (in Foundation) 5 -[NSTextStorage(VimOperation) xvim_firstOfLine:] at /Users/tidbeck/Source/XVim/XVim/NSTextStorage+VimOperation.m:248 (in XVim) 6 -[NSTextView(VimOperationPrivate) xvim_getOperationRangeFrom:To:Type:] at /Users/tidbeck/Source/XVim/XVim/NSTextView+VimOperation.m:2567 (in XVim) 7 -[NSTextView(VimOperation) _xvim_getDeleteRange:withRange:] at /Users/tidbeck/Source/XVim/XVim/NSTextView+VimOperation.m:725 (in XVim) 8 -[NSTextView(VimOperation) xvim_delete:withMotionPoint:andYank:] at /Users/tidbeck/Source/XVim/XVim/NSTextView+VimOperation.m:742 (in XVim) 9 -[NSTextView(VimOperation) xvim_delete:andYank:] at /Users/tidbeck/Source/XVim/XVim/NSTextView+VimOperation.m:737 (in XVim) 10 -[XVimDeleteEvaluator motionFixed:] at /Users/tidbeck/Source/XVim/XVim/XVimDeleteEvaluator.m:69 (in XVim) 11 -[XVimMotionEvaluator _motionFixed:] at /Users/tidbeck/Source/XVim/XVim/XVimMotionEvaluator.m:91 (in XVim) 12 -[XVimOperatorEvaluator _motionFixed:] at /Users/tidbeck/Source/XVim/XVim/XVimOperatorEvaluator.m:63 (in XVim) 13 -[XVimDeleteEvaluator d] at /Users/tidbeck/Source/XVim/XVim/XVimDeleteEvaluator.m:47 (in XVim) 14 -[XVimEvaluator eval:] at /Users/tidbeck/Source/XVim/XVim/XVimEvaluator.m:80 (in XVim) 15 -[XVimNumericEvaluator eval:] at /Users/tidbeck/Source/XVim/XVim/XVimNumericEvaluator.m:15 (in XVim) 16 -[XVimWindow handleKeyStroke:onStack:] at /Users/tidbeck/Source/XVim/XVim/XVimWindow.m:236 (in XVim) 17 -[XVimWindow handleOneXVimString:] at /Users/tidbeck/Source/XVim/XVim/XVimWindow.m:191 (in XVim) 18 -[XVimWindow handleXVimString:] at /Users/tidbeck/Source/XVim/XVim/XVimWindow.m:217 (in XVim) 19 -[XVimWindow handleKeyEvent:] at /Users/tidbeck/Source/XVim/XVim/XVimWindow.m:155 (in XVim) 20 -[DVTSourceTextView(XVim) xvim_keyDown:] at /Users/tidbeck/Source/XVim/XVim/DVTSourceTextView+XVim.m:102 (in XVim) 21 -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] (in AppKit) 22 -[NSWindow(NSEventRouting) sendEvent:] (in AppKit) 23 -[IDEWorkspaceWindow sendEvent:] (in IDEKit) 24 -[NSApplication(NSEvent) sendEvent:] (in AppKit) 25 -[IDEApplication sendEvent:] (in IDEKit) 26 -[NSApplication run] (in AppKit) 27 NSApplicationMain (in AppKit) 28 start (in libdyld.dylib)

Think this is a duplicate of #1004

So is there any plan to fix this?

I don't have the permission to merge it.

It should be fixed in master and develop branch.