diff --git a/CHANGELOG.md b/CHANGELOG.md index b9a2af71..3583cfef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ Types of changes: ### Removed ### Fixed +- Fixed `pyqasm validate` wrapping its diagnostics at the console width, which split a file path longer than the width across lines mid-token and left it neither copyable nor clickable. The error console now uses `soft_wrap`, keeping one diagnostic per line. - Fixed an indirect cycle between gate definitions exhausting the Python stack: `gate a q { b q; }` with `gate b q { a q; }` raised a bare `RecursionError` naming nothing, while the direct case was already reported cleanly. The guard compared the body's gate name against one name, so it saw only a cycle of length one. It now tests membership of the whole expansion chain, and names the path: `Recursive definitions not allowed for gate 'a' (a -> b -> a)`. A gate reached twice down separate paths is a diamond, not a cycle, and still expands. ([#369](https://github.com/qBraid/pyqasm/issues/369)) - Fixed a nested external custom gate counting the depth of the decomposition it skipped, the shape the [#352](https://github.com/qBraid/pyqasm/issues/352) fix did not reach: `unroll(external_gates=["outer"])` on a gate whose body calls another custom gate emitted one statement but reported `depth() == 13`. The suppression flag was assigned and cleared without save-restore, so the inner gate clobbered the outer gate's state in both directions. It is now saved and restored, and the depth is recorded once, from the outermost external gate. ([#367](https://github.com/qBraid/pyqasm/issues/367)) diff --git a/src/pyqasm/cli/validate.py b/src/pyqasm/cli/validate.py index ea8c23f7..92adb137 100644 --- a/src/pyqasm/cli/validate.py +++ b/src/pyqasm/cli/validate.py @@ -55,7 +55,10 @@ def validate_qasm(src_paths: list[str], skip_files: Optional[list[str]] = None) failed_files: list[tuple[str, Exception]] = [] - console = Console() + # soft_wrap keeps each diagnostic on one line. Rich otherwise wraps at the + # console width and breaks mid-token, so a file path longer than the width is + # split across lines and stops being copyable or clickable in a terminal. + console = Console(soft_wrap=True) def validate_qasm_file(file_path: str) -> None: with open(file_path, "r", encoding="utf-8") as f: