format: fix edge case with empty functions

format was adding a new empty line each time when trying to split a long line containing a function with no arguments
diff --git a/mesonbuild/mformat.py b/mesonbuild/mformat.py
index e20e458..42f562e 100644
--- a/mesonbuild/mformat.py
+++ b/mesonbuild/mformat.py
@@ -744,7 +744,7 @@
         self.exit_node(node)
 
     def split_if_needed(self, node: mparser.ArgumentNode) -> None:
-        if not node.is_multiline and self.length > self.config.max_line_length:
+        if len(node) and not node.is_multiline and self.length > self.config.max_line_length:
             arg = self.argument_stack[self.level] if len(self.argument_stack) > self.level else node
             if not arg.is_multiline:
                 arg.is_multiline = True
diff --git a/mesonbuild/mparser.py b/mesonbuild/mparser.py
index ec08ccf..50d7203 100644
--- a/mesonbuild/mparser.py
+++ b/mesonbuild/mparser.py
@@ -377,7 +377,7 @@
         return self.order_error
 
     def __len__(self) -> int:
-        return self.num_args() # Fixme
+        return self.num_args() + self.num_kwargs()
 
 @dataclass(unsafe_hash=True)
 class ArrayNode(BaseNode):
diff --git a/test cases/format/1 default/gh13242.meson b/test cases/format/1 default/gh13242.meson
index b9122ec..67f7dd1 100644
--- a/test cases/format/1 default/gh13242.meson
+++ b/test cases/format/1 default/gh13242.meson
@@ -10,9 +10,7 @@
 )
 
 test(
-    should_fail: (settings.get('x', false) and not settings['y'] and dep.version(
-        
-    ).version_compare(
+    should_fail: (settings.get('x', false) and not settings['y'] and dep.version().version_compare(
         '>=1.2.3',
     )),
 )
diff --git a/test cases/format/1 default/meson.build b/test cases/format/1 default/meson.build
index 35e5b96..83ae19a 100644
--- a/test cases/format/1 default/meson.build
+++ b/test cases/format/1 default/meson.build
@@ -10,6 +10,9 @@
     'gh13242': files('gh13242.meson'),
 }
 
+# Ensure empty function are formatted correctly on long lines
+a = '@0@@1@@2@@3@@4@'.format('one', 'two', 'three', 'four', 'five').strip().strip()
+
 foreach name, f : meson_files
     test(name, meson_cmd, args: ['format', '--check-only', f])
 endforeach