Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
composer: Make text editor more robust
This change makes the text editor/composer more robust and simple and solves Github issue #1558 It builds on the changes made for #1211, and on Jericho's (Jericho Hasselbush <[email protected]>) discovery during his work on #1544 It uses setContentCompressionResistance, disabled text box scrolling, and dynamic height adjustments (based on more accurate layout calculations) to allow several improvements: - It ensures lines get wrapped and not overflown - It uses system native "scroll cursor into view" when typing, eliminating the need to a ghost caret - It ensures we do not have a scroll view within a scroll view (which is confusing) - It ensures that we set the height of the text box to its ideal value using a native layout calculation (Removes some issues with copying and pasting larger text) - It resolves other small issues, such as #1558 Issue #1558 repro ----------------- Result: VERIFIED Device: iPhone 14 Pro Simulator iOS: 17.0 Damus: `476f52562a70c2615ad084640dd1a0ba5c4c12e3` Issue #1558 steps: 1. Type "hello world, hello @da" 2. Select "Damus" in contact list 3. Try moving cursor to the end of "world". Cursor should have gone there, but it immediately goes back to the end of "@Damus " instead. Testing for #1558 ----------------- Result: PASS Device: iPhone 14 Pro Simulator iOS: 17.0 Damus: This commit Steps: 1. Type "hello world, hello @da" 2. Select "Damus" in contact list 3. Try moving cursor to the end of "world". Cursor goes there. General functionality testing ----------------------------- Result: CONDITIONAL PASS. Summary: Behaviour is improved from #1211 patch, and #1558 is fixed. There are a few remaining issues, but they do not look like regressions from these changes. More details below. Device: iPhone 14 Pro Simulator iOS: 17.0 Damus: This commit Coverage: 1. Basic typing works. PASS 2. Basic user tagging works. PASS 3. Typing long text line wraps the line. PASS 4. Adding newlines to the end of the text works and text is visible (i.e. Text box is expanding with text). PASS 5. Adding lots of newlines causes the text box and inner PostView content to expand, and those contents can be scrolled. PASS 6. Typing text when cursor is out of view (both up and down) causes PostView to scroll the cursor into view. PASS 7. Tagging user on a line positioned at the middle of the screen causes view to scroll cursor into view. PASS 8. Tagging user on a very long line positioned causes view to scroll cursor into view. PASS 9. Pasting very long text (5 paragraphs of Lorem Ipsum) expands the text box as necessary, wraps all long lines, scrolls cursor at the end into view. PASS 10. Scrolling through very long text shows that there is only one scroll view active (PostView's). PASS 11. Typing text that expands text box does not cause jitters. PASS 12. Typing mentions do not cause jitter. PASS 13. Adding newline from the end of a mid paragraph unfortunately still causes cursor to jump to the end of the text. This is an existing bug (#1521). EXISTING ISSUE. 14. Tagging a user at the end of a line when there are other lines below it may cause the cursor to jump a few characters forward. It is unclear whether this is a regression because prior to this change the cursor would get stuck at the end of the mention. But since this is a very specific edge case that might not be a regression, it might be a good idea to address this on a separate ticket. CONDITIONAL PASS 15. Could not run PostView unit tests due to various build errors on the test target. Closes: #1558 Changelog-Fixed: Fix situations where the note composer cursor gets stuck in one place after tagging a user Changelog-Fixed: Fix some note composer issues, such as when copying/pasting larger text, and make the post composer more robust. Signed-off-by: Daniel D’Aquino <[email protected]> Signed-off-by: William Casarin <[email protected]>
- Loading branch information