zsh-workers
 help / color / mirror / code / Atom feed
* Re: Bug report interface comments
@ 2000-04-04  9:19 Sven Wischnowsky
  2000-04-04  9:29 ` copy-prev-word question " Andrej Borsenkow
  0 siblings, 1 reply; 9+ messages in thread
From: Sven Wischnowsky @ 2000-04-04  9:19 UTC (permalink / raw)
  To: zsh-workers


Andrej Borsenkow wrote:

> I tried to submit a (possible) bug, but what I do not like, that I have
> to have a logon there. Else bug comes from none. Normally, I have a
> field to enter mail address. It cannot be expected, that every user that
> wants to submit a bug report will get login - that means, you have no
> way to communicate with submitter.

Erm... could we, until we have some automatic forwarding from the bug
manager to zsh-workers, agree that full bug descriptions be sent to
zsh-workers, too?


Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: copy-prev-word question RE: Bug report interface comments
@ 2000-04-06  8:24 Sven Wischnowsky
  0 siblings, 0 replies; 9+ messages in thread
From: Sven Wischnowsky @ 2000-04-06  8:24 UTC (permalink / raw)
  To: zsh-workers


Andrej Borsenkow wrote:

> > Erm... could we, until we have some automatic forwarding from the bug
> > manager to zsh-workers, agree that full bug descriptions be sent to
> > zsh-workers, too?
> 
> bor@itsrm2% mv BI<TAB>
> bor@itsrm2% mv BIC\ NMI.rm2/
> bor@itsrm2% mv BIC\ NMI.rm2 <ESC-^_>
> bor@itsrm2% mv BIC\ NMI.rm2 NMI.rm2
> 
> I'd expect it to respect shell quouting ... note, that insert-last-word
> does that:
> 
> bor@itsrm2% mv 'xx xx' 'yy yy'
> mv: Cannot access xx xx: No such file or directory
> bor@itsrm2% mv <ESC-.>
> bor@itsrm2% mv 'yy yy'
> 
> the same with
> 
> bor@itsrm2% mv yy\ yy
> 
> the "yy\ yy" is inserted.

No patch, but I thought, I could try to explain...

insert-last-word uses the history, which contains the words for each
line, separated, parsed and everything. copy-prev-word has no such
luck, because the current line doesn't exist in parsed form yet. This
is, btw, the same reason why $historywords does not contain the words
from the current line and why `compctl -h' couldn't complete these
words.

The completion code has gat_comp_string() to get at the words from the 
current line, but setting everything up to be able to call that
function is complicated enough to kepp me from trying to fix this...

