mirror of
https://github.com/schollz/cowyo.git
synced 2023-08-10 21:13:00 +03:00
Fixed problem with matching last item
This commit is contained in:
parent
19aaf7bb44
commit
2b32faa1ee
@ -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