Git, i18n: shorter comments
This commit is contained in:
4 files changed
+12
-12
No files matched your search
+4
-4
@@ -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<Range<usize>>,
|
||||
}
|
||||
|
||||
/// 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<Stretch> {
|
||||
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>,
|
||||
|
||||
+2
-2
@@ -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<usize>,
|
||||
}
|
||||
@@ -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 {
|
||||
|
||||
+3
-3
@@ -33,7 +33,7 @@ type OnIndex = Rc<dyn Fn(usize, &mut Window, &mut App)>;
|
||||
type OnLayout = Rc<dyn Fn(DiffLayout, &mut Window, &mut App)>;
|
||||
type OnLine = Rc<dyn Fn(Place, bool, &mut Window, &mut App)>;
|
||||
|
||||
/// 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<Item = usize>) -> Self {
|
||||
self.open = stretches.into_iter().collect();
|
||||
self
|
||||
|
||||
+3
-3
@@ -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
|
||||
|
||||
Reference in new issue
Block a user