aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--style.go2
-rw-r--r--text.go6
-rw-r--r--view.go9
-rw-r--r--window.go11
5 files changed, 20 insertions, 10 deletions
diff --git a/README.md b/README.md
index 7f42d61..6a3dafa 100644
--- a/README.md
+++ b/README.md
@@ -20,7 +20,7 @@ Use the mouse. `^Q` exits.
Everything is text and everything is editable. There are two ways to interact with text, `Run` or `Open`.
-`Open` (`^O`, right-click or Ctrl+Click) will assume the selected text is a file or a directory and will open a new window listing its content. If none is found, it does nothing.
+`Open` (`^O`, right-click or Shift+Click) will assume the selected text is a file or a directory and will open a new window listing its content. If none is found, it does nothing.
`Run` (`^R`, middle-click or Alt+Click) interprets the text as a command, which can be an internal poe command like `New` or `Del`. If none is found, it does nothing.
diff --git a/style.go b/style.go
index eaff897..0e0294f 100644
--- a/style.go
+++ b/style.go
@@ -45,7 +45,7 @@ func InitStyles() {
tagSquareStyle = tagStyle.
Background(tcell.NewHexColor(0x8888cc))
tagSquareModifiedStyle = tagStyle.
- Background(tcell.NewHexColor(0x0))
+ Background(tcell.NewHexColor(0x2222cc))
vertlineStyle = bodyStyle
}
diff --git a/text.go b/text.go
index fb4090a..8771f12 100644
--- a/text.go
+++ b/text.go
@@ -9,11 +9,7 @@ import (
"github.com/prodhe/poe/gapbuffer"
)
-const (
- DirForward uint8 = iota
- DirBackward
- DirAbsolute
-)
+type Buffer struct{}
// Text is a buffer for editing. It uses an underlying gap buffer for storage and manages all things text related, like insert, delete, selection, searching and undo/redo.
//
diff --git a/view.go b/view.go
index c1cef21..9e26fc2 100644
--- a/view.go
+++ b/view.go
@@ -395,7 +395,7 @@ func (v *View) HandleEvent(ev tcell.Event) {
return
}
- if ev.Modifiers()&tcell.ModCtrl != 0 { // identic code to Btn3
+ if ev.Modifiers()&tcell.ModShift != 0 { // identic code to Btn3
pos := v.XYToOffset(mx, my)
// if we clicked inside a current selection, open that one
q0, q1 := v.text.Dot()
@@ -429,6 +429,7 @@ func (v *View) HandleEvent(ev tcell.Event) {
} else {
// single click
v.SetCursor(pos, 0)
+ //screen.ShowCursor(3, 3)
}
v.mclicktime = ev.When()
case tcell.WheelUp: // scrollup
@@ -597,7 +598,11 @@ func (v *View) HandleEvent(ev tcell.Event) {
RunCommand(cmd)
return
case tcell.KeyCtrlC: // copy to clipboard
- if err := clipboard.WriteAll(v.text.ReadDot()); err != nil {
+ str := v.text.ReadDot()
+ if str == "" {
+ return
+ }
+ if err := clipboard.WriteAll(str); err != nil {
printMsg("%s\n", err)
}
return
diff --git a/window.go b/window.go
index 763acc9..0e85bb7 100644
--- a/window.go
+++ b/window.go
@@ -280,7 +280,7 @@ func (win *Window) Flags() string {
func (win *Window) Resize(x, y, w, h int) {
win.x, win.y, win.w, win.h = x, y, w, h
- win.tagline.Resize(win.x, win.y, win.w, 1)
+ win.tagline.Resize(win.x+3, win.y, win.w-3, 1) // 3 for tagbox
win.body.Resize(win.x, win.y+1, win.w, win.h-1)
}
@@ -320,6 +320,15 @@ func (win *Window) HandleEvent(ev tcell.Event) {
}
func (win *Window) Draw() {
+ // Draw tag square
+ boxstyle := tagSquareStyle
+ if win.body.dirty {
+ boxstyle = tagSquareModifiedStyle
+ }
+ screen.SetContent(win.x, win.y, ' ', nil, boxstyle)
+ screen.SetContent(win.x+1, win.y, ' ', nil, boxstyle)
+ screen.SetContent(win.x+2, win.y, ' ', nil, win.tagline.style)
+
// Tagline
win.tagline.Draw()