Skip to content

Conversation

@qqrm
Copy link
Owner

@qqrm qqrm commented Jan 27, 2026

Motivation

  • Punctuation-only or letter-absent inputs could be converted in the wrong direction because the old heuristics had no explicit direction API.
  • Prefer the user-visible/foreground keyboard layout when letter counts are tied or absent so conversions match user expectations.
  • Ensure the contributor/agent workflow mandates running and addressing formatting, linting, build, and test checks before finalizing changes.

Description

  • Introduced ConversionDirection and convert_ru_en_with_direction and added conversion_direction_for_text plus letter-count helpers in src/domain/text/mapping.rs to allow explicit-direction conversions and deterministic behavior for punctuation-only inputs.
  • Implemented expected_direction_for_foreground_window() and layout helpers in src/domain/text/convert.rs to derive a layout-based fallback from the HKL/LANGID of the foreground window.
  • Updated selection- and last-word conversion flows to prefer conversion_direction_for_text and fall back to the foreground layout via a convert_with_layout_fallback wrapper, replacing direct uses of the old bidirectional API in src/domain/text/last_word.rs and src/domain/text/convert.rs.
  • Adjusted punctuation mappings so RU->EN and EN->RU behaviors are distinct (added complementary &? mapping) and added a unit test punctuation_only_respects_explicit_direction in src/tests/mapping_invariants_tests.rs.
  • Documented required agent workflow checks (format, clippy, build, tests) in AGENTS.md and applied rustfmt-aligned formatting tweaks to a few modules.

Testing

  • Ran cargo +nightly fmt --check which succeeded.
  • Ran cargo +nightly clippy --all-targets --all-features -- -D warnings which failed due to numerous unresolved Windows API items (the windows crate / Win32 symbols are not available in the current CI/host environment), producing type and unresolved-symbol errors.
  • Ran cargo +nightly build --features debug-tracing which failed for the same reason (many unresolved windows symbols and environment-specific items), so the project binary could not be built here.
  • Ran cargo +nightly test --locked which also failed because the crate could not be compiled; the new unit test is present but could not be executed due to the build failures described above.

Codex Task

@qqrm qqrm merged commit 1708fcc into dev Jan 27, 2026
1 check failed
@qqrm qqrm deleted the codex/add-layout-language-detection-utility branch January 27, 2026 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants