Indicate when caps lock is on while reading password

This commit is contained in:
Kovid Goyal
2023-02-04 11:04:19 +05:30
parent d06d6d7646
commit 0cabc3e109
2 changed files with 44 additions and 2 deletions

View File

@@ -93,6 +93,10 @@ func (self KeyModifiers) String() string {
return strings.Join(ans, "+")
}
func (self KeyModifiers) HasCapsLock() bool {
return self&CAPS_LOCK != 0
}
type KeyEvent struct {
Type KeyEventType
Mods KeyModifiers
@@ -121,6 +125,10 @@ func (self *KeyEvent) String() string {
return ans + "}"
}
func (self *KeyEvent) HasCapsLock() bool {
return self.Mods.HasCapsLock()
}
func KeyEventFromCSI(csi string) *KeyEvent {
if len(csi) == 0 {
return nil