Re: [g-a-devel] RFC: AtkText simplification (take 3)



On 08/06/2013 01:21 PM, Joanmarie Diggs wrote:
On 08/06/2013 11:36 AM, Mario Sanchez Prada wrote:

    typedef enum {
        ATK_TEXT_GRANULARITY_CHAR,
        ATK_TEXT_GRANULARITY_WORD,
        ATK_TEXT_GRANULARITY_LINE,
        ATK_TEXT_GRANULARITY_SENTENCE
    } AtkTextGranularity;
As long as we're at it.... How about ATK_TEXT_GRANULARITY_PARAGRAPH?

In some cases paragraphs are distinct objects; in other cases they are not.

So my first question would be, how do you know when the paragraph ends?
It is just about a new line? Probably writing the documentation for that
boundary would help, based on the current sentence one, I can think on
the following:

|ATK_TEXT_GRANULARITY_PARAGRAPH: |Granularity is the last (terminal)
character in a paragraph; in languages which use "paragraph stop"
punctuation such as English, the boundary is thus the '\n' or similar
terminal punctuation character"

Is that correct?

In any case, while we wait for concluding something about this value, I
will go on with the review of the current patches, just in case there
are something else to take into account.


    gchar* atk_text_get_text_for_offset (AtkText *text,
                                         gint offset,
                                         AtkTextGranularity  granularity,
                                         gint *start_offset,
                                         gint *end_offset);
In a similar spirit, currently start_offset and end_offset wind up being
0 and 0 respectively in two cases:

1. There is not text at that offset for the specified
   granularity/boundary.
2. Error, lack of implementation, etc.

We have traditionally used -1 elsewhere as an indication of errors, etc.
Any objection to doing so for this method (i.e. via adding it to the
documentation)?

Mario did a little research here, and I think that at-spi2 is changing
NULL for "" and also filling those -1. Mario, could you
confirm/elaborate that?

In any case, with my atk maintainer hat on, I don't mind to do the same
on atk (that I guess would make at-spi life easier). So I see this cases:
1. No text (atk implementation needs to return ""): start_offset ==
end_offset == 0
2. Lack of implementation (atk method would return NULL): start_offset
== end_offset == -1 (this can be done at atk)
3. Error (atk method would return NULL): start_offset == end_offset ==
-1 (this needs to be done at the implementation)

Is what you were proposing?

BR

-- 
Alejandro Piñeiro Iglesias



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