[atk: 1/2] Fix failure value for atk_text_get_caret_offset



commit 951b1e9b9fd47e3b36c0bd43f0d7782e9dc0eb1a
Author: Martin Robinson <mrobinson igalia com>
Date:   Fri Feb 22 09:21:46 2019 +0100

    Fix failure value for atk_text_get_caret_offset
    
    atk_text_get_caret_offset should return -1 if the caret is not located
    within the element or for other failures. This will allow clients to
    distinguish between a failure and when the caret is at offset 0.

 atk/atktext.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/atk/atktext.c b/atk/atktext.c
index f10885d..a974cd5 100644
--- a/atk/atktext.c
+++ b/atk/atktext.c
@@ -636,7 +636,7 @@ gchar* atk_text_get_string_at_offset (AtkText *text,
  *
  * Gets the offset of the position of the caret (cursor).
  *
- * Returns: the character offset of the position of the caret or 0  if
+ * Returns: the character offset of the position of the caret or -1 if
  *          the caret is not located inside the element or in the case of
  *          any other failure.
  **/
@@ -652,7 +652,7 @@ atk_text_get_caret_offset (AtkText *text)
   if (iface->get_caret_offset)
     return (*(iface->get_caret_offset)) (text);
   else
-    return 0;
+    return -1;
 }
 
 /**


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