class_docstr: Margin that displays the line numbers.
  
  :param relative: Number relative to the cursor position. Similar to the Vi
                   'relativenumber' option.
  :param display_tildes: Display tildes after the end of the document, just
      like Vi does.
class_docstr_tok: ["Margin","that","displays","the","line","numbers",".",":","param","relative",":","Number","relative","to","the","cursor","position",".","Similar","to","the","Vi","'relativenumber","'","option",".",":","param","display_tildes",":","Display","tildes","after","the","end","of","the","document",",","just","like","Vi","does","."]
code: def create_margin(
      self,
      window_render_info: WindowRenderInfo,
      width: int,
      height: int,
  ) -> StyleAndTextTuples:
      relative = self.relative()
  
      style = "class:line-number"
      style_current = "class:line-number.current"
  
      # Get current line number.
      current_lineno = window_render_info.ui_content.cursor_position.y
  
      # Construct margin.
      result: StyleAndTextTuples = []
      last_lineno = None
  
      for y, lineno in enumerate(window_render_info.displayed_lines):
          # Only display line number if this line is not a continuation of the previous line.
          if lineno != last_lineno:
              if lineno is None:
                  pass
              elif lineno == current_lineno:
                  # Current line.
                  if relative:
                      # Left align current number in relative mode.
                      result.append(
                          (style_current, "%i" % (lineno + 1))
                      )
                  else:
                      result.append(
                          (
                              style_current,
                              ("%i " % (lineno + 1)).rjust(width),
                          )
                      )
              else:
                  # Other lines.
                  if relative:
                      lineno = abs(lineno - current_lineno) - 1
  
                  result.append(
                      (style, ("%i " % (lineno + 1)).rjust(width))
                  )
  
          last_lineno = lineno
          result.append(("", "\n"))
  
      # Fill with tildes.
      if self.display_tildes():
          while y < window_render_info.window_height:
              result.append(("class:tilde", "~\n"))
              y += 1
  
      return result
  
imports: from __future__ import annotations
  from abc import ABCMeta, abstractmethod
  from typing import TYPE_CHECKING, Callable
  from prompt_toolkit.filters import FilterOrBool, to_filter
  from prompt_toolkit.formatted_text import StyleAndTextTuples, fragment_list_to_text, to_formatted_text
  from prompt_toolkit.utils import get_cwidth
  from .controls import UIContent
label_desc: Use image node_id 3 for calling the NumberedMargin obj's underlying member method code with example usage: obj.create_margin(window_render_info, width, height) and returns: result