Internal Note's Links II

Thomas Lohrum
Posts: 1312
Joined: Tue Mar 08, 2011 11:15 am

Internal Note's Links II

Postby Thomas Lohrum » Tue Mar 10, 2015 10:33 pm

Hi Alex,

there is still an issue with internal links to other notes. I can not reproduce, but the link recognition gets broken. It looks like some internal offset calculation misses something. I just had this again with a note containing many bullet lists, paragraphs, HTML Links and note links.

I know this does not help much, but want to make sure you are aware of the issue.

Thomas
User avatar
ChrisCN
Posts: 222
Joined: Wed Jul 04, 2012 10:20 am
Contact:

Re: Internal Note's Links II

Postby ChrisCN » Wed Mar 11, 2015 9:12 am

Hi

I can confirm, that this happens to me over and over again.
But - like Thomas - I have not noticed any "actions" that can provoke this.

One suspicion was that cutting-and-pasting other parts of the note could lead to this problem - but I am not really sure about that :?
Thomas Lohrum
Posts: 1312
Joined: Tue Mar 08, 2011 11:15 am

Re: Internal Note's Links II

Postby Thomas Lohrum » Wed Mar 11, 2015 11:22 am

Hi Chris,

thanks for confirming the issue. I always felt like i am the only one facing this. It is also interesting that you are seeing the issue quite often. The bug affects internal note links only, which is important for bug tracking. HTML links appear to work fine. I also observed that the issue might correlate with copy&paste actions. I don't remember any case when the bug would happen and i would immediately notice it. Usually i notice that the note got broken when i open it up the next time. This implies that the bug might affect text which is out of sight in the editor (not in the visible area) or that the bug does not affect the editor right away.

There is no workaround, but here are steps to clean up the mess in case anyone is facing the issue:

  • set the caret on the link (which might be text that should not be part of the link)
  • press Shift+Alt+D to delete the link (it will delete the reference but preserve the text)
  • select the text of the note that should be referenced
  • press Shift+Alt+N to create a new link (it should show up the desired note in the selection box)
  • press Enter to confirm

Thomas
User avatar
CintaNotes Developer
Site Admin
Posts: 4740
Joined: Fri Dec 12, 2008 4:45 pm
Contact:

Re: Internal Note's Links II

Postby CintaNotes Developer » Fri Mar 13, 2015 9:34 am

Thomas, Chris,
Thank a lot for the detailed report!
I'll pass this on to Denis to investigate, as he is responsible for the note links feature.
Alex
User avatar
CintaNotes Developer
Site Admin
Posts: 4740
Joined: Fri Dec 12, 2008 4:45 pm
Contact:

Re: Internal Note's Links II

Postby CintaNotes Developer » Thu Mar 19, 2015 6:01 am

Denis reports that despite multiple attempts, he was not able to reproduce the problem.
There must be some action that shifts the links. We just need to find it..
Any ideas? Thanks!
Alex
Thomas Lohrum
Posts: 1312
Joined: Tue Mar 08, 2011 11:15 am

Re: Internal Note's Links II

Postby Thomas Lohrum » Thu Mar 19, 2015 9:08 am

CintaNotes Developer wrote:Denis reports that despite multiple attempts, he was not able to reproduce the problem. There must be some action that shifts the links. We just need to find it.. Any ideas? Thanks!

There is no need in trying to reproduce the problem. You can't, because it is so hard to catch the moment it actually happens. Since it is related to internal links the code can be reviewed and compared to the html-link-handling. Possibly by another developer than the guy who coded it. What i do to catch such issues is to implement what i call a "fighter-interceptor". Add some code that observes and catches circumstances which must not happen. It is a kind of dynamic assert. In the case here one could track captions of all internal links (save them to a memory list) and their offset in the text. On any action test whether the saved captions still match the tracked (current) captions. In case they changed it is likely because of a change of the offset. In case of a failure warn the user and undo the last action. This should prevent the note from getting corrupted and should help to catch the steps necessary to reproduce the problem.

Thomas
Thomas Lohrum
Posts: 1312
Joined: Tue Mar 08, 2011 11:15 am

Re: Internal Note's Links II

Postby Thomas Lohrum » Thu Mar 19, 2015 10:29 am

One more time - just had it again creating a new note!

I tried to reproduce immediately - as usual without success.

The result text looks like this:

Title

  • skadjfhjwdehf
  • skdjfhjksdhf
  • öldkjdfsjdhf


Title

  • nmskdjfhsjdhf


Title

  • Internal Link #1
  • Internal Link #2


Features i used:

  • lists with plain text
  • lists with internal links (not just one)
  • Ctrl+Shift+U to format headlines


Remarks:

  • the internal links appear at the end of the text
  • the problem got obvious only after re-opening the note


Thomas
Thomas Lohrum
Posts: 1312
Joined: Tue Mar 08, 2011 11:15 am

Re: Internal Note's Links II

Postby Thomas Lohrum » Thu Mar 19, 2015 10:44 am

I can reproduce :D

I think it has to do with the handling of unicode characters, calculating their length respectively. At least this nails down one issue, maybe there are others left. The future will tell.

Steps to reproduce:

* create a new note
* press arrow-down to set caret to note's text
* press Ctrl+L
* press Alt+Shift+N
* search for a note reference
* press Enter to confirm and create an internal link
* press Home to set caret to position 1
* press Enter
* press up-arrow
* type some text, such as "bla bla €" ==> beware of the Euro-Symbol here!!!
* press Esc to save and exit
* re-open the note
=> voilà - there we go


No doubt - i am the best ;)

Thomas
User avatar
CintaNotes Developer
Site Admin
Posts: 4740
Joined: Fri Dec 12, 2008 4:45 pm
Contact:

Re: Internal Note's Links II

Postby CintaNotes Developer » Thu Mar 19, 2015 11:16 am

Thomas, yes you are! :)
I could reproduce, albeit only after I installed and used German layout to type that euro symbol.

Was this symbol present in your previously corrupted notes?
Alex
Thomas Lohrum
Posts: 1312
Joined: Tue Mar 08, 2011 11:15 am

Re: Internal Note's Links II

Postby Thomas Lohrum » Thu Mar 19, 2015 11:22 am

CintaNotes Developer wrote:I could reproduce, albeit only after I installed and used German layout to type that euro symbol.

You should be able to enter the symbol directly by holding the Alt-key and typing 20ac

CintaNotes Developer wrote:Was this symbol present in your previously corrupted notes?

Yes, i checked for the note which got corrupted on March 10. It also includes the euro symbol (before the internal note links).

Thomas
Thomas Lohrum
Posts: 1312
Joined: Tue Mar 08, 2011 11:15 am

Re: Internal Note's Links II

Postby Thomas Lohrum » Thu Mar 19, 2015 11:43 am

To all interested the problem is related to the computers handling of characters. This link gives an explanation http://www.firstobject.com/dn_markansifile.htm.

As one can see when using UTF-8 the Euro-symbol takes three bytes of storage. In case the software expects UTF-16 it calculates its size with one byte less, than necessary, causing the shift one can see in the editor. Because of that using other characters which take more than the usual two bytes will also cause the bug.

Thomas
User avatar
CintaNotes Developer
Site Admin
Posts: 4740
Joined: Fri Dec 12, 2008 4:45 pm
Contact:

Re: Internal Note's Links II

Postby CintaNotes Developer » Thu Mar 19, 2015 11:51 am

Thomas Lohrum wrote:You should be able to enter the symbol directly by holding the Alt-key and typing 20ac

In this case the error doesn't occur (and it's Alt+0128). This is a "Ctrl+Alt" problem.

Thomas Lohrum wrote:Yes, i checked for the note which got corrupted on March 10. It also includes the euro symbol (before the internal note links).

So if we are lucky seems that you've found the culprit.
But still we'll need to implement that watchdog, just to be sure.
Alex
Thomas Lohrum
Posts: 1312
Joined: Tue Mar 08, 2011 11:15 am

Re: Internal Note's Links II

Postby Thomas Lohrum » Thu Mar 19, 2015 12:02 pm

CintaNotes Developer wrote:So if we are lucky seems that you've found the culprit.

Can "ChrisCN" confirm the problem here?

CintaNotes Developer wrote:But still we'll need to implement that watchdog, just to be sure.

Implementing the watchdog can be tricky and takes time. It might also slow down the editor noticeably. Since we now have a good catch, i think it is ok to not implement the watchdog right away. A positive confirmation by ChrisCN will back up such the decision. I'd rather spend the time to check the code for relevant parts which also influence calculations of character length.

Thomas
gunars
Posts: 202
Joined: Fri Nov 08, 2013 5:35 am
Contact:

Re: Internal Note's Links II

Postby gunars » Thu Mar 19, 2015 5:33 pm

Excellent catch, Thomas! This sort of problem comes up when dealing with variable-length characters (UTF-8, DBCS, etc) where a character is not necessarily a fixed 8 (or 16 or 32) bits. Accented characters outside the Western European set would probably have triggered it also.
Thomas Lohrum
Posts: 1312
Joined: Tue Mar 08, 2011 11:15 am

Re: Internal Note's Links II

Postby Thomas Lohrum » Thu Mar 19, 2015 9:57 pm

Hi Alex,

i checked for older notes that might also be affected by the UTF-8 bug. It was rather hard to search for them, since i don't know of an easy way to filter notes that contain internal links. Still i found a note that i created and last modified in February. In the very first line it does contain a link that is corrupted. The note does not contain the euro-symbol. By its title i don't think it ever contained one. Also i was not able to see an obvious UTF-8 character that might have caused the issue. After all the UTF-8 bug might not be the only one. :( Do we need the watchdog at last?

Thomas
User avatar
CintaNotes Developer
Site Admin
Posts: 4740
Joined: Fri Dec 12, 2008 4:45 pm
Contact:

Re: Internal Note's Links II

Postby CintaNotes Developer » Fri Mar 20, 2015 8:08 pm

Thanks Thomas, that's worrisome.
I think we'll still implement the watchdog, just will make it optional so that its doesn't hog resources by default.
Could this note have been created before we fixed previous bugs in link place bookkeeping?
Alex
Thomas Lohrum
Posts: 1312
Joined: Tue Mar 08, 2011 11:15 am

Re: Internal Note's Links II

Postby Thomas Lohrum » Mon Mar 23, 2015 9:35 am

CintaNotes Developer wrote:Could this note have been created before we fixed previous bugs in link place bookkeeping?

Sorry, i am afraid the answer is no. The last fix to internal notes was back in 2014 (September/October???). My note was created on Feb. 06 2015.

Thomas
Thomas Lohrum
Posts: 1312
Joined: Tue Mar 08, 2011 11:15 am

Re: Internal Note's Links II

Postby Thomas Lohrum » Wed Mar 25, 2015 11:56 pm

I've just been working on a rather large note containing many note links. Most of them as part of lists. There was a € symbol included at some time. However, i had deleted that part of the note before and reopened it, before i noticed the problem. I did some copy&paste, deleted text, deleted note links (the text including the link by selecting the text and pressing Del), did some editing....and noticed that an internal link at the very end of the note text just got corrupted. Sorry, this involved complex editing of the note. No easy way of reproducing my steps.

Also there were a couple of note links that i had corrected a couple of days ago. But today i realized they all referenced one single note, though their caption was unique.

Thomas
User avatar
CintaNotes Developer
Site Admin
Posts: 4740
Joined: Fri Dec 12, 2008 4:45 pm
Contact:

Re: Internal Note's Links II

Postby CintaNotes Developer » Sat Mar 28, 2015 1:45 pm

Thomas, thanks for the latest comments. Ok, so the summary is: complex editing actions can still trigger "link wandering". All the more reason to implement the debug watchdog.
Alex
Thomas Lohrum
Posts: 1312
Joined: Tue Mar 08, 2011 11:15 am

Re: Internal Note's Links II

Postby Thomas Lohrum » Tue Mar 31, 2015 11:41 am

The € symbol does affect file links also (created by Alt+Shift+F). I've just had such a case.

Thomas

Return to “Bug Reports”