Issue #21960 has been updated by Eregon (Benoit Daloze). For context, https://bugs.ruby-lang.org/issues/14145#note-25 was about what the terminal selects when double-clicking on the path. In ptyxis and Gnome Terminal (commonly used terminals on Linux), this is the results: ``` path/to/test.rb:1:in ... # selects `path/to/test.rb` (good) path/to/test.rb:1 in ... # selects `path/to/test.rb` (good) Integer#times@path/to/test.rb:1 # selects `Integer#times@path/to/test.rb` (bad) Integer#times path/to/test.rb:1 # selects `path/to/test.rb` (good) ``` So a `@` before the path was confusing probably most terminals. OTOH at least ptyxis and Gnome Terminal stop at `:` so don't select the `:` at all. I'm +1 for this issue because I think it does look cleaner and more readable without the `:` before `in`, and it's more consistent with `from`: `in` is not part of the source code location so it should be separated with a space like `from location in 'Class#method'`. i.e. ```diff - from some/file.rb:1:in 'Kernel#tap' + from some/file.rb:1 in 'Kernel#tap' ``` Compatibility concerns might mean it's not worth it though. ---------------------------------------- Feature #21960: Improve #backtrace to not confuse terminals https://bugs.ruby-lang.org/issues/21960#change-116809 * Author: svoop (Sven Schwyn) * Status: Open ---------------------------------------- The `#backtrace` of exceptions are currently printed like so: ``` /path/to/whatever.rb:8:in `/' /path/to/whatever.rb:8:in `show' (...) ``` Most terminals recognize `/path/to/whatever.rb:8` as a local file and make it clickable as "open in editor", however, some (e.g. Ghostty) include everything up to the next whitespace, in this case `/path/to/whatever.rb:8:in`. This is then used as an argument to `open` (on macOS) which will not work due to the `:in` part. There are two ways to improve this: ## Replace the colon with a space Given the existence of `#backtrace_locations` which is better suited for programmatically working with backtrace locations, it should not break things to slightly modify the `#backtrace` to look like this: ``` /path/to/whatever.rb:8 in `/' /path/to/whatever.rb:8 in `show' (...) ^^^ space instead of colon ``` ## Add OCS 8 sequences [OCS 8](https://github.com/Alhadis/OSC8-Adoption) are the `<a>` tag for terminal output. While many terminals support it, it might cause visual noise in logs and therefore would have to be an opt-in feature e.g. via a Ruby interpreter argument. -- https://bugs.ruby-lang.org/