mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-16 05:47:06 +09:00
@@ -293,14 +293,20 @@ func DefaultBindings() map[string]string {
|
|||||||
|
|
||||||
// CursorUp moves the cursor up
|
// CursorUp moves the cursor up
|
||||||
func (v *View) CursorUp() bool {
|
func (v *View) CursorUp() bool {
|
||||||
|
if v.cursor.HasSelection() {
|
||||||
|
v.cursor.SetLoc(v.cursor.curSelection[0])
|
||||||
v.cursor.ResetSelection()
|
v.cursor.ResetSelection()
|
||||||
|
}
|
||||||
v.cursor.Up()
|
v.cursor.Up()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// CursorDown moves the cursor down
|
// CursorDown moves the cursor down
|
||||||
func (v *View) CursorDown() bool {
|
func (v *View) CursorDown() bool {
|
||||||
|
if v.cursor.HasSelection() {
|
||||||
|
v.cursor.SetLoc(v.cursor.curSelection[1])
|
||||||
v.cursor.ResetSelection()
|
v.cursor.ResetSelection()
|
||||||
|
}
|
||||||
v.cursor.Down()
|
v.cursor.Down()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -170,6 +170,7 @@ func (c *Cursor) SelectWord() {
|
|||||||
|
|
||||||
c.curSelection[1] = ToCharPos(forward, c.y, c.v.buf) + 1
|
c.curSelection[1] = ToCharPos(forward, c.y, c.v.buf) + 1
|
||||||
c.origSelection[1] = c.curSelection[1]
|
c.origSelection[1] = c.curSelection[1]
|
||||||
|
c.SetLoc(c.curSelection[1])
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddWordToSelection adds the word the cursor is currently on to the selection
|
// AddWordToSelection adds the word the cursor is currently on to the selection
|
||||||
@@ -202,6 +203,8 @@ func (c *Cursor) AddWordToSelection() {
|
|||||||
c.curSelection[1] = ToCharPos(forward, c.y, c.v.buf) + 1
|
c.curSelection[1] = ToCharPos(forward, c.y, c.v.buf) + 1
|
||||||
c.curSelection[0] = c.origSelection[0]
|
c.curSelection[0] = c.origSelection[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c.SetLoc(c.curSelection[1])
|
||||||
}
|
}
|
||||||
|
|
||||||
// SelectTo selects from the current cursor location to the given location
|
// SelectTo selects from the current cursor location to the given location
|
||||||
|
|||||||
@@ -307,6 +307,7 @@ func (v *View) HandleEvent(event tcell.Event) {
|
|||||||
v.lastClickTime = time.Now()
|
v.lastClickTime = time.Now()
|
||||||
|
|
||||||
loc := v.cursor.Loc()
|
loc := v.cursor.Loc()
|
||||||
|
v.cursor.origSelection[0] = loc
|
||||||
v.cursor.curSelection[0] = loc
|
v.cursor.curSelection[0] = loc
|
||||||
v.cursor.curSelection[1] = loc
|
v.cursor.curSelection[1] = loc
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user