LineEdit has a
text_entered signal that will fire when it has focus and Enter is pressed. Connect that signal to a function and it should be as easy as calling
clear() on the LineEdit node. You should be able to write your other logic in there as well.
Just tested and it works:
label_node = self.get_parent().get_node("RichTextLabel")
func _on_LineEdit_text_entered( text ):
if text.length() > 0:
# append the text to RichTextLabel
# option: label_node.newline() instead of "\n"
label_node.add_text(text + "\n")
# clear LineEdit