Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/ddb Fix CTRL-T to behave properly. It should swaps the c...



details:   https://anonhg.NetBSD.org/src/rev/88361c5237b0
branches:  trunk
changeset: 495459:88361c5237b0
user:      jhawk <jhawk%NetBSD.org@localhost>
date:      Fri Jul 28 16:33:39 2000 +0000

description:
Fix CTRL-T to behave properly. It should swaps the current and previous
characters, not the previous and second-to-previous.

diffstat:

 sys/ddb/db_input.c |  28 +++++++++++++++++++---------
 1 files changed, 19 insertions(+), 9 deletions(-)

diffs (42 lines):

diff -r bacbb6290f5e -r 88361c5237b0 sys/ddb/db_input.c
--- a/sys/ddb/db_input.c        Fri Jul 28 15:40:24 2000 +0000
+++ b/sys/ddb/db_input.c        Fri Jul 28 16:33:39 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_input.c,v 1.13 2000/03/30 11:31:27 augustss Exp $   */
+/*     $NetBSD: db_input.c,v 1.14 2000/07/28 16:33:39 jhawk Exp $      */
 
 /* 
  * Mach Operating System
@@ -200,14 +200,24 @@
                break;
            case CTRL('t'):
                /* twiddle last 2 characters */
-               if (db_lc >= db_lbuf_start + 2) {
-                   c = db_lc[-2];
-                   db_lc[-2] = db_lc[-1];
-                   db_lc[-1] = c;
-                   cnputc(BACKUP);
-                   cnputc(BACKUP);
-                   cnputc(db_lc[-2]);
-                   cnputc(db_lc[-1]);
+               if (db_lc >= db_lbuf_start + 1) {
+                   if (db_lc < db_le) {
+                           c = db_lc[-1];
+                           db_lc[-1] = db_lc[0];
+                           db_lc[0] = c;
+                           cnputc(BACKUP);
+                           cnputc(db_lc[-1]);
+                           cnputc(db_lc[0]);
+                           db_lc++;
+                   } else if (db_lc >= db_lbuf_start + 2) {
+                           c = db_lc[-2];
+                           db_lc[-2] = db_lc[-1];
+                           db_lc[-1] = c;
+                           cnputc(BACKUP);
+                           cnputc(BACKUP);
+                           cnputc(db_lc[-2]);
+                           cnputc(db_lc[-1]);
+                   }
                }
                break;
 #if DDB_HISTORY_SIZE != 0



Home | Main Index | Thread Index | Old Index