diff options
author | Joris Guyonvarch | 2015-03-22 17:13:04 +0100 |
---|---|---|
committer | Joris Guyonvarch | 2015-03-22 17:13:04 +0100 |
commit | b3076f37700291221ededbaf996a065b006cf42d (patch) | |
tree | 26535eb8756329565529f2c5383701aa41c06c17 /src/Update | |
parent | e7237e9f2a01197890d85b6ecc223e4022630cb8 (diff) |
Do not add more than one space when editing name
Diffstat (limited to 'src/Update')
-rw-r--r-- | src/Update/Update.elm | 2 | ||||
-rw-r--r-- | src/Update/UpdateEdition.elm | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/Update/Update.elm b/src/Update/Update.elm index 5a902df..a556e36 100644 --- a/src/Update/Update.elm +++ b/src/Update/Update.elm @@ -105,7 +105,7 @@ validEdition : Model -> Model validEdition model = case model.edition of Just edition -> - if List.isEmpty edition.chars + if isEmpty edition then model else 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 |