Bookmark indicator disappear when deleting space or tab in a line to empty the line

SyntaxEditor for WPF Forum

Posted 3 years ago by Jianjun Wang
Version: 16.1.0633
Platform: .NET 4.5
Environment: Windows 10 (64-bit)
Avatar

Steps to repro:

1. Using the bookmark sample from SyntaxEditor - General QuickStarts - Indicators - Bookmark

2. Press Enter key in the first line to insert a new line

3. Type a Space or Tab in the new line

4. Insert a bookmark indicator to the new line by clicking the "Toggle Bookmark" button in the toolbar

5. Use Backspace to delete the previously inserted space or tab

6. The bookmark indicator disappears then.

The line is still there but just empty, the bookmark indicator should be still there.

Comments (5)

Posted 3 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

Actually this is the same behavior as seen with Visual Studio's bookmarks too.  If you do the same steps, you'll see the same.


Actipro Software Support

Posted 3 years ago by Jianjun Wang
Avatar

But the behavior is a bit weird. User is allowed to add a bookmark on a empty line but a bookmark will disappear when a line becomes empty line.

Is there any way to keep the bookmark display when a line becomes empty?

Posted 3 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Thanks for the information.  We will update the logic for the upcoming maintenance release to alter things for this scenario.


Actipro Software Support

Posted 3 years ago by Jianjun Wang
Avatar

Hi Actipro,

Using build 634, the problem is fixed when emptying a single line, whihc means the bookmark will be maintained when selecting a line content but not the whole line and deleting the line content.

But the bookmark still disapppear for the last line whose content is fully selected but not the whole line in the multiple line selection scenario, which cause inconsistent behavior too.

Steps to repro:

1. Lauch the Syntax Editor sample, go to Syntax Editor - General QuickStarts\Indicators - Bookmark

2. Put the caret at line 4 and click the "Toggle Bookmark" toolbar button to add a bookmark on the line 4

3. Select the whole line 3 and full content of line 4 (till the end, last character ".", of line 4)

4. Delete the selection

5. The line 4 becomes line 3 and empty but the bookmark disappears.

 

But in step 3, if only select the full content of line 4 and then delete the selection. The line 4 becomes empty but the bookmark is there as expect.

Could you fix the problem in the multiple line selection scenario to get the consistent behavior as that of emptying a single line?

Posted 3 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

The behavior we added previously per this thread is already different from Visual Studio.  We agree with you that it is more ideal for a single line content deletion to keep the bookmark in place, especially since you can add a bookmark to an empty line. 

That being said, I don't think the latest request is possible using the tagging mechanism we have.  Right now, bookmarks are tagged over the content range of the line (excluding line terminators).  The previous change we made for this thread was to allow the bookmark tagged range to become zero-length and not get auto-deleted when it becomes so.  The only other option for auto-deletion of tagged ranges is when they are "surrounded," which is what the bookmarks now use instead of zero-length | surrounded.  When you start a selection on another line and cross it over into the line with the bookmark tagged range, it is considered surrounded, and thus gets deleted.  Sorry but there isn't another option in our core tagging framework to handle this more complex scenario you are asking for.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.