Bug: Fix Save As duplicate editor tabs; minor robustness improvements#479
Bug: Fix Save As duplicate editor tabs; minor robustness improvements#479LinuxBoy-96 wants to merge 7 commits intopop-os:masterfrom
Conversation
|
This seems like more code change than would be needed, can you provide a way for me to replicate a bug that this PR fixes? |
Yeah sorry, now it make a little bit more sense... I did not found a speciffic bug, but this would be more robust now with my 2nd commit. The code is overall cleaner and shorter. I tested it and it work perfectly. |
|
@jackpot51 fair point. |
|
@jackpot51 If you have specific scenarios you’d like me to test (path edge cases, tab selection, Save/Save As, symlinks, etc.), I’m happy to run them and report back. So far, all the cases I tested behaved correctly and matched current behavior. |
|
@jackpot51 @mmstick Sorry for the extra ping. I’ve now identified a concrete, reproducible issue that was causing real problems: This is fixed in the latest commit, so this PR now contains an actual bug fix. While working on this, I knew something was off but couldn’t immediately pinpoint the root cause. I knew something was fishy but could exactly tell what I did wrong on my side while I was working. so the first few commit are only me narrowing and cleaning the code until I understood. Thanks a lot. |
Root cause: cosmic-text's shape_until_scroll() uses INFINITY as scroll_end when buffer height is not set, causing ALL lines to be shaped on file load. Each character requires ~200 bytes of glyph/layout data, so a 60MB file was consuming 18.8GB RAM (313x multiplier). Fix: Set a minimal buffer height (100px) before loading files >1MB. This limits initial shaping to ~5 visible lines instead of all lines. The proper height is set during rendering, and additional lines are shaped on-demand as user scrolls. Results: - Before: 60MB file -> 18.8GB RAM (crashes on 8-16GB systems) - After: 60MB file -> 0.2GB RAM (94x memory reduction) Also includes PR pop-os#479 Save As fix: - Added resolve_path() helper for canonical path resolution - Added set_path() and save_as() methods to EditorTab - SaveAsResult now checks if file is already open in another tab Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Update Cargo.toml to use Lcstyle/cosmic-text fork with rope-buffer feature - Add patch section to redirect all cosmic-text dependencies to fork - Add comprehensive FORK_BUILD_INSTRUCTIONS.md documenting: - All patches required (cosmic-text, onig) - Features included (PR pop-os#497, pop-os#479, large file fixes) - Troubleshooting common build issues - Include fresh Cargo.lock with correct dependency resolution Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Integrates feature/rope-buffer-integration branch which adds: - RopeBuffer for efficient viewing of very large files (>1MB) - Scrollbar improvements with proper thumb sizing for large files - Line number offset support for windowed buffer display - ScrollChanged message handler for incremental window refresh Combined with existing features: - Session restore + auto-save (PR pop-os#497) - Save As duplicate tab fix (PR pop-os#479) - Large file memory fix (Issue pop-os#457) - Skip content hash for large files Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
fix conflicts
|
@jackpot51 Any chance this can be merged :( I'm suffering here. |
This PR addresses a reproducible issue in Save As handling and includes a small set of related robustness improvements.
1) Bug fix: Save As could create duplicate editor tabs for the same file
Steps to reproduce:
Fix:
2) Robustness improvements (no user-visible behavior change)
Notes: