parent
e3725817f0
commit
624c6427d2
|
|
@ -4,6 +4,7 @@ import (
|
|||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/atotto/clipboard"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
|
@ -184,13 +185,14 @@ func (l *Log) bindKeys() {
|
|||
ui.Key4: ui.NewKeyAction("30m", l.sinceCmd(30*60), true),
|
||||
ui.Key5: ui.NewKeyAction("1h", l.sinceCmd(60*60), true),
|
||||
tcell.KeyEnter: ui.NewSharedKeyAction("Filter", l.filterCmd, false),
|
||||
ui.KeyC: ui.NewKeyAction("Clear", l.clearCmd, true),
|
||||
ui.KeyL: ui.NewKeyAction("Clear", l.clearCmd, true),
|
||||
ui.KeyM: ui.NewKeyAction("Mark", l.markCmd, true),
|
||||
ui.KeyS: ui.NewKeyAction("Toggle AutoScroll", l.toggleAutoScrollCmd, true),
|
||||
ui.KeyF: ui.NewKeyAction("Toggle FullScreen", l.toggleFullScreenCmd, true),
|
||||
ui.KeyT: ui.NewKeyAction("Toggle Timestamp", l.toggleTimestampCmd, true),
|
||||
ui.KeyW: ui.NewKeyAction("Toggle Wrap", l.toggleTextWrapCmd, true),
|
||||
tcell.KeyCtrlS: ui.NewKeyAction("Save", l.SaveCmd, true),
|
||||
ui.KeyC: ui.NewKeyAction("Copy", l.cpCmd, true),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -288,6 +290,14 @@ func (l *Log) SaveCmd(evt *tcell.EventKey) *tcell.EventKey {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (l *Log) cpCmd(evt *tcell.EventKey) *tcell.EventKey {
|
||||
l.app.Flash().Info("Content copied to clipboard...")
|
||||
if err := clipboard.WriteAll(l.logs.GetText(true)); err != nil {
|
||||
l.app.Flash().Err(err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func sanitizeFilename(name string) string {
|
||||
processedString := invalidPathCharsRX.ReplaceAllString(name, "-")
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ func TestLogAutoScroll(t *testing.T) {
|
|||
v.GetModel().Set(dao.LogItems{dao.NewLogItemFromString("blee"), dao.NewLogItemFromString("bozo")})
|
||||
v.GetModel().Notify()
|
||||
|
||||
assert.Equal(t, 14, len(v.Hints()))
|
||||
assert.Equal(t, 15, len(v.Hints()))
|
||||
|
||||
v.toggleAutoScrollCmd(nil)
|
||||
assert.Equal(t, "Autoscroll: Off FullScreen: Off Timestamps: Off Wrap: Off", v.Indicator().GetText(true))
|
||||
|
|
|
|||
Loading…
Reference in New Issue