Skip to content

Commit f38829a

Browse files
pascalkuthearchseerthe-mikedavis
committed
Apply suggestions from code review
Co-authored-by: Blaž Hrastnik <[email protected]> Co-authored-by: Michael Davis <[email protected]>
1 parent 6e58077 commit f38829a

File tree

6 files changed

+16
-17
lines changed

6 files changed

+16
-17
lines changed

helix-vcs/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ homepage = "https://helix-editor.com"
1111
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1212

1313
[dependencies]
14-
1514
helix-core = { version = "0.6", path = "../helix-core" }
1615

1716
tokio = { version = "1", features = ["rt", "rt-multi-thread", "time", "sync", "parking_lot", "macros"] }

helix-vcs/src/diff.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ impl DiffHandle {
100100
}
101101

102102
// TODO configuration
103-
/// synchronus debounce value should be low
104-
/// so we can update synchrously most of the time
103+
/// synchronous debounce value should be low
104+
/// so we can update synchronously most of the time
105105
const DIFF_DEBOUNCE_TIME_SYNC: u64 = 1;
106106
/// maximum time that rendering should be blocked until the diff finishes
107107
const SYNC_DIFF_TIMEOUT: u64 = 50;
@@ -111,7 +111,7 @@ const MAX_DIFF_LINES: usize = 64 * u16::MAX as usize;
111111
// cap average line length to 128 for files with MAX_DIFF_LINES
112112
const MAX_DIFF_BYTES: usize = MAX_DIFF_LINES * 128;
113113

114-
/// A single change in a file potentially sppaning multiple lines
114+
/// A single change in a file potentially spanning multiple lines
115115
/// Hunks produced by the differs are always ordered by their position
116116
/// in the file and non-overlapping.
117117
/// Specifically for any two hunks `x` and `y` the following properties hold:
@@ -128,15 +128,15 @@ pub struct Hunk {
128128

129129
impl Hunk {
130130
/// Can be used instead of `Option::None` for better performance
131-
/// because lines larger then `i32::MAX` are not supported by imara-diff anways.
131+
/// because lines larger than `i32::MAX` are not supported by imara-diff anways.
132132
/// Has some nice properties where it usually is not necessary to check for `None` seperatly:
133-
/// Empty ranges fail contains checks and also faills smaller then checks.
133+
/// Empty ranges fail contains checks and also fails smaller than checks.
134134
pub const NONE: Hunk = Hunk {
135135
before: u32::MAX..u32::MAX,
136136
after: u32::MAX..u32::MAX,
137137
};
138138

139-
/// Inverts a change so that `before`
139+
/// Inverts a change so that `before` becomes `after` and `after` becomes `before`
140140
pub fn invert(&self) -> Hunk {
141141
Hunk {
142142
before: self.after.clone(),

helix-vcs/src/diff/line_cache.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ impl InternedRopeLines {
5555
}
5656
}
5757

58-
/// Updates the `doc` without reintering the `diff_base`, this funciton
59-
/// is therefore significantly faster then `update_diff_base` when only the document changes.
58+
/// Updates the `doc` without reinterning the `diff_base`, this function
59+
/// is therefore significantly faster than `update_diff_base` when only the document changes.
6060
pub fn update_doc(&mut self, doc: Rope) {
6161
// Safety: we clear any tokens that were added after
6262
// the interning of `self.diff_base` finished so
@@ -75,7 +75,7 @@ impl InternedRopeLines {
7575
}
7676

7777
fn update_diff_base_impl(&mut self) {
78-
// Safety: This transmute is save because it only transmutes a lifetime, which has no effect.
78+
// Safety: This transmute is safe because it only transmutes a lifetime, which has no effect.
7979
// The backing storage for the RopeSlices referred to by the lifetime is stored in `self.diff_base`.
8080
// Therefore as long as `self.diff_base` is not dropped/replaced this memory remains valid.
8181
// `self.diff_base` is only changed in `self.update_diff_base`, which clears the interner.

helix-vcs/src/diff/worker.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl<'a> EventAccumulator<'a> {
121121

122122
*dst = Some(event.text);
123123

124-
// always prefer the most synchronus requested render mode
124+
// always prefer the most synchronous requested render mode
125125
if event.render_strategy > self.render_stratagey {
126126
if self.render_lock.is_none() {
127127
self.timeout = Instant::now() + Duration::from_millis(SYNC_DIFF_TIMEOUT);
@@ -154,7 +154,7 @@ impl<'a> EventAccumulator<'a> {
154154
}
155155

156156
// setup task to trigger the rendering
157-
// with the choosen render stragey
157+
// with the chosen render stragey
158158
match self.render_stratagey {
159159
RenderStrategy::Async => {
160160
tokio::spawn(async move {
@@ -166,8 +166,8 @@ impl<'a> EventAccumulator<'a> {
166166
let timeout = self.timeout;
167167
tokio::spawn(async move {
168168
let res = {
169-
// Aquire a lock on the redraw handle.
170-
// The lock will block the rendering from occuring while held.
169+
// Acquire a lock on the redraw handle.
170+
// The lock will block the rendering from occurring while held.
171171
// The rendering waits for the diff if it doesn't time out
172172
let _render_guard = redraw_handle.1.read();
173173
timeout_at(timeout, diff_finished_notify.notified()).await

helix-view/src/editor.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ pub struct Config {
154154
)]
155155
pub idle_timeout: Duration,
156156
/// Time in milliseconds since last keypress before a redraws trigger.
157-
/// Used for redrawing asynchronsouly computed UI compoenents, set to 0 for instant.
157+
/// Used for redrawing asynchronsouly computed UI components, set to 0 for instant.
158158
/// Defaults to 100ms.
159159
#[serde(
160160
serialize_with = "serialize_duration_millis",

helix-view/src/gutter.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,10 @@ pub fn diff<'doc>(
101101
let mut hunk = hunks.nth_hunk(hunk_i);
102102
Box::new(move |line: usize, _selected: bool, out: &mut String| {
103103
// truncating the line is fine here because we don't compute diffs
104-
// for files with more lines then i32::MAX anyways
104+
// for files with more lines than i32::MAX anyways
105105
// we need to special case removals here
106106
// these technically do not have a range of lines to highlight (`hunk.after.start == hunk.after.end`).
107-
// However we still want to display these hunks correctly we must not yet scipe to the next hunk here
107+
// However we still want to display these hunks correctly we must not yet skip to the next hunk here
108108
while hunk.after.end < line as u32
109109
|| !hunk.is_pure_removal() && line as u32 == hunk.after.end
110110
{

0 commit comments

Comments
 (0)