This commit is contained in:
parent
052a4ebbf4
commit
52aa174091
@ -96,7 +96,7 @@ func (d *Document) InsertRow(at int, s string) {
|
|||||||
|
|
||||||
// Split the array of rows at the specified index
|
// Split the array of rows at the specified index
|
||||||
start := d.rows[0:at]
|
start := d.rows[0:at]
|
||||||
end := d.rows[at : d.RowCount()]
|
end := d.rows[at:d.RowCount()]
|
||||||
|
|
||||||
// Splice it back together
|
// Splice it back together
|
||||||
newRows = append(newRows, start...)
|
newRows = append(newRows, start...)
|
||||||
@ -114,7 +114,7 @@ func (d *Document) InsertNewline(at *gilo.Point) {
|
|||||||
row := d.rows[at.Y]
|
row := d.rows[at.Y]
|
||||||
|
|
||||||
// Insert the characters right of the cursor to the next line
|
// Insert the characters right of the cursor to the next line
|
||||||
d.InsertRow(at.Y + 1, string(row.chars[at.X:row.Size()]))
|
d.InsertRow(at.Y+1, string(row.chars[at.X:row.Size()]))
|
||||||
|
|
||||||
// Remove the characters copied to the next line
|
// Remove the characters copied to the next line
|
||||||
row.chars = row.chars[0:at.X]
|
row.chars = row.chars[0:at.X]
|
||||||
|
@ -103,7 +103,7 @@ func (e *editor) Prompt(prompt string) string {
|
|||||||
e.SetStatusMessage("")
|
e.SetStatusMessage("")
|
||||||
|
|
||||||
return buf.ToString()
|
return buf.ToString()
|
||||||
} else if ! key.IsCtrl(ch) && key.IsAscii(ch) {
|
} else if !key.IsCtrl(ch) && key.IsAscii(ch) {
|
||||||
buf.AppendRune(ch)
|
buf.AppendRune(ch)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -139,7 +139,7 @@ func (e *editor) delChar() {
|
|||||||
e.cursor.X = e.document.GetRow(e.cursor.Y - 1).Size()
|
e.cursor.X = e.document.GetRow(e.cursor.Y - 1).Size()
|
||||||
|
|
||||||
// Move the contents of the current row to the previous
|
// Move the contents of the current row to the previous
|
||||||
e.document.MergeRows(e.cursor.Y - 1, e.cursor.Y)
|
e.document.MergeRows(e.cursor.Y-1, e.cursor.Y)
|
||||||
|
|
||||||
e.cursor.Y -= 1
|
e.cursor.Y -= 1
|
||||||
}
|
}
|
||||||
|
@ -47,4 +47,4 @@ func (b *Buffer) ToString() string {
|
|||||||
|
|
||||||
func (b *Buffer) Len() int {
|
func (b *Buffer) Len() int {
|
||||||
return b.buf.Len()
|
return b.buf.Len()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user