mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-09 22:30:24 +09:00
Always use the selection as search term when using quick search
This commit is contained in:
@@ -799,9 +799,7 @@ func (v *View) FindNext(usePlugin bool) bool {
|
||||
|
||||
if v.Cursor.HasSelection() {
|
||||
searchStart = ToCharPos(v.Cursor.CurSelection[1], v.Buf)
|
||||
if lastSearch == "" { // or always? FIXME
|
||||
lastSearch = v.Cursor.GetSelection()
|
||||
}
|
||||
lastSearch = v.Cursor.GetSelection()
|
||||
} else {
|
||||
searchStart = ToCharPos(v.Cursor.Loc, v.Buf)
|
||||
}
|
||||
@@ -1003,7 +1001,7 @@ func (v *View) MoveLinesUp(usePlugin bool) bool {
|
||||
}
|
||||
v.Buf.MoveLinesUp(
|
||||
v.Cursor.Loc.Y,
|
||||
v.Cursor.Loc.Y + 1,
|
||||
v.Cursor.Loc.Y+1,
|
||||
)
|
||||
v.Cursor.UpN(1)
|
||||
messenger.Message("Moved up current line")
|
||||
@@ -1042,7 +1040,7 @@ func (v *View) MoveLinesDown(usePlugin bool) bool {
|
||||
}
|
||||
v.Buf.MoveLinesDown(
|
||||
v.Cursor.Loc.Y,
|
||||
v.Cursor.Loc.Y + 1,
|
||||
v.Cursor.Loc.Y+1,
|
||||
)
|
||||
v.Cursor.DownN(1)
|
||||
messenger.Message("Moved down current line")
|
||||
@@ -1055,7 +1053,6 @@ func (v *View) MoveLinesDown(usePlugin bool) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
// Paste whatever is in the system clipboard into the buffer
|
||||
// Delete and paste if the user has a selection
|
||||
func (v *View) Paste(usePlugin bool) bool {
|
||||
|
||||
@@ -378,12 +378,12 @@ func (b *Buffer) MoveLinesUp(start int, end int) {
|
||||
utf8.RuneCount(b.lines[end-1]),
|
||||
end - 1,
|
||||
},
|
||||
"\n" + b.Line(start - 1),
|
||||
"\n"+b.Line(start-1),
|
||||
)
|
||||
} else {
|
||||
b.Insert(
|
||||
Loc{0, end},
|
||||
b.Line(start - 1) + "\n",
|
||||
b.Line(start-1)+"\n",
|
||||
)
|
||||
}
|
||||
b.Remove(
|
||||
@@ -401,7 +401,7 @@ func (b *Buffer) MoveLinesDown(start int, end int) {
|
||||
}
|
||||
b.Insert(
|
||||
Loc{0, start},
|
||||
b.Line(end) + "\n",
|
||||
b.Line(end)+"\n",
|
||||
)
|
||||
end += 1
|
||||
b.Remove(
|
||||
|
||||
Reference in New Issue
Block a user