UIng::Area::AttributedString
Inherits UIng::BlockConstructor < Reference < Object
Constructors
new(*args, &)
Sourcenew(*args, **kwargs, &)
Sourcenew(ref_ptr : Pointer(LibUI::AttributedString))
Sourcenew(string : String)
SourceClass methods
open(string : String, &block : AttributedString -> Nil) : Nil
SourceInstance methods
append_unattributed(text : String) : Nil
Sourcebyte_index_to_grapheme(pos : LibC::SizeT) : LibC::SizeT
Sourcedelete(start : LibC::SizeT, end_ : LibC::SizeT) : Nil
Sourcefinalize
Sourcefor_each_attribute
Return value: 0 = Continue, 1 = Stop (follows LibUI's uiForEach convention)
free
Sourcegrapheme_to_byte_index(pos : LibC::SizeT) : LibC::SizeT
Sourceinsert_at_unattributed(text : String, at : LibC::SizeT) : Nil
Sourcelen
Sourcenum_graphemes
Sourceset_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)
string
Sourceto_unsafe
Source