mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-16 05:47:06 +09:00
@@ -361,14 +361,14 @@ func (h *BufHandler) InsertNewline() bool {
|
||||
|
||||
ws := util.GetLeadingWhitespace(h.Buf.LineBytes(h.Cursor.Y))
|
||||
cx := h.Cursor.X
|
||||
h.Buf.Insert(h.Cursor.Loc, []byte{'\n'})
|
||||
h.Buf.Insert(h.Cursor.Loc, "\n")
|
||||
// h.Cursor.Right()
|
||||
|
||||
if h.Buf.Settings["autoindent"].(bool) {
|
||||
if cx < len(ws) {
|
||||
ws = ws[0:cx]
|
||||
}
|
||||
h.Buf.Insert(h.Cursor.Loc, ws)
|
||||
h.Buf.Insert(h.Cursor.Loc, string(ws))
|
||||
// for i := 0; i < len(ws); i++ {
|
||||
// h.Cursor.Right()
|
||||
// }
|
||||
@@ -755,10 +755,10 @@ func (h *BufHandler) Cut() bool {
|
||||
// DuplicateLine duplicates the current line or selection
|
||||
func (h *BufHandler) DuplicateLine() bool {
|
||||
if h.Cursor.HasSelection() {
|
||||
h.Buf.Insert(h.Cursor.CurSelection[1], h.Cursor.GetSelection())
|
||||
h.Buf.Insert(h.Cursor.CurSelection[1], string(h.Cursor.GetSelection()))
|
||||
} else {
|
||||
h.Cursor.End()
|
||||
h.Buf.Insert(h.Cursor.Loc, append([]byte{'\n'}, h.Buf.LineBytes(h.Cursor.Y)...))
|
||||
h.Buf.Insert(h.Cursor.Loc, "\n"+string(h.Buf.LineBytes(h.Cursor.Y)))
|
||||
// h.Cursor.Right()
|
||||
}
|
||||
|
||||
@@ -869,7 +869,7 @@ func (h *BufHandler) paste(clip string) {
|
||||
h.Cursor.ResetSelection()
|
||||
}
|
||||
|
||||
h.Buf.Insert(h.Cursor.Loc, []byte(clip))
|
||||
h.Buf.Insert(h.Cursor.Loc, clip)
|
||||
// h.Cursor.Loc = h.Cursor.Loc.Move(Count(clip), h.Buf)
|
||||
h.freshClip = false
|
||||
InfoBar.Message("Pasted clipboard")
|
||||
|
||||
Reference in New Issue
Block a user