MCPcopy Create free account
hub / github.com/BoomingTech/Piccolo / GetLineWidth

Function GetLineWidth

engine/3rdparty/tinyobjloader/deps/cpplint.py:4351–4370  ·  view source on GitHub ↗

Determines the width of the line in column positions. Args: line: A string, which may be a Unicode string. Returns: The width of the line in column positions, accounting for Unicode combining characters and wide characters.

(line)

Source from the content-addressed store, hash-verified

4349
4350
4351def GetLineWidth(line):
4352 """Determines the width of the line in column positions.
4353
4354 Args:
4355 line: A string, which may be a Unicode string.
4356
4357 Returns:
4358 The width of the line in column positions, accounting for Unicode
4359 combining characters and wide characters.
4360 """
4361 if isinstance(line, unicode):
4362 width = 0
4363 for uc in unicodedata.normalize('NFC', line):
4364 if unicodedata.east_asian_width(uc) in ('W', 'F'):
4365 width += 2
4366 elif not unicodedata.combining(uc):
4367 width += 1
4368 return width
4369 else:
4370 return len(line)
4371
4372
4373def CheckStyle(filename, clean_lines, linenum, file_extension, nesting_state,

Callers 1

CheckStyleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected