aboutsummaryrefslogtreecommitdiff
path: root/src/sc_parse.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2018-03-03 16:01:50 +0100
committerThomas White <taw@physics.org>2018-03-03 18:17:16 +0100
commitb8dd2901f9e205f330fca47cbd3984270b5d60b1 (patch)
tree47158908f9b9d1974d68fd0ec94b14fab237e345 /src/sc_parse.c
parent4b757f1f48643e9b049e4c868c94d127a6bc8c1c (diff)
Remove text_run offsets and lengths
Keeping these up to date was becoming a gigantic headache. So instead of storing the values, routines which are interested in these lengths and offsets can calculate them themselves.
Diffstat (limited to 'src/sc_parse.c')
-rw-r--r--src/sc_parse.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/sc_parse.c b/src/sc_parse.c
index 2607031..26f9303 100644
--- a/src/sc_parse.c
+++ b/src/sc_parse.c
@@ -746,6 +746,12 @@ size_t scblock_delete_text(SCBlock *b, ssize_t o1, ssize_t o2)
return 0;
}
+ if ( (o2 != -1) && (o1 > o2) ) {
+ ssize_t t = o2;
+ o2 = o1;
+ o1 = t;
+ }
+
len = strlen(b->contents);
if ( o2 < 0 ) o2 = len;
if ( (o1 >= o2) || (o1 > len) || (o2 > len) ) {