mirror of
https://github.com/schollz/cowyo.git
synced 2023-08-10 21:13:00 +03:00
Fixed problem with matching last item
Former-commit-id: 1c65561e41b7d8a27e8cfb8dcc9f06fa9e4c020f [formerly ccc5f68fab577b901a7e8ee0df5f0e2230c2c8ba] [formerly f7c3674fe33d974bf744ca33c339d9309a0608af [formerly a0eb8f7bf489069445bd4cc672e3312697a88ada [formerly2b32faa1ee
]]] Former-commit-id: 189e38dfeafdafea0e41a11ad4d6090e3831ef2f [formerly e3ba06ac413ddd7b72724a7a2131f6deb731f3d1] Former-commit-id: ee81d42eb92f838d8b9f76d28fcc70c99f932a60 Former-commit-id:b673a761d0
This commit is contained in:
parent
2174edd471
commit
8ee5df0132
@ -140,11 +140,14 @@ func deleteListItem(c *gin.Context) {
|
|||||||
_, listItems := reorderList(p.Text)
|
_, listItems := reorderList(p.Text)
|
||||||
|
|
||||||
for i, lineString := range listItems {
|
for i, lineString := range listItems {
|
||||||
|
// fmt.Println(i, lineString, lineNum)
|
||||||
if i+1 == lineNum {
|
if i+1 == lineNum {
|
||||||
|
// fmt.Println("MATCHED")
|
||||||
if strings.Contains(lineString, "~~") == false {
|
if strings.Contains(lineString, "~~") == false {
|
||||||
p.Text = strings.Replace(p.Text, lineString[2:]+"\n", "~~"+lineString[2:]+"~~"+"\n", 1)
|
// fmt.Println(p.Text, "("+lineString[2:]+"\n"+")", "~~"+lineString[2:]+"~~"+"\n")
|
||||||
|
p.Text = strings.Replace(p.Text+"\n", lineString[2:]+"\n", "~~"+lineString[2:]+"~~"+"\n", 1)
|
||||||
} else {
|
} else {
|
||||||
p.Text = strings.Replace(p.Text, lineString[2:]+"\n", lineString[4:len(lineString)-2]+"\n", 1)
|
p.Text = strings.Replace(p.Text+"\n", lineString[2:]+"\n", lineString[4:len(lineString)-2]+"\n", 1)
|
||||||
}
|
}
|
||||||
p.save()
|
p.save()
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user