aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ui/logpage.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-05-01 12:23:24 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-05-01 12:23:44 +0200
commit7acb0b3b859e3d17469d1fe377d6409e54f3b077 (patch)
tree67bf49b0568aee9866523759a41fd0fc09495eb8 /ui/logpage.go
parentinstaller: allow same version upgrades (diff)
downloadwireguard-windows-7acb0b3b859e3d17469d1fe377d6409e54f3b077.tar.xz
wireguard-windows-7acb0b3b859e3d17469d1fe377d6409e54f3b077.zip
ui: allow selecting all on log page
Diffstat (limited to 'ui/logpage.go')
-rw-r--r--ui/logpage.go24
1 files changed, 16 insertions, 8 deletions
diff --git a/ui/logpage.go b/ui/logpage.go
index b41d56c4..d99ce5ff 100644
--- a/ui/logpage.go
+++ b/ui/logpage.go
@@ -100,17 +100,25 @@ func (lp *LogPage) scrollToBottom() {
}
func (lp *LogPage) onCopyLogLines(key walk.Key) {
- if key != walk.KeyC || !walk.ControlDown() {
+ if !walk.ControlDown() {
return
}
- var logLines strings.Builder
- selectedItemIndexes := lp.logView.SelectedIndexes()
- for i := 0; i < len(selectedItemIndexes); i++ {
- logItem := lp.model.items[selectedItemIndexes[i]]
- logLines.WriteString(fmt.Sprintf("%s: %s\r\n", logItem.Stamp.Format("2006-01-02 15:04:05.000"), logItem.Line))
+ switch key {
+ case walk.KeyC:
+ var logLines strings.Builder
+ selectedItemIndexes := lp.logView.SelectedIndexes()
+ if len(selectedItemIndexes) == 0 {
+ return
+ }
+ for i := 0; i < len(selectedItemIndexes); i++ {
+ logItem := lp.model.items[selectedItemIndexes[i]]
+ logLines.WriteString(fmt.Sprintf("%s: %s\r\n", logItem.Stamp.Format("2006-01-02 15:04:05.000"), logItem.Line))
+ }
+ walk.Clipboard().SetText(logLines.String())
+ case walk.KeyA:
+ lp.logView.SetSelectedIndexes([]int{-1})
}
- walk.Clipboard().SetText(logLines.String())
}
func (lp *LogPage) onSaveButtonClicked() {
@@ -161,7 +169,7 @@ func newLogModel(lp *LogPage) *logModel {
continue
}
mdl.lp.Synchronize(func() {
- isAtBottom := mdl.lp.isAtBottom()
+ isAtBottom := mdl.lp.isAtBottom() && len(lp.logView.SelectedIndexes()) <= 1
mdl.items = append(mdl.items, items...)
if len(mdl.items) > maxLogLinesDisplayed {