Skip to content

Commit 32b71c1

Browse files
CosmicHorrorDevcoastalwhitenicoburnsAlphaKeks
authored
v0.3.2 backportapalooza (#170)
* Some clean ups, fixes, config flag (#91) * Refactor: Remove unneccesary CLI branching * Refactor: Refactor configuration load function * Feat: Add '--config' flag * Refactor: Reduce passing of args and configuration * Fix: Fix cli parsing of page width * Clean: use 'display()' instead of debug print for path * Clean: use Default for Keybindings * Refactor: Use Keybindings in tests * Doc: Fix 'page width' to 'page_width' * Refactor: use interpolation style * Refactor: Remove inline on Keybindings::new * Refactor: Extract Keybindings Default implementation * Refactor: Destructure Config and Args in opts * Support bare relative links (#103) * Attempt to reregister file watcher on file "removal" (#106) * Add a test for all CLI options (#116) * Add repology badge for package manager installation (#109) * Make correct location of `inlyne.toml` file clearer (#122) * Make correct location of `inlyne.toml` file clearer * Fix missing backtick * Interpreter testing (#132) * Interpreter test tweaks (#138) * Cleanup existing custom debug impls * Add custom debug impls for `Element::Image(_)` * Add a snapshot test for complex image elements * More robust file watching (#147) * The watcher should attempt to re-register on name changes * Re-register watcher after longer delays * Add a reminder for fixing watching after file changes * Move file watcher into its own file * Make file watcher testable * Watcher follows file changes * Test the file watcher * Final test tweaks * Swap back to the old delays * Final final test tweaks * Use a slightly longer delay * Shorter poll interval for file watcher * Follow through with rename * Make file reloading less panic happy (#145) * Rework panic happy file reloading * Tweak logs * The watcher should attempt to re-register on name changes * Re-register watcher after longer delays * Improve syntax highlighting (#150) * Add failing test * Use extended syntax definitions * Add failing test * Allow for comma as an info string delimiter * Retry watcher test with increased delays (#155) * Fix-up nested lists (#154) * Add failing tests * Handle nesting of lists * Cleanup list prefix handling * Dogfood new `smart-debug` crate (#156) * Dont ignore locked mutex in debug impl (#166) * fix: add missing `fontdb` feature flag (#169) This solves an issue with the NixOS build where fonts are required at runtime for inlyne to start. With the `fontconfig` feature flag inlyne will use font-config to determine a font. Partially resolves #164 * Add relevant keywords to `Cargo.toml` (#171) * Use `human-panic` for a custom panic hook (#172) * Use `human-panic` for a custom panic hook * Indicate that the version is a "git release" * `cargo upgragde` * Update `two-face` * `cargo update` * Update simple dependencies * Update `smart-debug` * Update `resvg` & co. * Update `rust-version` to v1.70.0 * Bump version to v0.3.2 --------- Co-authored-by: Gijs Burghoorn <[email protected]> Co-authored-by: Nico Burns <[email protected]> Co-authored-by: AlphaKeks <[email protected]>
1 parent 8f55507 commit 32b71c1

30 files changed

+3349
-1163
lines changed

Cargo.lock

+1,648-819
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+36-27
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,63 @@
11
[package]
22
name = "inlyne"
3-
version = "0.3.1"
3+
version = "0.3.2"
44
description = "Introducing Inlyne, a GPU powered yet browserless tool to help you quickly view markdown files in the blink of an eye."
55
edition = "2021"
66
authors = ["trimental"]
77
license = "MIT"
88
readme = "README.md"
99
repository = "https://github.com/trimental/inlyne"
1010
homepage = "https://github.com/trimental/inlyne"
11+
rust-version = "1.70"
12+
keywords = ["markdown", "viewer", "gpu"]
1113

1214
[dependencies]
13-
wgpu_glyph = "0.20"
14-
winit = "0.28.5"
15-
wgpu = "0.16"
16-
bytemuck = "1.13.1"
15+
wgpu_glyph = "0.21"
16+
winit = "0.28.7"
17+
wgpu = "0.17"
18+
bytemuck = "1.14.0"
1719
lyon = "1.0.1"
18-
comrak = { version = "0.18.0", default-features = false, features = ["syntect"] }
19-
open = "4.1.0"
20+
comrak = { version = "0.19.0", default-features = false, features = ["syntect"] }
21+
open = "5.0.1"
2022
html5ever = "0.26.0"
21-
image = "0.24.6"
22-
clap = { version = "4.2.7", features = ["cargo"] }
23-
copypasta = "0.8.2"
24-
resvg = "0.32.0"
25-
usvg = "0.32.0"
26-
tiny-skia = "0.9.0"
27-
anyhow = "1.0.71"
23+
image = "0.24.7"
24+
clap = { version = "4.3.24", features = ["cargo"] }
25+
copypasta = "0.10.0"
26+
resvg = "0.36"
27+
usvg = "0.36"
28+
tiny-skia = "0.11"
29+
anyhow = "1.0.75"
2830
dirs = "5.0.1"
29-
serde = { version = "1.0.162", features = ["derive"] }
30-
toml = "0.7.3"
31-
reqwest = { version = "0.11.17", features = ["blocking", "json", "stream"] }
31+
serde = { version = "1.0.193", features = ["derive"] }
32+
toml = "0.7.6"
33+
reqwest = { version = "0.11.22", features = ["blocking", "json", "stream"] }
3234
font-kit = "0.11.0"
33-
memmap2 = "0.5.10"
34-
log = "0.4.17"
35-
env_logger = "0.10.0"
36-
notify = "5.1.0"
37-
clap_complete = "4.2.1"
35+
memmap2 = "0.9.0"
36+
log = "0.4.20"
37+
env_logger = "0.10.1"
38+
notify = "6.1.1"
39+
clap_complete = "4.3.2"
3840
dark-light = "1.0.0"
3941
# We only decompress our own compressed data, so disable `safe-decode` and
4042
# `checked-decode`
41-
lz4_flex = { version = "0.10.0", default-features = false, features = ["frame", "safe-encode", "std"] }
43+
lz4_flex = { version = "0.11.1", default-features = false, features = ["frame", "safe-encode", "std"] }
4244
pollster = "0.3.0"
45+
smart-debug = "0.0.3"
46+
syntect = "5.1.0"
47+
two-face = "0.3.0"
4348

44-
# Uncomment for profiling
45-
# [profile.release]
46-
# debug = true
49+
# Required for WGPU to work properly with Vulkan
50+
fontdb = { version = "0.16.0", features = ["fontconfig"] }
51+
human-panic = "1.2.2"
4752

4853
[profile.release-lto]
4954
inherits = "release"
5055
strip = true
5156
lto = true
5257

5358
[dev-dependencies]
54-
pretty_assertions = "1.3.0"
59+
filetime = "0.2.22"
60+
insta = "1.34.0"
61+
pretty_assertions = "1.4.0"
62+
tempfile = "3.8.1"
63+
wiremock = "0.5.21"

README.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ view markdown files in the blink of an eye.
2323
## Install
2424

2525
To install just use `cargo install inlyne`, everything comes pre-bundled.
26+
Alternatively you can install through various package managers.
27+
28+
[![Packaging status](https://repology.org/badge/vertical-allrepos/inlyne.svg)](https://repology.org/project/inlyne/versions)
2629

2730
## Features
2831

@@ -90,7 +93,13 @@ You weren't supposed to see this!
9093

9194
## Configuration
9295

93-
Use `inlyne --help` to see all the command line options. Some of which can be set permentantly by placing an `inlyne.toml` file into the default [dirs](https://crates.io/crates/dirs) configuration folder for your respective OS. Checkout `inlyne.toml.sample` for an example configuration.
96+
Use `inlyne --help` to see all the command line options. Some of which can be set permentantly by placing an `inlyne.toml` file into a directory called `inlyne` within the default [dirs](https://crates.io/crates/dirs) configuration folder for your respective OS:
97+
98+
- Linux: `/home/alice/.config/inlyne/inlyne.toml`
99+
- Windows: `C:\Users\Alice\AppData\Roaming\inlyne\inlyne.toml`
100+
- Mac: `/Users/Alice/Library/Application Support/inlyne/inlyne.toml`
101+
102+
Checkout `inlyne.toml.sample` for an example configuration.
94103

95104
## FAQ
96105

src/debug_impls.rs

+176
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
//! A whole load of custom debug impls to keep the output more succinct
2+
//!
3+
//! Mostly to reduce noise for snapshot tests, but also good in general
4+
5+
use std::fmt;
6+
7+
use crate::{positioner::Spacer, text::Text};
8+
9+
pub struct DebugInlineMaybeF32Color<'a>(pub &'a Option<[f32; 4]>);
10+
11+
impl fmt::Debug for DebugInlineMaybeF32Color<'_> {
12+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
13+
match self.0 {
14+
None => f.write_str("None"),
15+
Some(rgba) => f.write_fmt(format_args!("Some({:?})", DebugF32Color(*rgba))),
16+
}
17+
}
18+
}
19+
20+
pub struct DebugF32Color(pub [f32; 4]);
21+
22+
impl fmt::Debug for DebugF32Color {
23+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
24+
if self.0 == [0.0, 0.0, 0.0, 1.0] {
25+
f.write_str("Color(BLACK)")
26+
} else {
27+
let Self([r, g, b, a]) = self;
28+
29+
if *a == 1.0 {
30+
f.write_fmt(format_args!("Color {{ r: {r:.2}, g: {g:.2}, b: {b:.2} }}"))
31+
} else {
32+
f.write_fmt(format_args!(
33+
"Color {{ r: {r:.2}, g: {g:.2}, b: {b:.2}, a: {a:.2} }}"
34+
))
35+
}
36+
}
37+
}
38+
}
39+
40+
pub struct DebugInline<'inner, T>(pub &'inner T);
41+
42+
impl<T: fmt::Debug> fmt::Debug for DebugInline<'_, T> {
43+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
44+
f.write_fmt(format_args!("{:?}", self.0))
45+
}
46+
}
47+
48+
fn debug_inline_some<T: fmt::Debug>(
49+
debug: &mut fmt::DebugStruct<'_, '_>,
50+
name: &'static str,
51+
maybe_t: &Option<T>,
52+
) {
53+
if maybe_t.is_some() {
54+
debug.field(name, &DebugInline(maybe_t));
55+
}
56+
}
57+
58+
pub struct DebugBytesPrefix<'a>(pub &'a [u8]);
59+
60+
impl<'a> fmt::Debug for DebugBytesPrefix<'a> {
61+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
62+
match self.0 {
63+
[x, y, z, _, ..] => {
64+
let len = self.0.len();
65+
f.write_fmt(format_args!("{{ len: {len}, data: [{x}, {y}, {z}, ..] }}"))
66+
}
67+
three_or_less => f.write_fmt(format_args!("{three_or_less:?}")),
68+
}
69+
}
70+
}
71+
72+
pub fn text(text: &Text, f: &mut fmt::Formatter<'_>) -> fmt::Result {
73+
#[derive(Copy, Clone)]
74+
struct StyleWrapper {
75+
is_bold: bool,
76+
is_italic: bool,
77+
is_underlined: bool,
78+
is_striked: bool,
79+
}
80+
81+
impl StyleWrapper {
82+
fn is_regular(self) -> bool {
83+
let Self {
84+
is_bold,
85+
is_italic,
86+
is_underlined,
87+
is_striked,
88+
} = self;
89+
90+
![is_bold, is_italic, is_underlined, is_striked].contains(&true)
91+
}
92+
}
93+
94+
impl fmt::Debug for StyleWrapper {
95+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
96+
let Self {
97+
is_bold,
98+
is_italic,
99+
is_underlined,
100+
is_striked,
101+
} = *self;
102+
103+
if self.is_regular() {
104+
f.write_str("REGULAR")?;
105+
} else {
106+
if is_bold {
107+
f.write_str("BOLD ")?;
108+
}
109+
if is_italic {
110+
f.write_str("ITALIC ")?;
111+
}
112+
if is_underlined {
113+
f.write_str("UNDERLINED ")?;
114+
}
115+
if is_striked {
116+
f.write_str("STRIKED ")?;
117+
}
118+
}
119+
120+
Ok(())
121+
}
122+
}
123+
124+
let Text {
125+
text,
126+
size,
127+
color,
128+
link,
129+
is_bold,
130+
is_italic,
131+
is_underlined,
132+
is_striked,
133+
font: _,
134+
// Globally consistent so avoid displaying as noise
135+
hidpi_scale: _,
136+
default_color,
137+
} = text;
138+
139+
let mut debug = f.debug_struct("Text");
140+
141+
// Fields that we will always display
142+
debug.field("text", text);
143+
144+
// Fields that we only display when set to unique values
145+
if *size != 16.0 {
146+
debug.field("size", size);
147+
}
148+
if color.is_none() {
149+
debug.field("default_color", &DebugF32Color(*default_color));
150+
} else {
151+
let color = color.map(DebugF32Color);
152+
debug.field("color", &DebugInline(&color));
153+
}
154+
let style = StyleWrapper {
155+
is_bold: *is_bold,
156+
is_italic: *is_italic,
157+
is_underlined: *is_underlined,
158+
is_striked: *is_striked,
159+
};
160+
if !style.is_regular() {
161+
debug.field("style", &style);
162+
}
163+
debug_inline_some(&mut debug, "link", link);
164+
165+
debug.finish_non_exhaustive()
166+
}
167+
168+
pub fn spacer(spacer: &Spacer, f: &mut fmt::Formatter<'_>) -> fmt::Result {
169+
let Spacer { space, visible } = spacer;
170+
171+
if *visible {
172+
f.write_fmt(format_args!("VisibleSpacer({space})"))
173+
} else {
174+
f.write_fmt(format_args!("InvisibleSpacer({space})"))
175+
}
176+
}

0 commit comments

Comments
 (0)