shrinkIfHigherThanLine :: Monad m => ExprGuiM m (ExpressionGui f -> ExpressionGui f)
shrinkIfHigherThanLine =
    do
        sizedFont <-
            ExprGuiM.widgetEnv WE.readTextStyle
            <&> (^. TextEdit.sTextViewStyle . TextView.styleFont)
        config <- ExprGuiM.readConfig <&> Config.hole
        return $ \w ->
            let ratio =
                    (Font.height sizedFont /
                      w ^. ExpressionGui.egWidget . Widget.height)
                    ** realToFrac (Config.holeResultInjectedScaleExponent config)
                result
                    | ratio >= 1 = w
                    | otherwise =
                          w
                          & ExpressionGui.scale (realToFrac ratio)
                          & ExpressionGui.egAlignment . _2 .~ 0.5
            in result
shrinkIfHigherThanLine :: Monad m => ExprGuiM m (ExpressionGui f -> ExpressionGui f)
shrinkIfHigherThanLine =
    do
        sizedFont <-
            ExprGuiM.widgetEnv WE.readTextStyle
            <&> (^. TextEdit.sTextViewStyle . TextView.styleFont)
        config <- ExprGuiM.readConfig <&> Config.hole
        return $ \w ->
            let ratio =
                    (Font.height sizedFont /
                      w ^. ExpressionGui.egWidget . Widget.height)
                    ** realToFrac (Config.holeResultInjectedScaleExponent config)
                result
                    | ratio >= 1 = w
                    | otherwise =
                          w
                          & ExpressionGui.scale (realToFrac ratio)
                          & ExpressionGui.egAlignment . _2 .~ 0.5
            in result
shrinkIfHigherThanLine =
    do
        sizedFont <-
            ExprGuiM.widgetEnv WE.readTextStyle
            <&> (^. TextEdit.sTextViewStyle . TextView.styleFont)
        config <- ExprGuiM.readConfig <&> Config.hole
        return $ \w ->
            let ratio =
                    (Font.height sizedFont /
                      w ^. ExpressionGui.egWidget . Widget.height)
                    ** realToFrac (Config.holeResultInjectedScaleExponent config)
                result
                    | ratio >= 1 = w
                    | otherwise =
                          w
                          & ExpressionGui.scale (realToFrac ratio)
                          & ExpressionGui.egAlignment . _2 .~ 0.5
            in result