Compare commits
No commits in common. "5913a002cab96a5013b98cd1ed12b818aee98f61" and "1e37c2c47b04167802e363db2707fd4446ebdcfd" have entirely different histories.
5913a002ca
...
1e37c2c47b
|
@ -6,10 +6,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to the
|
and this project adheres to the
|
||||||
[Haskell Package Versioning Policy](https://pvp.haskell.org/).
|
[Haskell Package Versioning Policy](https://pvp.haskell.org/).
|
||||||
|
|
||||||
## [Unreleased]
|
## Unreleased
|
||||||
|
|
||||||
## [0.1.0.1] - 2024-08-17
|
## 0.1.0.0 - YYYY-MM-DD
|
||||||
|
|
||||||
### Added
|
|
||||||
|
|
||||||
- added Emacs-style keybindings for cursor movement
|
|
||||||
|
|
|
@ -67,8 +67,8 @@ effects:
|
||||||
### Edit Mode
|
### Edit Mode
|
||||||
|
|
||||||
- ESC: Return to display mode.
|
- ESC: Return to display mode.
|
||||||
- Up/K/CTRL-P: Move the cursor up.
|
- Up/K: Move the cursor up.
|
||||||
- Down/J/CTRL-N: Move the cursor down.
|
- Down/J: Move the cursor down.
|
||||||
- Left/H/CTRL-B: Move the cursor left.
|
- Left/H: Move the cursor left.
|
||||||
- Right/L/CTRL-F: Move the cursor right.
|
- Right/L: Move the cursor right.
|
||||||
- F: Flip the bit under the cursor (1 becomes 0; 0 becomes 1).
|
- F: Flip the bit under the cursor (1 becomes 0; 0 becomes 1).
|
||||||
|
|
|
@ -5,9 +5,9 @@ cabal-version: 2.2
|
||||||
-- see: https://github.com/sol/hpack
|
-- see: https://github.com/sol/hpack
|
||||||
|
|
||||||
name: hamming
|
name: hamming
|
||||||
version: 0.1.0.1
|
version: 0.1.0
|
||||||
synopsis: game/utility for teaching about Hamming codes
|
synopsis: game/utility for teaching about Hamming codes
|
||||||
description: Please see the README
|
description: Please see the README on GitHub at <https://github.com/githubuser/hamming#readme>
|
||||||
category: Games
|
category: Games
|
||||||
author: Jonathan Lamothe
|
author: Jonathan Lamothe
|
||||||
maintainer: jonathan@jlamothe.net
|
maintainer: jonathan@jlamothe.net
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name: hamming
|
name: hamming
|
||||||
version: 0.1.0.1
|
version: 0.1.0
|
||||||
license: AGPL-3.0-or-later
|
license: AGPL-3.0-or-later
|
||||||
author: "Jonathan Lamothe"
|
author: "Jonathan Lamothe"
|
||||||
maintainer: "jonathan@jlamothe.net"
|
maintainer: "jonathan@jlamothe.net"
|
||||||
|
@ -16,7 +16,7 @@ category: Games
|
||||||
# To avoid duplicated efforts in documentation and dealing with the
|
# To avoid duplicated efforts in documentation and dealing with the
|
||||||
# complications of embedding Haddock markup inside cabal files, it is
|
# complications of embedding Haddock markup inside cabal files, it is
|
||||||
# common to point users to the README.md file.
|
# common to point users to the README.md file.
|
||||||
description: Please see the README
|
description: Please see the README on GitHub at <https://github.com/githubuser/hamming#readme>
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
- base >= 4.7 && < 5
|
- base >= 4.7 && < 5
|
||||||
|
|
|
@ -24,7 +24,7 @@ License along with this program. If not, see
|
||||||
|
|
||||||
|-}
|
|-}
|
||||||
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE LambdaCase, OverloadedStrings #-}
|
||||||
|
|
||||||
module Hamming.App.Events (
|
module Hamming.App.Events (
|
||||||
eventHandler,
|
eventHandler,
|
||||||
|
@ -47,7 +47,7 @@ import Brick.Keybindings
|
||||||
, onEvent
|
, onEvent
|
||||||
)
|
)
|
||||||
import Control.Monad (void)
|
import Control.Monad (void)
|
||||||
import Control.Monad.State.Class (gets, modify, put)
|
import Control.Monad.State.Class (get, gets, modify, put)
|
||||||
import Data.Either (fromRight)
|
import Data.Either (fromRight)
|
||||||
import Graphics.Vty.Input.Events
|
import Graphics.Vty.Input.Events
|
||||||
( Event (EvKey)
|
( Event (EvKey)
|
||||||
|
@ -95,7 +95,10 @@ keyEventHandlers =
|
||||||
, onEvent CheckBitsEvent "Set Check Bits" $
|
, onEvent CheckBitsEvent "Set Check Bits" $
|
||||||
hammingCode %= setCheckBits
|
hammingCode %= setCheckBits
|
||||||
, onEvent FixCodeEvent "Attempt to Correct Errors" $
|
, onEvent FixCodeEvent "Attempt to Correct Errors" $
|
||||||
zoom hammingCode $ gets correctErrors >>= mapM_ put
|
zoom hammingCode $ get >>= \case
|
||||||
|
Nothing -> return ()
|
||||||
|
Just c -> put c
|
||||||
|
. correctErrors
|
||||||
, onEvent ResetEvent "Reset Code" $
|
, onEvent ResetEvent "Reset Code" $
|
||||||
hammingCode .= 0
|
hammingCode .= 0
|
||||||
]
|
]
|
||||||
|
@ -150,25 +153,21 @@ keyBindingsFor m = coreBindings ++ case m of
|
||||||
, ( UpEvent
|
, ( UpEvent
|
||||||
, [ bind KUp
|
, [ bind KUp
|
||||||
, bind 'k'
|
, bind 'k'
|
||||||
, ctrl 'p'
|
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
, ( DownEvent
|
, ( DownEvent
|
||||||
, [ bind KDown
|
, [ bind KDown
|
||||||
, bind 'j'
|
, bind 'j'
|
||||||
, ctrl 'n'
|
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
, ( LeftEvent
|
, ( LeftEvent
|
||||||
, [ bind KLeft
|
, [ bind KLeft
|
||||||
, bind 'h'
|
, bind 'h'
|
||||||
, ctrl 'b'
|
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
, ( RightEvent
|
, ( RightEvent
|
||||||
, [ bind KRight
|
, [ bind KRight
|
||||||
, bind 'l'
|
, bind 'l'
|
||||||
, ctrl 'f'
|
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
, ( FlipBitEvent
|
, ( FlipBitEvent
|
||||||
|
|
Loading…
Reference in New Issue
Block a user