mikehardy / thunderlink

Link to your Thunderbird emails!
Mozilla Public License 2.0
42 stars 14 forks source link

Ctrl+Alt+Number shortcuts broken again #39

Closed gcamaril closed 3 years ago

gcamaril commented 5 years ago

Hi,

the Ctrl+Alt+Number shortcuts are working fine for me when using Thunderlink 1.2.6 with ThunderBird 60.3.3 (win 32). However, when I upgrade to Thunderlink 1.2.9 the shortcuts do not work any longer.

For example, this is my entry for Ctrl+Alt+2: extensions.thunderlink.custom-tl-string-2;<thunderlink>

This seems to be related to the following issue: https://github.com/mikehardy/thunderlink/issues/36

Thanks!

mikehardy commented 5 years ago

@gcamaril - can you put the exact entry in quotes so markdown will render it? Markdown won't take HTML unless it is in ticks like so:

<html tag here should show up>

Or if it is longer you do triple ticks on lines above+below:

this is a longer
quote block
that should show up
even <with> weird <tags>
mikehardy commented 5 years ago

Actually never mind, I realized I could edit the comment and fix it - the tag was still there :-). I think we have the info we need. And some fresh markdown skills ;-)

mikehardy commented 5 years ago

I am unable to reproduce this in Thunderbird 60.5.1 (that's win32 current I believe?) and Thunderlink 1.2.9

Can you open the console (ctrl-shift-J), hit the trashcan on the top-left (to clear output) then try a shortcut to see what happens and send the contents here? It should look something like this:

screenshot from 2019-02-20 09-49-40

mikehardy commented 5 years ago

As a hunch, maybe there is something going on with the preferences, since you are good with emacs, maybe you could upgrade to thunderlink 1.2.9, close thunderbird, cat the preferences through a grep -v for thunderlink and put the now thunderlink-free preferences in place, try reconfiguring with thunderlink 1.2.9 (fresh preferences) and see what happens? If that works, then maybe we have some preferences upgrade thing we need to do from 1.2.6 -> 1.2.9

gcamaril commented 5 years ago

Hi,

Using version 1.2.9, this is the console's output when I try Ctrl+Alt+1, which is defined as: From: <sender> Subject: <subject> <tbexe> <thunderlink>

tl1 2 9

With respect to the TB version I am using, I am using TB 60.3.3 right now because using later win32 TB releases broke other parts of the addon (such as clicking on a Thunderlink from an external application). Once we resolve this one, I will update to the latest TB and see if there are still more issues ;-)

Thanks!

gcamaril commented 5 years ago

For comparison, if I do the same as above but using version 1.2.6, everything works fine and this is the console's output:

tl1 2 6

Cheers!

mikehardy commented 5 years ago

It's the carriage return - it needs to be '\n' now - this is as discussed here:

https://github.com/mikehardy/thunderlink/issues/36#issuecomment-457354068

I'll put a $1 on that fixing it. This does mean that we're taking working preferences from 1.2.6 and with the new control characters they aren't working in 1.2.9 anymore - @MarioKusek the way the replacement is done here doesn't generate valid JSON but we send it through JSON.parse anyway ?

You can see as an example the preference resolved in the image above - it's got newlines in it, but I'm assuming they are windows CRLFs instead of \n

mikehardy commented 5 years ago

This may or may not actually be platform-specific but until it's reproduced on mac or linux I think it might just be windows newlines - unsure

MarioKusek commented 5 years ago

So is your template is this?

From: <sender>
Subject: <subject>
<tbexe> <thunderlink>
gcamaril commented 5 years ago

Using \n fixes the issue partially. That is, if I use the following with Ctrl+Alt+1, everything works fine:

From: <sender>\nSubject: <subject>\n<tbexe> <thunderlink>\n

Before logging this issue, I had actually tried that and it did not work. The reason seems to be that I had tried it using Ctrl+Alt+2 instead. I have now used the code above for both Ctrl+Alt+1 and Ctrl+Alt+2 and while the former one works, the latter one doesn't! When I hit Ctrl+Alt+2, there is no output at all on the console.

These are the preferences I am using:

prefs

Cheers!

MarioKusek commented 5 years ago

What is output in console when you hit Ctrl+Alt+2?

gcamaril commented 5 years ago

The console output after hitting Ctrl+Alt+2 is absolutely nothing:

console2

Cheers!

gcamaril commented 5 years ago

I have just updated to the current version of TB for win32 (60.5.1) and the issue above with Ctrl+Alt+2 is still there.

MarioKusek commented 5 years ago

I can not reproduce it on mac :( On my machine it works fine.

@mikehardy Can you reproduce it on win?

gcamaril commented 5 years ago

I have tried all the shortcuts (from 1 to 8) and the only ones that work are Ctrl+Alt+1 and Ctrl+Alt+6.

MarioKusek commented 5 years ago

That is strange because they are declared in the same way (look here lines 18-25).

The only thing that comes to my mind is that either some other TB plugin has the same shortcuts or the OS is using those shortcuts for something else.

Anyway, you can check active shortcuts by using plugin Dorando keyconfig. In the preferences of that plugin look for keys cpCstTlStr1 where 1 is for first. There you can even change shortcut and try with new keys.

gcamaril commented 5 years ago

Yes, I also use the keyconfig add on. It does not show anything strange either:

keyconfig

In any case, I myself only actually use one Thunderlink shortcut, which is Ctrl+Alt+1. So, if you guys cannot reproduce the problem, feel free to close this issue.

Thanks!

gcamaril commented 5 years ago

I have used keyconfig to define another shortcut (Shift+Q) with the same code as Ctrl+Alt+2: ThunderLinkChromeNS.ActivateCustomTlString(2);

And it works. So, there must be something in my system picking the Ctrl+Alt+Number shortcuts that do not work. Being able to use keyconfig to go around that resolves all the remaining issues I had.

Thanks a lot for the quick responses!

mikehardy commented 5 years ago

There is still the issue that previously working configs need a change manually or a migration or the regex needs a change in the extension and a new release...

MarioKusek commented 5 years ago

Can we put in convertEscapeCharacters another replacement of CR to \r and LF to \n before parsing JSON?

mikehardy commented 5 years ago

definitely - I think that would fix it up