From bad7e7f20b680afc9f2fb500f947a51153a24dc9 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> Date: Sun, 11 Apr 2021 09:55:57 +0100 Subject: [PATCH] fix left arrow key (#92) * fix left arrow key * remove LambdaCase --- ChatTerminal/Core.hs | 8 ++++---- Styled.hs | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/ChatTerminal/Core.hs b/ChatTerminal/Core.hs index 92e16decdd..0b4cecf783 100644 --- a/ChatTerminal/Core.hs +++ b/ChatTerminal/Core.hs @@ -87,10 +87,10 @@ updateTermState ac tw (key, ms) ts@TerminalState {inputString = s, inputPosition | p == 0 = ts' (tail s, 0) | otherwise = let (b, a) = splitAt p s in ts' (b <> tail a, p) leftPos - | ms == mempty = min (length s) (p + 1) - | ms == shiftKey = length s - | ms == ctrlKey = nextWordPos - | ms == altKey = nextWordPos + | ms == mempty = max 0 (p - 1) + | ms == shiftKey = 0 + | ms == ctrlKey = prevWordPos + | ms == altKey = prevWordPos | otherwise = p rightPos | ms == mempty = min (length s) (p + 1) diff --git a/Styled.hs b/Styled.hs index 5b54644bad..87f28a7867 100644 --- a/Styled.hs +++ b/Styled.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE LambdaCase #-} - module Styled ( StyledString (..), bPlain,