Compare commits

...
9 Commits
Author SHA1 Message Date
meehl 3ca5f984de chore: Release rusty-path-of-building version 0.2.17
Release / create-release (push) Successful in 8s
2026-05-24 09:29:31 +02:00
meehl 6dbf6c0e3c Update CHANGELOG 2026-05-24 09:29:09 +02:00
meehl 6a05d86801 Adjust index to account for color escape sequences
get_text_index_at_cursor() returns an index into the stripped string,
but PoB expects an index into the original unstripped text. Accumulate
the total length of all escape sequences preceding the cursor position
and add it to the returned index.

Fixes #45
2026-05-14 10:42:26 +02:00
meehl 068dfce7ca Use correct font names to register generic font families
Fixes #48
2026-05-13 15:37:54 +02:00
Game Monster 28a9089443 Add macOS development setup guide to CONTRIBUTING 2026-04-08 15:23:38 +02:00
Game Monster e42776a2c8 Improve macOS compatibility
Enables wgpu's metal backend and restricts usage of smithay-clipboard, which provides access to the Wayland clipboard, to linux systems.
2026-04-08 14:48:21 +02:00
meehl c8bda4b76f chore: Release rusty-path-of-building version 0.2.16
Release / create-release (push) Successful in 4s
2026-03-23 08:54:23 +01:00
meehl fe10962c4b Update CHANGELOG 2026-03-23 08:53:54 +01:00
meehl 4dc8db6921 Fix tar extraction 2026-03-23 08:49:59 +01:00
9 changed files with 174 additions and 37 deletions

No files matched your search

