Skip to content

Commit

Permalink
Fix: CLRF line endings incompatible with Mac game clients
Browse files Browse the repository at this point in the history
  • Loading branch information
KonaeAkira committed Jul 6, 2024
1 parent 733b0e0 commit 08fd1de
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
10 changes: 5 additions & 5 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

<!-- config for our rust wasm binary. go to https://trunkrs.dev/assets/#rust for more customization -->

<script type="module" nonce="CDpB5BK3/B5k+WDQ7mbRFQ==">
import init, * as bindings from 'https://www.raphael-xiv.com/raphael-xiv-8772b6e094f636c0.js';
const wasm = await init('https://www.raphael-xiv.com/raphael-xiv-8772b6e094f636c0_bg.wasm');
<script type="module" nonce="Ka22yMCJS2QopkyHiIeX1g==">
import init, * as bindings from 'https://www.raphael-xiv.com/raphael-xiv-dfd223f526365870.js';
const wasm = await init('https://www.raphael-xiv.com/raphael-xiv-dfd223f526365870_bg.wasm');


window.wasmBindings = bindings;
Expand Down Expand Up @@ -126,8 +126,8 @@
}
</style>

<link rel="modulepreload" href="https://www.raphael-xiv.com/raphael-xiv-8772b6e094f636c0.js" crossorigin=anonymous integrity="sha384-9ld9RE6NxsOA3EuQXsPsXxZgDby98dakyepah95IPUAzwmXcMcrt7ozxbIGkWqr8">
<link rel="preload" href="https://www.raphael-xiv.com/raphael-xiv-8772b6e094f636c0_bg.wasm" crossorigin=anonymous integrity="sha384-8ig7NvByOj+1v6U0G6IsDvbN+Z6jCwPxq5+RX2rT476T4/xJfSyjggsxuXqqWL+Q" as="fetch" type="application/wasm"></head>
<link rel="modulepreload" href="https://www.raphael-xiv.com/raphael-xiv-dfd223f526365870.js" crossorigin=anonymous integrity="sha384-9ld9RE6NxsOA3EuQXsPsXxZgDby98dakyepah95IPUAzwmXcMcrt7ozxbIGkWqr8">
<link rel="preload" href="https://www.raphael-xiv.com/raphael-xiv-dfd223f526365870_bg.wasm" crossorigin=anonymous integrity="sha384-WIjIHv7U96GzUbsSt9293sNVG9HrLmk2sfStloYDFxpP9hY2iT+QH/gb803D4kJS" as="fetch" type="application/wasm"></head>

<body>
<!-- The WASM code will resize the canvas dynamically -->
Expand Down
File renamed without changes.
Binary file not shown.
15 changes: 13 additions & 2 deletions src/widgets/macro_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ impl MacroTextBox {
max_index: usize,
actions: &[Action],
config: &MacroViewConfig,
newline: &'static str,
) -> Self {
let mut lines: Vec<_> = actions
.into_iter()
Expand All @@ -54,7 +55,7 @@ impl MacroTextBox {
));
}
Self {
text: lines.join("\r\n"),
text: lines.join(newline),
}
}
}
Expand Down Expand Up @@ -146,8 +147,18 @@ impl<'a> Widget for MacroView<'a> {
false => usize::MAX,
};
let count = self.actions.chunks(chunk_size).count();
let newline = match ui.ctx().os() {
egui::os::OperatingSystem::Mac => "\n",
_ => "\r\n",
};
for (index, actions) in self.actions.chunks(chunk_size).enumerate() {
ui.add(MacroTextBox::new(index + 1, count, actions, &self.config));
ui.add(MacroTextBox::new(
index + 1,
count,
actions,
&self.config,
newline,
));
}
// fill the remaining space
ui.with_layout(Layout::bottom_up(Align::LEFT), |_| {});
Expand Down

0 comments on commit 08fd1de

Please sign in to comment.