Text Changed and GailTextView

At ATK level the signal "text-changed" is defined in atktext.c. This
signal supports two details "insert" and "delete". The signal handler has
two integer parameters, which are the position and length of the text being 
inserted or deleted.

A GtkTextBuffer has three signals of interest, "insert-text", "delete-range"
and "changed". The "insert-text" and "delete-range" signals are emitted 
before the change occurs. The parameters of the "insert-text" signal  gives 
the position and length of the text as well as the actual text. The two
parameters of the "delete-range" signal are both GtkTextIters which identify
the start and end point of the text being deleted. The "changed" signal
is emitted after the text has been inserted or deleted.

The current implementation in GailTextView causes a "text-changed" signal
with the appropriate detail to be emitted on receipt of a "insert-text"
or "delete-range" signal. Note that the text being inserted which is
available in the "text-changed" signal handler is discarded.

When the "changed" signal is received another "text-changed" signal is emitted
as well as a notification that the property "accessible-text" has changed.

To my mind, the emission of two "text-changed" signals for the one
insertion and deletion looks wrong.

One possibility would be to emit the "text-changed" signal for a deletion when
"delete-range" signal is received. This way one could determine the text being 
deleted.  The "text-changed' signal for an insertion could be emitted
when the "changed" signal is received rather than when "insert-text" signal
is received. One could then determine what text was inserted.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]