diff options
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | style.go | 2 | ||||
-rw-r--r-- | text.go | 6 | ||||
-rw-r--r-- | view.go | 9 | ||||
-rw-r--r-- | window.go | 11 |
5 files changed, 20 insertions, 10 deletions
@@ -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. @@ -45,7 +45,7 @@ func InitStyles() { tagSquareStyle = tagStyle. Background(tcell.NewHexColor(0x8888cc)) tagSquareModifiedStyle = tagStyle. - Background(tcell.NewHexColor(0x0)) + Background(tcell.NewHexColor(0x2222cc)) vertlineStyle = bodyStyle } @@ -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. // @@ -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 @@ -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() |