diff options
Diffstat (limited to 'src/cmd')
-rw-r--r-- | src/cmd/acme/text.c | 46 | ||||
-rw-r--r-- | src/cmd/devdraw/cocoa-screen.m | 2 |
2 files changed, 40 insertions, 8 deletions
diff --git a/src/cmd/acme/text.c b/src/cmd/acme/text.c index 7634d921..ec72b4a8 100644 --- a/src/cmd/acme/text.c +++ b/src/cmd/acme/text.c @@ -681,10 +681,19 @@ texttype(Text *t, Rune r) textshow(t, t->q1+1, t->q1+1, TRUE); return; case Kdown: - if(t->what == Tag) - goto Tagdown; - n = t->fr.maxlines/3; - goto case_Down; + typecommit(t); + q0 = t->q0; + nnb = 0; + if(q0>0 && textreadc(t, q0-1)!='\n') + nnb = textbswidth(t, 0x15); + while(q0<t->file->b.nc && textreadc(t, q0)!='\n') + q0++; + if (q0+1 <= t->file->b.nc) + q0++; + while(q0<t->file->b.nc && textreadc(t, q0)!='\n' && nnb--) + q0++; + textshow(t, q0, q0, TRUE); + return; case Kscrollonedown: if(t->what == Tag) goto Tagdown; @@ -699,10 +708,25 @@ texttype(Text *t, Rune r) textsetorigin(t, q0, TRUE); return; case Kup: - if(t->what == Tag) - goto Tagup; - n = t->fr.maxlines/3; - goto case_Up; + typecommit(t); + q0 = t->q0; + nnb = 0; + n = 0; + if(q0>0 && textreadc(t, q0-1)!='\n') + nnb = textbswidth(t, 0x15); + q0 -= nnb; + if (q0>0) + q0--; + while (q0>0 && textreadc(t, q0-1)!='\n') + if (q0 == 0) + break; + else { + q0--; + n++; + } + q0 += (nnb > n) ? n : nnb; + textshow(t, q0, q0, TRUE); + return; case Kscrolloneup: if(t->what == Tag) goto Tagup; @@ -757,6 +781,12 @@ texttype(Text *t, Rune r) typecommit(t); undo(t, nil, nil, TRUE, 0, nil, 0); return; + case Kcmd+'s': /* %S: save/put file */ + typecommit(t); + put(&t->w->body, nil, nil, XXX, XXX, nil, 0); + return; + + Tagdown: /* expand tag to show all text */ diff --git a/src/cmd/devdraw/cocoa-screen.m b/src/cmd/devdraw/cocoa-screen.m index 7aebae21..3cc7ad22 100644 --- a/src/cmd/devdraw/cocoa-screen.m +++ b/src/cmd/devdraw/cocoa-screen.m @@ -922,6 +922,8 @@ getkeyboard(NSEvent *e) case NSFlagsChanged: if(in.mbuttons || in.kbuttons){ in.kbuttons = 0; + if(m & NSControlKeyMask) + in.kbuttons |= 1; if(m & NSAlternateKeyMask) in.kbuttons |= 2; if(m & NSCommandKeyMask) |