[pango/line-breaker] pango-lines: more cornercases
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/line-breaker] pango-lines: more cornercases
- Date: Mon, 24 Jan 2022 19:52:52 +0000 (UTC)
commit 615bae911865ee4bfebcdc6d9526ee856dc2ba7a
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Jan 24 13:55:07 2022 -0500
pango-lines: more cornercases
pango/pango-lines.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/pango/pango-lines.c b/pango/pango-lines.c
index de86735c..bf28f9e9 100644
--- a/pango/pango-lines.c
+++ b/pango/pango-lines.c
@@ -1000,7 +1000,7 @@ pango_lines_get_caret_pos (PangoLines *lines,
* was at the trailing edge.
* @direction: direction to move cursor. A negative
* value indicates motion to the left
- * @new_line: `PangoLayoutLine` wrt to which @new_idx is interpreted
+ * @new_line: (nullable): `PangoLayoutLine` wrt to which @new_idx is interpreted
* @new_idx: (out): location to store the new cursor byte index
* A value of -1 indicates that the cursor has been moved off the
* beginning of the layout. A value of %G_MAXINT indicates that
@@ -1052,7 +1052,6 @@ pango_lines_move_cursor (PangoLines *lines,
g_return_if_fail (PANGO_IS_LINES (lines));
g_return_if_fail (idx >= 0);
g_return_if_fail (trailing >= 0);
- g_return_if_fail (new_line != NULL);
g_return_if_fail (new_idx != NULL);
g_return_if_fail (new_trailing != NULL);
@@ -1127,7 +1126,8 @@ pango_lines_move_cursor (PangoLines *lines,
prev_line = pango_lines_get_line (lines, line_no - 1, NULL, NULL);
if (!prev_line)
{
- *new_line = NULL;
+ if (new_line)
+ *new_line = NULL;
*new_idx = -1;
*new_trailing = 0;
g_array_unref (cursors);
@@ -1145,7 +1145,8 @@ pango_lines_move_cursor (PangoLines *lines,
next_line = pango_lines_get_line (lines, line_no + 1, NULL, NULL);
if (!next_line)
{
- *new_line = NULL;
+ if (new_line)
+ *new_line = NULL;
*new_idx = G_MAXINT;
*new_trailing = 0;
g_array_unref (cursors);
@@ -1202,7 +1203,8 @@ pango_lines_move_cursor (PangoLines *lines,
while (log_pos > start_offset && !line->data->log_attrs[log_pos].is_cursor_position);
}
- *new_line = line;
+ if (new_line)
+ *new_line = line;
g_array_unref (cursors);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]