summaryrefslogtreecommitdiff
blob: e5f2eb497b09e28e8532cde6b3490a3b7c3220e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
diff -ru bash-2.05b.orig/lib/readline/display.c bash-2.05b/lib/readline/display.c
--- bash-2.05b.orig/lib/readline/display.c	2002-06-04 23:54:47.000000000 +0900
+++ bash-2.05b/lib/readline/display.c	2002-12-12 16:31:06.000000000 +0900
@@ -1129,16 +1129,24 @@
       memset (&ps_new, 0, sizeof(mbstate_t));
       memset (&ps_old, 0, sizeof(mbstate_t));
 
-      new_offset = old_offset = 0;
-      for (ofd = old, nfd = new;
-	   (ofd - old < omax) && *ofd &&
-	     _rl_compare_chars(old, old_offset, &ps_old, new, new_offset, &ps_new); )
-	{
-	  old_offset = _rl_find_next_mbchar (old, old_offset, 1, MB_FIND_ANY);
-	  new_offset = _rl_find_next_mbchar (new, new_offset, 1, MB_FIND_ANY);
-	  ofd = old + old_offset;
-	  nfd = new + new_offset;
-	}
+      if(omax == nmax && strncmp(new,old,omax) == 0)
+        {
+          ofd = old + omax;
+          nfd = new + nmax;
+        }
+      else
+        {
+          new_offset = old_offset = 0;
+          for (ofd = old, nfd = new;
+               (ofd - old < omax) && *ofd &&
+                 _rl_compare_chars(old, old_offset, &ps_old, new, new_offset, &ps_new); )
+            {
+              old_offset = _rl_find_next_mbchar (old, old_offset, 1, MB_FIND_ANY);
+              new_offset = _rl_find_next_mbchar (new, new_offset, 1, MB_FIND_ANY);
+              ofd = old + old_offset;
+              nfd = new + new_offset;
+            }
+        }
     }
   else
 #endif
@@ -1169,8 +1177,9 @@
 	  memset (&ps_old, 0, sizeof (mbstate_t));
 	  memset (&ps_new, 0, sizeof (mbstate_t));
 
-	  _rl_adjust_point (old, ols - old, &ps_old);
-	  _rl_adjust_point (new, nls - new, &ps_new);
+          /* these doesn't make sense */
+	  /* _rl_adjust_point (old, ols - old, &ps_old); */
+          /* _rl_adjust_point (new, nls - new, &ps_new); */
 
 	  if (_rl_compare_chars (old, ols - old, &ps_old, new, nls - new, &ps_new) == 0)
 	    break;