Re: Pango delete/backspace best practices



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 alumni imperial ac uk> 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.



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