class

UIng::Area::AttributedString

Inherits UIng::BlockConstructor < Reference < Object

Constructors

new(*args, &)
Source
new(*args, **kwargs, &)
Source
new(ref_ptr : Pointer(LibUI::AttributedString))
Source
new(string : String)
Source

Class methods

open(string : String, &block : AttributedString -> Nil) : Nil
Source

Instance methods

append_unattributed(text : String) : Nil
Source
byte_index_to_grapheme(pos : LibC::SizeT) : LibC::SizeT
Source
delete(start : LibC::SizeT, end_ : LibC::SizeT) : Nil
Source
finalize
Source
for_each_attribute

Return value: 0 = Continue, 1 = Stop (follows LibUI's uiForEach convention)

Source
free
Source
grapheme_to_byte_index(pos : LibC::SizeT) : LibC::SizeT
Source
insert_at_unattributed(text : String, at : LibC::SizeT) : Nil
Source
num_graphemes
Source
set_attribute(attribute : Attribute, start : LibC::SizeT, end_ : LibC::SizeT) : Nil

Applies an attribute to a range of text.

IMPORTANT: Ownership transfer

  • libui takes ownership of the attribute after this call.
  • The attribute MUST NOT be reused or freed manually.
  • Each call requires a NEW Attribute instance.

Example: attr_str.set_attribute(Attribute.new_color(1.0, 0.0, 0.0, 1.0), 0, 5)

Source
string
Source
to_unsafe
Source