vte_terminal_get_text_range_format() misses the annotation of length
vte_terminal_get_text_range_format()
's length
parameter is an output parameter but it's not annotated.
So GObject Introspection based VTE users need to specify length
by themselves as an input parameter:
import gi
gi.require_version("Vte", "2.91")
from gi.repository import Vte
terminal = Vte.Terminal()
terminal.get_text_range_format(Vte.Format.TEXT, 0, 0, 0, 0)
# Traceback (most recent call last):
# File "a.py", line 6, in <module>
# terminal.get_text_range_format(Vte.Format.TEXT, 0, 0, 0, 0)
# TypeError: Vte.Terminal.get_text_range_format() takes exactly 7 arguments (6 given)
But this is unexpected because users need to pass an address of length not an integer value:
import gi
gi.require_version("Vte", "2.91")
from gi.repository import Vte
terminal = Vte.Terminal()
terminal.get_text_range_format(Vte.Format.TEXT, 0, 0, 0, 0, 0) # This works because the last 0 is treated as NULL
terminal.get_text_range_format(Vte.Format.TEXT, 0, 0, 0, 0, 100) # This crashes because the last 100 is an invalid address
How about adding an annotation for length
like vte_terminal_get_text_selected_full()
https://gitlab.gnome.org/GNOME/vte/-/blob/master/src/vtegtk.cc#L5876 ?
diff --git a/src/vtegtk.cc b/src/vtegtk.cc
index 095cb47e..b80f908e 100644
--- a/src/vtegtk.cc
+++ b/src/vtegtk.cc
@@ -4457,6 +4457,7 @@ catch (...)
* @start_col: the first column of the range
* @end_row: the last row of the range
* @end_col: the last column of the range
+ * @length: (optional) (out): a pointer to a #gsize to store the string length
*
* Returns the specified range of text in the specified format.
*