From fe1408485df5b7c965304f5581364627c97ba821 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Tue, 9 Aug 2016 16:28:53 -0700 Subject: [PATCH] ui: shift-left/right/up/down equivalent to p/n/u/d --- hledger-ui/Hledger/UI/AccountsScreen.hs | 16 ++++++++----- hledger-ui/Hledger/UI/RegisterScreen.hs | 16 ++++++++----- hledger-ui/doc/hledger-ui.1 | 16 ++++++------- hledger-ui/doc/hledger-ui.1.info | 32 ++++++++++++------------- hledger-ui/doc/hledger-ui.1.m4.md | 12 ++++------ hledger-ui/doc/hledger-ui.1.txt | 12 +++++----- 6 files changed, 55 insertions(+), 49 deletions(-) diff --git a/hledger-ui/Hledger/UI/AccountsScreen.hs b/hledger-ui/Hledger/UI/AccountsScreen.hs index 012a34be0..f0df020ad 100644 --- a/hledger-ui/Hledger/UI/AccountsScreen.hs +++ b/hledger-ui/Hledger/UI/AccountsScreen.hs @@ -22,7 +22,7 @@ import Data.Monoid import qualified Data.Text as T import Data.Time.Calendar (Day) import qualified Data.Vector as V -import Graphics.Vty (Event(..),Key(..)) +import Graphics.Vty (Event(..),Key(..),Modifier(..)) import Lens.Micro.Platform import System.Console.ANSI import System.FilePath (takeFileName) @@ -286,11 +286,15 @@ asHandle ui0@UIState{ EvKey (KChar '-') [] -> continue $ regenerateScreens j d $ decDepth ui EvKey (KChar '_') [] -> continue $ regenerateScreens j d $ decDepth ui EvKey (KChar c) [] | c `elem` ['+','='] -> continue $ regenerateScreens j d $ incDepth ui - EvKey (KChar 'd') [] -> continue $ regenerateScreens j d $ cycleReportDurationDown d ui - EvKey (KChar 'u') [] -> continue $ regenerateScreens j d $ cycleReportDurationUp d ui - EvKey (KChar 't') [] -> continue $ regenerateScreens j d $ setReportPeriod (DayPeriod d) ui - EvKey (KChar 'n') [] -> continue $ regenerateScreens j d $ nextReportPeriod ui - EvKey (KChar 'p') [] -> continue $ regenerateScreens j d $ previousReportPeriod ui + EvKey (KChar 't') [] -> continue $ regenerateScreens j d $ setReportPeriod (DayPeriod d) ui + EvKey (KChar 'd') [] -> continue $ regenerateScreens j d $ cycleReportDurationDown d ui + EvKey (KChar 'u') [] -> continue $ regenerateScreens j d $ cycleReportDurationUp d ui + EvKey (KDown) [MShift] -> continue $ regenerateScreens j d $ cycleReportDurationDown d ui + EvKey (KUp) [MShift] -> continue $ regenerateScreens j d $ cycleReportDurationUp d ui + EvKey (KChar 'n') [] -> continue $ regenerateScreens j d $ nextReportPeriod ui + EvKey (KChar 'p') [] -> continue $ regenerateScreens j d $ previousReportPeriod ui + EvKey (KRight) [MShift] -> continue $ regenerateScreens j d $ nextReportPeriod ui + EvKey (KLeft) [MShift] -> continue $ regenerateScreens j d $ previousReportPeriod ui EvKey (KChar 'F') [] -> continue $ regenerateScreens j d $ toggleFlat ui EvKey (KChar 'Z') [] -> scrollTop >> (continue $ regenerateScreens j d $ toggleEmpty ui) EvKey (KChar 'C') [] -> scrollTop >> (continue $ regenerateScreens j d $ toggleCleared ui) diff --git a/hledger-ui/Hledger/UI/RegisterScreen.hs b/hledger-ui/Hledger/UI/RegisterScreen.hs index 79ffeaf9a..41a0ab7eb 100644 --- a/hledger-ui/Hledger/UI/RegisterScreen.hs +++ b/hledger-ui/Hledger/UI/RegisterScreen.hs @@ -18,7 +18,7 @@ import Data.Maybe import qualified Data.Text as T import Data.Time.Calendar (Day) import qualified Data.Vector as V -import Graphics.Vty (Event(..),Key(..)) +import Graphics.Vty (Event(..),Key(..),Modifier(..)) import Brick import Brick.Widgets.List import Brick.Widgets.Edit @@ -259,11 +259,15 @@ rsHandle ui@UIState{ EvKey (KChar 'g') [] -> liftIO (uiReloadJournalIfChanged copts d j ui) >>= continue EvKey (KChar 'I') [] -> continue $ uiCheckBalanceAssertions d (toggleIgnoreBalanceAssertions ui) EvKey (KChar 'a') [] -> suspendAndResume $ clearScreen >> setCursorPosition 0 0 >> add copts j >> uiReloadJournalIfChanged copts d j ui - EvKey (KChar 'd') [] -> continue $ regenerateScreens j d $ cycleReportDurationDown d ui - EvKey (KChar 'u') [] -> continue $ regenerateScreens j d $ cycleReportDurationUp d ui - EvKey (KChar 't') [] -> continue $ regenerateScreens j d $ setReportPeriod (DayPeriod d) ui - EvKey (KChar 'n') [] -> continue $ regenerateScreens j d $ nextReportPeriod ui - EvKey (KChar 'p') [] -> continue $ regenerateScreens j d $ previousReportPeriod ui + EvKey (KChar 't') [] -> continue $ regenerateScreens j d $ setReportPeriod (DayPeriod d) ui + EvKey (KChar 'd') [] -> continue $ regenerateScreens j d $ cycleReportDurationDown d ui + EvKey (KChar 'u') [] -> continue $ regenerateScreens j d $ cycleReportDurationUp d ui + EvKey (KDown) [MShift] -> continue $ regenerateScreens j d $ cycleReportDurationDown d ui + EvKey (KUp) [MShift] -> continue $ regenerateScreens j d $ cycleReportDurationUp d ui + EvKey (KChar 'n') [] -> continue $ regenerateScreens j d $ nextReportPeriod ui + EvKey (KChar 'p') [] -> continue $ regenerateScreens j d $ previousReportPeriod ui + EvKey (KRight) [MShift] -> continue $ regenerateScreens j d $ nextReportPeriod ui + EvKey (KLeft) [MShift] -> continue $ regenerateScreens j d $ previousReportPeriod ui EvKey (KChar 'E') [] -> suspendAndResume $ void (runEditor pos f) >> uiReloadJournalIfChanged copts d j ui where (pos,f) = case listSelectedElement rsList of diff --git a/hledger-ui/doc/hledger-ui.1 b/hledger-ui/doc/hledger-ui.1 index 85c5fdcca..055f60d34 100644 --- a/hledger-ui/doc/hledger-ui.1 +++ b/hledger-ui/doc/hledger-ui.1 @@ -234,14 +234,14 @@ While editing the query you can use typical command\-line edit keys (CTRL\-a/e/d/k, cursor keys etc.), and \f[C]ENTER\f[]to set the new filter or \f[C]ESCAPE\f[]to cancel. .PP -\f[C]t\f[] sets the report period to today, while \f[C]d\f[] and -\f[C]u\f[] cycle downward and upward through standard report periods \- -day, week, month, quarter, year, and unlimited. -This is useful on the register screen, to limit the transaction history. -When a standard report period is selected in this way, \f[C]n\f[] and -\f[C]p\f[] step to the next or previous period. -(For non\-standard periods, you can use \f[C]/\f[] to set a -\f[C]date:\f[] query.) +\f[C]d\f[] and \f[C]u\f[] cycle downward and upward through standard +report periods \- year, quarter, month, week, day. +When a standard report period is selected, \f[C]n\f[] and \f[C]p\f[] +step it to the next or previous period. +\f[C]Shift\-down/up/right/left\f[] can also be used for this. +\f[C]t\f[] sets the report period to today. +For non\-standard periods, you can use \f[C]/\f[] to set a +\f[C]date:\f[] query. .PP \f[C]BACKSPACE\f[] or \f[C]DELETE\f[] clears any filters in effect. .PP diff --git a/hledger-ui/doc/hledger-ui.1.info b/hledger-ui/doc/hledger-ui.1.info index 8b46f4cd8..76be301cb 100644 --- a/hledger-ui/doc/hledger-ui.1.info +++ b/hledger-ui/doc/hledger-ui.1.info @@ -166,12 +166,12 @@ described below). While editing the query you can use typical command-line edit keys (CTRL-a/e/d/k, cursor keys etc.), and `ENTER'to set the new filter or `ESCAPE'to cancel. - `t' sets the report period to today, while `d' and `u' cycle -downward and upward through standard report periods - day, week, month, -quarter, year, and unlimited. This is useful on the register screen, to -limit the transaction history. When a standard report period is -selected in this way, `n' and `p' step to the next or previous period. -(For non-standard periods, you can use `/' to set a `date:' query.) + `d' and `u' cycle downward and upward through standard report +periods - year, quarter, month, week, day. When a standard report period +is selected, `n' and `p' step it to the next or previous period. +`Shift-down/up/right/left' can also be used for this. `t' sets the +report period to today. For non-standard periods, you can use `/' to +set a `date:' query. `BACKSPACE' or `DELETE' clears any filters in effect. @@ -347,15 +347,15 @@ Node: OPTIONS831 Ref: #options930 Node: KEYS3743 Ref: #keys3840 -Node: SCREENS6157 -Ref: #screens6244 -Node: Accounts screen6334 -Ref: #accounts-screen6464 -Node: Register screen7930 -Ref: #register-screen8087 -Node: Transaction screen10047 -Ref: #transaction-screen10207 -Node: Error screen11074 -Ref: #error-screen11198 +Node: SCREENS6107 +Ref: #screens6194 +Node: Accounts screen6284 +Ref: #accounts-screen6414 +Node: Register screen7880 +Ref: #register-screen8037 +Node: Transaction screen9997 +Ref: #transaction-screen10157 +Node: Error screen11024 +Ref: #error-screen11148  End Tag Table diff --git a/hledger-ui/doc/hledger-ui.1.m4.md b/hledger-ui/doc/hledger-ui.1.m4.md index 0d7e7d559..4fc993ab7 100644 --- a/hledger-ui/doc/hledger-ui.1.m4.md +++ b/hledger-ui/doc/hledger-ui.1.m4.md @@ -93,13 +93,11 @@ command-line edit keys ([CTRL-a/e/d/k, cursor keys etc.](http://hackage.haskell.org/package/brick-0.7/docs/Brick-Widgets-Edit.html#t:Editor)), and `ENTER`to set the new filter or `ESCAPE`to cancel. -`t` sets the report period to today, -while `d` and `u` cycle downward and upward through standard report periods -- day, week, month, quarter, year, and unlimited. -This is useful on the register screen, to limit the transaction history. -When a standard report period is selected in this way, -`n` and `p` step to the next or previous period. -(For non-standard periods, you can use `/` to set a [`date:` query](manual.html#queries).) +`d` and `u` cycle downward and upward through standard report periods - year, quarter, month, week, day. +When a standard report period is selected, `n` and `p` step it to the next or previous period. +`Shift-down/up/right/left` can also be used for this. +`t` sets the report period to today. +For non-standard periods, you can use `/` to set a [`date:` query](manual.html#queries). `BACKSPACE` or `DELETE` clears any filters in effect. diff --git a/hledger-ui/doc/hledger-ui.1.txt b/hledger-ui/doc/hledger-ui.1.txt index 4be411ef2..20826349f 100644 --- a/hledger-ui/doc/hledger-ui.1.txt +++ b/hledger-ui/doc/hledger-ui.1.txt @@ -155,12 +155,12 @@ KEYS mand-line edit keys (CTRL-a/e/d/k, cursor keys etc.), and ENTERto set the new filter or ESCAPEto cancel. - t sets the report period to today, while d and u cycle downward and - upward through standard report periods - day, week, month, quarter, - year, and unlimited. This is useful on the register screen, to limit - the transaction history. When a standard report period is selected in - this way, n and p step to the next or previous period. (For non-stan- - dard periods, you can use / to set a date: query.) + d and u cycle downward and upward through standard report periods - + year, quarter, month, week, day. When a standard report period is + selected, n and p step it to the next or previous period. + Shift-down/up/right/left can also be used for this. t sets the report + period to today. For non-standard periods, you can use / to set a + date: query. BACKSPACE or DELETE clears any filters in effect.