-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐞 Hide temporary files which are created when saving a file #134
Comments
Is there a pattern how the file system names these temp files? |
Is this still reproducible? @pkasila |
Just check for a .temp as the extension because all temp folders get saved with that extension... Another way you can also check is take the original file name and see if there is other characters after it and with a .temp extension also. |
Seems like it's not reproducible already, I'm closing this issue |
In essence, the line is calculated by dividing the y-position of the text segment with the cursor by the line height: ```swift var line = Int(textSegmentFrame.maxY / textSegmentFrame.height) ``` However, this counts the preceding line wraps as lines too. As a result, I have to count the preceding line wraps with: ```swift textLayoutManager.enumerateTextLayoutFragments(from: textLayoutManager.documentRange.location, options: [.ensuresLayout, .ensuresExtraLineFragment] ) { textLayoutFragment in guard let cursorTextLineFragment = textLayoutManager.textLineFragment(at: insertionPointLocation) else { return false } /// Check whether the textLayoutFragment has line wraps if textLayoutFragment.textLineFragments.count > 1 { for lineFragment in textLayoutFragment.textLineFragments { lineWrapsCount += 1 /// Do not count lineFragments after the lineFragment where the cursor is placed if lineFragment == cursorTextLineFragment { break } } /// The first lineFragment will be counted as an actual line lineWrapsCount -= 1 } if textLayoutFragment.textLineFragments.contains(cursorTextLineFragment) { return false } return true } ``` Unfortunately, this does scale with the line count of the file. So we might want to change that if we can come up with a better alternative in the future. As a first implementation, I think it works. --------- Co-authored-by: Lukas Pistrol <l.pistrol@gmail.com>
When you close or save file temporary file is created before saving to original file's URL. It's shown in the sidebar for a fraction of a second. It's a little bit annoying as I think.
The Problem
2022-03-21.09.56.08.mov
The text was updated successfully, but these errors were encountered: