ajs124 / autokey

Automatically exported from code.google.com/p/autokey
GNU General Public License v3.0
0 stars 0 forks source link

No replacements made #219

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run 'autokey -l' in terminal.
2. Change focus to any text window (e.g., Mousepad).
3. Type any letter/number.

What is the expected output? What do you see instead?

Autokey should replace configured abbreviations.  Instead, no replacements are 
made, and even a single letter triggers an exception:

Exception in thread KeypressHandler-thread:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/dist-packages/autokey/iomediator.py", line 204, in run
    target.handle_keypress(rawKey, modifiers, key, windowName, windowClass)
  File "/usr/lib/python2.7/dist-packages/autokey/service.py", line 179, in handle_keypress
    currentInput, windowInfo, True)
  File "/usr/lib/python2.7/dist-packages/autokey/service.py", line 304, in __checkTextMatches
    if item.check_input(buffer, windowInfo):
  File "/usr/lib/python2.7/dist-packages/autokey/model.py", line 735, in check_input
    abbr = self._should_trigger_abbreviation(buffer)
  File "/usr/lib/python2.7/dist-packages/autokey/model.py", line 134, in _should_trigger_abbreviation
    if self.__checkInput(buffer, abbr):
  File "/usr/lib/python2.7/dist-packages/autokey/model.py", line 147, in __checkInput
    stringBefore, typedAbbr, stringAfter = self._partition_input(buffer, abbr)
  File "/usr/lib/python2.7/dist-packages/autokey/model.py", line 189, in _partition_input
    stringBefore, typedAbbr, stringAfter = matchString.rpartition(abbr)
ValueError: empty separator

What version of the product are you using? On what operating system?

Autokey 0.90.4, KDE 4.8.5, Xubuntu 12.04

Please provide any additional information below.

Full command-line log attached.  To obtain this, I ran 'autokey -l', clicked on 
an open Mousepad window, and typed the letter 'a', then exited Autokey normally.

Original issue reported on code.google.com by justin.y...@gmail.com on 26 Sep 2012 at 4:00

Attachments:

GoogleCodeExporter commented 9 years ago
OK, found the problem.  I had accidentally entered a *blank* abbreviation for a 
given phrase.  Since it was blank, I didn't see it in the abbreviations window, 
and the only way I noticed (besides knowing how rpartition() can throw a 
ValueError) was that the list of abbreviations was '[question,question,]': 
there was an extra comma at the end.

It might be a good idea to notify the user if he/she has entered an empty 
abbreviation, or disallow it altogether.

Original comment by justin.y...@gmail.com on 26 Sep 2012 at 4:44