Gjsify LogoGjsify Logo

A PangoAttrList represents a list of attributes that apply to a section of text.

The attributes in a PangoAttrList are, in general, allowed to overlap in an arbitrary fashion. However, if the attributes are manipulated only through [methodPango.AttrList.change], the overlap between properties will meet stricter criteria.

Since the PangoAttrList structure is stored as a linear list, it is not suitable for storing attributes for large amounts of text. In general, you should not use a single PangoAttrList for more than one paragraph of text.

record

Hierarchy

  • AttrList

Index

Constructors

Properties

name: string

Methods

  • Insert the given attribute into the PangoAttrList.

    It will replace any attributes of the same type on that segment and be merged with any adjoining attributes that are identical.

    This function is slower than [methodPango.AttrList.insert] for creating an attribute list in order (potentially much slower for large lists). However, [methodPango.AttrList.insert] is not suitable for continually changing a set of attributes since it never removes or combines existing attributes.

    Parameters

    Returns void

  • Checks whether list and other_list contain the same attributes and whether those attributes apply to the same ranges.

    Beware that this will return wrong values if any list contains duplicates.

    Parameters

    Returns boolean

  • Given a PangoAttrList and callback function, removes any elements of list for which func returns %TRUE and inserts them into a new list.

    Parameters

    • func: AttrFilterFunc

      callback function; returns %TRUE if an attribute should be filtered out

    Returns Pango.AttrList

  • Insert the given attribute into the PangoAttrList.

    It will be inserted after all other attributes with a matching start_index.

    Parameters

    Returns void

  • Insert the given attribute into the PangoAttrList.

    It will be inserted before all other attributes with a matching start_index.

    Parameters

    Returns void

  • This function opens up a hole in list, fills it in with attributes from the left, and then merges other on top of the hole.

    This operation is equivalent to stretching every attribute that applies at position pos in list by an amount len, and then calling [methodPango.AttrList.change] with a copy of each attribute in other in sequence (offset in position by pos, and limited in length to len).

    This operation proves useful for, for instance, inserting a pre-edit string in the middle of an edit buffer.

    For backwards compatibility, the function behaves differently when len is 0. In this case, the attributes from other are not imited to len, and are just overlayed on top of list.

    This mode is useful for merging two lists of attributes together.

    Parameters

    • other: Pango.AttrList

      another PangoAttrList

    • pos: number

      the position in list at which to insert other

    • len: number

      the length of the spliced segment. (Note that this must be specified since the attributes in other may only be present at some subsection of this range)

    Returns void

  • to_string(): string
  • Serializes a PangoAttrList to a string.

    No guarantees are made about the format of the string, it may change between Pango versions.

    The intended use of this function is testing and debugging. The format is not meant as a permanent storage format.

    Returns string

  • unref(): void
  • Decrease the reference count of the given attribute list by one.

    If the result is zero, free the attribute list and the attributes it contains.

    Returns void

  • update(pos: number, remove: number, add: number): void
  • Update indices of attributes in list for a change in the text they refer to.

    The change that this function applies is removing remove bytes at position pos and inserting add bytes instead.

    Attributes that fall entirely in the (pos, pos + remove) range are removed.

    Attributes that start or end inside the (pos, pos + remove) range are shortened to reflect the removal.

    Attributes start and end positions are updated if they are behind pos + remove.

    Parameters

    • pos: number

      the position of the change

    • remove: number

      the number of removed bytes

    • add: number

      the number of added bytes

    Returns void

  • Deserializes a PangoAttrList from a string.

    This is the counterpart to [methodPango.AttrList.to_string]. See that functions for details about the format.

    Parameters

    • text: string

      a string

    Returns Pango.AttrList

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method