Skip to content

longzhongliang/programming-ime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

编程输入法

A Windows TSF proof-of-concept for programmers: letters are committed to the editor immediately, while locally generated Pinyin candidates are shown in a separate, non-activating popup. The popup shows the current Pinyin and up to nine horizontal choices such as 1 中国 2 中果; pressing that number replaces the still-verified Pinyin range. Tab and code punctuation continue to the editor; Esc only cancels candidates.

Privacy and safety

  • All input processing, the bundled dictionary, and settings stay on the device.
  • The IME makes no network requests and stores only the selected input mode in %LocalAppData%\CodeFirstPinyinIme\settings.json.
  • The runtime bundle contains one compact, approximately 2.6 MB dictionary with 108,652 entries derived from rime-ice; the full upstream repositories are not installed or loaded.
  • A candidate replacement is refused if the captured text range or adjacent caret has changed.
  • This project is currently a development MVP. Do not distribute an unsigned third-party IME.

Build

Open an x64 Visual Studio Developer Command Prompt, then run:

cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug
cmake --build build
ctest --test-dir build --output-on-failure

This produces build\CodeFirstPinyinIme.dll, build\pinyin_open_source.tsv, third-party license/provenance files, build\code_first_pinyin_register.exe, and the non-installing build\candidate_window_demo.exe.

Development registration

Windows TSF registration on this machine requires elevation. The command replaces only the machine-wide TSF/COM registration, copies the current DLL, compact dictionary, notices, and registration helper to a new versioned directory below %ProgramFiles%\CodeFirstPinyinIme, then registers a Simplified Chinese TSF profile and COM server for the machine. Earlier versioned directories are retained for rollback, so a DLL mapped by an editor is never overwritten or deleted during an upgrade. Run it only from an Administrator PowerShell prompt.

PowerShell -ExecutionPolicy Bypass -File .\scripts\register-dev.ps1 -Action Install

Select Code-First Pinyin IME (Development) from Windows input settings, then test in Notepad or an IDE. Remove all development registration and copied files with:

PowerShell -ExecutionPolicy Bypass -File .\scripts\register-dev.ps1 -Action Uninstall

If Windows rejects an unsigned development IME, use the uninstall command above and obtain a suitable code-signing certificate before further testing or distribution.

Behavior

  • Type ASCII letters: the letters enter the editor immediately; a plausible Pinyin prefix opens a visible popup from the first letter, with the Pinyin on top and up to nine numbered Chinese candidates in one horizontal row.
  • Press 19: a replacement occurs only while the pinyin text and caret still match the captured TSF range.
  • Press Tab or code punctuation: the editor handles it normally and candidates are cleared.
  • Press Esc: candidates are cleared without changing editor text.
  • Press backtick: toggle automatic/manual candidate mode. The setting stays local.

Open-source dictionary

The bundled dictionary is a deterministic compact derivative of rime-ice, pinned to the revision documented in third_party/rime-ice/SOURCE.md. It contains the 100,000 highest-frequency base entries plus the complete 8105-character table. rime-ice and the derivative are GPL-3.0-only; see docs/third-party-notices.md and third_party/rime-ice/LICENSE.

TSF placement and UI-element lifecycle patterns are adapted from Microsoft's MIT-licensed Windows classic SampleIME; see third_party/microsoft-sample-ime/SOURCE.md. Microsoft Pinyin itself is not open source and no Microsoft Pinyin product code is included.

Candidate-window demo

To inspect the horizontal popup without installing or registering an IME, run:

.\build\candidate_window_demo.exe 8000

The optional argument is the display duration in milliseconds.

WiX package

The WiX v4 source is installer/CodeFirstPinyin.wxs. With WiX v4 installed, after a successful CMake build run:

wix build .\installer\CodeFirstPinyin.wxs -d BuildDirectory=$((Resolve-Path .\build).Path) -o .\build\CodeFirstPinyin.msi

The MSI installs per machine below %ProgramFiles% and invokes the same elevated registration helper at install/uninstall. Verify the MSI on a disposable development machine before distribution.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors