summaryrefslogtreecommitdiff
path: root/desktop/selection.c
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/selection.c')
-rw-r--r--desktop/selection.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/desktop/selection.c b/desktop/selection.c
index 9140ebbf0..0d45f1720 100644
--- a/desktop/selection.c
+++ b/desktop/selection.c
@@ -134,7 +134,8 @@ void selection_reinit(struct selection *s, struct box *root)
if (IS_INPUT(root)) {
static int next_idx = 0;
- root_idx = (next_idx++) << 28;
+ if (!++next_idx) next_idx = 1;
+ root_idx = next_idx << 28;
}
else
root_idx = 0;
@@ -192,6 +193,20 @@ void selection_init(struct selection *s, struct box *root)
/**
+ * Indicate whether the selected text is read only, ie. cannot be modified.
+ *
+ * \param s selection object
+ * \return true iff the selection is read only
+ */
+
+bool selection_read_only(struct selection *s)
+{
+ return !s->root || !NUMBER_SPACE(s->root->byte_offset);
+
+}
+
+
+/**
* Label each text box in the given box subtree with its position
* in a textual representation of the content.
*