bubbletea icon indicating copy to clipboard operation
bubbletea copied to clipboard

Cannot detect Ctrl + Space keypress in Windows

Open schollz opened this issue 3 months ago • 7 comments

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:

  1. Execute the source code below
  2. Press Ctrl + Space
  3. 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

Space produces: Image

Ctrl+Space produces the same:

Image

schollz avatar Sep 12 '25 04:09 schollz

Image

hi i had completed this issue , can i raise pr on this??

VallabhaE avatar Sep 28 '25 13:09 VallabhaE

@schollz hi please check this pr and approve it when you are available. and i am just started with open-source so if you are not the correct person to ask , i appreciate your help in reaching out to that person

#1498

VallabhaE avatar Sep 28 '25 14:09 VallabhaE

@VallabhaE I used your change locally but couldn't reproduce your results. The results I get are the same as my original issue using your code. Tried in Powershell and Alacritty terminal emulator.

schollz avatar Sep 29 '25 12:09 schollz

@schollz Hi, i tried it just now its working fine for me, can you please confrom u cloned repo which i forked?? to raise this pr

git clone https://github.com/VallabhaE/bubbletea.git

and try running thing command go clean -modcache -cache and try again its working fine for me here

i followd

  1. clone my repo given above
  2. paste your code under basicz/main.go
Image

gussing this is the issue

Image trying to get actual repo, please follow my steps i mentioned above and try

VallabhaE avatar Sep 29 '25 13:09 VallabhaE

Yes, using your method here are the results from Windows Powershell, there is no difference between Space and Ctrl+Space.

Pressing Ctrl:

Image

Pressing Space:

Image

Pressing Ctrl+Space:

Image

schollz avatar Sep 29 '25 14:09 schollz

is it possible to connect with you eather discord or any other platform ?? please

VallabhaE avatar Sep 29 '25 14:09 VallabhaE

Hi @schollz and @VallabhaE! Thank you for bringing this up and flagging it. We're working on this and will release a new patch soon.

aymanbagabas avatar Sep 29 '25 18:09 aymanbagabas