1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-26 14:49:06 -04:00

Use runtime knowledge of OS for OS-specific text editing (#3840)

How text editing behaves depends on what OS we are running on.

`target_os` is a compile-time check, but `ctx.os()` is a runtime check,
that works also on web.
This commit is contained in:
Emil Ernerfeldt
2024-01-19 13:37:10 +01:00
committed by GitHub
parent b766a48fa7
commit f7ec8f210d
4 changed files with 46 additions and 14 deletions

View File

@@ -66,6 +66,15 @@ def lint_lines(filepath, lines_in):
)
lines_out.append("#[inline]")
if (
"(target_os" in line
and filepath.startswith("./crates/egui/")
and filepath != "./crates/egui/src/os.rs"
):
errors.append(
f"{filepath}:{line_nr}: Don't use `target_os` - use ctx.os() instead."
)
lines_out.append(line)
prev_line = line