diff --git a/src/git/diff.rs b/src/git/diff.rs index 9c2dae5..657bb79 100644 --- a/src/git/diff.rs +++ b/src/git/diff.rs @@ -11,7 +11,7 @@ pub enum LineKind { Removed, } -/// A line of a diff: its kind, its numbers in the old and new text from one, its text, and the words that changed. +/// A diff line: kind, numbers from one, text, changed words. #[derive(Clone, Debug, PartialEq)] pub struct DiffLine { pub kind: LineKind, @@ -21,7 +21,7 @@ pub struct DiffLine { pub words: Vec>, } -/// A stretch of a diff: changed lines in their context, or unchanged lines folded away between. +/// A hunk of changes in context, or folded unchanged lines. #[derive(Clone, Debug, PartialEq)] pub enum Stretch { Hunk { @@ -42,7 +42,7 @@ fn same(text: &str, old: usize, new: usize) -> DiffLine { } } -/// `old` against `new` line by line: hunks with `context` lines around each change, the rest folded. +/// `old` against `new`, `context` lines per hunk, the rest folded. pub fn diff(old: &str, new: &str, context: usize) -> Vec { let diff = TextDiff::from_lines(old, new); let (olds, news): (Vec<&str>, Vec<&str>) = ( @@ -197,7 +197,7 @@ pub fn mark_words(lines: &mut [DiffLine]) { } } -/// The numbers a side-by-side row shows: the old file's on the left, the new file's on the right. +/// A side-by-side row's numbers: old left, new right. pub(crate) fn side_numbers( left: Option<&DiffLine>, right: Option<&DiffLine>, diff --git a/src/git/tests.rs b/src/git/tests.rs index b5466b6..c0db129 100644 --- a/src/git/tests.rs +++ b/src/git/tests.rs @@ -6,7 +6,7 @@ use gpui::{ use super::DiffViewer; use crate::{forms, primitives::FocusNext, theme::Theme}; -/// A diff whose first stretch folds, and the folds asked open. +/// A diff whose first stretch folds, and folds asked open. struct Folded { opened: Vec, } @@ -51,7 +51,7 @@ fn a_fold_opens_from_the_keyboard(cx: &mut TestAppContext) { assert_eq!(view.read_with(cx, |folded, _| folded.opened.clone()), [0]); } -/// A blame from before the file changed: an owner too few, and one past the blames. +/// A blame older than its code: owners short and past. struct Behind; impl Render for Behind { diff --git a/src/git/viewer.rs b/src/git/viewer.rs index 04f4a8a..ae1a6ae 100644 --- a/src/git/viewer.rs +++ b/src/git/viewer.rs @@ -33,7 +33,7 @@ type OnIndex = Rc; type OnLayout = Rc; type OnLine = Rc; -/// One file's changes: each change in its context with old and new numbers and its changed words marked, the stretches between folded until pressed; unified or side by side. Long diffs draw only the rows in view; it fills its box. +/// One file's changes, unified or side by side; fills its box. #[derive(IntoElement)] pub struct DiffViewer { id: ElementId, @@ -123,7 +123,7 @@ impl DiffViewer { self } - /// Leaves the file's header, its path, counts and layout, to the owner, as a change card draws it. + /// Leaves the header, path, counts and layout, to the owner. pub fn headless(mut self) -> Self { self.headless = true; self @@ -134,7 +134,7 @@ impl DiffViewer { self } - /// Folded stretches shown in full, by their place among the stretches. + /// Folded stretches shown in full, by their place. pub fn open(mut self, stretches: impl IntoIterator) -> Self { self.open = stretches.into_iter().collect(); self diff --git a/src/i18n/builtin.rs b/src/i18n/builtin.rs index d6d3c7d..61d88c7 100644 --- a/src/i18n/builtin.rs +++ b/src/i18n/builtin.rs @@ -1,6 +1,6 @@ -//! Component copy in English and Chinese; `text` reads it when the app's catalogs lack the key. +//! Component copy in English and Chinese, the apps' fallback. -/// English, the canonical set; zh-CN holds the same keys, a test keeps parity. +/// English, the canonical set; zh-CN mirrors its keys. const EN: &[(&str, &str)] = &[ ("palette.command.placeholder", "Type a command"), ("palette.command.empty", "No matching commands"), @@ -170,7 +170,7 @@ const ZH_CN: &[(&str, &str)] = &[ ("git.commit.amend", "修改最近一次提交"), ]; -/// Ely's own message for `key` in `locale`, English for a locale Ely does not ship; fails on an unknown key. +/// Ely's message for `key`; English if unshipped, fails if unknown. pub(crate) fn builtin(locale: &str, key: &str) -> &'static str { let table = if locale == "zh-CN" { ZH_CN } else { EN }; table