Skip to content

Commit

Permalink
Add standard accelerators on Windows
Browse files Browse the repository at this point in the history
On windows, ctrl-{z,x,c,v} are shortcuts for undo, cut, copy, paste.
Edwood did not implement this. Add these shortcuts.
  • Loading branch information
rjkroege committed Feb 21, 2024
1 parent e347c3d commit ceba5f8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions text.go
Original file line number Diff line number Diff line change
Expand Up @@ -897,11 +897,11 @@ func (t *Text) Type(r rune) {
}
t.Show(q0, q0, true)
return
case draw.KeyCmd + 'c': // %C: copy
case 0x3, draw.KeyCmd + 'c': // %C: copy

Check warning on line 900 in text.go

View check run for this annotation

Codecov / codecov/patch

text.go#L900

Added line #L900 was not covered by tests
t.TypeCommit()
cut(t, t, nil, true, false, "")
return
case draw.KeyCmd + 'z': // %Z: undo
case 0x1a, draw.KeyCmd + 'z': // %Z: undo

Check warning on line 904 in text.go

View check run for this annotation

Codecov / codecov/patch

text.go#L904

Added line #L904 was not covered by tests
t.TypeCommit()
undo(t, nil, nil, true, false, "")
return
Expand All @@ -920,7 +920,7 @@ func (t *Text) Type(r rune) {
// These following blocks contain mutating actions.
// cut/paste must be done after the seq++/filemark
switch r {
case draw.KeyCmd + 'x': // %X: cut
case 0x18, draw.KeyCmd + 'x': // %X: cut

Check warning on line 923 in text.go

View check run for this annotation

Codecov / codecov/patch

text.go#L923

Added line #L923 was not covered by tests
setUndoPoint()
t.TypeCommit()
if t.what == Body {
Expand All @@ -931,7 +931,7 @@ func (t *Text) Type(r rune) {
t.Show(t.q0, t.q0, true)
t.iq1 = t.q0
return
case draw.KeyCmd + 'v': // %V: paste
case 0x16, draw.KeyCmd + 'v': // %V: paste

Check warning on line 934 in text.go

View check run for this annotation

Codecov / codecov/patch

text.go#L934

Added line #L934 was not covered by tests
setUndoPoint()
t.TypeCommit()
if t.what == Body {
Expand Down

0 comments on commit ceba5f8

Please sign in to comment.