return false
}
+// SelectPageUp selects up one page
+func (v *View) SelectPageUp(usePlugin bool) bool {
+ if usePlugin && !PreActionCall("SelectPageUp", v) {
+ return false
+ }
+
+ if !v.Cursor.HasSelection() {
+ v.Cursor.OrigSelection[0] = v.Cursor.Loc
+ }
+ v.Cursor.UpN(v.Height)
+ v.Cursor.SelectTo(v.Cursor.Loc)
+
+ if usePlugin {
+ return PostActionCall("SelectPageUp", v)
+ }
+ return true
+}
+
+// SelectPageDown selects down one page
+func (v *View) SelectPageDown(usePlugin bool) bool {
+ if usePlugin && !PreActionCall("SelectPageDown", v) {
+ return false
+ }
+
+ if !v.Cursor.HasSelection() {
+ v.Cursor.OrigSelection[0] = v.Cursor.Loc
+ }
+ v.Cursor.DownN(v.Height)
+ v.Cursor.SelectTo(v.Cursor.Loc)
+
+ if usePlugin {
+ return PostActionCall("SelectPageDown", v)
+ }
+ return true
+}
+
// CursorPageUp places the cursor a page up
func (v *View) CursorPageUp(usePlugin bool) bool {
if usePlugin && !PreActionCall("CursorPageUp", v) {
"End": (*View).End,
"PageUp": (*View).PageUp,
"PageDown": (*View).PageDown,
+ "SelectPageUp": (*View).SelectPageUp,
+ "SelectPageDown": (*View).SelectPageDown,
"HalfPageUp": (*View).HalfPageUp,
"HalfPageDown": (*View).HalfPageDown,
"StartOfLine": (*View).StartOfLine,
"Escape": tcell.KeyEscape,
"Enter": tcell.KeyEnter,
"Backspace": tcell.KeyBackspace2,
+ "OldBackspace": tcell.KeyBackspace,
// I renamed these keys to PageUp and PageDown but I don't want to break someone's keybindings
"PgUp": tcell.KeyPgUp,
}
func (v *View) paste(clip string) {
- leadingWS := GetLeadingWhitespace(v.Buf.Line(v.Cursor.Y))
+ leadingWS := ""
+ if v.Cursor.X > 0 {
+ leadingWS = GetLeadingWhitespace(v.Buf.Line(v.Cursor.Y))
+ }
if v.Cursor.HasSelection() {
v.Cursor.DeleteSelection()