aboutsummaryrefslogtreecommitdiff
path: root/view-main.go
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2018-03-17 14:00:02 +0200
committerTulir Asokan <tulir@maunium.net>2018-03-17 14:00:02 +0200
commitdacc7fd6a310d3945bc61983ec218d083900a98d (patch)
tree3677189b8cb853113f1bec026189d9f0937df31c /view-main.go
parent4196931e1bef5c4e6cdea2e8921703be286b717a (diff)
Fix wide characters in input field and prepare for tab completion
Diffstat (limited to 'view-main.go')
-rw-r--r--view-main.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/view-main.go b/view-main.go
index acd9576..5a3a70c 100644
--- a/view-main.go
+++ b/view-main.go
@@ -65,11 +65,14 @@ func (ui *GomuksUI) NewMainView() tview.Primitive {
mainView.roomList.
ShowSecondaryText(false).
+ SetSelectedBackgroundColor(tcell.ColorDarkGreen).
+ SetSelectedTextColor(tcell.ColorWhite).
SetBorderPadding(0, 0, 1, 0)
mainView.input.
SetDoneFunc(mainView.InputDone).
SetChangedFunc(mainView.InputChanged).
+ SetTabCompleteFunc(mainView.InputTabComplete).
SetFieldBackgroundColor(tcell.ColorDefault).
SetPlaceholder("Send a message...").
SetPlaceholderExtColor(tcell.ColorGray).
@@ -93,6 +96,13 @@ func (view *MainView) InputChanged(text string) {
}
}
+func (view *MainView) InputTabComplete(text string, cursorOffset int) {
+ roomView, _ := view.rooms[view.CurrentRoomID()]
+ if roomView != nil {
+ // text[0:cursorOffset]
+ }
+}
+
func (view *MainView) InputDone(key tcell.Key) {
if key == tcell.KeyEnter {
room, text := view.CurrentRoomID(), view.input.GetText()
@@ -128,7 +138,7 @@ func (view *MainView) HandleCommand(room, command string, args []string) {
view.matrix.client.LeaveRoom(room)
case "/join":
if len(args) == 0 {
- view.AddMessage(room, "Usage: /join <room>")
+ view.AddMessage(room, "Usage: /join <room>")
break
}
view.debug.Print(view.matrix.JoinRoom(args[0]))
@@ -207,7 +217,7 @@ func (view *MainView) AddRoom(room string) {
return
}
view.roomIDs = append(view.roomIDs, room)
- view.addRoom(len(view.roomIDs) - 1, room)
+ view.addRoom(len(view.roomIDs)-1, room)
}
func (view *MainView) RemoveRoom(room string) {