From 644df4c729dcbec5264d74ab691247b979241c73 Mon Sep 17 00:00:00 2001 From: zu1k Date: Tue, 3 Aug 2021 08:31:27 +0800 Subject: [PATCH] fix entity parse --- internal/entity/parse.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/internal/entity/parse.go b/internal/entity/parse.go index c741d3b..77b88db 100644 --- a/internal/entity/parse.go +++ b/internal/entity/parse.go @@ -56,10 +56,9 @@ func ParseLine(line string) Entities { idx = e.Loc[1] } } - - if len(es) == 0 { + if total := len(line); idx < total { es = append(es, &Entity{ - Loc: []int{0, len(line)}, + Loc: []int{idx, total}, Type: TypePlain, Text: line, })