You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Cannot detect Ctrl + V keypress in windows. On pressing Ctrl+V, I instead get the clipboard text's individual keys as input, one by one.
Setup
Please complete the following information along with version numbers, if applicable.
OS - Windows 11
Shell - Windows Powershell
Terminal Emulator - No emulator. Plain windows powershell
Terminal Multiplexer - None
To Reproduce
Steps to reproduce the behavior:
Copy "hello" to windows clipboard
Execute the source code provided below
Press Ctrl + V
Read the prog.log file for logs.
Source Code
Code
package main
import (
"fmt""log""os"
tea "github.com/charmbracelet/bubbletea"
)
typemodelstruct {
headerstringcontentstringkeycntint// Add any fields you need for your model
}
func (mmodel) Init() tea.Cmd {
returnnil
}
func (mmodel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.keycnt++m.content=fmt.Sprintf("\n(Key %d)", m.keycnt)
switchmsg:=msg.(type) {
case tea.KeyMsg:
m.content+=fmt.Sprintf("msg = %v, typestr = %v, runes = %v, type = %d, paste=%v, alt=%v",
msg, msg.Type.String(), msg.Runes, msg.Type, msg.Paste, msg.Alt)
log.Println(m.content)
ifmsg.String() =="q" {
returnm, tea.Quit
}
}
returnm, nil
}
func (mmodel) View() string {
returnfmt.Sprintf("%s\n%s", m.header, m.content)
}
funcmain() {
f,err:=os.OpenFile("prog.log", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
iferr!=nil {
panic(err)
}
log.SetOutput(f)
p:=tea.NewProgram(model{header: "Press Enter or Ctrl + M\n"})
if_,err:=p.Run(); err!=nil {
fmt.Printf("Error starting program: %v", err)
}
}
Expected behavior
I should see Ctrl+V detected in logs.
Screenshots
Add screenshots to help explain your problem.
Logs
Describe the bug
Cannot detect Ctrl + V keypress in windows. On pressing Ctrl+V, I instead get the clipboard text's individual keys as input, one by one.
Setup
Please complete the following information along with version numbers, if applicable.
To Reproduce
Steps to reproduce the behavior:
Source Code
Code
Expected behavior
I should see Ctrl+V detected in logs.
Screenshots
Add screenshots to help explain your problem.
Logs
Additional context
This related to yorukot/superfile#561 - We are trying to make Ctrl+V key work in our file manager on windows.
The text was updated successfully, but these errors were encountered: