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