From 15dd95d420148720efce8dee9731a192903c03fb Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 15 Jul 2024 22:32:29 +0530 Subject: [PATCH] kitten @ resize-window: Fix --increment=0 treated as --increment=2 --- gen/go_code.py | 5 ++++- kitty/rc/resize_window.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/gen/go_code.py b/gen/go_code.py index 8dd0b9cba..2a5bfd7f8 100755 --- a/gen/go_code.py +++ b/gen/go_code.py @@ -324,13 +324,16 @@ class JSONField: self.required = False self.field, self.field_type = field_def.split('/', 1) self.field_type, self.special_parser = self.field_type.partition('=')[::2] + self.field_type, self.metadata = self.field_type.partition('-')[::2] if self.field.endswith('+'): self.required = True self.field = self.field[:-1] self.struct_field_name = self.field[0].upper() + self.field[1:] + self.omitempty = 'noomitempty' not in self.metadata def go_declaration(self) -> str: - return self.struct_field_name + ' ' + go_field_type(self.field_type) + f'`json:"{self.field},omitempty"`' + omitempty = ',omitempty' if self.omitempty else '' + return self.struct_field_name + ' ' + go_field_type(self.field_type) + f'`json:"{self.field}{omitempty}"`' def go_code_for_remote_command(name: str, cmd: RemoteCommand, template: str) -> str: diff --git a/kitty/rc/resize_window.py b/kitty/rc/resize_window.py index 58c378852..f9fbe1ed4 100644 --- a/kitty/rc/resize_window.py +++ b/kitty/rc/resize_window.py @@ -13,7 +13,7 @@ class ResizeWindow(RemoteCommand): protocol_spec = __doc__ = ''' match/str: Which window to resize self/bool: Boolean indicating whether to resize the window the command is run in - increment/int: Integer specifying the resize increment + increment/int-noomitempty: Integer specifying the resize increment axis/choices.horizontal.vertical.reset: One of :code:`horizontal, vertical` or :code:`reset` '''