-
Notifications
You must be signed in to change notification settings - Fork 8
/
font.go
41 lines (35 loc) · 969 Bytes
/
font.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright 2016 The lime Authors.
// Use of this source code is governed by a 2-clause
// BSD-style license that can be found in the LICENSE file.
package commands
import "github.com/limetext/backend"
type (
// IncreaseFontSize command increases the font size by 1.
IncreaseFontSize struct {
backend.DefaultCommand
}
// DecreaseFontSize command decreases the font size by 1.
DecreaseFontSize struct {
backend.DefaultCommand
}
)
// Run executes the IncreaseFontSize command.
func (i *IncreaseFontSize) Run(w *backend.Window) error {
fontSize := w.Settings().Int("font_size")
fontSize++
w.Settings().Set("font_size", fontSize)
return nil
}
// Run executes the DecreaseFontSize command.
func (d *DecreaseFontSize) Run(w *backend.Window) error {
fontSize := w.Settings().Int("font_size")
fontSize--
w.Settings().Set("font_size", fontSize)
return nil
}
func init() {
register([]backend.Command{
&IncreaseFontSize{},
&DecreaseFontSize{},
})
}