Better softwrap

This commit is contained in:
Zachary Yedidia
2019-12-24 16:01:08 -05:00
parent 432f1f3363
commit 3b306c1d3b
8 changed files with 27 additions and 43 deletions

View File

@@ -40,7 +40,7 @@ func (h *BufPane) ScrollDown(n int) {
func (h *BufPane) MousePress(e *tcell.EventMouse) bool {
b := h.Buf
mx, my := e.Position()
mouseLoc := h.GetMouseLoc(buffer.Loc{mx, my})
mouseLoc := h.LocFromVisual(buffer.Loc{mx, my})
h.Cursor.Loc = mouseLoc
if h.mouseReleased {
if b.NumCursors() > 1 {
@@ -1410,7 +1410,7 @@ func (h *BufPane) SpawnMultiCursorSelect() bool {
func (h *BufPane) MouseMultiCursor(e *tcell.EventMouse) bool {
b := h.Buf
mx, my := e.Position()
mouseLoc := h.GetMouseLoc(buffer.Loc{X: mx, Y: my})
mouseLoc := h.LocFromVisual(buffer.Loc{X: mx, Y: my})
c := buffer.NewCursor(b, mouseLoc)
b.AddCursor(c)
b.MergeCursors()

View File

@@ -241,7 +241,7 @@ func (h *BufPane) HandleEvent(event tcell.Event) {
// Mouse was just released
mx, my := e.Position()
mouseLoc := h.GetMouseLoc(buffer.Loc{X: mx, Y: my})
mouseLoc := h.LocFromVisual(buffer.Loc{X: mx, Y: my})
// Relocating here isn't really necessary because the cursor will
// be in the right place from the last mouse event

View File

@@ -103,7 +103,7 @@ func (t *TabList) HandleEvent(event tcell.Event) {
mx, my := e.Position()
switch e.Buttons() {
case tcell.Button1:
ind := t.GetMouseLoc(buffer.Loc{mx, my})
ind := t.LocFromVisual(buffer.Loc{mx, my})
if ind != -1 {
t.SetActive(ind)
}