Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ public final class T3ComposerEditorView: ExpoView, UITextViewDelegate, UITextDro
private var iconImages: [String: UIImage] = [:]
private var pendingIconUris = Set<String>()
private var tokensNeedRebuild = false
private var chipsNeedMeasuredWidth = false

let onComposerChange = EventDispatcher()
let onComposerSelectionChange = EventDispatcher()
Expand Down Expand Up @@ -571,6 +572,10 @@ public final class T3ComposerEditorView: ExpoView, UITextViewDelegate, UITextDro
public override func layoutSubviews() {
super.layoutSubviews()
textView.frame = bounds
if chipsNeedMeasuredWidth, bounds.width > 0 {
chipsNeedMeasuredWidth = false
applyControlledDocument(force: true)
}
let placeholderX = textView.textContainerInset.left + textView.textContainer.lineFragmentPadding
let placeholderY = textView.textContainerInset.top
let placeholderWidth = max(
Expand Down Expand Up @@ -970,7 +975,10 @@ public final class T3ComposerEditorView: ExpoView, UITextViewDelegate, UITextDro
// `maximumWidth` does, so the chip always fits the line it sits on.
let availableWidth = textView.textContainer.size.width > 0
? textView.textContainer.size.width - textView.textContainer.lineFragmentPadding * 2
: UIScreen.main.bounds.width
: (textView.window?.bounds.width ?? bounds.width)
Comment thread
juliusmarminge marked this conversation as resolved.
Resolved
if availableWidth <= 0 {
chipsNeedMeasuredWidth = true
}
let maximumLabelWidth = max(chipFontSize * 3, availableWidth - padding * 2 - iconWidth - iconGap)
paragraph.lineBreakMode = .byTruncatingMiddle
attributedLabel.addAttribute(
Expand Down
4 changes: 2 additions & 2 deletions apps/mobile/modules/t3-review-diff/ios/T3ReviewDiffView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1923,7 +1923,7 @@ private final class ReviewDiffContentView: UIView, UIGestureRecognizerDelegate {
theme.headerBackground.setFill()
context.fill(cardRect)

let hairline = 1 / UIScreen.main.scale
let hairline = 1 / traitCollection.displayScale
theme.border.setFill()
context.fill(CGRect(x: cardRect.minX, y: cardRect.maxY - hairline, width: cardRect.width, height: hairline))

Expand Down Expand Up @@ -1982,7 +1982,7 @@ private final class ReviewDiffContentView: UIView, UIGestureRecognizerDelegate {
theme.background.setFill()
context.fill(rect)

let hairline = 1 / UIScreen.main.scale
let hairline = 1 / traitCollection.displayScale
theme.border.withAlphaComponent(0.65).setFill()
context.fill(CGRect(x: 0, y: rect.maxY - hairline, width: rect.width, height: hairline))

Expand Down
7 changes: 5 additions & 2 deletions apps/mobile/modules/t3-terminal/ios/T3TerminalView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,8 @@ public final class T3TerminalView: ExpoView, UITextFieldDelegate {

applyTheme()
clipsToBounds = true
contentScaleFactor = UIScreen.main.scale
// The real scale arrives with the window; layoutSubviews corrects it.
contentScaleFactor = traitCollection.displayScale

terminalViewport.clipsToBounds = true
terminalViewport.contentScaleFactor = contentScaleFactor
Expand Down Expand Up @@ -677,7 +678,9 @@ public final class T3TerminalView: ExpoView, UITextFieldDelegate {
}

private func updateContentScale() {
let scale = window?.screen.scale ?? UIScreen.main.scale
// The trait collection follows the scene the view is in, which matters once
// iPhone apps run resizable and on external displays; UIScreen.main does not.
let scale = traitCollection.displayScale
if contentScaleFactor != scale {
contentScaleFactor = scale
}
Expand Down
Loading