Skip to content

Commit

Permalink
Merge pull request #968 from benoit-pierre/fix_bug966
Browse files Browse the repository at this point in the history
formatting: fix orthographic replacements
  • Loading branch information
morinted committed Jun 5, 2018
2 parents e66222a + 280a7d5 commit ace4050
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
4 changes: 3 additions & 1 deletion plover/formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,9 @@ def _apply_meta_attach(meta, ctx):
):
new_word = add_suffix(last_word, meta)
common_len = len(commonprefix([last_word, new_word]))
action.prev_replace = last_word[common_len:]
replaced = last_word[common_len:]
action.prev_replace = ctx.last_text(len(replaced))
assert replaced.lower() == action.prev_replace.lower()
last_word = last_word[:common_len]
meta = new_word[common_len:]
action.text = meta
Expand Down
18 changes: 18 additions & 0 deletions test/test_blackbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -1380,3 +1380,21 @@ def test_bug961(self):
PHAED/KWREUS 'madies '
* 'made '
'''

def test_bug966_1(self):
r'''
"-G": "{^ing}",
"KPA*L": "{<}",
"TKPWAEUPL": "game",
KPA*L/TKPWAEUPLG ' GAMING'
'''

def test_bug966_2(self):
r'''
"-G": "{^ing}",
"KPA*L": "{<}",
"TKPWAEUPL": "game",
KPA*L/TKPWAEUPL/-G/* ' GAME'
'''

0 comments on commit ace4050

Please sign in to comment.