bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: sdiff UI enhancement


From: Chuck Swiger
Subject: Re: sdiff UI enhancement
Date: Wed, 6 Jun 2007 09:24:19 -0700

On Jun 6, 2007, at 2:10 AM, David Malone wrote:
I use sdiff a fair bit, as it is used as part of FreeBSD's mergemaster
script. I often notice that when I am merging left and right sections,
I type "r" for left and "l" for right, because "l" is on the right
hand side of the keyboard and "r" is on the left hand side of the
keyboard.

Agreed. It gets even worse if English isn't your native language-- in French, for example, the words are "droit" and "gauche".

I believe this is a known cognative problem for humans (if I remember
right, it gets a mention in the O'Reilly "Mind Hacks" book). We're
unlikely to be able to patch humans, so I thought it might be good
to add an alias where "1" means left and "2" means right. On all
the keyboards I've seen (including Hebrew keyboards) 1 is on the
left and 2 is on the right.

The following patch adds 1 and 2 as aliases for l and r - would it
be possible to get something like this added to diffutils?

I wish you the best of luck getting your patch included. Regrettably, the diff maintainers weren't interested in a similar patch I wrote about three years ago, located here:

  http://www.pkix.net/~chuck/sdiff2.diff

This patch makes the choice of keys configurable via an environment variable, and also fixes the invocation of an external editor via the calleditor() routine if the user chooses to manually perform the merge.

--- sdiff.c     Wed Jun  6 09:43:49 2007
+++ sdiff.c.patched     Wed Jun  6 09:44:54 2007
@@ -858,6 +858,8 @@
 e:\tEdit a new version.\n\
 l:\tUse the left version.\n\
 r:\tUse the right version.\n\
+1:\tUse the left version.\n\
+2:\tUse the right version.\n\
 s:\tSilently include common lines.\n\
 v:\tVerbosely include common lines.\n\
 q:\tQuit.\n\
@@ -913,7 +915,7 @@
          cmd0 = skip_white ();
          switch (cmd0)
            {
-           case 'l': case 'r': case 's': case 'v': case 'q':
+ case '1': case '2': case 'l': case 'r': case 's': case 'v': case 'q':
              if (skip_white () != '\n')
                {
                  give_help ();
@@ -966,10 +968,12 @@
       switch (cmd0)
        {
        case 'l':
+       case '1':
          lf_copy (left, llen, outfile);
          lf_skip (right, rlen);
          return 1;
        case 'r':
+       case '2':
          lf_copy (right, rlen, outfile);
          lf_skip (left, llen);
          return 1;

--
-Chuck





reply via email to

[Prev in Thread] Current Thread [Next in Thread]