Get set_font_size working
This commit is contained in:
parent
bd1b3d9f6e
commit
bacca88213
@ -246,7 +246,7 @@ def update_at_commands() -> None:
|
|||||||
os.remove(dest)
|
os.remove(dest)
|
||||||
with open(dest, 'w') as f:
|
with open(dest, 'w') as f:
|
||||||
f.write(code)
|
f.write(code)
|
||||||
print('\x1b[31mTODO\x1b[m: test set_font_size, send_text, env, scroll_window', file=sys.stderr)
|
print('\x1b[31mTODO\x1b[m: test send_text, env, scroll_window', file=sys.stderr)
|
||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
|
|||||||
@ -26,9 +26,10 @@ class SetFontSize(RemoteCommand):
|
|||||||
' must have the same font size. A value of zero'
|
' must have the same font size. A value of zero'
|
||||||
' resets the font size to default. Prefixing the value'
|
' resets the font size to default. Prefixing the value'
|
||||||
' with a :code:`+` or :code:`-` increments the font size by the specified'
|
' with a :code:`+` or :code:`-` increments the font size by the specified'
|
||||||
' amount.'
|
' amount. Use -- before using - to have it not mistaken for a option. For example:'
|
||||||
|
' kitty @ set-font-size -- -2'
|
||||||
)
|
)
|
||||||
args = RemoteCommand.Args(spec='FONT_SIZE', count=1, special_parse='+increment_op:parse_set_font_size(args[0], io_data)', json_field='size')
|
args = RemoteCommand.Args(spec='FONT_SIZE', count=1, special_parse='+increment_op:parse_set_font_size(args[0], &payload)', json_field='size')
|
||||||
options_spec = '''\
|
options_spec = '''\
|
||||||
--all -a
|
--all -a
|
||||||
type=bool-set
|
type=bool-set
|
||||||
|
|||||||
@ -6,16 +6,15 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
func parse_set_font_size(arg string, io_data *rc_io_data) error {
|
func parse_set_font_size(arg string, payload *set_font_size_json_type) error {
|
||||||
payload := io_data.rc.Payload.(set_font_size_json_type)
|
|
||||||
if len(arg) > 0 && (arg[0] == '+' || arg[0] == '-') {
|
if len(arg) > 0 && (arg[0] == '+' || arg[0] == '-') {
|
||||||
payload.Increment_op = arg[:1]
|
payload.Increment_op = arg[:1]
|
||||||
|
arg = arg[1:]
|
||||||
}
|
}
|
||||||
val, err := strconv.ParseFloat(arg, 64)
|
val, err := strconv.ParseFloat(arg, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
payload.Size = val
|
payload.Size = val
|
||||||
io_data.rc.Payload = payload
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user