Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/davidbalbert/Watt
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Mar 19, 2024
2 parents 40b2b44 + 628b339 commit 0e50a41
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
7 changes: 6 additions & 1 deletion Watt/LayoutManager/Buffer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,12 @@ extension Buffer: HighlighterDelegate {

extension Buffer: TextContent {
func index(ofParagraphBoundaryBefore i: Buffer.Index) -> Buffer.Index {
lines.index(before: i)
var j = i
if lines.isBoundary(j) {
j = index(before: j)
}

return lines.index(roundingDown: j)
}

func index(ofParagraphBoundaryAfter i: Buffer.Index) -> Buffer.Index {
Expand Down
12 changes: 3 additions & 9 deletions Watt/TextView/TextView+Mouse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,12 @@ extension TextView {

if event.modifierFlags.intersection(.deviceIndependentFlagsMask) == .shift {
selection = SelectionNavigator(selection).selection(extendingTo: point, dataSource: layoutManager)
return
}

switch event.clickCount {
case 1:
} else if event.clickCount == 1 {
selection = SelectionNavigator.selection(interactingAt: point, dataSource: layoutManager)
case 2:
} else if event.clickCount == 2 {
selection = SelectionNavigator(selection).selection(for: .word, enclosing: point, dataSource: layoutManager)
case 3:
} else if event.clickCount == 3 {
selection = SelectionNavigator(selection).selection(for: .paragraph, enclosing: point, dataSource: layoutManager)
default:
break
}

var mouseEvent = event
Expand Down

0 comments on commit 0e50a41

Please sign in to comment.