2017-03-27 00:52:16 +08:00
|
|
|
package edit
|
|
|
|
|
2017-03-27 01:12:48 +08:00
|
|
|
// Raw insert mode is a special mode, in that it does not use the normal key
|
|
|
|
// binding. Rather, insertRaw is called directly from the main loop in
|
|
|
|
// Editor.ReadLine.
|
|
|
|
|
|
|
|
type rawInsert struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
func startInsertRaw(ed *Editor) {
|
2017-03-27 00:52:16 +08:00
|
|
|
ed.reader.SetRaw(true)
|
|
|
|
ed.mode = rawInsert{}
|
|
|
|
}
|
|
|
|
|
2017-03-27 01:12:48 +08:00
|
|
|
func insertRaw(ed *Editor, r rune) {
|
|
|
|
ed.insertAtDot(string(r))
|
|
|
|
ed.reader.SetRaw(false)
|
|
|
|
ed.mode = &ed.insert
|
2017-03-27 00:52:16 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (ri rawInsert) Mode() ModeType {
|
|
|
|
return modeRawInsert
|
|
|
|
}
|
|
|
|
|
|
|
|
func (ri rawInsert) ModeLine() renderer {
|
|
|
|
return modeLineRenderer{" RAW ", ""}
|
|
|
|
}
|