Skip to content

Conversation

@bilboquet
Copy link
Contributor

Description

This PR adds the support for arrow keys in navigation mode. I need this because I use the "bepo" layout, so h,j,k and l are dispersed around my keyboard, and it does not make much sense to use them for navigating.
Remapping c,t,s and r - that are at the same place as h,j,k and l - would conflict very badly helix key bindings.
I hope this would be useful to other non "standard" keyboard layout.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test coverage improvement

Related Issues

Closes #

Changes Made

  • add app_config module

Testing

Test Results

  • All existing tests pass (cargo nextest run --lib)
  • Added new tests for new functionality
  • Manual testing completed
# Test commands run
cargo nextest run --lib
cargo clippy -- -D warnings
cargo +nightly fmt -- --check
cargo deny check

Test Coverage

  • I test that arrow keys behave like h,j,k and l

Screenshots/Demo

Checklist

  • Code follows the project's style guidelines
  • Self-review of code completed
  • Comments added for complex logic
  • Documentation updated (if applicable)
  • No new warnings generated
  • Tests added/updated and passing
  • CLAUDE.md updated (if architecture changed)
  • README.md updated (if user-facing changes)

Performance Impact

  • No performance impact
  • Performance improved
  • Performance impact assessed and acceptable

Security Considerations

  • No security impact
  • Security review completed
  • Input validation added/updated

Additional Notes

@codecov-commenter
Copy link

codecov-commenter commented Jan 17, 2026

Codecov Report

❌ Patch coverage is 92.22222% with 28 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/main.rs 0.00% 16 Missing ⚠️
src/input/handlers.rs 95.53% 8 Missing ⚠️
src/ui/state/substates.rs 57.14% 3 Missing ⚠️
src/config/app_config.rs 99.30% 1 Missing ⚠️

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #153      +/-   ##
==========================================
+ Coverage   91.58%   91.59%   +0.01%     
==========================================
  Files         123      124       +1     
  Lines       24921    25279     +358     
==========================================
+ Hits        22823    23154     +331     
- Misses       2098     2125      +27     
Flag Coverage Δ
unittests 91.59% <92.22%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/ui/state/mod.rs 67.66% <100.00%> (+1.16%) ⬆️
src/config/app_config.rs 99.30% <99.30%> (ø)
src/ui/state/substates.rs 96.75% <57.14%> (-1.56%) ⬇️
src/input/handlers.rs 90.77% <95.53%> (+1.23%) ⬆️
src/main.rs 0.00% <0.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a user-configurable option to enable arrow keys for cursor movement in normal mode, specifically designed to help users with non-standard keyboard layouts (like bépo) where h/j/k/l keys are not conveniently positioned for navigation.

Changes:

  • Added persistent application configuration storage system with JSON serialization
  • Introduced enable_arrow_keys_in_normal_mode configuration option that maps arrow keys to h/j/k/l movement commands in normal mode
  • Modified application state initialization to support custom configuration via new with_config method

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/config/app_config.rs New module implementing configuration storage and persistence with JSON serialization to ~/.config/helix-trainer/config.json
src/config/mod.rs Added app_config module and exports for AppConfig and ConfigStorage
src/ui/state/substates.rs Added enable_arrow_keys_in_normal_mode boolean field to ConfigState with default value of false
src/ui/state/mod.rs Added with_config method to support custom configuration initialization while maintaining backward compatibility with existing new method
src/main.rs Integrated configuration loading on startup and saving on exit, with error handling and logging
src/input/handlers.rs Implemented arrow key to h/j/k/l mapping logic with conditional behavior based on configuration, including comprehensive tests

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Owner

@bug-ops bug-ops left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review

Thanks for the contribution! Arrow key support for non-standard keyboard layouts like bépo is a useful feature.

I've reviewed the implementation and found a few issues that should be addressed before merging.

Summary

Good:

  • Clean implementation following existing ProfileStorage pattern
  • Feature is opt-in (disabled by default)
  • Good test coverage

⚠️ Issues to address:

  1. Error handling uses Result<_, String> instead of proper error types
  2. Field duplication between AppConfig and ConfigState
  3. Config is saved on every exit regardless of changes

See inline comments for specific suggestions.

@github-actions github-actions bot added enhancement New feature or request ui User interface components input Input handling and key mapping config Configuration and settings labels Jan 18, 2026
Signed-off-by: Jean-François <jfm@laposte.net>
Signed-off-by: Jean-François <jfm@laposte.net>
Signed-off-by: Jean-François <jfm@laposte.net>
Signed-off-by: Jean-François <jfm@laposte.net>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@bug-ops
Copy link
Owner

bug-ops commented Jan 20, 2026

Hey, @bilboquet! Great implementation! A few items to consider for future PRs:

  1. ConfigData wrapper simplification - The ConfigData struct wraps AppConfig to produce {"config": {...}}
    JSON. Consider serializing AppConfig directly to reduce indirection.

  2. Config load error visibility - When malformed config exists, we silently fall back to defaults. Users might not
    realize their config was ignored. Consider adding a user-visible warning on next startup.

  3. ConfigState::reset() behavior - Currently resets all fields including persistent config (arrow keys setting).
    Clarify: should persistent settings survive filter resets, or is the current behavior intentional?

These don't block the PR but worth revisiting when refactoring config handling.

@bug-ops bug-ops merged commit 7949507 into bug-ops:main Jan 20, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

config Configuration and settings enhancement New feature or request input Input handling and key mapping ui User interface components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants