packages feed

vty-ui 1.5 → 1.5.1

raw patch · 3 files changed

+24/−7 lines, 3 files

Files

src/Graphics/Vty/Widgets/DirBrowser.hs view
@@ -148,7 +148,7 @@   b `onBrowserPathChange` setText (dirBrowserPathDisplay b)    fg <- newFocusGroup-  _ <- addToFocusGroup fg l+  _ <- addToFocusGroup fg ui    setDirBrowserPath b path   return (b, fg)
src/Graphics/Vty/Widgets/Edit.hs view
@@ -38,6 +38,7 @@  import Control.Applicative ((<$>)) import Control.Monad+import Data.List import Graphics.Vty import Graphics.Vty.Widgets.Core import Graphics.Vty.Widgets.Events@@ -127,12 +128,21 @@                                      , normalAttr ctx                                      ] +                  totalAllowedLines = fromEnum $ region_height size+                  numEmptyLines = lim - length truncatedLines+                      where+                        lim = case lineLimit st of+                                Just v -> min v totalAllowedLines+                                Nothing -> totalAllowedLines++                  emptyLines = replicate numEmptyLines ""+               isFocused <- focused <~ this               let attr = if isFocused then focusAttr ctx else nAttr                   lineWidget s = string attr s                                  <|> char_fill attr ' ' (region_width size - (toEnum $ length s)) 1 -              return $ vert_cat $ lineWidget <$> truncatedLines+              return $ vert_cat $ lineWidget <$> (truncatedLines ++ emptyLines)          , keyEventHandler = editKeyEvent         }@@ -209,7 +219,7 @@ -- |Get the current contents of the edit widget.  This returns all of -- the lines of text in the widget, separated by newlines. getEditText :: Widget Edit -> IO String-getEditText = ((unlines . currentText) <~~)+getEditText = (((intercalate "\n") . currentText) <~~)  -- |Get the contents of the current line of the edit widget (the line -- on which the cursor is positioned).@@ -237,8 +247,13 @@   lim <- lineLimit <~~ wRef   s <- case lim of     Nothing -> return str-    Just l -> return $ unlines $ take l $ lines str-  updateWidgetState wRef $ \st -> st { currentText = lines s }+    Just l -> return $ intercalate "\n" $ take l $ lines str+  updateWidgetState wRef $ \st -> st { currentText = if null s+                                                     then [""]+                                                     else lines s+                                     , cursorColumn = 0+                                     , cursorRow = 0+                                     }   when (oldS /= lines s) $ do     gotoBeginning wRef     notifyChangeHandlers wRef@@ -359,7 +374,9 @@   curCol <- cursorColumn <~~ this   curLine <- getEditCurrentLine this   case null curLine of-    False -> setEditCurrentLine this $ take curCol curLine+    False -> do+      setEditCurrentLine this $ take curCol curLine+      notifyChangeHandlers this     True -> do       curRow <- cursorRow <~~ this       numLines <- (length . currentText) <~~ this
vty-ui.cabal view
@@ -1,5 +1,5 @@ Name:                vty-ui-Version:             1.5+Version:             1.5.1 Synopsis:   An interactive terminal user interface library for Vty