Merge pull request #3914 from matthias314/m3/fix-issue-3700

quick fix for #3700
This commit is contained in:
Jöran Karl
2025-11-27 19:24:52 +01:00
committed by GitHub
2 changed files with 16 additions and 8 deletions

View File

@@ -1144,8 +1144,7 @@ func (h *BufPane) find(useRegex bool) bool {
match, found, err := h.Buf.FindNext(resp, h.Buf.Start(), h.Buf.End(), h.searchOrig, true, useRegex)
if err != nil {
InfoBar.Error(err)
}
if found {
} else if found {
h.Cursor.SetSelectionStart(match[0])
h.Cursor.SetSelectionEnd(match[1])
h.Cursor.OrigSelection[0] = h.Cursor.CurSelection[0]

View File

@@ -41,12 +41,21 @@ func findLineParams(b *Buffer, start, end Loc, i int, r *regexp.Regexp) ([]byte,
}
}
if padMode == padStart {
r = regexp.MustCompile(".(?:" + r.String() + ")")
} else if padMode == padEnd {
r = regexp.MustCompile("(?:" + r.String() + ").")
} else if padMode == padStart|padEnd {
r = regexp.MustCompile(".(?:" + r.String() + ").")
if padMode != 0 {
re, err := regexp.Compile(r.String() + `\E`)
if err == nil {
// r contains \Q without closing \E
r = re
}
if padMode == padStart {
r = regexp.MustCompile(".(?:" + r.String() + ")")
} else if padMode == padEnd {
r = regexp.MustCompile("(?:" + r.String() + ").")
} else {
// padMode == padStart|padEnd
r = regexp.MustCompile(".(?:" + r.String() + ").")
}
}
return l, charpos, padMode, r