Preserve newlines and get closest cursor on reload, fixes #390

This commit is contained in:
Jeremy Soller 2025-10-09 12:28:39 -06:00
parent 801c7fa68c
commit 117f00337d
No known key found for this signature in database
GPG key ID: 670FDFB5428E05CA
3 changed files with 157 additions and 134 deletions

View file

@ -27,7 +27,6 @@ use cosmic_files::{
};
use cosmic_text::{Cursor, Edit, Family, Selection, SwashCache, SyntaxSystem, ViMode};
use serde::{Deserialize, Serialize};
use unicode_segmentation::UnicodeSegmentation;
use std::{
any::TypeId,
collections::HashMap,
@ -37,6 +36,7 @@ use std::{
sync::{Mutex, OnceLock},
};
use tokio::time;
use unicode_segmentation::UnicodeSegmentation;
use config::{AppTheme, CONFIG_VERSION, Config, ConfigState};
mod config;
@ -871,7 +871,7 @@ impl App {
for line in buffer.lines.iter() {
let text = line.text();
let mut last_whitespace = true;
// Count graphemes instead of Unicode scalar values for accurate character count
for grapheme in text.graphemes(true) {
character_count += 1;