On 15.04.2011 01:22, Enrico Forestieri wrote:
> On Thu, Apr 14, 2011 at 07:00:34PM -0400, Richard Heck wrote:
>> On 04/14/2011 05:58 PM, Enrico Forestieri wrote:
>>> On Thu, Apr 14, 2011 at 09:53:46PM +0200, Peter Kuemmel wrote:
>>>> This patch
>>>>
>>>>     http://www.lyx.org/trac/attachment/ticket/7394/resetAnchor.patch
>>>>
>>>> fixes the crash in
>>>>
>>>>     http://www.lyx.org/trac/ticket/7394
>>>>
>>>> But I don't know if it introduces any side effects.
>>> This is not the correct fix, and neither is removing anchor_.clear().
>>> For example, the assert is avoided but when you shift-click, the entire
>>> document from the beginning gets selected and not from the cursor
>>> position. Please, find attached the correct fix.
>>>
>> The same fix is therefore needed in LFUN_SCREEN_UP and
>> LFUN_SCREEN_DOWN, since, as I said in the other email, the same
>> crash happens there.
>>
>> Auditing the other calls to Cursor::reset... What about in
>> BufferView::setCursor() itself? I've seen some weird selection
>> behavior that may be caused by the lack of a resetAnchor() call
>> there, but I don't know for sure.
>>
>> You definitely get weird behavior with LFUN_ALL_CHANGES_*: The
>> anchor seems to be left at the end of the Buffer. So same problem
>> there.
> 
> Yes, I think that a d->cursor_.resetAnchor() is in order at the end
> of BufferView::setCursor(). This is because Cursor::setCursor()
> "(intentionally) does neither touch anchor nor selection status"
> as stated in Cursor.cpp, but in BufferView::setCursor() the selection
> status is reset without touching anchor. Hmmm... either a resetAnchor()
> call is needed or the setSelection(false) removed. Don't have time
> to investigate now, though...
> 

Seems the whole anchor stuff needs a review.

Peter

Reply via email to