<commit_before>module Display2 (module Display, module Display2) where

import Data.Set as S
import Data.List as L
import Data.Map as M

import Message
import Display
import State
import Geometry
import Level
import Perception
import Monster
import Item

-- | Next event translated to a canonical form
nextCommand :: Session -> IO String
nextCommand session =
  do
    e <- nextEvent session
    return (canonicalKey e)

-- | maps a key to the canonical key for the command it denotes
canonicalKey :: String -> String
canonicalKey e =
  case e of
    ['8'] -> ['K']
    ['2'] -> ['J']
    ['4'] -> ['H']
    ['6'] -> ['L']
    ['7'] -> ['Y']
    ['9'] -> ['U']
    ['1'] -> ['B']
    ['3'] -> ['N']
    ['5'] -> "period"
    "KP_8" -> ['K']
    "KP_2" -> ['J']
    "KP_4" -> ['H']
    "KP_6" -> ['L']
    "KP_7" -> ['Y']
    "KP_9" -> ['U']
    "KP_1" -> ['B']
    "KP_3" -> ['N']
    "KP_5" -> "period"
    "KP_Up"        -> ['k']
    "KP_Down"      -> ['j']
    "KP_Left"      -> ['h']
    "KP_Right"     -> ['l']
    "KP_Home"      -> ['y']
    "KP_Page_Up"   -> ['u']
    "KP_End"       -> ['b']
    "KP_Page_Down" -> ['n']
    "KP_Begin"     -> "period"
    "KP_Enter"     -> "Return"
    k -> k

-- | Displays a message on a blank screen. Waits for confirmation.
displayBlankConfirm :: Session -> String -> IO Bool
displayBlankConfirm session txt =
  let x = txt ++ more
  in  do
        display ((0,0),(0,length x - 1)) session (const (attr, ' ')) x ""
        getConfirm session

-- | Waits for a space or return.
getConfirm :: Session -> IO Bool
getConfirm session =
  getOptionalConfirm session return (const $ getConfirm session)

getOptionalConfirm :: Session -> (Bool -> IO a) -> (String -> IO a) -> IO a<commit_msg>[enhancement] starting the game with normal size window (mostly gtk)<commit_after>module Display2 (module Display, module Display2) where

import Data.Set as S
import Data.List as L
import Data.Map as M

import Message
import Display
import State
import Geometry
import Level
import Dungeon
import Perception
import Monster
import Item

-- | Next event translated to a canonical form
nextCommand :: Session -> IO String
nextCommand session =
  do
    e <- nextEvent session
    return (canonicalKey e)

-- | maps a key to the canonical key for the command it denotes
canonicalKey :: String -> String
canonicalKey e =
  case e of
    ['8'] -> ['K']
    ['2'] -> ['J']
    ['4'] -> ['H']
    ['6'] -> ['L']
    ['7'] -> ['Y']
    ['9'] -> ['U']
    ['1'] -> ['B']
    ['3'] -> ['N']
    ['5'] -> "period"
    "KP_8" -> ['K']
    "KP_2" -> ['J']
    "KP_4" -> ['H']
    "KP_6" -> ['L']
    "KP_7" -> ['Y']
    "KP_9" -> ['U']
    "KP_1" -> ['B']
    "KP_3" -> ['N']
    "KP_5" -> "period"
    "KP_Up"        -> ['k']
    "KP_Down"      -> ['j']
    "KP_Left"      -> ['h']
    "KP_Right"     -> ['l']
    "KP_Home"      -> ['y']
    "KP_Page_Up"   -> ['u']
    "KP_End"       -> ['b']
    "KP_Page_Down" -> ['n']
    "KP_Begin"     -> "period"
    "KP_Enter"     -> "Return"
    k -> k

-- | Displays a message on a blank screen. Waits for confirmation.
displayBlankConfirm :: Session -> String -> IO Bool
displayBlankConfirm session txt =
  let x = txt ++ more
  in do
    display ((0, 0), normalSize) session (const (attr, ' ')) x ""
    getConfirm session
    where
      normalSize = levelSize $ defaultLevelConfig 1

-- | Waits for a space or return.
getConfirm :: Session -> IO Bool
getConfirm session =
  getOptionalConfirm session return (const $ getConfirm session)

getOptionalConfirm :: Session -> (Bool -> IO a) -> (String -> IO a) -> IO a
{'fraction_non_alphanumeric': 0.18339390550740844, 'fraction_numerical': 0.013139502376292984, 'mean_word_length': 2.4272030651340994, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 81, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4844237', 'n_tokens_mistral': 1284, 'n_tokens_neox': 1219, 'n_words': 405}