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

abbreviation not removed #434

Open
ghost opened this issue Aug 4, 2020 · 4 comments
Open

abbreviation not removed #434

ghost opened this issue Aug 4, 2020 · 4 comments
Labels
autokey-qt phrase expansion Issues related to Phrases

Comments

@ghost
Copy link

ghost commented Aug 4, 2020

Classification:

Bug

Reproducibility:

Always

Version

AutoKey version: 0.95.9

Used GUI : Qt

Installed via: (PPA, pip3, …). pip3

Linux Distribution: opensuse 15.2

Summary

The abbreviation is not removed even though it is configured this way.

Steps to Reproduce (if applicable)

phrase = Albrecht Mehl
abbreviation = na
hotkey = f7
trigger on all non-word
remove typed abbreviation

My name is na [and the hotkey F7 behind na. This is not shown as autokey triggers, see note below]

Expected Results

My name is Albrecht Mehl

Actual Results

My name is naAlbrecht Mehl

Important note: this bug happens when writing within the editor kate. It does not happen here when writing this issue,
i.e. within the window '...autokey/issues/new', i.e. within the browser FireFox.

Arno

@ghost
Copy link
Author

ghost commented Aug 5, 2020

I apologize for not having expressed myself clearly in the note at the end of my post. This note should be:

When writing 'My name is na[F7] this results

  • in the editor kate in 'My name is naAlbrecht Mehl'
  • here within this page ...issues/434, i.e. in the browser Firefox in 'My name is Albrecht Mehl'

i.e. autokey works correctly within Firefox, not correctly within kate.
This almost makes autokey useless as one cannot rely on it ... always asking oneself whether autokey works within the program one just uses is cumbersome.

Arno

@josephj11 josephj11 added autokey-qt phrase expansion Issues related to Phrases labels Aug 6, 2020
@josephj11
Copy link
Contributor

I'm using 0.95.10 on kubuntu 18.0
I tried and failed to duplicate this issue. It works fine for me in kate and Firefox (using a trigger abbreviation or a hotkey.)

I checked the release notes for 0.95.10 and it doesn't look like anything that might affect this issue was changed.

Maybe this is just a misunderstanding.

When a phrase (or script) has both a trigger abbreviation and a hotkey defined, you use one or the other - not both at the same time.

When you typed your trigger abbreviation, you "stopped" before typing a non-word character, so there was nothing for AutoKey to do yet. Then, you pressed F7 which triggered your phrase correctly. The trigger abbreviation was never seen as such by AutoKey because it was not immediately followed by a non-word character and so was treated as normal text.

I was able to duplicate this behavior, but that is how it's supposed to work and not a bug.

If I have misunderstood something, let me know.

@ghost
Copy link
Author

ghost commented Aug 7, 2020

Thank you for your reply.

I'm using 0.95.10 on kubuntu 18.0
I tried and failed to duplicate this issue. It works fine for me in kate and Firefox (using a trigger abbreviation or a hotkey.)

This gives me hope that it will work with me, too.

Maybe this is just a misunderstanding.

I am afraid that this is on my side not misunderstanding, but not understanding.

When a phrase (or script) has both a trigger abbreviation and a hotkey defined, you use one or the other - not both at the same time.

I do not know what the difference between trigger and hotkey is. Simply I know what I want:

  • no 'automatic' replacement of abbreviation by phrase by triggering whatsoever
  • replacement on typing [F7] immediately behind the abbreviation with removal of abbreviation.

So I would be grateful to get from you hints on how to configure

  • the main autokey window
  • the Set abbreviations window

to get this result.

Probably I have to be a bit ashamed to ask these questions. But I always think: 'Better ask dumb questions than staying dumb'

Arno

@josephj11
Copy link
Contributor

A trigger abbreviation would be configuring a phrase or script to run when you type something like "na". The default is for AutoKey to wait for the next character typed to be a non-word character like punctuation or white space. So, e.g., if you type "na " it would activate, but if you type "name", it would not do anything.

When you define a phrase or script in the AutoKey main window, you can tell it to trigger when typed as part of word or to trigger immediately without waiting for a non-word character to be typed. You can also tell it to leave the trigger abbreviation in the text or to erase it. There are a few other options as well.

If you configure a hotkey for a phrase or script, then what you typed before pressing the hotkey doesn't matter. As soon as you press the hotkey (such as F7), the phrase or script will run.

So the two invocation methods are conceptually separate. They don't work together. One or the other starts the phrase or script.

If you are running a script, it can subsequently do whatever you are skilled enough to make it do, but that is conceptually independent of how it was invoked.

As you learn more about AutoKey and have questions or issues, please join us on our support list where more help is available. We want to reserve GitHub issues for actual bug reports and feature requests. If you're not sure, start out on our list and if it really ends up being a bug or feature request, then open an issue here.

If you really want F7 to do nothing unless the last two characters typed (or just to the left of the current text position) are "na", you can code that in a script, but it will require fooling around with selecting those characters, copying them to the clipboard, loading them into a variable which you can then test to see if it is "na".

While this is certainly not "rocket science," it should probably not be attempted until you have successfully written a few much simpler scripts and are comfortable with how the basic features of AutoKey work.

As a script gets more involved and has more steps, it's also important to add more error checking to the code. Otherwise, once a script goes off the rails, it will keep on running blindly until it does something illegal and dies or potentially does a bunch of unintended actions with unpredictable consequences.

I have one such script I use (and accidentally misuse) regularly. When I run it in the wrong context, I just have to sit there and watch it screw up my screen until it's done. You want to avoid this if possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autokey-qt phrase expansion Issues related to Phrases
Projects
None yet
Development

No branches or pull requests

1 participant