mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-08 22:28:24 +02:00
kitten @ resize-window: Fix --increment=0 treated as --increment=2
This commit is contained in:
@@ -324,13 +324,16 @@ class JSONField:
|
|||||||
self.required = False
|
self.required = False
|
||||||
self.field, self.field_type = field_def.split('/', 1)
|
self.field, self.field_type = field_def.split('/', 1)
|
||||||
self.field_type, self.special_parser = self.field_type.partition('=')[::2]
|
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('+'):
|
if self.field.endswith('+'):
|
||||||
self.required = True
|
self.required = True
|
||||||
self.field = self.field[:-1]
|
self.field = self.field[:-1]
|
||||||
self.struct_field_name = self.field[0].upper() + 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:
|
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:
|
def go_code_for_remote_command(name: str, cmd: RemoteCommand, template: str) -> str:
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class ResizeWindow(RemoteCommand):
|
|||||||
protocol_spec = __doc__ = '''
|
protocol_spec = __doc__ = '''
|
||||||
match/str: Which window to resize
|
match/str: Which window to resize
|
||||||
self/bool: Boolean indicating whether to resize the window the command is run in
|
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`
|
axis/choices.horizontal.vertical.reset: One of :code:`horizontal, vertical` or :code:`reset`
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user