mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-11 02:19:56 -06:00
Merge pull request #5039 from dotCooCoo/feat/typed-lists-preference-r
Type: add a VectorCraft preference for typed list detection
This commit is contained in:
@@ -208,6 +208,7 @@ pub const PREF_SPECS: &[PrefSpec] = &[
|
||||
p!("highlightAlternateGlyphs", "Type", "Options", "Highlight Alternate Glyphs", bool),
|
||||
p!("highlightSubstitutedFonts", "Type", "Options", "Highlight Substituted Fonts", bool),
|
||||
p!("placeholderText", "Type", "Options", "Fill New Type Objects With Placeholder Text", bool),
|
||||
p!("typedLists", "Type", "Options", "Start Lists From Typed Markers", bool),
|
||||
p!("fontsFolder", "Type", "Options", "Additional Fonts Folder", text),
|
||||
// Units
|
||||
p!("unitsGeneral", "Units", "", "General", choice(UNITS)),
|
||||
|
||||
@@ -97,6 +97,9 @@ pub struct Prefs {
|
||||
/// font is highlighted, in every document (on by default).
|
||||
pub highlight_substituted_fonts: bool,
|
||||
pub placeholder_text: bool,
|
||||
/// Type › Start Lists From Typed Markers: a list marker and a space typed at the start of a
|
||||
/// paragraph start a list (on by default). Off, they stay as typed text.
|
||||
pub typed_lists: bool,
|
||||
// Units
|
||||
pub units_general: String,
|
||||
pub units_stroke: String,
|
||||
@@ -402,6 +405,7 @@ impl Default for Prefs {
|
||||
highlight_alternate_glyphs: false,
|
||||
highlight_substituted_fonts: true,
|
||||
placeholder_text: true,
|
||||
typed_lists: true,
|
||||
units_general: s("points"),
|
||||
units_stroke: s("points"),
|
||||
units_type: s("points"),
|
||||
|
||||
@@ -1132,6 +1132,60 @@ fn the_caret_follows_undo_and_redo_of_a_typed_list() {
|
||||
}
|
||||
}
|
||||
|
||||
/// Type › Start Lists From Typed Markers off: a list marker and a space typed at the start of a
|
||||
/// paragraph stay as text and start no list; `text.startList` still starts one.
|
||||
#[test]
|
||||
fn typed_lists_off_leaves_typed_markers_as_text() {
|
||||
let v = ViewInfo::default();
|
||||
for typed in ["1.", "1)", "A.", "A)", "*", "#", ">", "+"] {
|
||||
let mut s = session();
|
||||
s.execute("prefs.set", &json!({"key": "typedLists", "value": false})).unwrap();
|
||||
s.select_tool("type", v).unwrap();
|
||||
click(&mut s, 200.0, 200.0);
|
||||
let id = s.doc().unwrap().selection.objects[0];
|
||||
for c in typed.chars().chain(" a".chars()) {
|
||||
s.tool_text(&c.to_string(), v).unwrap();
|
||||
}
|
||||
let t = obj(&s, id);
|
||||
assert_eq!((t.plain_text(), t.para_at(0).list), (format!("{typed} a"), None), "{typed}");
|
||||
assert!(!undo_labels(&s).iter().any(|l| l == "Bullets and Numbering"), "{typed}");
|
||||
// Turned back on, the same typing in a new paragraph starts a list.
|
||||
s.execute("prefs.set", &json!({"key": "typedLists", "value": true})).unwrap();
|
||||
key(&mut s, ToolKey::Enter, Mods::default());
|
||||
for c in typed.chars().chain(" ".chars()) {
|
||||
s.tool_text(&c.to_string(), v).unwrap();
|
||||
}
|
||||
let t = obj(&s, id);
|
||||
assert_eq!((t.plain_text(), t.para_at(0).list, t.para_at(1).list.is_some()), (format!("{typed} a\n"), None, true), "on: {typed}");
|
||||
assert_eq!(undo_labels(&s).last().map(String::as_str), Some("Bullets and Numbering"), "on: {typed}");
|
||||
}
|
||||
let mut s = session();
|
||||
s.execute("prefs.set", &json!({"key": "typedLists", "value": false})).unwrap();
|
||||
let id = text(&mut s, "1. a");
|
||||
let r = s.execute("text.startList", &json!({"id": id.0, "at": 3})).unwrap();
|
||||
assert_eq!(r["started"], true);
|
||||
assert_eq!(obj(&s, id).plain_text(), "a");
|
||||
assert!(obj(&s, id).para_at(0).list.is_some());
|
||||
}
|
||||
|
||||
/// `typedLists` is a Type preference, on by default: `prefs.list` lists it as a bool, and
|
||||
/// `prefs.reset` of the Type category turns it back on.
|
||||
#[test]
|
||||
fn typed_lists_is_a_type_preference_on_by_default() {
|
||||
let mut s = Session::new();
|
||||
assert!(s.prefs.typed_lists);
|
||||
let l = s.execute("prefs.list", &json!({})).unwrap();
|
||||
let row = l.as_array().unwrap().iter().find(|e| e["key"] == "typedLists").unwrap().clone();
|
||||
assert_eq!(
|
||||
(&row["category"], &row["kind"], &row["label"], &row["value"]),
|
||||
(&json!("Type"), &json!("bool"), &json!("Start Lists From Typed Markers"), &json!(true))
|
||||
);
|
||||
s.execute("prefs.set", &json!({"key": "typedLists", "value": false})).unwrap();
|
||||
assert!(!s.prefs.typed_lists);
|
||||
s.execute("prefs.reset", &json!({"category": "Type"})).unwrap();
|
||||
assert!(s.prefs.typed_lists);
|
||||
}
|
||||
|
||||
/// The same characters later in a paragraph, without the space, typed in one piece with the space
|
||||
/// (a paste), or at the start of a paragraph that is already in a list start nothing.
|
||||
#[test]
|
||||
|
||||
@@ -332,6 +332,7 @@ impl Session {
|
||||
pen_rubber_band: self.prefs.pen_rubber_band,
|
||||
curvature_rubber_band: self.prefs.curvature_rubber_band,
|
||||
placeholder_text: self.prefs.placeholder_text,
|
||||
typed_lists: self.prefs.typed_lists,
|
||||
smart_guide_color: rgb(&self.prefs.smart_guide_color, vectorcraft_tools::guides::MAGENTA),
|
||||
alignment_guides: self.prefs.alignment_guides,
|
||||
anchor_path_labels: self.prefs.anchor_path_labels,
|
||||
|
||||
@@ -223,6 +223,9 @@ pub struct ToolContext<'a> {
|
||||
/// Type → Fill New Type Objects With Placeholder Text: type the Type tools place starts with
|
||||
/// placeholder text, selected.
|
||||
pub placeholder_text: bool,
|
||||
/// Type → Start Lists From Typed Markers: a list marker and a space typed at the start of a
|
||||
/// paragraph start a list ([`crate::text::TypeTool`]).
|
||||
pub typed_lists: bool,
|
||||
/// Smart Guides → Color: the smart guides' lines and labels (RGB).
|
||||
pub smart_guide_color: [u8; 3],
|
||||
/// Smart Guides → Alignment Guides: the lines along the edges and centres the art lines up
|
||||
|
||||
@@ -525,6 +525,7 @@ pub(crate) mod testutil {
|
||||
pen_rubber_band: true,
|
||||
curvature_rubber_band: true,
|
||||
placeholder_text: false,
|
||||
typed_lists: true,
|
||||
smart_guide_color: guides::MAGENTA,
|
||||
alignment_guides: true,
|
||||
anchor_path_labels: true,
|
||||
|
||||
@@ -521,7 +521,11 @@ impl TypeTool {
|
||||
/// from the start of the caret's paragraph up to it start a list ([`TextObject::typed_list_at`]),
|
||||
/// the typing session ends as one undo step with those characters, and `text.startList`
|
||||
/// removes them and makes the paragraph a list as the next one, so one Undo puts them back.
|
||||
/// With Type › Start Lists From Typed Markers off, the characters stay as typed.
|
||||
fn start_typed_list(&mut self, cx: &ToolContext) -> Vec<Action> {
|
||||
if !cx.typed_lists {
|
||||
return vec![];
|
||||
}
|
||||
let (Some(id), Some(ty)) = (self.editing, &self.typing) else { return vec![] };
|
||||
let Some(mut t) = Self::text(cx, id).cloned() else { return vec![] };
|
||||
// The document does not have the space yet (its preview is applied after this input).
|
||||
|
||||
@@ -1130,6 +1130,7 @@ font-technology Variable Променливи
|
||||
Live curve fitting Напасване на кривата в реално време
|
||||
Fill Color Цвят на запълване
|
||||
Fill New Type Objects With Placeholder Text Запълване на нови текстови обекти с примесен текст
|
||||
Start Lists From Typed Markers Започване на списъци от въведени маркери
|
||||
Fill Rule Правило за запълване
|
||||
Fill with Placeholder Text Запълване с примесен текст
|
||||
Fill: Запълване:
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -3577,6 +3577,7 @@ theme Appearance Izgled
|
||||
Feet Stope
|
||||
Files Datoteke
|
||||
Fill New Type Objects With Placeholder Text Ispuni nove tekstualne objekte tekstom čuvara mjesta
|
||||
Start Lists From Typed Markers Započni liste iz otkucanih oznaka
|
||||
Folder Folder
|
||||
Font Preview Size Veličina pregleda fonta
|
||||
Get Preferences Preuzmi postavke
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -1555,6 +1555,7 @@ digits Malayalam Malaiàlam
|
||||
Fill Line Línia de farciment
|
||||
Fill new strokes Omple els traços nous
|
||||
Fill New Type Objects With Placeholder Text Omple els objectes de text nous amb text de mostra
|
||||
Start Lists From Typed Markers Comença llistes a partir dels marcadors escrits
|
||||
Fill Rule Regla de farciment
|
||||
Fill with Placeholder Text Omple amb text de mostra
|
||||
Fill: Farciment:
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -3620,6 +3620,7 @@ theme Appearance Motiv
|
||||
Feet Stopy
|
||||
Files Soubory
|
||||
Fill New Type Objects With Placeholder Text Vyplňovat nové textové objekty zástupným textem
|
||||
Start Lists From Typed Markers Začínat seznamy z napsaných značek
|
||||
Folder Složka
|
||||
Font Preview Size Velikost náhledu písma
|
||||
Get Preferences Získat předvolby
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -3362,6 +3362,7 @@ theme Appearance Udseende
|
||||
Feet Fod
|
||||
Files Filer
|
||||
Fill New Type Objects With Placeholder Text Udfyld nye tekstobjekter med pladsholdertekst
|
||||
Start Lists From Typed Markers Start lister fra indtastede markører
|
||||
Folder Mappe
|
||||
Font Preview Size Størrelse på skrifttypeforhåndsvisning
|
||||
Get Preferences Hent indstillinger
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -1145,6 +1145,7 @@ font-technology Variable Variabel
|
||||
Stroke When Editable Kontur, wenn bearbeitbar
|
||||
Fill Color Flächenfarbe
|
||||
Fill New Type Objects With Placeholder Text Neue Textobjekte mit Platzhaltertext füllen
|
||||
Start Lists From Typed Markers Listen aus getippten Aufzählungszeichen beginnen
|
||||
Fill Rule Füllregel
|
||||
Fill with Placeholder Text Mit Platzhaltertext füllen
|
||||
Fill: Fläche:
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -1103,6 +1103,7 @@ font-technology Variable Μεταβλητές
|
||||
Live curve fitting Προσαρμογή καμπύλης σε πραγματικό χρόνο
|
||||
Fill Color Χρώμα γεμίσματος
|
||||
Fill New Type Objects With Placeholder Text Συμπλήρωση νέων αντικειμένων κειμένου με κείμενο υπόδειξης
|
||||
Start Lists From Typed Markers Έναρξη λιστών από πληκτρολογημένα σύμβολα
|
||||
Fill Rule Κανόνας γεμίσματος
|
||||
Fill with Placeholder Text Γέμισμα με κείμενο υπόδειξης
|
||||
Fill: Γέμισμα:
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 168 and column 5.
|
@@ -1173,6 +1173,7 @@ font-technology Variable Variables
|
||||
Stroke When Editable Trazo si es editable
|
||||
Fill Color Color de relleno
|
||||
Fill New Type Objects With Placeholder Text Rellenar nuevos objetos de texto con texto de muestra
|
||||
Start Lists From Typed Markers Iniciar listas a partir de marcadores escritos
|
||||
Fill Rule Regla de relleno
|
||||
Fill with Placeholder Text Rellenar con texto de muestra
|
||||
Insert Inline Symbol Insertar símbolo en el texto
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -3558,6 +3558,7 @@ theme Appearance Ulkoasu
|
||||
Feet Jalat
|
||||
Files Tiedostot
|
||||
Fill New Type Objects With Placeholder Text Täytä uudet tekstiobjektit paikkamerkkitekstillä
|
||||
Start Lists From Typed Markers Aloita luettelot kirjoitetuista merkeistä
|
||||
Folder Kansio
|
||||
Font Preview Size Fontin esikatselukoko
|
||||
Get Preferences Hae asetukset
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -1168,6 +1168,7 @@ font-technology Variable Variables
|
||||
Stroke When Editable Contour quand il est modifiable
|
||||
Fill Color Couleur de fond
|
||||
Fill New Type Objects With Placeholder Text Remplir les nouveaux objets texte avec un texte de substitution
|
||||
Start Lists From Typed Markers Commencer des listes à partir des marqueurs saisis
|
||||
Fill Rule Règle de remplissage
|
||||
Fill with Placeholder Text Remplir avec un texte de substitution
|
||||
Fill: Fond :
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -7960,3 +7960,4 @@ swatch White, Black सफ़ेद, काला
|
||||
swatch Yellow पीला
|
||||
swatch Yellow Green पीला हरा
|
||||
theme Appearance अपीयरेंस
|
||||
Start Lists From Typed Markers टाइप किए गए चिह्नों से सूचियाँ शुरू करें
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -1467,6 +1467,7 @@ digits Malayalam Malajálam
|
||||
Highlight: Kiemelés:
|
||||
Stroke When Editable Körvonal, ha szerkeszthető
|
||||
Fill New Type Objects With Placeholder Text Új szövegobjektumok kitöltése helykitöltő szöveggel
|
||||
Start Lists From Typed Markers Listák indítása begépelt jelölőkből
|
||||
Fill Rule Kitöltési szabály
|
||||
Fill with Placeholder Text Kitöltés helykitöltő szöveggel
|
||||
Fill: Kitöltés:
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -3362,6 +3362,7 @@ theme Appearance Tampilan
|
||||
Feet Kaki
|
||||
Files File
|
||||
Fill New Type Objects With Placeholder Text Isi objek teks baru dengan teks placeholder
|
||||
Start Lists From Typed Markers Mulai daftar dari penanda yang diketik
|
||||
Folder Folder
|
||||
Font Preview Size Ukuran pratinjau font
|
||||
Get Preferences Dapatkan preferensi
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2260 and column 5.
|
@@ -1175,6 +1175,7 @@ font-technology Variable Variabili
|
||||
Stroke When Editable Traccia se modificabile
|
||||
Fill Color Colore riempimento
|
||||
Fill New Type Objects With Placeholder Text Riempi i nuovi oggetti di testo con testo segnaposto
|
||||
Start Lists From Typed Markers Avvia elenchi dai marcatori digitati
|
||||
Fill Rule Regola di riempimento
|
||||
Fill with Placeholder Text Riempi con testo segnaposto
|
||||
Fill: Riempimento:
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -1635,6 +1635,7 @@ digits Malayalam マラヤーラム数字
|
||||
Files of this standard tag their colours with ICC profiles. この規格のファイルでは、カラーに ICC プロファイルが付けられます。
|
||||
Fill 塗り
|
||||
Fill New Type Objects With Placeholder Text 新規テキストオブジェクトをダミーテキストで埋める
|
||||
Start Lists From Typed Markers 入力した記号からリストを開始
|
||||
Fill Rule 塗りのルール
|
||||
Fill and Stroke 塗りと線
|
||||
Fill new strokes 新しいストロークに塗りを適用
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -3178,6 +3178,7 @@ theme Appearance იერსახე
|
||||
Feet ფუტები
|
||||
Files ფაილები
|
||||
Fill New Type Objects With Placeholder Text ახალი ტექსტური ობიექტების ჩანაცვლების ტექსტით შევსება
|
||||
Start Lists From Typed Markers სიების დაწყება აკრეფილი მარკერებიდან
|
||||
Folder საქაღალდე
|
||||
Font Preview Size შრიფტის ნიმუშის ზომა
|
||||
Get Preferences პარამეტრების მიღება
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -1625,6 +1625,7 @@ digits Malayalam 말라얄람어
|
||||
Files of this standard tag their colours with ICC profiles. 이 표준의 파일은 ICC 프로파일로 색상을 태그합니다.
|
||||
Fill 칠
|
||||
Fill New Type Objects With Placeholder Text 새 문자 개체를 대체 텍스트로 채우기
|
||||
Start Lists From Typed Markers 입력한 기호로 목록 시작
|
||||
Fill Rule 칠 규칙
|
||||
Fill and Stroke 칠과 선
|
||||
Fill new strokes 새 선 칠하기
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -3376,6 +3376,7 @@ theme Appearance Vormgeving
|
||||
Feet Voet
|
||||
Files Bestanden
|
||||
Fill New Type Objects With Placeholder Text Nieuwe tekstobjecten met plaatshoudertekst vullen
|
||||
Start Lists From Typed Markers Lijsten starten met getypte opsommingstekens
|
||||
Folder Map
|
||||
Font Preview Size Grootte van lettertypevoorbeelden
|
||||
Get Preferences Voorkeuren ophalen
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -3497,6 +3497,7 @@ theme Appearance Wygląd
|
||||
Feet Stopy
|
||||
Files Pliki
|
||||
Fill New Type Objects With Placeholder Text Wypełniaj nowe obiekty tekstowe tekstem zastępczym
|
||||
Start Lists From Typed Markers Rozpoczynaj listy od wpisanych znaczników
|
||||
Folder Folder
|
||||
Font Preview Size Rozmiar podglądu czcionki
|
||||
Get Preferences Pobierz preferencje
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -1045,6 +1045,7 @@
|
||||
Fill & Stroke Preenchimento e Traçado
|
||||
Fill Color Cor de Preenchimento
|
||||
Fill New Type Objects With Placeholder Text Preencher Novos Objetos de Texto com Texto de Placeholder
|
||||
Start Lists From Typed Markers Iniciar Listas a Partir de Marcadores Digitados
|
||||
Fill Rule Regra de Preenchimento
|
||||
Fill and Stroke Preenchimento e Traçado
|
||||
Fill new strokes Preencher novos traçados
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -1172,6 +1172,7 @@ font-technology Variable Вариативные
|
||||
Stroke When Editable Редактируемая обводка
|
||||
Fill Color Цвет заливки
|
||||
Fill New Type Objects With Placeholder Text Заполнять новые текстовые объекты текстом-заполнителем
|
||||
Start Lists From Typed Markers Начинать списки с введённых маркеров
|
||||
Fill Rule Правило заливки
|
||||
Fill with Placeholder Text Заполнить текстом-заполнителем
|
||||
Fill: Заливка:
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -1138,6 +1138,7 @@ font-technology Variable Variabla
|
||||
Live curve fitting Kurvanpassning medan du ritar
|
||||
Fill Color Fyllnadsfärg
|
||||
Fill New Type Objects With Placeholder Text Fyll nya textobjekt med platshållartext
|
||||
Start Lists From Typed Markers Starta listor från inskrivna punkttecken
|
||||
Fill Rule Fyllningsregel
|
||||
Fill with Placeholder Text Fyll med platshållartext
|
||||
Fill: Fyllning:
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 5 and column 25.
|
@@ -1127,6 +1127,7 @@ font-technology Variable Değişken
|
||||
Merge only with selection Yalnızca seçimle birleştir
|
||||
Fill Color Dolgu Rengi
|
||||
Fill New Type Objects With Placeholder Text Yeni Yazım Nesnelerini Yer Tutucu Metinle Doldurun
|
||||
Start Lists From Typed Markers Yazılan İşaretlerden Liste Başlat
|
||||
Fill Rule Doldurma Kuralı
|
||||
Fill with Placeholder Text Yer Tutucu Metinle Doldur
|
||||
Fill: Doldurun:
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 5 and column 25.
|
@@ -1169,6 +1169,7 @@ font-technology Variable Варіативні
|
||||
Stroke When Editable Обведення, яке можна редагувати
|
||||
Fill Color Колір заливки
|
||||
Fill New Type Objects With Placeholder Text Заповнювати нові текстові об’єкти текстом-заповнювачем
|
||||
Start Lists From Typed Markers Починати списки з введених маркерів
|
||||
Fill Rule Правило заливки
|
||||
Fill with Placeholder Text Заповнити текстом-заповнювачем
|
||||
Fill: Заливка:
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 182 and column 5.
|
@@ -1345,6 +1345,7 @@ digits Malayalam Malayalam
|
||||
Highlight: Làm nổi bật:
|
||||
Stroke When Editable Nét khi có thể chỉnh sửa
|
||||
Fill New Type Objects With Placeholder Text Tô đối tượng chữ mới bằng văn bản giữ chỗ
|
||||
Start Lists From Typed Markers Bắt đầu danh sách từ ký hiệu đã gõ
|
||||
Fill Rule Quy tắc tô
|
||||
Fill with Placeholder Text Tô bằng văn bản giữ chỗ
|
||||
Fill: Tô:
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 204 and column 5.
|
@@ -1114,6 +1114,7 @@
|
||||
Stroke When Editable 可编辑时的描边
|
||||
Fill Color 填色
|
||||
Fill New Type Objects With Placeholder Text 用占位文本填充新文字对象
|
||||
Start Lists From Typed Markers 从键入的标记开始列表
|
||||
Fill Rule 填充规则
|
||||
Fill with Placeholder Text 用占位文本填充
|
||||
Insert Inline Symbol 插入行内符号
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -1139,6 +1139,7 @@ font-technology Variable 可變
|
||||
Highlight: 強調顯示:
|
||||
Stroke When Editable 可編輯時的筆畫
|
||||
Fill New Type Objects With Placeholder Text 以預留位置文字填滿新文字物件
|
||||
Start Lists From Typed Markers 從輸入的標記開始清單
|
||||
Fill Rule 填色規則
|
||||
Fill with Placeholder Text 以預留位置文字填滿
|
||||
Insert Inline Symbol 插入行內符號
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -16,6 +16,27 @@ fn geometric_snapping_is_a_saved_smart_guides_preference() {
|
||||
assert!(a.run("view.snapping", json!({})).is_err());
|
||||
}
|
||||
|
||||
/// Type › Start Lists From Typed Markers is a checkbox in the Type panel, on by default; turning
|
||||
/// it off is saved, and every bundled language translates its label.
|
||||
#[test]
|
||||
fn start_lists_from_typed_markers_is_a_saved_type_preference() {
|
||||
const LABEL: &str = "Start Lists From Typed Markers";
|
||||
let mut a = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default());
|
||||
assert!(a.session.prefs.typed_lists);
|
||||
open(&mut a, Some("Type"));
|
||||
let text = crate::tests_labels::painted_text(&mut a, |a, ui| show(a, ui.ctx()));
|
||||
assert!(text.contains(LABEL), "{text}");
|
||||
assert_eq!(a.ui.dialog.as_ref().unwrap().fields.get("typedLists"), Some(&json!(true)));
|
||||
a.ui.dialog.as_mut().unwrap().fields.insert("typedLists".into(), json!(false));
|
||||
confirm(&mut a).unwrap();
|
||||
assert!(!a.session.prefs.typed_lists);
|
||||
let saved: Prefs = serde_json::from_value(a.ui.engine_prefs.clone()).unwrap();
|
||||
assert!(!saved.typed_lists);
|
||||
for lang in crate::i18n::Lang::all().filter(|l| l.code() != crate::i18n::Lang::EN.code()) {
|
||||
assert!(crate::i18n::has(lang, LABEL), "{}", lang.code());
|
||||
}
|
||||
}
|
||||
|
||||
/// A resting checkbox must have a visible outline in both states and every brightness.
|
||||
#[test]
|
||||
fn preference_checkboxes_draw_outlines_without_hover() {
|
||||
|
||||
+5
-1
@@ -3799,6 +3799,9 @@ Pen's second anchor at (150, 431), in line with the square's centre.
|
||||
|
||||
- `placeholderText` (on by default): type the Type tools place (`pointer_gesture` with `type`, `areaType`…) starts with
|
||||
placeholder text, selected, so `type_text` replaces it; `text.create` and `text.createInPath` take `placeholder: true`.
|
||||
- `typedLists` (on by default; Type › Start Lists From Typed Markers): a list marker and a space typed with the Type tool
|
||||
at the start of a paragraph start a list (see `text.startList`). Off, the Type tool leaves them as typed text;
|
||||
`text.startList`, `text.setFormat {list}` and the Bullets and Numbered List buttons work as before.
|
||||
- `typeSizeIncrement`, `trackingIncrement`, `baselineShiftIncrement`: what `type.step {attribute: "size" | "leading" |
|
||||
"tracking" | "kerning" | "baselineShift", by?}` steps by, on the text range given, the type objects in `ids`, the
|
||||
Type tool's selected text or the selected type objects. `type.size.increase` / `type.size.decrease` (Cmd+Shift+. and
|
||||
@@ -5757,7 +5760,8 @@ whose left and first-line indents are both 0 gets 18 pt and -18 pt. The tool run
|
||||
the byte after the space, as an undo step of its own after the typing: one Undo puts the characters back as text with no
|
||||
list, and typing goes on after them; Redo removes them again, and typing goes on before the paragraph's text. The same
|
||||
characters later in a paragraph start nothing, and so do list characters that arrive in one piece with the space: a
|
||||
paste, an IME commit, or `type_text` of a longer string. From a script, `text.startList {id, at?}` (`at` defaults to the end of the text) does
|
||||
paste, an IME commit, or `type_text` of a longer string. With the `typedLists` preference off (Preferences › Type ›
|
||||
Start Lists From Typed Markers), the Type tool starts no list from typed characters. From a script, `text.startList {id, at?}` (`at` defaults to the end of the text) does
|
||||
the same with the text before `at` and returns `started` and `caret`. When the list starts, `caret` is the byte where
|
||||
the paragraph's text now starts; when the text before `at` starts no list, nothing changes, `started` is false and
|
||||
`caret` is `at`.
|
||||
|
||||
Reference in New Issue
Block a user