[REPOST, now with patch attached... somehow this is not my day today...
;-( ]
Roland Mainz wrote:
> Attached is a pach for ksh93r+_alpha
> ("ksh93r+_alpha_tab_tab_patch_001.diff.txt")
Apologies... that was the wrong version (an older one where TAB-TAB
wasn't an 100% alias of "<ESC>=") ... attached is now the correct
version ("ksh93r+_alpha_tab_tab_patch_002.diff.txt") ... sorry for the
mistake...
----
Bye,
Roland
--
__ . . __
(o.\ \/ /.o) roland.mainz at nrubsig.org
\__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer
/O /==\ O\ TEL +49 641 7950090
(;O/ \/ \O;)
-------------- next part --------------
Index: src/lib/libshell/common/include/edit.h
===================================================================
--- src/lib/libshell/common/include/edit.h (revision 267)
+++ src/lib/libshell/common/include/edit.h (working copy)
@@ -109,7 +109,8 @@
int e_lbuf[LOOKAHEAD];/* pointer to look-ahead buffer */
int e_fd; /* file descriptor */
int e_ttyspeed; /* line speed, also indicates tty parms are
valid */
- int e_tabcount;
+ int e_tabcount; /* number of <TAB>s in a row */
+ int e_quotechar; /* boolean: quote next character */
#ifdef _hdr_utime
ino_t e_tty_ino;
dev_t e_tty_dev;
Index: src/lib/libshell/common/edit/edit.c
===================================================================
--- src/lib/libshell/common/edit/edit.c (revision 267)
+++ src/lib/libshell/common/edit/edit.c (working copy)
@@ -972,7 +972,8 @@
/*** map '\r' to '\n' ***/
if(c == '\r' && mode!=2)
c = '\n';
- if(ep->e_tabcount && !(c=='\t'||c==ESC || c=='\\'))
+ /* '=' is needed for emacs mode "<ESC>=" sequence*/
+ if(ep->e_tabcount && !(c=='\t'||c==ESC || c=='\\' || c=='='))
ep->e_tabcount = 0;
}
else
Index: src/lib/libshell/common/edit/emacs.c
===================================================================
--- src/lib/libshell/common/edit/emacs.c (revision 267)
+++ src/lib/libshell/common/edit/emacs.c (working copy)
@@ -306,10 +306,20 @@
count = 1;
adjust = -1;
i = cur;
+
+ /* CTRL-V is used to quote special characters
+ * (which otherwise would have a special meaning/function) */
+ if(ep->ed->e_quotechar)
+ {
+ ep->ed->e_quotechar = 0;
+ goto do_default_processing;
+ }
+
switch(c)
{
case cntl('V'):
- show_info(ep,fmtident(e_version));
+ /* Quote the character following CTRL-V */
+ ep->ed->e_quotechar = 1;
continue;
case '\0':
ep->mark = i;
@@ -327,21 +337,19 @@
continue;
#endif /* u370 */
case '\t':
- if(cur>0 && cur>=eol && out[cur-1]!='\t' &&
out[cur-1]!=' ' && ep->ed->sh->nextprompt)
+ ep->ed->e_tabcount++;
+ if(ep->ed->e_tabcount == 1)
+ {
+ ed_ungetchar(ep->ed,ESC);
+ goto do_escape;
+ }
+ else if(ep->ed->e_tabcount > 1)
{
- if(ep->ed->e_tabcount==0)
- {
- ep->ed->e_tabcount=1;
- ed_ungetchar(ep->ed,ESC);
- goto do_escape;
- }
- else if(ep->ed->e_tabcount==1)
- {
- ed_ungetchar(ep->ed,'=');
- goto do_escape;
- }
- ep->ed->e_tabcount = 0;
+ ed_ungetchar(ep->ed,'=');
+ goto do_escape;
}
+ continue; /* should not be reached */
+ do_default_processing:
default:
if ((eol+1) >= (scend)) /* will not fit on line */
{
@@ -920,15 +928,7 @@
case '=': /* escape = - list all matching file names */
ep->mark = cur;
if(ed_expand(ep->ed,(char*)out,&cur,&eol,i,count) < 0)
- {
- if(ep->ed->e_tabcount==1)
- {
- ep->ed->e_tabcount=2;
- ed_ungetchar(ep->ed,cntl('\t'));
- return(-1);
- }
beep();
- }
else if(i=='=')
draw(ep,REFRESH);
else