5 patches for repository /Users/jwall/sandbox/apps/yi-pristine: Tue Oct 12 17:16:10 CDT 2010 [email protected] * retrieve the scroll tyle in runEditor
Tue Oct 12 17:34:34 CDT 2010 [email protected] * Actually use the ScrollStyle in the refreshEditor This patch compiles but I've yet to test that it actually does what I think it does. :-) Tue Oct 12 17:50:35 CDT 2010 [email protected] * Set the correct defaults for the emacs and vim default configs Tue Oct 12 17:57:25 CDT 2010 [email protected] * add the misc library to the cabal file:wq Tue Oct 12 18:23:45 CDT 2010 [email protected] * Fix the gap calculation algorithm to be more efficient. We no only calculate the single line gap in the case of SingleLine style useage. The previous code had some errors in the case statement. This version makes more sense and seems more readable to me.
-- Yi development mailing list [email protected] http://groups.google.com/group/yi-devel
New patches: [retrieve the scroll tyle in runEditor [email protected]**20101012221610 Ignore-this: a3a0c048f9285feb71d16ad199fc366 ] hunk ./src/Yi/Core.hs 262 -- | Redraw refreshEditor :: YiM () refreshEditor = onYiVar $ \yi var -> do - let runOnWins a = runEditor (yiConfig yi) + let cfg = yiConfig yi + runOnWins a = runEditor cfg (do ws <- getA windowsA forM ws $ flip withWindowE a) hunk ./src/Yi/Core.hs 266 + style = configScrollStyle $ configUI $ cfg let scroll e3 = let (e4, relayout) = runOnWins snapScreenB e3 in -- Scroll windows to show current points as appropriate -- Do another layout pass if there was any scrolling; [Actually use the ScrollStyle in the refreshEditor [email protected]**20101012223434 Ignore-this: 822b9da7a9bccefe9bcb4c65f30b4fdd This patch compiles but I've yet to test that it actually does what I think it does. :-) ] hunk ./src/Yi/Buffer/HighLevel.hs 21 import Yi.Buffer.Region import Yi.String import Yi.Window +import Yi.Config.Misc (ScrollStyle) -- --------------------------------------------------------------------- -- Movement operations hunk ./src/Yi/Buffer/HighLevel.hs 394 pointScreenRelPosition _ _ _ = Within -- just to disable the non-exhaustive pattern match warning -- | Move the visible region to include the point -snapScreenB :: BufferM Bool -snapScreenB = do +snapScreenB :: Maybe ScrollStyle ->BufferM Bool +snapScreenB style = do movePoint <- getA pointFollowsWindowA w <- askWindow wkey if movePoint w then return False else do hunk ./src/Yi/Buffer/HighLevel.hs 406 p <- pointB let gap = case pointScreenRelPosition p (regionStart r) (regionEnd r) of Above -> 0 - Below -> h - 1 + Below -> case style of + Nothing -> h `div` 2 + _ -> h - 1 Within -> 0 -- Impossible but handle it anyway i <- indexOfSolAbove gap f <- fromMark <$> askMarks hunk ./src/Yi/Config.hs 7 import Data.Prototype import Yi.Buffer +import Yi.Config.Misc import {-# source #-} Yi.Keymap import {-# source #-} Yi.Editor import Data.Dynamic hunk ./src/Yi/Config.hs 17 import {-# source #-} Yi.UI.Common import qualified Yi.Interact as I -data ScrollStyle = SnapToCenter | SingleLine - data UIConfig = UIConfig { configVtyEscDelay :: Int, configFontName :: Maybe String, -- ^ Font name, for the UI that support it. addfile ./src/Yi/Config/Misc.hs hunk ./src/Yi/Config/Misc.hs 1 +-- Copyright (C) 2010 Jeremy Wall +module Yi.Config.Misc where + +data ScrollStyle = SnapToCenter | SingleLine + hunk ./src/Yi/Core.hs 267 (do ws <- getA windowsA forM ws $ flip withWindowE a) style = configScrollStyle $ configUI $ cfg - let scroll e3 = let (e4, relayout) = runOnWins snapScreenB e3 in + let scroll e3 = let (e4, relayout) = runOnWins (snapScreenB style) e3 in -- Scroll windows to show current points as appropriate -- Do another layout pass if there was any scrolling; (if or relayout then UI.layout (yiUi yi) else return) e4 [Set the correct defaults for the emacs and vim default configs [email protected]**20101012225035 Ignore-this: 32f9e6e2d67a6272e425297d2431fc0f ] hunk ./src/Yi/Config/Default.hs 19 import Yi.Command (cabalBuildE, cabalConfigureE, grepFind, makeBuild, reloadProjectE, searchSources, shell) import {-# source #-} Yi.Boot import Yi.Config +import Yi.Config.Misc import Yi.Core import Yi.Dired import Yi.File hunk ./src/Yi/Config/Default.hs 190 toEmacsStyleConfig, toVimStyleConfig, toCuaStyleConfig :: Config -> Config toEmacsStyleConfig cfg = cfg { - configUI = (configUI cfg) { configVtyEscDelay = 1000 }, + configUI = (configUI cfg) { configVtyEscDelay = 1000 , configScrollStyle = Just SnapToCenter}, defaultKm = Emacs.keymap, startActions = makeAction openScratchBuffer : startActions cfg, configInputPreprocess = escToMeta, hunk ./src/Yi/Config/Default.hs 206 I.write (Event (KASCII c) [MMeta]) toVimStyleConfig cfg = cfg { defaultKm = Vim.keymapSet + , configUI = (configUI cfg) { configScrollStyle = Just SingleLine} , configRegionStyle = Inclusive , modeTable = AnyMode Abella.abellaModeVim : modeTable cfg } toCuaStyleConfig cfg = cfg {defaultKm = Cua.keymap} [add the misc library to the cabal file:wq [email protected]**20101012225725 Ignore-this: c93dcd328e1a538ec4b67fad01ee3e97 ] hunk ./yi.cabal 99 Yi.Completion Yi.Config Yi.Config.Default + Yi.Config.Misc Yi.Core Yi.Debug Yi.Dired [Fix the gap calculation algorithm to be more efficient. [email protected]**20101012232345 Ignore-this: 7a788b8171585077fd31fa40a2900dca We no only calculate the single line gap in the case of SingleLine style useage. The previous code had some errors in the case statement. This version makes more sense and seems more readable to me. ] hunk ./src/Yi/Buffer/HighLevel.hs 21 import Yi.Buffer.Region import Yi.String import Yi.Window -import Yi.Config.Misc (ScrollStyle) +import Yi.Config.Misc (ScrollStyle(SingleLine)) -- --------------------------------------------------------------------- -- Movement operations hunk ./src/Yi/Buffer/HighLevel.hs 404 h <- askWindow actualLines r <- winRegionB p <- pointB - let gap = case pointScreenRelPosition p (regionStart r) (regionEnd r) of - Above -> 0 - Below -> case style of - Nothing -> h `div` 2 - _ -> h - 1 - Within -> 0 -- Impossible but handle it anyway + let gap = case style of + Just SingleLine -> case pointScreenRelPosition p (regionStart r) (regionEnd r) of + Above -> 0 + Below -> h - 1 + Within -> 0 -- Impossible but handle it anyway + _ -> h `div` 2 i <- indexOfSolAbove gap f <- fromMark <$> askMarks setMarkPointB f i Context: [Add a config setting for the style of scroll. [email protected]**20101011231548 Ignore-this: eeb2dd4bb9c60149b18e1b1ca4c23420 After the last patch fixing the scrolling bug and making yi do scrolling in the style of vim the next logical step is to make this setting configurable. This patch adds that config setting but does not yet use it. ] [add documentation and clean up [email protected]**20101006205136 Ignore-this: 62d3c4a4707e0ed5fbbfd0967be5f40f Document the rational for this change as well as clean up some of the comments and todos. ] [Scrolling - Store actual buffer lines displayed in a window. [email protected]**20100918042058 Ignore-this: 832bc90350c820a84a56aab985a46f35 In order for scrolling to work we have to differentiate between the height of the window in display lines and the number of actual buffer lines displayed in a window. This patch stores that information in a window. ] [fix scrolling so it no longer snaps to the middle. [email protected]**20100916051742 Ignore-this: e80f848c675274b889129e20d4e9a5b6 scrolling off the top or bottom of the screen now just moves the viewport the minimum # of lines necessary to keep the point in sight. This is a much less disruptive scrolling experience. ] [compilation fix [email protected]**20100829162455 Ignore-this: d3533951084623ae2697a012d314f165 ] [Add Yi/File.hs-boot that I forgot [email protected]**20100812064755 Ignore-this: 5348938d1f93a7615aad115fe7200dd7 ] [Restrict monads-fd version Malte Sommerkorn <[email protected]>**20100807175958 Ignore-this: 1461085ee6150364333a173040269203 Fixed compilation for me ] [Remove some trailing whitespace [email protected]**20100716053746 Ignore-this: fd303d5446fc978aa3f233c42accd97d ] [Move Yi.Dired.fnewE to Yi.File.editFile [email protected]**20100716053557 Ignore-this: 578136341ce60c89d8a7e97f9712d6bd It can actually open dirs too. Thought about the name a lot, and this is the most intuitive I can think of. Open to suggestions, though. ] [-Wall in dired [email protected]**20100715071636 Ignore-this: 218351628f93cbb2278ad1a89211e149 ] [Begin to clean up fnewE, which opens buffers new buffers based on a filename [email protected]**20100715071435 Ignore-this: a9430b3d156311402fa32a49e26f2178 The behavior right now hasn't changed. I think some behavior should change, but I have left that for the future (tomorrow?). Creating the parent directories here seems especially broken. ] [TAG 0.6.2.4 [email protected]**20100715044543 Ignore-this: a03d48b597790a46cb899c354b5a97d1 ] Patch bundle hash: 49e2b4a73a114d45681ab6eddf1762c205c987c2
