- Add unicode-segmentation dependency for proper grapheme cluster support
- Replace chars() iteration with graphemes(true) for accurate character counting
- Fix counting of complex Unicode characters like emojis, combining characters, and multi-byte sequences
- Resolves TODO: 'do graphemes?' in document_statistics function
This change provides more accurate character counts for international text,
emojis with skin tones, combined characters, and other multi-codepoint graphemes.
Examples of improved accuracy:
- 👍🏾 now counts as 1 character instead of 2
- é (e + combining acute) counts as 1 character instead of 2
- 🧑💻 (person technologist) counts as 1 character instead of 4
- Add monospace_attrs() function in main.rs to centralize monospace font attributes creation
- Replace duplicated Attrs::new().family(Family::Monospace) calls in:
* line_number.rs: LineNumberCache::get() method
* main.rs: App::init() font enumeration
* tab.rs: EditorTab::new() constructor
- Remove unused imports (Attrs, Family) from line_number.rs
- Resolves TODO comments about code repetition across modules
This change improves maintainability by having a single source of truth
for monospace font configuration.
* Enable saving read-only/root files via pkexec (Fixes#249)
This update addresses the issue where users couldn't open Cosmic Edit as root. It allows users to save read-only or root files using pkexec for privilege escalation, all within the graphical interface of Cosmic Edit, eliminating the need to open the terminal.
Changes:
Implemented pkexec functionality for saving read-only/root files.
Added a confirmation dialog for file modifications.
This feature resolves issue #249 and streamlines the process, ensuring a smoother experience for users managing protected files directly within Cosmic Edit.
* Secure pkexec handling with piped stdin and escape safety
Enhanced permission handling by using `pkexec` with `tee` and piped stdin. This implementation avoids shell injection risks and ensures proper handling of special escape characters in the input. The approach securely writes text content to files with elevated privileges while maintaining robustness against potentially malicious inputs.
* Update tab.rs
* Log Errors but dont crash
* Update tab.rs
* Update tab.rs
* Clean up after child (sounds weird...)