rework max_lines/cols detection to support line wrapping (#15 part 1)
[smdp.git] / src / parser.c
index c04facc..c8120cd 100644 (file)
@@ -501,6 +501,13 @@ int next_nonblank(cstring_t *text, int i) {
     return i;
 }
 
+int prev_blank(cstring_t *text, int i) {
+    while ((i > 0) && !isspace((unsigned char) (text->text)[i]))
+        i--;
+
+    return i;
+}
+
 int next_blank(cstring_t *text, int i) {
     while ((i < text->size) && !isspace((unsigned char) (text->text)[i]))
         i++;