mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-25 18:07:07 +09:00
@@ -762,6 +762,8 @@ func (h *BufPane) ReplaceCmd(args []string) {
|
|||||||
h.Cursor.SetSelectionStart(locs[0])
|
h.Cursor.SetSelectionStart(locs[0])
|
||||||
h.Cursor.SetSelectionEnd(locs[1])
|
h.Cursor.SetSelectionEnd(locs[1])
|
||||||
|
|
||||||
|
h.Relocate()
|
||||||
|
|
||||||
InfoBar.YNPrompt("Perform replacement (y,n,esc)", func(yes, canceled bool) {
|
InfoBar.YNPrompt("Perform replacement (y,n,esc)", func(yes, canceled bool) {
|
||||||
if !canceled && yes {
|
if !canceled && yes {
|
||||||
_, nrunes := h.Buf.ReplaceRegex(locs[0], locs[1], regex, replace)
|
_, nrunes := h.Buf.ReplaceRegex(locs[0], locs[1], regex, replace)
|
||||||
@@ -786,6 +788,7 @@ func (h *BufPane) ReplaceCmd(args []string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
h.Buf.RelocateCursors()
|
h.Buf.RelocateCursors()
|
||||||
|
h.Relocate()
|
||||||
|
|
||||||
var s string
|
var s string
|
||||||
if nreplaced > 1 {
|
if nreplaced > 1 {
|
||||||
|
|||||||
@@ -139,6 +139,9 @@ func (w *BufWindow) Relocate() bool {
|
|||||||
ret := false
|
ret := false
|
||||||
activeC := w.Buf.GetActiveCursor()
|
activeC := w.Buf.GetActiveCursor()
|
||||||
cy := activeC.Y
|
cy := activeC.Y
|
||||||
|
if activeC.HasSelection() {
|
||||||
|
cy = activeC.CurSelection[0].Y
|
||||||
|
}
|
||||||
scrollmargin := int(b.Settings["scrollmargin"].(float64))
|
scrollmargin := int(b.Settings["scrollmargin"].(float64))
|
||||||
if cy < w.StartLine+scrollmargin && cy > scrollmargin-1 {
|
if cy < w.StartLine+scrollmargin && cy > scrollmargin-1 {
|
||||||
w.StartLine = cy - scrollmargin
|
w.StartLine = cy - scrollmargin
|
||||||
|
|||||||
Reference in New Issue
Block a user