+53
View File
@@ -1,11 +1,64 @@
# Contributing to Rusty Path Of Building
## Reporting bugs
- Ensure the bug was not already reported by searching through existing [issues](https://github.com/meehl/rusty-path-of-building/issues).
- If the bug can also be reproduced with the official runtime (e.g. by running through wine), please open an issue in the [PoB1](https://github.com/PathOfBuildingCommunity/PathOfBuilding) or [PoB2](https://github.com/PathOfBuildingCommunity/PathOfBuilding-PoE2) repo instead. If you're unsure, feel free to just open it here.
- If possible, use the bug report template to create the issue and provide as much information as possible.
## Contributing code
- Get familiar with the code base before you start. I'll try to add more documentation providing a high-level overview of the architecture in the future. Until then, feel free to reach out through [Discussions](https://github.com/meehl/rusty-path-of-building/discussions) if you have any questions.
- If you intend to work on the API functions, also check out the [SimpleGraphic](https://github.com/PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic) code base. A great place to ask questions about it is the PoB dev discord server. [Here](https://github.com/PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic) is more info on how to join.
- Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable.
## macOS Development Setup
### 1. Install Lua runtime dependencies
The application requires several Lua C libraries at runtime. Install them using LuaRocks with the LuaJIT backend:
```bash
brew install luajit luarocks
luarocks --lua-version 5.1 install luasocket
luarocks --lua-version 5.1 install luautf8
luarocks --lua-version 5.1 install lua-curl
```
Build and install `lzip` from the bundled source (requires zlib, which is pre-installed on macOS):
```bash
cd lua/libs/lzip && make LUA_IMPL=luajit install
```
### 2. Configure LUA_CPATH
Add the following to your shell profile (`~/.zshrc` or `~/.bash_profile`) so the runtime can locate the installed libraries:
```bash
eval $(luarocks --lua-version 5.1 path)
```
Then reload your shell or run `source ~/.bash_profile`.
### 3. Startup
```bash
cargo run <poe1|poe2>
```
Path of Building files are automatically downloaded to the following directories on first startup:
- poe1: `~/Library/Application Support/RustyPathOfBuilding1`
- poe2: `~/Library/Application Support/RustyPathOfBuilding2`
### Troubleshooting
**Build fails with `library 'luajit-5.1' not found`**
This usually means the build cache points to an old LuaJIT version after a Homebrew upgrade. Run:
```bash
cargo clean && cargo run <poe1|poe2>
```
+2
View File
@@ -1 +1,3 @@
/target/
*.so
*.so.dSYM
+20 -1
View File
@@ -2,6 +2,23 @@
## [Unreleased] - ReleaseDate
## [0.2.17] - 2026-05-24
### Changed
- Improve macOS compatibility
### Fixed
- Fix broken selection and display of colored text
- Fix black screen during installation on nixOS
## [0.2.16] - 2026-03-23
### Fixed
- Fix bug that causes tarball extraction to fail
## [0.2.15] - 2026-03-22
### Changed
@@ -182,8 +199,10 @@
- First release
<!-- next-url -->
[Unreleased]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.15...HEAD
[Unreleased]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.17...HEAD
[0.2.17]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.16...v0.2.17
[0.2.16]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.15...v0.2.16
[0.2.15]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.14...v0.2.15
[0.2.14]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.13...v0.2.14
[0.2.13]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.12...v0.2.13
Generated
+66 -2
View File
@@ -372,6 +372,12 @@ dependencies = [
"core2",
]
[[package]]
name = "block"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
[[package]]
name = "block2"
version = "0.5.1"
@@ -648,7 +654,7 @@ checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081"
dependencies = [
"bitflags 1.3.2",
"core-foundation 0.9.4",
"core-graphics-types",
"core-graphics-types 0.1.3",
"foreign-types",
"libc",
]
@@ -664,6 +670,17 @@ dependencies = [
"libc",
]
[[package]]
name = "core-graphics-types"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb"
dependencies = [
"bitflags 2.11.0",
"core-foundation 0.10.1",
"libc",
]
[[package]]
name = "core2"
version = "0.4.0"
@@ -1792,6 +1809,15 @@ version = "0.11.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "373f5eceeeab7925e0c1098212f2fbc4d416adec9d35051a6ab251e824c1854a"
[[package]]
name = "malloc_buf"
version = "0.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb"
dependencies = [
"libc",
]
[[package]]
name = "maybe-rayon"
version = "0.1.1"
@@ -1817,6 +1843,21 @@ dependencies = [
"libc",
]
[[package]]
name = "metal"
version = "0.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00c15a6f673ff72ddcc22394663290f870fb224c1bfce55734a75c414150e605"
dependencies = [
"bitflags 2.11.0",
"block",
"core-graphics-types 0.2.0",
"foreign-types",
"log",
"objc",
"paste",
]
[[package]]
name = "mime"
version = "0.3.17"
@@ -2039,6 +2080,15 @@ dependencies = [
"syn",
]
[[package]]
name = "objc"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1"
dependencies = [
"malloc_buf",
]
[[package]]
name = "objc-sys"
version = "0.3.5"
@@ -3099,7 +3149,7 @@ checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
[[package]]
name = "rusty-path-of-building"
version = "0.2.15"
version = "0.2.17"
dependencies = [
"ahash",
"anyhow",
@@ -4084,11 +4134,21 @@ dependencies = [
"rustc-hash 1.1.0",
"smallvec",
"thiserror 2.0.18",
"wgpu-core-deps-apple",
"wgpu-core-deps-windows-linux-android",
"wgpu-hal",
"wgpu-types",
]
[[package]]
name = "wgpu-core-deps-apple"
version = "27.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0772ae958e9be0c729561d5e3fd9a19679bcdfb945b8b1a1969d9bfe8056d233"
dependencies = [
"wgpu-hal",
]
[[package]]
name = "wgpu-core-deps-windows-linux-android"
version = "27.0.0"
@@ -4108,16 +4168,20 @@ dependencies = [
"arrayvec",
"ash",
"bitflags 2.11.0",
"block",
"bytemuck",
"cfg-if",
"cfg_aliases",
"core-graphics-types 0.2.0",
"gpu-alloc",
"gpu-descriptor",
"hashbrown 0.16.1",
"libc",
"libloading",
"log",
"metal",
"naga",
"objc",
"ordered-float",
"parking_lot",
"portable-atomic",
+3 -3
View File
@@ -4,7 +4,7 @@ authors = ["meehl"]
description = "Cross-platform runtime for Path of Building"
repository = "https://github.com/meehl/rusty-path-of-building"
license = "MIT"
version = "0.2.15"
version = "0.2.17"
edition = "2024"
publish = false
@@ -37,11 +37,11 @@ regex = "1.11.2"
reqwest = { version = "0.13.2", features = ["blocking"] }
swash = "0.2.5"
tar = "0.4.44"
wgpu = { version = "27.0.1", default-features = false, features = ["std", "parking_lot", "vulkan", "wgsl"] }
wgpu = { version = "27.0.1", default-features = false, features = ["std", "parking_lot", "vulkan", "metal", "wgsl"] }
winit = "0.30"
zstd = "0.13.3"
[target.'cfg(unix)'.dependencies]
[target.'cfg(target_os = "linux")'.dependencies]
smithay-clipboard = "0.7.3"
[features]
+18 -3
View File
@@ -445,14 +445,29 @@ fn get_index_at_cur(
let font_type = font_type.parse::<PoBFontType>()?;
let job = build_layout_job(&text, Srgba::WHITE, font_type, line_height, None);
let index = ctx.fonts().get_text_index_at_cursor(
let index_stripped = ctx.fonts().get_text_index_at_cursor(
job,
Point::new(cur_x, cur_y),
ctx.window().scale_factor(),
);
// convert to lua's 1-based indexing
Ok(index + 1)
// build_layout_job() strips all color escape strings from the original string. The
// resulting [`LayoutJob`] is then passed to get_text_index_at_cursor() which returns an
// index into the **stripped* string.
// But PoB expects an index into the **original, unstripped** text. Therefore we need to add
// the length of all color escapes up until the cursor position to return the right value.
//
// TODO: avoid matching and iterating over string twice
let mut color_escapes_total_length = 0;
for capture in ESCAPE_STR_REGEX.find_iter(&text) {
if capture.start() - color_escapes_total_length > index_stripped {
break;
}
color_escapes_total_length += capture.len();
}
// add length of color escapes and convert to lua's 1-based indexing
Ok(index_stripped + color_escapes_total_length + 1)
}
pub static ESCAPE_STR_REGEX: LazyLock<Regex> =
+3 -10
View File
@@ -392,24 +392,17 @@ fn pob_font_definitions() -> FontDefinitions {
definitions.generic_families.insert(
parley::GenericFamily::Monospace,
vec!["bitstream-vera-sans-mono".to_owned()],
vec!["Bitstream Vera Sans Mono".to_owned()],
);
definitions.generic_families.insert(
parley::GenericFamily::SansSerif,
vec![
"liberation-sans".to_owned(),
"liberation-sans-bold".to_owned(),
],
vec!["Liberation Sans".to_owned()],
);
definitions.generic_families.insert(
parley::GenericFamily::Serif,
vec![
"fontin-regular".to_owned(),
"fontin-italic".to_owned(),
"fontin-smallcaps".to_owned(),
],
vec!["Fontin".to_owned(), "Fontin SmallCaps".to_owned()],
);
definitions
+5 -5
View File
@@ -5,7 +5,7 @@ use raw_window_handle::RawDisplayHandle;
/// `smithay_clipboard`: Used on wayland
/// `arboard`: All other platforms (check arboard docs for platform support)
pub struct Clipboard {
#[cfg(target_family = "unix")]
#[cfg(target_os = "linux")]
smithay: Option<smithay_clipboard::Clipboard>,
arboard: Option<arboard::Clipboard>,
// fallback if everything else fails. only supports intra-application copy/paste
@@ -15,7 +15,7 @@ pub struct Clipboard {
impl Clipboard {
pub fn new(_raw_display_handle: Option<RawDisplayHandle>) -> Self {
Self {
#[cfg(target_family = "unix")]
#[cfg(target_os = "linux")]
smithay: create_smithay_clipboard(_raw_display_handle),
arboard: create_arboard_clipboard(),
fallback: None,
@@ -24,7 +24,7 @@ impl Clipboard {
/// Sets the text content of clipboard
pub fn set_text(&mut self, text: String) {
#[cfg(target_family = "unix")]
#[cfg(target_os = "linux")]
if let Some(clipboard) = &mut self.smithay {
clipboard.store(text);
return;
@@ -40,7 +40,7 @@ impl Clipboard {
/// Gets the text content of clipboard
pub fn get_text(&mut self) -> Option<String> {
#[cfg(target_family = "unix")]
#[cfg(target_os = "linux")]
if let Some(clipboard) = &mut self.smithay {
return clipboard.load().ok();
}
@@ -57,7 +57,7 @@ impl Clipboard {
}
}
#[cfg(target_family = "unix")]
#[cfg(target_os = "linux")]
fn create_smithay_clipboard(
raw_display_handle: Option<RawDisplayHandle>,
) -> Option<smithay_clipboard::Clipboard> {
+4 -13
View File
@@ -183,16 +183,7 @@ pub fn download_and_extract_tarball(
let gz = GzDecoder::new(io::BufReader::new(tmp_file));
let mut archive = Archive::new(gz);
let mut entries = archive.entries()?;
let root_prefix = {
let first = entries
.next()
.ok_or_else(|| io::Error::new(io::ErrorKind::UnexpectedEof, "archive is empty"))??;
first.path()?.to_string_lossy().into_owned()
};
for entry_result in entries {
for entry_result in archive.entries()? {
let mut entry = entry_result?;
let entry_path = entry.path()?.to_path_buf();
let entry_str = entry_path.to_string_lossy();
@@ -202,9 +193,9 @@ pub fn download_and_extract_tarball(
continue;
}
// Strip root prefix before matching against rules
let relative = match entry_str.strip_prefix(root_prefix.as_str()) {
Some(r) => r,
// Strip root folder before matching against rules
let relative = match entry_str.split_once('/') {
Some((_, rest)) => rest,
None => continue,
};