-
Notifications
You must be signed in to change notification settings - Fork 1k
Open
Description
Describe the bug
Cannot detect Ctrl + Space keypress in Windows, instead it looks identical to pressing "Space".
Setup
- OS - Windows 11
- Shell - Windows Powershell
- Terminal Emulator - No emulator. Plain windows powershell
- Terminal Multiplexer - None
To Reproduce
Steps to reproduce the behavior:
- Execute the source code below
- Press Ctrl + Space
- Read the prog.log file for logs
Source Code
Code
package main
import (
"fmt"
"log"
"os"
tea "github.com/charmbracelet/bubbletea"
)
type model struct {
header string
content string
keycnt int
// Add any fields you need for your model
}
func (m model) Init() tea.Cmd {
return nil
}
func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.keycnt++
m.content = fmt.Sprintf("\n(Key %d)", m.keycnt)
switch msg := 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)
if msg.String() == "q" {
return m, tea.Quit
}
}
return m, nil
}
func (m model) View() string {
return fmt.Sprintf("%s\n%s", m.header, m.content)
}
func main() {
f,err := os.OpenFile("prog.log", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
if err!= 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+space, or something different than just "space"
Screenshots
Ctrl+Space produces the same:

Metadata
Metadata
Assignees
Labels
No labels
