mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-25 18:07:07 +09:00
command: Fix replace to be able to insert '$' (#2954)
* command: Fix replace to be able to insert '$' * help: commands: Precise the documentation of `replace` * help: commands: Further improvement suggested within the review Co-authored-by: Beni Cherniavsky-Paskin <cben@redhat.com> * Fix replace with '$' in a more kosher way On top of JoeKar's fix. --------- Co-authored-by: Beni Cherniavsky-Paskin <cben@redhat.com> Co-authored-by: Dmytro Maluka <dmitrymaluka@gmail.com>
This commit is contained in:
@@ -820,7 +820,7 @@ func (h *BufPane) ReplaceCmd(args []string) {
|
||||
end = h.Cursor.CurSelection[1]
|
||||
}
|
||||
if all {
|
||||
nreplaced, _ = h.Buf.ReplaceRegex(start, end, regex, replace)
|
||||
nreplaced, _ = h.Buf.ReplaceRegex(start, end, regex, replace, !noRegex)
|
||||
} else {
|
||||
inRange := func(l buffer.Loc) bool {
|
||||
return l.GreaterEqual(start) && l.LessEqual(end)
|
||||
@@ -850,7 +850,7 @@ func (h *BufPane) ReplaceCmd(args []string) {
|
||||
|
||||
InfoBar.YNPrompt("Perform replacement (y,n,esc)", func(yes, canceled bool) {
|
||||
if !canceled && yes {
|
||||
_, nrunes := h.Buf.ReplaceRegex(locs[0], locs[1], regex, replace)
|
||||
_, nrunes := h.Buf.ReplaceRegex(locs[0], locs[1], regex, replace, !noRegex)
|
||||
|
||||
searchLoc = locs[0]
|
||||
searchLoc.X += nrunes + locs[0].Diff(locs[1], h.Buf)
|
||||
|
||||
Reference in New Issue
Block a user