summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-07-06 10:14:16 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-07-06 10:14:16 +0200
commitf2d74a69df074262d020a4dd3d5e05d348e327e9 (patch)
tree3a436d19ab2a86072bc3d3bf8fd0a2168c244788
parentchore(deployes): Add newly deployed binaries (diff)
downloadqmk_layout-f2d74a69df074262d020a4dd3d5e05d348e327e9.zip
fix(keymap): Avoid formatting it via clang-format
Diffstat (limited to '')
-rw-r--r--rust/format/src/main.rs20
-rw-r--r--src/keymaps/soispha/layout/keymap.h2
2 files changed, 20 insertions, 2 deletions
diff --git a/rust/format/src/main.rs b/rust/format/src/main.rs
index 3554087..9c167eb 100644
--- a/rust/format/src/main.rs
+++ b/rust/format/src/main.rs
@@ -10,12 +10,25 @@ fn main() {
.read_to_string(&mut keymap_h)
.expect("Failed to read keymap_h");
+ let mut lines: Vec<_> = keymap_h.lines().collect();
+ if lines[0] == "// clang-format off" {
+ lines.remove(0);
+ }
+ if lines.last().expect("Exists") == &"// clang-format on" {
+ lines.remove(lines.len() - 1);
+ }
+
+ keymap_h = lines.join("\n");
+
let mut c_column_max = [0; 14];
let out = calculate(&mut c_column_max, keymap_h);
let output = calculate(&mut c_column_max, out.join("\n"));
- print!("{}", output.join("\n"));
+ print!(
+ "// clang-format off\n{}\n// clang-format on",
+ output.join("\n")
+ );
}
fn calculate(c_column_max: &mut [usize; 14], keymap_h: String) -> Vec<String> {
@@ -35,7 +48,10 @@ fn calculate(c_column_max: &mut [usize; 14], keymap_h: String) -> Vec<String> {
}
'[' => {
// Start of a new layer
- assert!(c_layer.is_empty(), "No new layer, without empty");
+ assert!(
+ c_layer.is_empty(),
+ "A new layer cannot start, when the current layer is not empty."
+ );
output.push(format!(" {}", line));
}
')' => {
diff --git a/src/keymaps/soispha/layout/keymap.h b/src/keymaps/soispha/layout/keymap.h
index e6697d8..e5cbfc1 100644
--- a/src/keymaps/soispha/layout/keymap.h
+++ b/src/keymaps/soispha/layout/keymap.h
@@ -1,3 +1,4 @@
+// clang-format off
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_moonlander( // Dvorak
KK_TP, KK_TP, KK_TP, KK_TP, KK_TP, KK_TP, QK_BOOT, QK_BOOT, KK_TP, KK_TP, KK_TP, KK_TP, KK_TP, VERSION_NUMBER,
@@ -90,3 +91,4 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),
};
+// clang-format on