From 136c546c1f4c1a57de584a41d0abb3927aab2454 Mon Sep 17 00:00:00 2001 From: Syed Daanish Date: Mon, 8 Dec 2025 19:16:18 +0000 Subject: [PATCH] Add better precompiler control --- include/editor.h | 6 +++++- include/rope.h | 6 +++--- include/ts.h | 6 +++++- include/ui.h | 6 +++++- include/utils.h | 5 +++++ 5 files changed, 23 insertions(+), 6 deletions(-) diff --git a/include/editor.h b/include/editor.h index 37401b2..6d42d3e 100644 --- a/include/editor.h +++ b/include/editor.h @@ -1,4 +1,6 @@ -#pragma once +#ifndef EDITOR_H +#define EDITOR_H + #include "../libs/tree-sitter/lib/include/tree_sitter/api.h" #include "./rope.h" #include "./ui.h" @@ -143,3 +145,5 @@ void cursor_down(Editor *editor, uint32_t number); void cursor_left(Editor *editor, uint32_t number); void cursor_right(Editor *editor, uint32_t number); void ensure_scroll(Editor *editor); + +#endif diff --git a/include/rope.h b/include/rope.h index 5f29da4..53cfebc 100644 --- a/include/rope.h +++ b/include/rope.h @@ -1,5 +1,5 @@ -#ifndef ROPE_HPP -#define ROPE_HPP +#ifndef ROPE_H +#define ROPE_H #include #include @@ -154,4 +154,4 @@ std::vector> search_rope(Knot *root, // This must be called only once when the rope is no longer needed void free_rope(Knot *root); -#endif // ROPE_HPP +#endif // ROPE_H diff --git a/include/ts.h b/include/ts.h index f175ae7..96ff6f2 100644 --- a/include/ts.h +++ b/include/ts.h @@ -1,7 +1,11 @@ -#pragma once +#ifndef TS_H +#define TS_H + #include "./editor.h" #define HEX(s) (static_cast(std::stoul(s, nullptr, 16))) TSQuery *load_query(const char *query_path, Editor *editor); void ts_collect_spans(Editor *editor); + +#endif diff --git a/include/ui.h b/include/ui.h index adc2f1b..8a60a78 100644 --- a/include/ui.h +++ b/include/ui.h @@ -1,4 +1,6 @@ -#pragma once +#ifndef UI_H +#define UI_H + #include #include #include @@ -104,3 +106,5 @@ int read_input(char *buf, size_t buflen); KeyEvent read_key(); int display_width(const char *str); + +#endif diff --git a/include/utils.h b/include/utils.h index 0ee2219..5eccb64 100644 --- a/include/utils.h +++ b/include/utils.h @@ -1,3 +1,6 @@ +#ifndef UTILS_H +#define UTILS_H + #include #include #include @@ -30,3 +33,5 @@ uint32_t get_bytes_from_visual_col(const char *line, uint32_t target_visual_col); void log(const char *fmt, ...); std::string get_exe_dir(); + +#endif