diff --git a/Cargo.lock b/Cargo.lock index 8375271b12f..b9991ae7207 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -67,9 +67,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.2.53" +version = "1.2.54" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "755d2fce177175ffca841e9a06afdb2c4ab0f593d53b4dee48147dfaade85932" +checksum = "6354c81bbfd62d9cfa9cb3c773c2b7b2a3a482d569de977fd0e961f6e7c00583" dependencies = [ "find-msvc-tools", "jobserver", @@ -125,18 +125,18 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.54" +version = "4.5.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6e6ff9dcd79cff5cd969a17a545d79e84ab086e444102a591e288a8aa3ce394" +checksum = "3e34525d5bbbd55da2bb745d34b36121baac88d07619a9a09cfcf4a6c0832785" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.5.54" +version = "4.5.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa42cf4d2b7a41bc8f663a7cab4031ebafa1bf3875705bfaf8466dc60ab52c00" +checksum = "59a20016a20a3da95bef50ec7238dbd09baeef4311dcdd38ec15aba69812fb61" dependencies = [ "anstyle", "clap_lex", @@ -348,6 +348,14 @@ version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" +[[package]] +name = "lsh" +version = "0.0.0" +dependencies = [ + "regex-syntax", + "stdext", +] + [[package]] name = "memchr" version = "2.7.6" @@ -427,18 +435,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.105" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "535d180e0ecab6268a3e718bb9fd44db66bbbc256257165fc699dadf70d16fe7" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.43" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc74d9a594b72ae6656596548f56f667211f8a97b3d4c3d467150794690dc40a" +checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4" dependencies = [ "proc-macro2", ] @@ -813,9 +821,9 @@ dependencies = [ [[package]] name = "winresource" -version = "0.1.29" +version = "0.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17cdfa8da4b111045a5e47c7c839e6c5e11c942de1309bc624393ed5d87f89c6" +checksum = "e287ced0f21cd11f4035fe946fd3af145f068d1acb708afd248100f89ec7432d" dependencies = [ "version_check", ] @@ -828,18 +836,18 @@ checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" [[package]] name = "zerocopy" -version = "0.8.33" +version = "0.8.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "668f5168d10b9ee831de31933dc111a459c97ec93225beb307aed970d1372dfd" +checksum = "71ddd76bcebeed25db614f82bf31a9f4222d3fbba300e6fb6c00afa26cbd4d9d" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.33" +version = "0.8.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c7962b26b0a8685668b671ee4b54d007a67d4eaf05fda79ac0ecf41e32270f1" +checksum = "d8187381b52e32220d50b255276aa16a084ec0a9017a0ca2152a1f55c539758d" dependencies = [ "proc-macro2", "quote", @@ -848,9 +856,9 @@ dependencies = [ [[package]] name = "zmij" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfcd145825aace48cff44a8844de64bf75feec3080e0aa5cdbde72961ae51a65" +checksum = "02aae0f83f69aafc94776e879363e9771d7ecbffe2c7fbb6c14c5e00dfe88439" [[package]] name = "zstd" diff --git a/Cargo.toml b/Cargo.toml index fb53ab464f5..52f2424021e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,5 +28,6 @@ lto = "thin" # Similarly, speed up linking by a ton [workspace.dependencies] edit = { path = "./crates/edit" } +lsh = { path = "./crates/lsh" } stdext = { path = "./crates/stdext" } unicode-gen = { path = "./crates/unicode-gen" } diff --git a/assets/highlighting-tests/COMMIT_EDITMSG b/assets/highlighting-tests/COMMIT_EDITMSG new file mode 100644 index 00000000000..cfba35d08da --- /dev/null +++ b/assets/highlighting-tests/COMMIT_EDITMSG @@ -0,0 +1,62 @@ +lsh: flip legacy flag, add follow-up hook & diff test + +Refactors placeholder logic and introduces a lightweight follow-up hook. +Adds diff highlighting test and removes outdated asset to streamline visuals. + +# Please enter the commit message for your changes. Lines starting +# with '#' will be ignored, and an empty message aborts the commit. +# +# On branch foobar +# Your branch is up to date with 'origin/foobar'. +# +# Changes to be committed: +# renamed: foo.rs -> bar.rs +# modified: src/lsh/definitions.rs +# deleted: assets/old_logo.svg +# new file: baz.rs +# +# ------------------------ >8 ------------------------ +# Do not modify or remove the line above. +# Everything below it will be ignored. +diff --git a/src/lsh/definitions.rs b/src/lsh/definitions.rs +index a1b2c3d..d4c3b2a 100644 +--- a/src/lsh/definitions.rs ++++ b/src/lsh/definitions.rs +@@ -12,9 +12,11 @@ // context line 12 + // context line 13 +-// old placeholder logic A +-const LEGACY_FLAG: bool = true; +-// end legacy block ++// updated placeholder logic A ++const LEGACY_FLAG: bool = false; // flipped for test ++// added note: migration in progress ++// end legacy block + // context line 19 + // context line 20 +@@ -42,7 +44,12 @@ // context line 42 + // context line 43 +- do_placeholder_action(alpha, beta); ++ // Split actions for clarity ++ do_placeholder_prepare(alpha); ++ do_placeholder_action(alpha, beta); ++ if (enable_extra()) { ++ do_placeholder_followup(beta); ++ } + // context line 50 + // context line 51 + // context line 52 +@@ -90,6 +97,15 @@ // context line 90 + // context line 91 + // context line 92 ++/// Added lightweight fake helper ++fn enable_extra() -> bool { ++ // Pretend this consults a config value ++ true ++} ++ ++// Temporary debug instrumentation (to be removed) ++const _DEBUG_HOOK: &str = "lsh:extra"; ++ + // context line 93 + // context line 94 + // context line 95 diff --git a/assets/highlighting-tests/diff.diff b/assets/highlighting-tests/diff.diff new file mode 100644 index 00000000000..8d033f94bfc --- /dev/null +++ b/assets/highlighting-tests/diff.diff @@ -0,0 +1,142 @@ +diff --git a/src/lsh/definitions.rs b/src/lsh/definitions.rs +index a1b2c3d..d4c3b2a 100644 +--- a/src/lsh/definitions.rs ++++ b/src/lsh/definitions.rs +@@ -12,9 +12,11 @@ // context line 12 + // context line 13 +-// old placeholder logic A +-const LEGACY_FLAG: bool = true; +-// end legacy block ++// updated placeholder logic A ++const LEGACY_FLAG: bool = false; // flipped for test ++// added note: migration in progress ++// end legacy block + // context line 19 + // context line 20 +@@ -42,7 +44,12 @@ // context line 42 + // context line 43 +- do_placeholder_action(alpha, beta); ++ // Split actions for clarity ++ do_placeholder_prepare(alpha); ++ do_placeholder_action(alpha, beta); ++ if (enable_extra()) { ++ do_placeholder_followup(beta); ++ } + // context line 50 + // context line 51 + // context line 52 +@@ -90,6 +97,15 @@ // context line 90 + // context line 91 + // context line 92 ++/// Added lightweight fake helper ++fn enable_extra() -> bool { ++ // Pretend this consults a config value ++ true ++} ++ ++// Temporary debug instrumentation (to be removed) ++const _DEBUG_HOOK: &str = "lsh:extra"; ++ + // context line 93 + // context line 94 + // context line 95 + +diff --git a/src/tui.rs b/src/tui.rs +index 1122334..5566778 100644 +--- a/src/tui.rs ++++ b/src/tui.rs +@@ -5,8 +5,13 @@ // context line 5 + // context line 6 + // context line 7 +-// previous rendering stub +-render_placeholder(frame); ++// refined rendering sequence ++begin_frame(frame); ++render_header(frame); ++render_body(frame); ++render_footer(frame); ++end_frame(frame); ++ + // context line 14 + // context line 15 + // context line 16 + +diff --git a/README.md b/README.md +index 9aa9aa9..1bb1bb1 100644 +--- a/README.md ++++ b/README.md +@@ -1,6 +1,11 @@ + # Project Title +-Some brief description here. ++Some brief description here (updated). ++ ++Experimental notes: ++- Added fake diff example ++- Demonstrates multi-hunk & multi-file patch ++ + ## Usage + Run the binary as needed. + +diff --git a/Cargo.toml b/Cargo.toml +index cafe123..fade321 100644 +--- a/Cargo.toml ++++ b/Cargo.toml +@@ -8,7 +8,10 @@ edition = "2021" + # context + [features] +-default = [] ++default = ["experimental-preview"] ++experimental-preview = [] ++ ++# NOTE: Above feature is placeholder & fake + + [dependencies] + # context +@@ -20,6 +23,7 @@ anyhow = "1" + # context + # instrumentation (fake addition) + tracing = "0.1" ++tracing-subscriber = "0.3" + +diff --git a/src/feature/experimental.rs b/src/feature/experimental.rs +new file mode 100644 +index 0000000..abc1234 +--- /dev/null ++++ b/src/feature/experimental.rs +@@ -0,0 +1,24 @@ ++//! Placeholder experimental module (fake content). ++//! This file exists only to demonstrate a multi-file diff. ++#![allow(dead_code)] ++ ++pub struct ExperimentalToggle { ++ enabled: bool, ++} ++ ++impl ExperimentalToggle { ++ pub fn new() -> Self { ++ Self { enabled: true } ++ } ++ pub fn enabled(&self) -> bool { ++ self.enabled ++ } ++} ++ ++pub fn run_experimental_path() { ++ if ExperimentalToggle::new().enabled() { ++ // Fake behavior ++ eprintln!("(fake) running experimental path"); ++ } ++} ++ + +diff --git a/assets/old_logo.svg b/assets/old_logo.svg +deleted file mode 100644 +index 55aa55a..0000000 +--- a/assets/old_logo.svg ++++ /dev/null +@@ -1,5 +0,0 @@ +- +- +- +- X +- diff --git a/assets/highlighting-tests/git-rebase-todo b/assets/highlighting-tests/git-rebase-todo new file mode 100644 index 00000000000..d051d122292 --- /dev/null +++ b/assets/highlighting-tests/git-rebase-todo @@ -0,0 +1,54 @@ +pick 3f9d2ab # chore(ci): add initial pipeline +pick e12c0ff # feat(io): introduce streaming reader +reword 7ac14d0 feat(io): add zero-copy buffered writer +edit 4d92b67 fix(io): handle partial UTF-8 sequences at buffer boundary +pick 8bb3a21 docs: expand README performance section +squash 1c02f55 docs: tidy wording in performance section +pick 54ae91b feat(cli): add --color=auto detection +fixup 0b77c3e feat(cli): typo in help text +fixup -c 2f4e8ab feat(cli): adjust arg parsing error message +pick 6d8e5f1 refactor(core): split large module into submodules +break +pick a41e9d3 test(core): add regression tests for issue #410 +exec cargo test --package edit --lib --quiet +pick c3bb921 perf(render): SIMD accelerate line diffing +drop 91d0f2e debug(render): temporary logging (to be dropped) +label pre-merge-split +pick d2f7ac4 feat(ui): add mouse wheel smooth scrolling +pick f1a4bd9 feat(ui): add high-DPI awareness +label post-ui +update-ref refs/heads/feature/ui-stack-post +reset pre-merge-split +merge -C 5ab77e3 post-ui # Merge UI feature stack +pick d8c4b91 build: bump version to 0.9.0 + +# Rebase 3f9d2ab..d8c4b91 onto d8c4b91 (18 commands) +# +# Commands: +# p, pick = use commit +# r, reword = use commit, but edit the commit message +# e, edit = use commit, but stop for amending +# s, squash = use commit, but meld into previous commit +# f, fixup [-C | -c] = like "squash" but keep only the previous +# commit's log message, unless -C is used, in which case +# keep only this commit's message; -c is same as -C but +# opens the editor +# x, exec = run command (the rest of the line) using shell +# b, break = stop here (continue rebase later with 'git rebase --continue') +# d, drop = remove commit +# l, label