Moving lines loses bookmarks

SyntaxEditor for Windows Forms Forum

Posted 1 year ago by Gavin Huet
Version: 22.1.3
Platform: .NET 6.0
Environment: Windows 11 (64-bit)
Avatar

Hi,

If I have a couple of lines of code with a bookmark on one of them, using the ALT+UP or ALT+DOWN to move non-bookmarked lines over a bookmarked line loses the bookmark.

For example:

document.write("<p>" + sampleString); // LINE 1 : Bookmarked
document.write(product(width, height)); // LINE 2 : No bookmark
document.write("</p>"); // LINE 3 : No bookmark

If there is a bookmark on that first line, I move the cursor to the second line and use ALT+UP to move the second line to the first line, the bookmark associated with the first line is lost - I would expect it to stay with that code which is now the second line.

document.write(product(width, height)); // LINE 2 now LINE 1 : No bookmark
document.write("<p>" + sampleString); // LINE 1 now LINE 2 : No bookmark
document.write("</p>"); // LINE 3 : No bookmark

However, in the same scenario I go onto the first line which has a bookmark, use the ALT+DOWN to move this line to the second line, the bookmark moves with the line as expected.

document.write(product(width, height)); // LINE 2 now LINE 1 : No bookmark
document.write("<p>" + sampleString); // LINE 1 now LINE 2 : Bookmarked
document.write("</p>"); // LINE 3 : No bookmark

Thanks

Gavin

Comments (3)

Answer - Posted 1 year ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Gavin,

This is a tricky scenario because behind the scenes, a line move consists of a pair of delete and insert operations.  The text range being deleted (so it can move elsewhere) will end up losing bookmarks over that range.  That's what's effectively happening here and unfortunately can't be avoided due to the deletion.

When testing in Visual Studio, the same thing happens there however it's opposite of ours.  In their implementation, the selected lines lose the bookmarks.  That way of thinking probably makes more sense if we have to "lose" a bookmark since the selected lines are the ones being deleted and then inserted into a new location.  The surrounding lines shouldn't have their bookmarks affected.

We will update our logic to work more like Visual Studio's editor.


Actipro Software Support

Posted 1 year ago by Gavin Huet
Avatar

Thanks, that makes sense.

As an aside, when will the next update of the WinForms control be released?

Answer - Posted 1 year ago by Actipro Software Support - Cleveland, OH, USA
Avatar

v23.1 is in beta testing right now, so it should be in the next several weeks.


Actipro Software Support

The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.