mirror of
https://github.com/veops/oneterm.git
synced 2025-10-20 14:06:03 +08:00
fix(api): monitor, replay
This commit is contained in:
@@ -672,7 +672,8 @@ func (m Model) View() string {
|
||||
v += styleText(m.echoTransform(string(value[pos+1:]))) // text after cursor
|
||||
v += m.completionView(0) // suggested completion
|
||||
} else {
|
||||
if m.canAcceptSuggestion() {
|
||||
if m.canAcceptSuggestion() && len(m.matchedSuggestions) <= 1 {
|
||||
|
||||
suggestion := m.matchedSuggestions[m.currentSuggestionIndex]
|
||||
if len(value) < len(suggestion) {
|
||||
m.Cursor.TextStyle = m.CompletionStyle
|
||||
|
@@ -175,7 +175,11 @@ func (m *view) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
}
|
||||
case errMsg:
|
||||
if msg != nil {
|
||||
return m, tea.Printf(" [ERROR] %s\n\n", errStyle.Render(msg.Error()))
|
||||
str := msg.Error()
|
||||
if ae, ok := msg.(*controller.ApiError); ok {
|
||||
str = controller.Err2Msg[ae.Code].One
|
||||
}
|
||||
return m, tea.Printf(" [ERROR] %s\n\n", errStyle.Render(str))
|
||||
}
|
||||
}
|
||||
m.textinput, tiCmd = m.textinput.Update(msg)
|
||||
@@ -327,7 +331,7 @@ func (conn *connector) SetStderr(w io.Writer) {
|
||||
}
|
||||
|
||||
func (conn *connector) Run() error {
|
||||
gsess, err := controller.DoConnect(conn.Ctx)
|
||||
gsess, err := controller.DoConnect(conn.Ctx, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user