Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BasicEvent ¶
BasicEvent is an embeddable type that implements the views.EventWidget interface.
func NewBasicEvent ¶
func NewBasicEvent(widget views.Widget) BasicEvent
func (BasicEvent) When ¶
func (e BasicEvent) When() time.Time
When returns the time at which the event took place.
func (BasicEvent) Widget ¶
func (e BasicEvent) Widget() views.Widget
Widget returns the widget requesting the reply.
type Editor ¶
Editor implements a simple text editor as a widget. It emits EventSendRequest when an edited message is ready to be sent.
func (*Editor) HandleEvent ¶
HandleEvent handles keypresses.
func (*Editor) UntypeRune ¶
func (e *Editor) UntypeRune()
Untype rune deletes the last rune in the editor.
func (*Editor) UpdateContent ¶
func (e *Editor) UpdateContent()
UpdateContent synchronizes the internal editor state and the visible editor state.
type EphemeralEditor ¶
type EphemeralEditor struct { PrimaryContent views.Widget Separator, Editor, Requestor views.Widget // the ID field of the EventEditRequest currently being handled, if any RequestID int EditorVisible bool *views.BoxLayout views.WidgetWatchers }
EphemeralEditor is a layout that can summon and dismiss an Editor widget as needed. When it receives EventEditRequest, it will create an Editor widget that will accept all key events before its PrimaryContent. Once that Editor emits EventEditFinished, it will dismiss the editor.
func NewEphemeralEditor ¶
func NewEphemeralEditor(primary views.Widget) *EphemeralEditor
NewEphemeralEditor creates a new layout with the given view as the primary content.
func (*EphemeralEditor) ClearRequestor ¶
func (e *EphemeralEditor) ClearRequestor()
func (*EphemeralEditor) HandleEvent ¶
func (e *EphemeralEditor) HandleEvent(ev tcell.Event) bool
HandleEvent processes events of interest to the EphemeralEditor. Notably, it handles EventEditRequest and EventEditFinished by summoning and dismissing the editor widget.
func (*EphemeralEditor) HideEditor ¶
func (e *EphemeralEditor) HideEditor()
HideEditor makes the editor invisible and clears its content.
func (*EphemeralEditor) SetRequestor ¶
func (e *EphemeralEditor) SetRequestor(event EventEditRequest)
func (*EphemeralEditor) ShowEditor ¶
func (e *EphemeralEditor) ShowEditor()
ShowEditor makes the editor visible.
type EventEditFinished ¶
type EventEditFinished struct { ID int Content string BasicEvent }
EventEditFinished indicates that an EventEditFinished has been processed by an editor and contains the final edited text that the user provided. It fulfills views.EventWidget.
func NewEventEditFinished ¶
func NewEventEditFinished(id int, widget views.Widget, content string) EventEditFinished
NewEventEditFinished creates a new finished event. The id provided should be an ID from the EventEditRequest that was just finished.
type EventEditRequest ¶
type EventEditRequest struct { ID int Content string BasicEvent }
EventEditRequest indicates that a widget has requested that an editor be presented to the user with the provided initial content. The ID field is provided by the creator of the request and should be included in any EventEditFinished event that is created as a result of this Request. This allows higher-level logic to correlate the Finished event with the Requst. It fulfills views.EventWidget.
func NewEventEditRequest ¶
func NewEventEditRequest(id int, widget views.Widget, content string) EventEditRequest
NewEventEditRequest creates a new request.
type EventReplySelected ¶
type EventReplySelected struct { Selected *forest.Reply Author *forest.Identity Community *forest.Community BasicEvent }
EventReplySelected indicates that a particular node was selected in the TUI.
func NewEventReplySelected ¶
func NewEventReplySelected(widget views.Widget, selected *forest.Reply, author *forest.Identity, community *forest.Community) EventReplySelected
NewEventReplySelected creates an event indicating which node was selected as well as providing a copy of its author and parent community nodes.
type StatusBar ¶
type StatusBar struct {
views.SimpleStyledTextBar
}
func NewStatusBar ¶
func NewStatusBar() *StatusBar
type Switcher ¶
type Switcher struct { *wistTcell.Application LogWidget views.Widget ContentWidget views.Widget Current views.Widget views.WidgetWatchers }
Switcher allows toggling a single widget between multiple underlying widgets with only one widget visible at a time. Only the visible widget receives events.
func NewSwitcher ¶
func NewSwitcher(app *wistTcell.Application, content, log views.Widget) *Switcher
NewSwitcher creates a Switcher with the given views as its Content and Log widgets.
func (*Switcher) ToggleLogWidget ¶
func (s *Switcher) ToggleLogWidget()
type Writer ¶
Writer is a TextArea modified to implement io.Writer
func NewWriterWidget ¶
func NewWriterWidget() *Writer
func (*Writer) EnableCursor ¶
EnableCursor enables a soft cursor in the TextArea.
func (*Writer) HideCursor ¶
HideCursor hides or shows the cursor in the TextArea. If on is true, the cursor is hidden. Note that a cursor is only shown if it is enabled.