@@ -215,8 +215,8 @@ fn (mut c ParaChunk) update_line_height(cv &ChunkView) {
215
215
mut lh := 0
216
216
mut style, mut left := '' , ''
217
217
for content in c.content {
218
- if content.index_after (para_style_delim, 0 ) == 0 {
219
- content_start := content.index_after (para_style_delim, 1 )
218
+ if content.index_after (para_style_delim, 0 ) or { - 1 } == 0 {
219
+ content_start := content.index_after (para_style_delim, 1 ) or { - 1 }
220
220
if content_start > 1 { // empty style means same style
221
221
style = content[1 ..content_start]
222
222
}
@@ -247,8 +247,8 @@ fn (mut c ParaChunk) update_chunks(cv &ChunkView) {
247
247
mut add_chunk := cv.has_scrollview // false
248
248
249
249
for content in c.content {
250
- if content.index_after (para_style_delim, 0 ) == 0 {
251
- content_start := content.index_after (para_style_delim, 1 )
250
+ if content.index_after (para_style_delim, 0 ) or { - 1 } == 0 {
251
+ content_start := content.index_after (para_style_delim, 1 ) or { - 1 }
252
252
if content_start > 1 { // empty style means same style
253
253
style = content[1 ..content_start]
254
254
}
@@ -495,8 +495,8 @@ fn (mut c VerticalAlignChunk) update_line_height(cv &ChunkView) {
495
495
mut lh := 0
496
496
mut style, mut left := '' , ''
497
497
for content in c.content {
498
- if content.index_after (para_style_delim, 0 ) == 0 {
499
- content_start := content.index_after (para_style_delim, 1 )
498
+ if content.index_after (para_style_delim, 0 ) or { - 1 } == 0 {
499
+ content_start := content.index_after (para_style_delim, 1 ) or { - 1 }
500
500
if content_start > 1 { // empty style means same style
501
501
style = content[1 ..content_start]
502
502
}
@@ -517,7 +517,7 @@ fn (mut c VerticalAlignChunk) init_line_chunks(cv &ChunkView) {
517
517
mut contents := [][]string {}
518
518
mut lines := []string {}
519
519
for content in c.content {
520
- if content.index_after (para_style_delim, 0 ) == 0 {
520
+ if content.index_after (para_style_delim, 0 ) or { - 1 } == 0 {
521
521
if lines.len > 0 && lines[0 ] == 'br' {
522
522
contents << lines
523
523
lines = []string {}
@@ -553,8 +553,8 @@ fn (mut c VerticalAlignChunk) init_line_chunks(cv &ChunkView) {
553
553
c.line_chunks << chunks
554
554
for content in line_content {
555
555
// TextChunk
556
- if content.index_after (para_style_delim, 0 ) == 0 {
557
- content_start := content.index_after (para_style_delim, 1 )
556
+ if content.index_after (para_style_delim, 0 ) or { - 1 } == 0 {
557
+ content_start := content.index_after (para_style_delim, 1 ) or { - 1 }
558
558
if content_start > 1 { // empty style means same style
559
559
style = content[1 ..content_start]
560
560
}
0 commit comments