Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Sources/SwiftTerm/Apple/AppleTerminalView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1945,7 +1945,8 @@ extension TerminalView {
{
search.invalidate()
// Preserve manual selection while output is streaming when mouse reporting is disabled.
if allowMouseReporting {
// Also preserve when user is scrolled back (viewing history while output arrives).
if allowMouseReporting && !terminal.userScrolling {
selection.active = false
}
startDisplayUpdates()
Expand Down
5 changes: 3 additions & 2 deletions Sources/SwiftTerm/Mac/MacTerminalView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,8 @@ open class TerminalView: NSView, NSTextInputClient, NSUserInterfaceValidations,

open func linefeed(source: Terminal) {
// Preserve manual selection while output is streaming when mouse reporting is disabled.
if allowMouseReporting {
// Also preserve when user is scrolled back (viewing history while output arrives).
if allowMouseReporting && !source.userScrolling {
selection.selectNone()
}
}
Expand Down Expand Up @@ -2259,7 +2260,7 @@ open class TerminalView: NSView, NSTextInputClient, NSUserInterfaceValidations,
}
}

public override func scrollWheel(with event: NSEvent) {
open override func scrollWheel(with event: NSEvent) {
if event.deltaY == 0 {
return
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftTerm/Terminal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ open class Terminal {
var refreshEnd = -1
var scrollInvariantRefreshStart = Int.max
var scrollInvariantRefreshEnd = -1
var userScrolling = false
public var userScrolling = false
var lineFeedMode = false

// We do not implement smooth scrolling here, dubious value, but
Expand Down