aboutsummaryrefslogtreecommitdiff
path: root/ui/tcell/view.go
diff options
context:
space:
mode:
authorPetter Rodhelind <petter.rodhelind@gmail.com>2021-03-06 20:14:06 +0100
committerPetter Rodhelind <petter.rodhelind@gmail.com>2021-03-06 20:14:06 +0100
commita0591e399d5228ce27a2ca55acb5376c2b76ccac (patch)
tree7a33238367ff49288c3b0cd627588e5119613ae6 /ui/tcell/view.go
parent816aa1dd19ca760a94bb7b9d54e768c6aa3af332 (diff)
downloadpoe-master.tar.gz
poe-master.tar.bz2
poe-master.zip
Manage columns in a sane way.HEADmasterdev
Diffstat (limited to 'ui/tcell/view.go')
-rw-r--r--ui/tcell/view.go18
1 files changed, 12 insertions, 6 deletions
diff --git a/ui/tcell/view.go b/ui/tcell/view.go
index 73f1453..55490b9 100644
--- a/ui/tcell/view.go
+++ b/ui/tcell/view.go
@@ -16,6 +16,7 @@ import (
const (
ViewMenu int = iota
+ ViewColumn
ViewTagline
ViewBody
ViewScratch
@@ -235,7 +236,7 @@ func (v *View) ScrollTo(offset int) {
}
func (b *View) Draw() {
- //screen.HideCursor()
+ // screen.HideCursor()
x, y := b.x, b.y
@@ -261,7 +262,7 @@ func (b *View) Draw() {
// highlight cursor if on screen
if (q0 == q1 && i == q0) && b.focused {
- //style = b.cursorStyle
+ // style = b.cursorStyle
screen.ShowCursor(x, y)
}
@@ -512,9 +513,6 @@ func (v *View) HandleEvent(ev tcell.Event) {
ed.WorkDir(), CurWin.Dir(), CurWin.Name(),
CurWin.w, CurWin.h, sh, sw)
return
- case tcell.KeyCtrlN: // new column
- CmdNewcol()
- return
case tcell.KeyCtrlC: // copy to clipboard
str := v.text.ReadDot()
if str == "" {
@@ -533,6 +531,10 @@ func (v *View) HandleEvent(ev tcell.Event) {
v.text.Write([]byte(s))
return
case tcell.KeyCtrlQ: // close window
+ if v.what == ViewColumn || v.what == ViewMenu {
+ CmdDelcol() // calls CmdExit if cols < 2
+ return
+ }
CmdDel()
return
default:
@@ -575,7 +577,11 @@ func ButtonSecondary(v *View, mx, my int) {
return
}
if fn != "" && fn[0] != filepath.Separator {
- fn = CurWin.Dir() + string(filepath.Separator) + fn
+ if CurWin != nil {
+ fn = CurWin.Dir() + string(filepath.Separator) + fn
+ } else {
+ fn = ed.WorkDir() + string(filepath.Separator) + fn
+ }
fn = filepath.Clean(fn)
}