Skip to content

Commit

Permalink
Strip bbcode tags before printing to stdout and fix whitespace issue
Browse files Browse the repository at this point in the history
  • Loading branch information
limbonaut committed Sep 10, 2024
1 parent 9302217 commit a6ce8aa
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions limbo_console.gd
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,9 @@ func print_boxed(p_line: String) -> void:
func print_line(p_line: String, p_stdout: bool = _options.print_to_stdout) -> void:
if _silent:
return
var line: String = p_line + "\n"
_output.text += line
_output.text += p_line + "\n"
if p_stdout:
print_rich(line.strip_edges())
print(_bbcode_strip(p_line))


## Registers a new command for the specified callable. [br]
Expand Down Expand Up @@ -747,6 +746,19 @@ func _bbcode_escape(p_text: String) -> String:
.replace("~RB~", "[rb]")


func _bbcode_strip(p_text: String) -> String:
var stripped := ""
var in_brackets: bool = false
for c: String in p_text:
if c == '[':
in_brackets = true
elif c == ']':
in_brackets = false
elif not in_brackets:
stripped += c
return stripped


func _get_method_info(p_callable: Callable) -> Dictionary:
var method_info: Dictionary
var method_list: Array[Dictionary]
Expand Down

0 comments on commit a6ce8aa

Please sign in to comment.