// SetTextAlign sets the text alignment within the text view. This must be
// either AlignLeft, AlignCenter, or AlignRight.
557631
func (t *TextView) SetTextAlign(align int) *TextView {
	if t.align != align {
		t.index = nil
	}
	t.align = align
	return t
}
921144
public void setTextAlignment(final TextAlignment ALIGNMENT) {
        if (null == textAlignment) {
            _textAlignment = ALIGNMENT;
            fireTileEvent(RESIZE_EVENT);
        } else {
            textAlignment.set(ALIGNMENT);
        }
    }
375682
func AlignText(txt string, width int, align TextAlignment) string {
	return AlignTextWithFill(txt, width, align, ' ')
}
735134
func setAlignment(formatStyle *formatStyle) *xlsxAlignment {
	var alignment xlsxAlignment
	if formatStyle.Alignment != nil {
		alignment.Horizontal = formatStyle.Alignment.Horizontal
		alignment.Indent = formatStyle.Alignment.Indent
		alignment.JustifyLastLine = formatStyle.Alignment.JustifyLastLine
		alignment.ReadingOrder = formatStyle.Alignment.ReadingOrder
		alignment.RelativeIndent = formatStyle.Alignment.RelativeIndent
		alignment.ShrinkToFit = formatStyle.Alignment.ShrinkToFit
		alignment.TextRotation = formatStyle.Alignment.TextRotation
		alignment.Vertical = formatStyle.Alignment.Vertical
		alignment.WrapText = formatStyle.Alignment.WrapText
	}
	return &alignment
}
86693
func AlignTextWithFill(txt string, width int, align TextAlignment, fill rune) string {
	fillChar := string(fill)
	numSpaces := width - len(txt)
	switch align {
	case AlignCenter:
		if numSpaces/2 > 0 {
			return fmt.Sprintf("%s%s%s",
				strings.Repeat(fillChar, numSpaces/2),
				txt, strings.Repeat(fillChar, numSpaces/2),
			)
		}
		return txt
	case AlignRight:
		return fmt.Sprintf("%s%s", strings.Repeat(fillChar, numSpaces), txt)
	default:
		if numSpaces >= 0 {
			return fmt.Sprintf("%s%s", txt, strings.Repeat(fillChar, numSpaces))
		}
		return txt
	}
}
306088
func (t *TextBar) SetRight(s string, style tcell.Style) {
	t.initialize()
	if style == tcell.StyleDefault {
		style = t.style
	}
	t.right.SetText(s)
	t.right.SetStyle(style)
}
225605
func (s *NoteUpdate) SetText(v string) *NoteUpdate {
	s.Text = &v
	return s
}
868509
func (s *DescribeDimensionKeysOutput) SetAlignedStartTime(v time.Time) *DescribeDimensionKeysOutput {
	s.AlignedStartTime = &v
	return s
}
566956
func (t *TextBar) SetLeft(s string, style tcell.Style) {
	t.initialize()
	if style == tcell.StyleDefault {
		style = t.style
	}
	t.left.SetText(s)
	t.left.SetStyle(style)
}
577232
func (s *StartSpeechSynthesisTaskInput) SetTextType(v string) *StartSpeechSynthesisTaskInput {
	s.TextType = &v
	return s
}
1117967
func (s *CodeContentDescription) SetTextContent(v string) *CodeContentDescription {
	s.TextContent = &v
	return s
}
752957
func (b *Buffer) setText(v string) {
	debug.Assert(b.cursorPosition <= len([]rune(v)), "length of input should be shorter than cursor position")
	o := b.workingLines[b.workingIndex]
	b.workingLines[b.workingIndex] = v

	if o != v {
		// Text is changed.
		// TODO: Call callback function triggered by text changed. And also history search text should reset.
		// https://github.com/jonathanslenders/python-prompt-toolkit/blob/master/prompt_toolkit/buffer.py#L380-L384
	}
}
223446
function set(textAlign, scale) {
         this.textAlign = textAlign; // updated scaled Size

         if (scale) {
           this.resize(scale);
         }

         this.isDirty = true;
         return this;
       }
1047706
func (s *DetectEntitiesInput) SetText(v string) *DetectEntitiesInput {
	s.Text = &v
	return s
}
726954
func (i *InputField) SetText(text string) *InputField {
	i.text = text
	i.cursorPos = len(text)
	if i.changed != nil {
		i.changed(text)
	}
	return i
}
96613
func (e *TextEdit) SetText(text string) {
	e.text.Set([]rune(text))
}
1263177
func (t *Text) SetText(s string) {
	t.width = 0
	t.text = []rune(s)
	if len(t.widths) < len(t.text) {
		t.widths = make([]int, len(t.text))
	} else {
		t.widths = t.widths[0:len(t.text)]
	}
	if len(t.styles) < len(t.text) {
		t.styles = make([]tcell.Style, len(t.text))
	} else {
		t.styles = t.styles[0:len(t.text)]
	}
	t.lengths = []int{}
	length := 0
	for i, r := range t.text {
		t.widths[i] = runewidth.RuneWidth(r)
		t.styles[i] = t.style
		if r == '\n' {
			t.lengths = append(t.lengths, length)
			if length > t.width {
				t.width = length
				length = 0
			}

		} else if t.widths[i] == 0 && length == 0 {
			// If first character on line is combining, inject
			// a leading space.  (Shame on the caller!)
			t.widths = append(t.widths, 0)
			copy(t.widths[i+1:], t.widths[i:])
			t.widths[i] = 1

			t.text = append(t.text, ' ')
			copy(t.text[i+1:], t.text[i:])
			t.text[i] = ' '

			t.styles = append(t.styles, t.style)
			copy(t.styles[i+1:], t.styles[i:])
			t.styles[i] = t.style
			length++
		} else {
			length += t.widths[i]
		}
	}
	if length > 0 {
		t.lengths = append(t.lengths, length)
		if length > t.width {
			t.width = length
		}
	}
	t.height = len(t.lengths)
	t.PostEventWidgetContent(t)
}