From b3076f37700291221ededbaf996a065b006cf42d Mon Sep 17 00:00:00 2001 From: Joris Guyonvarch Date: Sun, 22 Mar 2015 17:13:04 +0100 Subject: Do not add more than one space when editing name --- src/Update/UpdateEdition.elm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/Update/UpdateEdition.elm') diff --git a/src/Update/UpdateEdition.elm b/src/Update/UpdateEdition.elm index 911a4c1..d94bd1e 100644 --- a/src/Update/UpdateEdition.elm +++ b/src/Update/UpdateEdition.elm @@ -3,7 +3,8 @@ module Update.UpdateEdition , EditionAction(..) ) where -import Char (..) +import Char +import Char (KeyCode) import Model.Edition.Edition (..) @@ -25,6 +26,8 @@ updateEdition action edition = AddChar keyCode -> case keyCodeToChar edition.kind keyCode of Just char -> - { edition | chars <- char :: edition.chars } + if keyCode == 32 && maybeHead edition.chars == Just (Char.fromCode 32) + then edition + else { edition | chars <- char :: edition.chars } Nothing -> edition -- cgit v1.2.3