Skip to content

Commit

Permalink
Double-click and triple-click selection in pango
Browse files Browse the repository at this point in the history
Fixes #100 and fixes #101.
  • Loading branch information
Fuuzetsu committed Oct 11, 2014
1 parent f6463fb commit f94a951
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
* Fix dired for directories with unicode files/dirs (#445)
* Fix vim indenting under some circumstances (#621)
* Allow the font size to be changed per buffer (#608)
* Double-click and triple-click selection in pango (#100 and #101)

0.9.0
-----
Expand Down
14 changes: 12 additions & 2 deletions yi/src/library/Yi/UI/Pango.hs
Original file line number Diff line number Diff line change
Expand Up @@ -828,21 +828,31 @@ handleButtonClick ui ref = do
runAction = uiActionCh ui . makeAction

runAction focusWindow

win <- io $ readIORef (coreWin w)

let selectRegion tu = runAction $ do
b <- gets $ bkey . findBufferWith (bufkey win)
withGivenBufferAndWindow0 win b $
moveTo point >> regionOfB tu >>= setSelectRegionB

case (click, button) of
(SingleClick, LeftButton) -> do
(SingleClick, LeftButton) -> do
io $ writeIORef (lButtonPressed w) True
win <- io $ readIORef (coreWin w)
runAction $ do
b <- gets $ bkey . findBufferWith (bufkey win)
withGivenBufferAndWindow0 win b $ do
m <- selMark <$> askMarks
markPointA m .= point
moveTo point
setVisibleSelection False
(DoubleClick, LeftButton) -> selectRegion unitWord
(TripleClick, LeftButton) -> selectRegion Line
_ -> return ()

return True


handleButtonRelease :: UI -> WinInfo -> EventM EButton Bool
handleButtonRelease ui w = do
(x, y) <- eventCoordinates
Expand Down

0 comments on commit f94a951

Please sign in to comment.