Type forced English directly, without an underlined composition
After a Shift tap, letters, digits and word punctuation go straight to the app instead of into marked text, so nothing is underlined. Space, Enter, Tab, Escape or another symbol ends the forced word and automatic detection resumes; backspace is handled by the app. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -267,5 +267,25 @@ class CursorTests(unittest.TestCase):
|
||||
self.assertTrue(e.showing_candidates)
|
||||
|
||||
|
||||
class DirectEnglishTests(unittest.TestCase):
|
||||
def test_forced_english_has_no_composition(self):
|
||||
e = make_engine()
|
||||
e.handle(SHIFT_TAP)
|
||||
self.assertEqual(e.handle("r"), (True, "r"))
|
||||
self.assertEqual(e.marked_text, "")
|
||||
self.assertEqual(e.handle("'"), (True, "'"))
|
||||
self.assertEqual(e.handle(BACKSPACE), (False, None))
|
||||
self.assertTrue(e.english_armed)
|
||||
self.assertEqual(e.handle(" "), (True, " "))
|
||||
self.assertFalse(e.english_armed)
|
||||
|
||||
def test_enter_ends_forced_english(self):
|
||||
e = make_engine()
|
||||
e.handle(SHIFT_TAP)
|
||||
e.handle("a")
|
||||
self.assertEqual(e.handle(ENTER), (False, None))
|
||||
self.assertFalse(e.english_armed)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user