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

Shorthand: use Hotstring() to replace Loop + Input #144

Open
lintalist opened this issue Nov 20, 2019 · 16 comments
Open

Shorthand: use Hotstring() to replace Loop + Input #144

lintalist opened this issue Nov 20, 2019 · 16 comments
Assignees

Comments

@lintalist
Copy link
Owner

Currently Lintalist uses a "faux" hotstring function by using a Loop + Input.

This should be replaced by the new native https://autohotkey.com/docs/commands/Hotstring.htm function for better reliability.

@beefeater7
Copy link

Is this related to performance contrast between hotstrings and shorthand? Will briefs be faster now?

@lintalist
Copy link
Owner Author

Yes, using Hotstrings() should improve the overall reliability and possibly offer some speed improvements.

@lintalist
Copy link
Owner Author

A (experimental!) development branch is available here:
https://github.com/lintalist/lintalist/tree/dev-hotstrings

If you try it out please make sure you have a backup of your bundles, they may end up corrupted (shouldn't happen but if you have backups nothing is lost)

@beefeater7
Copy link

I finally got around to trying this, and the performance markedly improved! Very nice.

@exetico
Copy link
Contributor

exetico commented Oct 20, 2020

I've tested the experimental fix, but it happend again. However, it took a good amount of time, compared to the normal 5-30minutes (2-3 hotstrings).

Are there any way to check why it's not listening, like it should? (Debug-log, specific commands, command-lookup, and so on...)

@lintalist
Copy link
Owner Author

Nope, no debugging available, I tried to add something in the past but as it jumps around all over the script it isn't really feasible (would require a "log" command after nearly every command to pin point a problem). This experiment was a first attempt, the entire shorthand/hotkey routine needs to be redone which would hopefull fix it, if it doesn't it should at least make it a bit easier to bug track where it "stops" :(

@exetico
Copy link
Contributor

exetico commented Oct 27, 2020

Update: After moving the application to another locations, it's more stable with the Hotstring(), so something must be working - And I can't tell if it's a combination, or if it isolated to a single thing. I'll continue to use the experimental version.

@exetico
Copy link
Contributor

exetico commented Jun 23, 2021

Hi,

There's something broken in the latest dev-hotsrings branch. Going from shorthand to key-shotcut works every time, but going from key-shotcut to shorthand doesn't work properly. It's failing to execute the shorthand properly the first time.

Example:

  1. "test" > Shorthand works
  2. Ctrl+Alt+b > Key-shortcut works
  3. "test" > Shorthand doesnt execute properly. But the shorthand text itself, are removed from the editor where I entered "test".
  4. "test" again > Now it's working again.

Grap the latest dev-hotstrings, and use the following bundle:

BundleFormat: 1
Name: Default
Description: Default bundle for Lintalist
Author: Lintalist
TitleMatch:
Patterns:
- LLPart1: This is Snippet Part 1, refer to documentation for further info.
  LLPart2: This is Snippet Part 2
  LLKey: 
  LLShorthand: test
  LLScript:
- LLPart1: This is Snippet Part 111, refer to documentation for further info.
  LLPart2: This is Snippet Part 222
  LLKey: ^!b
  LLShorthand: 
  LLScript:

Or grap my file:
lintalist-dev-hotstrings.zip

I really hope you're able to fix this, @lintalist . I'm not that good in the AHK-codebase, so I can't spot what's breaking.

Here's a GIF:
lintalist-bug

The "Hotstring()" method are way more stable, so it's not an option to go back to the old loop-method. 🦄🌞 🌈

@lintalist
Copy link
Owner Author

I'm still thinking about it :) one caveat I can't put my finger on is how to deal with duplicate hotstrings that are available in two or more bundles. e.g. /b in HTML and CSS which (titlematch for both: html,css) which at the moment shows a menu "which one to use" - with hotstrings I haven't thought of a way to do that - or I would simply have to accept you can only have one hotstring (it would load only the first one it finds so either always HTML or CCS in the case, would depend on which bundle would be loaded first).

AutoHotkey 2 (beta) is around the corner, so I'm tempted to re-write Lintalist in AutoHotkey v2 getting rid of all the spaghetti code and "dirty hacks" which would make it easier to maintain.

@exetico
Copy link
Contributor

exetico commented Jun 23, 2021

@lintalist - That's fair. But can't we fix the issue, which I just mentioned? I thought that was easy to fix 😊? That would be SO NICE 😅...

@lintalist
Copy link
Owner Author

Try this (experimental so backup everything) lintalist.zip

@exetico
Copy link
Contributor

exetico commented Jun 24, 2021

Looks OK to me :-) https://www.diffchecker.com/soSDCQF9

I'll give it a try!

Update:
Looks OK in my end. Can OutputDebug be removed? I guess so... So I've just removed these lines.

lintalist.zip

@lintalist
Copy link
Owner Author

lintalist commented Jun 24, 2021

Do report back if

  • it works flawlessly :)
  • the wrong snippet is pasted at some point, especially if you can reproduce it
  • if snippets go missing or get duplicated somehow

Edit: I think you can still make it trip up after cancelling a plugin (choice, filelist)

@exetico
Copy link
Contributor

exetico commented Jul 2, 2021

Still no issues seen in the latest fix 👍

@exetico
Copy link
Contributor

exetico commented Jul 21, 2021

Hi Lintalist.

Here's another follow up. Everything are working as expected, and we've not seen other issues/bugs in relation to this change. So I guess it's safe to make the chage in the main release.

@lintalist
Copy link
Owner Author

It stopped working two times in a row today, I don't know why though. There is a certain chain of events that sets or doesn't clear a variable that is used later so it just stops and only a restart fixes it. It can work for days on end and today I did something and it stopped, but I can't pin point it to what "it" is yet. Very annoying.

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

No branches or pull requests

3 participants