Web lists-archives.com

Re: Pango delete/backspace best practices




On 1 September 2017 at 12:41, Jeffrey Sheen
<jeffrey.sheen00@xxxxxxxxxxxxxxxxxxxxx> wrote:
> Thank you Emmanuele,
>
> I received similar feedback from another member of the list.
>
> I will take a look at the suggested source code in GtkTextView and GtkEntry
> (I am unfamiliar, as I am not using the upper libraries in the GTK stack).

If you're going to implement text editing, you're probably going to
need much more than Pango alone. GTK+ has a lot of code dealing with
text editing — both in single line and multi-line contexts.

On top of that, there are two whole libraries for text editing widgets
based on top of that code:

  - GtkSourceView: https://git.gnome.org/browse/gtksourceview
  - Tepl: https://git.gnome.org/browse/tepl/

> A suggestion of a more suitable mailing list would be appreciated as well. I
> do not want to clutter an inappropriate group.

You probably want gtk-devel-list, but mailing lists are kind of high
latency and not everyone familiar with Pango reads them.

You may want to join the #gtk+ IRC channel, on irc.gnome.org.

Ciao,
 Emmanuele.

> On 1 September 2017 at 12:34, Emmanuele Bassi <ebassi@xxxxxxxxx> wrote:
>>
>> Or, more likely, you sent the email to the wrong list. You probably
>> want to talk to the developers of text editors based on GtkTextView
>> and Pango.
>>
>> Additionally, you may want to look at GtkTextView itself.
>>
>> Ciao,
>>  Emmanuele.
>>
>>
>> On 1 September 2017 at 12:14, Jeffrey Sheen
>> <jeffrey.sheen00@xxxxxxxxxxxxxxxxxxxxx> wrote:
>> > Dear list,
>> >
>> > As there has not been a response to my query about Unicode deletion-key
>> > interrupts, one of the following must be true:
>> >
>> > My question does not make sense, as I have made an incorrect assumption
>> > No-one on the list has written code for a text editor widget
>> > No-one wishes to share their experience writing code for a text editor
>> > widget
>> >
>> > The first reason is most likely, but I would appreciate a brief
>> > explanation.
>> >
>> > Deletion-key interrupts are a fundamental use-case of creating an
>> > application with interactive text, so I think this is an important
>> > talking
>> > point.
>> >
>> > Jeff.
>> >
>> > On 22 July 2017 at 12:45, Jeffrey Sheen
>> > <jeffrey.sheen00@xxxxxxxxxxxxxxxxxxxxx> wrote:
>> >>
>> >> Dear list,
>> >>
>> >> I would like to leverage your experience with the Pango API.
>> >>
>> >> I am currently using "pango_layout_move_cursor_visually" to handle
>> >> arrow-key presses. This establishes the byte index that the cursor
>> >> should be
>> >> moved to, visually skipping whole grapheme clusters.
>> >>
>> >> However, I understand that there are more states are required when
>> >> handling the delete and backspace keys, depending on the text's
>> >> language.
>> >>
>> >> i.e. it is possible to press a deletion key, and the grapheme cluster
>> >> be
>> >> altered, but not reduce the number of grapheme clusters in the string.
>> >>
>> >> Reading the Pango API documentation, this aspect appears to be
>> >> represented
>> >> with the "PangoLogAttr.backspace_deletes_character" member variable.
>> >>
>> >> However, unlike "pango_layout_move_cursor_visually",
>> >> "pango_get_log_attrs"
>> >> operates below the level of a PangoLayout object, requiring a
>> >> PangoLanguage*
>> >> to be passed.
>> >>
>> >> Must I manually store the language that a block of text is written in
>> >> and
>> >> convert this to a PangoLanguage object?
>> >>
>> >> What is the best practice when handling a delete/backspace key press?
>> >>
>> >> Cheers,
>> >>
>> >> Jeff.
>> >
>> >
>> >
>> > _______________________________________________
>> > gtk-list mailing list
>> > gtk-list@xxxxxxxxx
>> > https://mail.gnome.org/mailman/listinfo/gtk-list
>> >
>>
>>
>>
>> --
>> https://www.bassi.io
>> [@] ebassi [@gmail.com]
>
>
>
> _______________________________________________
> gtk-list mailing list
> gtk-list@xxxxxxxxx
> https://mail.gnome.org/mailman/listinfo/gtk-list
>



-- 
https://www.bassi.io
[@] ebassi [@gmail.com]
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list