View previous topic :: View next topic |
Author |
Message |
mstaszew
Joined: 21 Jul 2006 Posts: 67 Location: North Carolina, USA
|
Posted: Wed May 27, 2009 3:05 pm Post subject: Bookmark being removed |
|
|
In version 2.40 if I set a bookmark on line 10 and then remove line 10 the bookmark will move to line 9.
In version 2.60 if I do the same the bookmark is removed completely.
I wouldn't have noticed this, but our users are reporting bugs regarding this change. I personally think that the behavior in 2.40 is a little weird, but it is also what Delphi's IDE does. I have not tested with others. Is there a way to restore the behavior of version 2.40?
Thanks,
Michael |
|
Back to top |
|
|
econtrol Site Admin
Joined: 09 Jun 2006 Posts: 202
|
Posted: Thu May 28, 2009 10:47 am Post subject: |
|
|
There is new option.
TBookmark.AllowDelete: Boolean;
It's default value is True. To change it use OnSetBookmark event as in example (from main demo) below:
Code: | procedure TEditorFrame.EditorMasterSetBookmark(Snder: TObject;
Bookmark: TBookmark; var Accept: Boolean);
begin
with Bookmark do
if (BmIndex >= 0) and (BmIndex < 10) then
begin
ImageIndex := 13 + BmIndex;
Hint := 'Bookmark ' + IntToStr(BmIndex);
AllowDelete := False; // Disable deleting bookmark with text
end;
end; |
Michael. |
|
Back to top |
|
|
mstaszew
Joined: 21 Jul 2006 Posts: 67 Location: North Carolina, USA
|
Posted: Thu May 28, 2009 1:28 pm Post subject: |
|
|
Thanks, that did it. |
|
Back to top |
|
|
mstaszew
Joined: 21 Jul 2006 Posts: 67 Location: North Carolina, USA
|
Posted: Tue Aug 04, 2009 5:44 pm Post subject: |
|
|
This fix has unfortunately introduced another problem. In past versions text removal would not free the bookmark, but pressing CTRL+SHIFT+<NUMBER> would toggle a bookmark. Meaning, if bookmark 0 was set on line 10 and the caret is on line 10 and CTRL+SHIFT+0 is pressed the bookmark was removed, but deleting all text on line 10 would not remove the bookmark. I'd like to get that old behavior back. Setting AllowDelete to False fixes the initial issue, but makes it such that CTRL+SHIFT+0 on line 10 will not remove the bookmark if it was already set.
Thanks,
Michael |
|
Back to top |
|
|
econtrol Site Admin
Joined: 09 Jun 2006 Posts: 202
|
Posted: Thu Aug 13, 2009 7:31 pm Post subject: |
|
|
Yes, I agree.
Fix (ecSyntMemo.pas):
Code: |
procedure TCustomSyntaxMemo.ToggleBookmark(Index: integer);
var bm: TBookmark;
AllowDelBmk : boolean;
begin
bm := GetBookmarkObj(Index);
if bm = nil then SetBookmark(Index, CaretStrPos) else
if CaretPos.Y = bm.Line then
begin
AllowDelBmk := True; //bm.AllowDelete;
if Assigned(FOnDeleteBookmark) then
FOnDeleteBookmark(Self, bm, AllowDelBmk);
if AllowDelBmk then bm.Free
else bm.Position := CaretStrPos;
end
else bm.Position := CaretStrPos;
Invalidate;
end;
|
In this case Toggle bookmark will work as expected.
Michael. |
|
Back to top |
|
|
|