Maybe one could try it with a loop as in set_comp_sep() some day...

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: copy-prev-word question RE: Bug report interface comments
@ 2000-04-10  7:58 Sven Wischnowsky
  2000-04-11  2:52 ` Bart Schaefer
  0 siblings, 1 reply; 9+ messages in thread
From: Sven Wischnowsky @ 2000-04-10  7:58 UTC (permalink / raw)
  To: zsh-workers


Andrej Borsenkow wrote:

> > Erm... could we, until we have some automatic forwarding from the bug
> > manager to zsh-workers, agree that full bug descriptions be sent to
> > zsh-workers, too?
> 
> bor@itsrm2% mv BI<TAB>
> bor@itsrm2% mv BIC\ NMI.rm2/
> bor@itsrm2% mv BIC\ NMI.rm2 <ESC-^_>
> bor@itsrm2% mv BIC\ NMI.rm2 NMI.rm2
> 
> I'd expect it to respect shell quouting ... note, that insert-last-word
> does that:
> 
> ...

The patch could be something like the one below. I haven't committed
it because it would change the behaviour it always had and I don't
know if it counts as a bug fix.

The core is the new function bufferwords() in hist.c which returns a
list containing the words from the current line. The patch makes that
also be used for the $historywords parameter.

And the maual was wrong, wasn't it?

Bye
 Sven

diff -u -r ../oz/Doc/Zsh/zle.yo ./Doc/Zsh/zle.yo
--- ../oz/Doc/Zsh/zle.yo	Fri Apr  7 20:06:26 2000
+++ ./Doc/Zsh/zle.yo	Fri Apr  7 21:31:46 2000
@@ -637,7 +637,7 @@
 )
 tindex(copy-prev-word)
 item(tt(copy-prev-word) (ESC-^_) (unbound) (unbound))(
-Duplicate the word behind the cursor.
+Duplicate the word before the cursor.
 )
 tindex(vi-delete)
 item(tt(vi-delete) (unbound) (d) (unbound))(
diff -u -r ../oz/Src/Modules/parameter.c ./Src/Modules/parameter.c
--- ../oz/Src/Modules/parameter.c	Fri Apr  7 20:06:31 2000
+++ ./Src/Modules/parameter.c	Fri Apr  7 21:27:16 2000
@@ -1081,10 +1081,14 @@
 histwgetfn(Param pm)
 {
     char **ret, **p, *h, *e, sav;
-    LinkList l = newlinklist();
+    LinkList l = newlinklist(), ll;
     LinkNode n;
     int i = addhistnum(curhist, -1, HIST_FOREIGN), iw;
     Histent he = quietgethistent(i, GETHIST_UPWARD);
+
+    ll = bufferwords(NULL);
+    for (n = firstnode(ll); n; incnode(n))
+	pushnode(l, getdata(n));
 
     while (he) {
 	for (iw = he->nwords - 1; iw >= 0; iw--) {
diff -u -r ../oz/Src/Zle/zle_misc.c ./Src/Zle/zle_misc.c
--- ../oz/Src/Zle/zle_misc.c	Fri Apr  7 20:06:30 2000
+++ ./Src/Zle/zle_misc.c	Fri Apr  7 21:11:44 2000
@@ -523,20 +523,25 @@
 int
 copyprevword(char **args)
 {
-    int len, t0;
+    LinkList l;
+    LinkNode n;
+    int i;
+    char *p = NULL;
 
-    for (t0 = cs - 1; t0 >= 0; t0--)
-	if (iword(line[t0]))
-	    break;
-    for (; t0 >= 0; t0--)
-	if (!iword(line[t0]))
+    l = bufferwords(&i);
+
+    for (n = firstnode(l); n; incnode(n))
+	if (!i--) {
+	    p = getdata(n);
 	    break;
-    if (t0)
-	t0++;
-    len = cs - t0;
-    spaceinline(len);
-    memcpy((char *)&line[cs], (char *)&line[t0], len);
-    cs += len;
+	}
+    if (p) {
+	int len = strlen(p);
+
+	spaceinline(len);
+	memcpy(line + cs, p, len);
+	cs += len;
+    }
     return 0;
 }
 
diff -u -r ../oz/Src/hist.c ./Src/hist.c
--- ../oz/Src/hist.c	Fri Apr  7 20:06:27 2000
+++ ./Src/hist.c	Fri Apr  7 21:14:42 2000
@@ -2032,3 +2032,66 @@
 	free(lockfile);
     }
 }
+
+/* Get the words in the current buffer. Using the lexer. */
+
+/**/
+mod_export LinkList
+bufferwords(int *index)
+{
+    LinkList list = newlinklist();
+    int num = 0, cur = -1, got = 0, ne = noerrs, ocs = cs;
+    char *p;
+
+    zleparse = 1;
+    addedx = 0;
+    noerrs = 1;
+    lexsave();
+    if (!isfirstln && chline) {
+	p = (char *) zhalloc(hptr - chline + ll + 2);
+	memcpy(p, chline, hptr - chline);
+	memcpy(p + (hptr - chline), line, ll);
+	p[(hptr - chline) + ll] = ' ';
+	p[(hptr - chline) + ll + 1] = '\0';
+	inpush(p, 0, NULL);
+	cs += hptr - chline;
+    } else {
+	p = (char *) zhalloc(ll + 2);
+	memcpy(p, line, ll);
+	p[ll] = ' ';
+	p[ll + 1] = '\0';
+	inpush(p, 0, NULL);
+    }
+    if (cs)
+	cs--;
+    strinbeg(0);
+    noaliases = 1;
+    do {
+	ctxtlex();
+	if (tok == ENDINPUT || tok == LEXERR)
+	    break;
+	if (tokstr && *tokstr) {
+	    untokenize((p = dupstring(tokstr)));
+	    addlinknode(list, p);
+	    num++;
+	}
+	if (!got && !zleparse) {
+	    got = 1;
+	    cur = num - 1;
+	}
+    } while (tok != ENDINPUT && tok != LEXERR);
+    if (cur < 0 && num)
+	cur = num - 1;
+    noaliases = 0;
+    strinend();
+    inpop();
+    errflag = zleparse = 0;
+    noerrs = ne;
+    lexrestore();
+    cs = ocs;
+
+    if (index)
+	*index = cur;
+
+    return list;
+}

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2000-04-11 15:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-04-04  9:19 Bug report interface comments Sven Wischnowsky
2000-04-04  9:29 ` copy-prev-word question " Andrej Borsenkow
2000-04-06  8:24 Sven Wischnowsky
2000-04-10  7:58 Sven Wischnowsky
2000-04-11  2:52 ` Bart Schaefer
2000-04-11  6:11   ` Andrej Borsenkow
2000-04-11  9:20   ` Oliver Kiddle
2000-04-11  9:48     ` Sven Wischnowsky
2000-04-11 15:25       ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).