mirror of
https://github.com/zyedidia/micro.git
synced 2026-02-05 22:50:21 +09:00
Fix regression in CopyLine, CutLine, DeleteLine for last line (#3519)
Fix regression introduced in commit fdacb28962 ("CopyLine, CutLine,
DeleteLine: respect selection"): when CopyLine, CutLine or DeleteLine is
done in the last line of the buffer and this line is not empty, this
line gets selected but does not get copied/cut/deleted (and worse, it
remains selected).
This commit is contained in:
@@ -1300,7 +1300,13 @@ func (h *BufPane) selectLines() int {
|
||||
} else {
|
||||
h.Cursor.SelectLine()
|
||||
}
|
||||
return h.Cursor.CurSelection[1].Y - h.Cursor.CurSelection[0].Y
|
||||
|
||||
nlines := h.Cursor.CurSelection[1].Y - h.Cursor.CurSelection[0].Y
|
||||
if nlines == 0 && h.Cursor.HasSelection() {
|
||||
// selected last line and it is not empty
|
||||
nlines++
|
||||
}
|
||||
return nlines
|
||||
}
|
||||
|
||||
// Copy the selection to the system clipboard
|
||||
|
||||
Reference in New Issue
Block a user