From 744815f6480f76574acdc52772a1759f02e56aa9 Mon Sep 17 00:00:00 2001 From: CosmicHorror Date: Sat, 6 Apr 2024 10:31:54 -0600 Subject: [PATCH] v0.4.2 backportapalooza (#303) * fix(links): ignore the case when look-up for an anchor (#256) * Fix exclude for `manual_test_data` (#257) * docs(repology): Exclude unsupported package repos (#271) * fix(table): Fix crash when rendering headerless table (#279) * docs(readme): Improve installation docs (#280) * fix: add check to render_selection, so it does not return small boxes. (#288) Signed-off-by: konrad * chore(deps): Update `smithay-client-toolkit` from v0.16.0 -> v0.16.1 (#298) * chore: Dont check for typos on test data --------- Signed-off-by: konrad Co-authored-by: Anas Co-authored-by: kokoISnoTarget <72217393+kokoISnoTarget@users.noreply.github.com> --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- README.md | 22 ++++++++++++++++------ src/main.rs | 2 +- src/renderer.rs | 13 +++++++++---- src/text.rs | 4 ++++ typos.toml | 2 ++ 7 files changed, 37 insertions(+), 16 deletions(-) create mode 100644 typos.toml diff --git a/Cargo.lock b/Cargo.lock index 4ae89076..6f8fd985 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -985,7 +985,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412" dependencies = [ - "libloading 0.8.1", + "libloading 0.7.4", ] [[package]] @@ -3711,9 +3711,9 @@ dependencies = [ [[package]] name = "smithay-client-toolkit" -version = "0.16.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f307c47d32d2715eb2e0ece5589057820e0e5e70d07c247d1063e844e107f454" +checksum = "870427e30b8f2cbe64bf43ec4b86e88fe39b0a84b3f15efd9c9c2d020bc86eb9" dependencies = [ "bitflags 1.3.2", "calloop 0.10.6", @@ -5164,7 +5164,7 @@ dependencies = [ "percent-encoding", "raw-window-handle", "redox_syscall 0.3.5", - "smithay-client-toolkit 0.16.0", + "smithay-client-toolkit 0.16.1", "wasm-bindgen", "wayland-client 0.29.5", "wayland-commons", diff --git a/Cargo.toml b/Cargo.toml index 71976d8b..d78fa6d6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,7 +18,7 @@ rust-version = "1.72.1" exclude = [ "/ci/*", "/.github/*", - "/tests/manual_test_data/*", + "/assets/manual_test_data/*", ] keywords = ["markdown", "viewer", "gpu"] diff --git a/README.md b/README.md index 26d38d54..e3780c17 100644 --- a/README.md +++ b/README.md @@ -20,16 +20,26 @@ Except 9 times out of 10 you need an entire web browser to quickly open a file.. Introducing **Inlyne**, a GPU powered yet browserless tool to help you quickly view markdown files in the blink of an eye 👀. -## Install +## Installation -To install just use `cargo install inlyne`, almost everything comes pre-bundled (see [Dependencies](#dependencies)). -Alternatively you can install through various package managers. +`inlyne` is already present in a handful of different package repos. +Installation should be mostly painless as _most_ things come pre-bundled. -[![Packaging status](https://repology.org/badge/vertical-allrepos/inlyne.svg)](https://repology.org/project/inlyne/versions) +[![Packaging status](https://repology.org/badge/vertical-allrepos/inlyne.svg?exclude_unsupported=1)](https://repology.org/project/inlyne/versions) -### Dependencies +### Building from Source -The `fontconfig` package from your distribution needs to be installed. See https://github.com/yeslogic/fontconfig-rs#dependencies. +There are a small handful of dependencies needed to build `inlyne` from source. +Namely + +1. `cargo` with a somewhat recent Rust toolchain + [(the relevant docs)](https://www.rust-lang.org/learn/get-started) +2. A C-compiler +3. (On Linux) Development libraries for `fontconfig`, `xkbcommon`, and `wayland` + (when the `wayland` feature flag is set) + +For instance on Ubuntu `gcc` covers 2. and `libfontconfig-dev`, +`libxkbcommon-dev` and `libwayland-dev` would cover 3. ## Features diff --git a/src/main.rs b/src/main.rs index 28b7d29b..c0ee3a0d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -533,7 +533,7 @@ impl Inlyne { } } } else if let Some(anchor_pos) = - self.renderer.positioner.anchors.get(link) + self.renderer.positioner.anchors.get(&link.to_lowercase()) { self.renderer.set_scroll_y(*anchor_pos); self.window.request_redraw(); diff --git a/src/renderer.rs b/src/renderer.rs index 102c8096..13015d48 100644 --- a/src/renderer.rs +++ b/src/renderer.rs @@ -399,10 +399,15 @@ impl Renderer { } } } - let last_header_node = layout.headers.last().unwrap(); - let y = last_header_node.location.y - + last_header_node.size.height - + TABLE_ROW_GAP / 2.; + let y = layout + .headers + .last() + .map(|last_header_node| { + last_header_node.location.y + + last_header_node.size.height + + TABLE_ROW_GAP / 2.0 + }) + .unwrap_or(0.0); let x = layout .headers .last() diff --git a/src/text.rs b/src/text.rs index 1192d502..80ca56db 100644 --- a/src/text.rs +++ b/src/text.rs @@ -442,6 +442,10 @@ impl TextBox { select_end.0 - screen_position.0, select_end.1 - screen_position.1, ) { + if start_cursor.index == end_cursor.index { + return (vec![], String::new()); + } + let mut y = screen_position.1; for line in buffer.layout_runs() { let line_contains = diff --git a/typos.toml b/typos.toml new file mode 100644 index 00000000..67b5763a --- /dev/null +++ b/typos.toml @@ -0,0 +1,2 @@ +[files] +extend-exclude = ["assets/manual_test_data"]