Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marked text should become a link when "Link" button is clicked #12

Closed
traumschule opened this issue Nov 28, 2017 · 10 comments
Closed

Marked text should become a link when "Link" button is clicked #12

traumschule opened this issue Nov 28, 2017 · 10 comments

Comments

@traumschule
Copy link

traumschule commented Nov 28, 2017

Expected

Marked text becomes a link when the button "Link" is clicked and a new note with that title opens.

Observation

Nothing happens.

Might be limited to Linux/i386.

  • a new note with that title opens
  • the marked word becomes no link
  • the note does not appear in the tray menu directly nor in the search list or in the ./Notes directory
  • as soon as I start typing, it is saved and appears on disk and in the tray.

I guess this is confusing. Could we save directly after opening the note?

On first save it shows up in the search list like the first row in the attached image (with overlong timestamp), the next save (eg closing the note) however corrects it.
tomboy_newnote

@davidbannon
Copy link
Member

No, not an i386 issue, just a case of bad regression testing.
I believe its now fixed in source.

@traumschule
Copy link
Author

traumschule commented Nov 29, 2017

is the Link button working as expected ?

not with ac9a77d

@traumschule
Copy link
Author

traumschule commented Nov 29, 2017

Adding OnClick = ButtLinkClick in editbox.lfm, but still then the new note window is only opened but not added to the register (checked with search).
Oh and please reopen until it is fixed.

@davidbannon davidbannon reopened this Nov 29, 2017
@davidbannon
Copy link
Member

Reopened.
I suspect this is my bad. ObjectPascal is perhaps not a great model to use under git. Trouble is lfm files change as soon as you move the form, perhaps to see whats behind it. I reckon I have not uploaded the editbox.lfm file after adding an event for the Link button (ignoring Gits prompting). I'll push my current one now. Please delete your existing lfm file and pull down the new one.

@traumschule
Copy link
Author

That's what I thought. Do you check for changed files with git status before committing? Git is awesome, it tells me about remote changes on git pull and suggests git stash to temporarily move them aside. I can then pull and git stash pop to reapply them resulting in merge conflicts which I resolve with git mergetool -t meld - no need to delete for me. After I added files when conflicts are resolved, i it stash drop` to delete the stashed version.

New behavior:

  • I open a note, select a word, click link and a new note with that title opens. GREAT!
  • the marked word however becomes no link
  • the note does not appear in the tray menu directly nor in the search list or in the ./Notes directory
  • but as soon as I start typing, it is saved and appears on disk and in the tray. I guess this is confusing. Could we save directly after opening the note?
  • on first save it shows up in the search list like the first row in the attached image (with overlong timestamp), the next save (eg closing the note) however corrects it.
    tomboy_newnote

Note that RichMemo1LinkAction in editbox-ref.pas is unused:

procedure TEditBoxForm.RichMemo1LinkAction(Sender: TObject;
    ALinkAction: TLinkAction; const info: TLinkMouseInfo; LinkStart,
    LinkLen: Integer);
	// Note as of August 2017, this funtion is incomplete in Win10
	// Cannot rely on LinkStart or LinkLen so workaround.
	// http://forum.lazarus.freepascal.org/index.php/topic,37909.0.html
var
     Index, Len : longint;
begin
    Index := RichMemo1.SelStart;
    Len := 0;
    while RichMemo1.IsLink(Index) do dec(Index);
    inc(Index);
    While RichMemo1.isLink(Index + Len) do inc(Len);

    // Ahh, but what if user has changed the note's title ??
    if RichMemo1.GetText(LinkStart, LinkLen) <> NoteTitle then
    	SearchForm.OpenNote(RichMemo1.GetText(Index, Len));
    // SearchForm.OpenNote(RichMemo1.GetText(LinkStart, LinkLen));
end;      

@traumschule traumschule changed the title Link button has no effect Marked text should become a link when "Link" button is clicked Nov 29, 2017
@davidbannon
Copy link
Member

Easy one first, editbox-ref.pas is not used and should not have been submitted to git. I'll work out to delete it ...
I personally don't use the Link button (or internal links) so am not in tune with how it works. I actually hate the way it links to things that often have no relevance ! So, when making a new page, I (with my mindset) gave the user an opportunity to no make a new note unless they wrote to it. Sounds like you don't like that model ? I should not assume ...
I can easily do a save on opening, its easy to detect, I have a title but no file name.
And I have not truncated the long datetime string, don't know how I missed that.

Lets leave this ticket open to fix -

  • **Immediately save a note begot by the Link button (even though I don't like it :-) )
  • Truncate the date time string for above note.**

And no, I have not been always saving lfm files when the only change has happened because of a moved form. The updated lfm entry in git would be labeled with that real commit which would have nothing to do with the lfm file. I'd better review that policy.

@traumschule
Copy link
Author

traumschule commented Nov 29, 2017

i agree it's rather low priority, if in doubt we should mimick Tomboy NG's behavior.
Regarding git: git rm removes a file, if you add a path or pattern to .gitignore, git status won't bother you about it anymore.

@davidbannon
Copy link
Member

Yeah, thanks, have removed that and another -ref file. Should not have been there in the first place.
I cannot add lfm to gitignore because sometimes changes to the lfm file are important. Like it the case you found where the link button did not have its event registered. I think its a case of being more careful.

davidbannon added a commit that referenced this issue Nov 30, 2017
…on and its displayed nicely in Search Form
@davidbannon
Copy link
Member

OK, updates pushed.
change dates in search box for new notes shown cleanly.
A new note created by clicking Link button in another note is saved immediately.
The text selected when that Link button was clicked becomes a link.

I think this issue is closed ??

@traumschule
Copy link
Author

traumschule commented Nov 30, 2017

Thanks, great work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants