Documentation · Where it works

Lang Switcher in browsers, Word and Telegram: how the word gets replaced

In ordinary windows, the program selects the word you typed and types the replacement over it in one go, so autocomplete can’t swallow any letters. The clipboard isn’t touched.

How the replacement works

In ordinary windows, such as a browser, Word, Telegram or Notepad, the program selects the word you typed (Shift+← as many times as the word has characters) and types the replacement over the selection, so the word is replaced in one go. Then it switches the window’s layout.

Erasing letter by letter would be simpler, but in programs with autocomplete and autocorrect, a single Backspace can erase a whole suggested word instead of one letter.

The clipboard isn’t touched. Only text you select yourself goes through it: the program copies the selection, converts it, pastes it, and then puts back whatever was on the clipboard before.

Browsers

  • The address bar. The list of suggestions that drops down as you type doesn’t cut the word off: the program can tell this change of focus from you moving to another field.
  • Password fields. Keystrokes there are deliberately not remembered, and pressing Pause gets you a dull thud.
  • A page script that moves the cursor to the next field by itself, as confirmation code fields often do, looks to the program just like typing. If you press the hotkey right after such a jump, the fix may land in the new field.

Word and Outlook

  • Word’s AutoCorrect doesn’t get in the way: the word is selected and replaced as a whole.
  • The layout switched back on its own? That’s the Office option “Automatically switch keyboard to match language of surrounding text”: Office changes the layout itself, after the replacement. You can turn it off in Office, under File → Options → Advanced → Editing options.

Telegram

Telegram Desktop handles input its own way: a character sent as a press without a release gets repeated, so instead of “hello” you’d get “hhhhh”. That’s why the program sends every character of the replacement as a press and a release, and in Telegram Desktop the word arrives whole.

Code editors

On Ctrl+C with nothing selected, VS Code and similar editors copy the whole line. If you press the hotkey without having typed a word, the program takes that line for selected text and pastes a converted copy of it. If that gets in the way, clear “Convert the selected text” in the “General” section of the settings.

If something goes wrong

  • A program reads the keyboard directly, bypassing Windows, as many games do: add it to the exclusions.
  • Letters go missing or get replaced wrong: in the settings file, you can set the replacement method by hand, [replacement] method = backspace or selection, and a pause between events, [replacement] inter_event_delay_ms. That’s a last resort: auto suits almost everyone.
  • Write to me: tray menu → “Write to the author…”. Switch to the window where it didn’t work, and the wizard fills in the program’s name by itself.

Questions and problemson GitHub Issues ↗ or by email: send.me@panda-pishet-kod.dev