* Re: PATCH: Re: Question
@ 2000-04-13 7:59 Sven Wischnowsky
0 siblings, 0 replies; 4+ messages in thread
From: Sven Wischnowsky @ 2000-04-13 7:59 UTC (permalink / raw)
To: zsh-workers
Bart Schaefer wrote:
> On Apr 12, 10:30am, Sven Wischnowsky wrote:
> } Subject: PATCH: Re: Question
> }
> } Peter Stephenson wrote:
> }
> } > Sven Wischnowsky wrote:
> } > > Currently, if a completion list is too long, the completion system
> } > > asks if onw wants to see all <n> matches.
> } > >
> } > > Should we change it to mention the number of lines needed?
> }
> } - qup = printfmt("zsh: do you wish to see all %n possibilities? ",
> } - listdat.nlist, 1, 1);
> } + qup = printfmt("zsh: do you wish to see all %n lines? ",
> } + listdat.nlines, 1, 1);
>
> Oh, I thought you were going to ADD the information about the number of
> lines needed, not replace the number of matches with it. I want to see
> the number of matches in there, at least when it's greater than zero.
No problem.
Bye
Sven
Index: Src/Zle/compresult.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/compresult.c,v
retrieving revision 1.5
diff -u -r1.5 compresult.c
--- Src/Zle/compresult.c 2000/04/12 09:12:16 1.5
+++ Src/Zle/compresult.c 2000/04/13 07:59:09
@@ -1587,10 +1587,15 @@
((complistmax > 0 && listdat.nlist >= complistmax) ||
(complistmax < 0 && listdat.nlines <= -complistmax) ||
(!complistmax && listdat.nlines >= lines))) {
- int qup;
+ int qup, l;
+
zsetterm();
- qup = printfmt("zsh: do you wish to see all %n lines? ",
- listdat.nlines, 1, 1);
+ l = (listdat.nlist > 0 ?
+ fprintf(shout, "zsh: do you wish to see all %d possibilities (%d lines)? ",
+ listdat.nlist, listdat.nlines) :
+ fprintf(shout, "zsh: do you wish to see all %d lines? ",
+ listdat.nlines));
+ qup = ((l + columns - 1) / columns) - 1;
fflush(shout);
if (getzlequery() != 'y') {
if (clearflag) {
Index: Src/Zle/zle_tricky.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_tricky.c,v
retrieving revision 1.4
diff -u -r1.4 zle_tricky.c
--- Src/Zle/zle_tricky.c 2000/04/12 08:31:55 1.4
+++ Src/Zle/zle_tricky.c 2000/04/13 07:59:09
@@ -1988,11 +1988,14 @@
max = getiparam("LISTMAX");
if ((max && num > max) || (!max && nlines > lines)) {
- int qup;
+ int qup, l;
zsetterm();
- qup = printfmt("zsh: do you wish to see all %n lines? ",
- nlines, 1, 1);
+ l = (num > 0 ?
+ fprintf(shout, "zsh: do you wish to see all %d possibilities (%d lines)? ",
+ num, nlines) :
+ fprintf(shout, "zsh: do you wish to see all %d lines? ", nlines));
+ qup = ((l + columns - 1) / columns) - 1;
fflush(shout);
if (getzlequery() != 'y') {
if (clearflag) {
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 4+ messages in thread
* PATCH: Re: Question
@ 2000-04-13 8:40 Sven Wischnowsky
0 siblings, 0 replies; 4+ messages in thread
From: Sven Wischnowsky @ 2000-04-13 8:40 UTC (permalink / raw)
To: zsh-workers
Bart Schaefer wrote:
> ...
>
> integer i=0
> while read -E
> do
> (( ++i == LINES-2 )) &&
> { i=0; read -q '?Continue? [no] ' </dev/tty || break }
> done
>
> (The above reveals a possible bug: "read -q" prints a prompt only if
> standard input is a TTY, but it always reads from the TTY if there is
> one. So I had to throw in that redirection.)
Hm. This should fix it. It also copies the code to set up shout when
a new SHTTY was opened from bin_vared().
Bye
Sven
Index: Src/builtin.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/builtin.c,v
retrieving revision 1.5
diff -u -r1.5 builtin.c
--- Src/builtin.c 2000/04/12 11:10:52 1.5
+++ Src/builtin.c 2000/04/13 08:40:08
@@ -3356,11 +3356,12 @@
bin_read(char *name, char **args, char *ops, int func)
{
char *reply, *readpmpt;
- int bsiz, c = 0, gotnl = 0, al = 0, first, nchars = 1, bslash;
+ int bsiz, c = 0, gotnl = 0, al = 0, first, nchars = 1, bslash, keys = 0;
int haso = 0; /* true if /dev/tty has been opened specially */
int isem = !strcmp(term, "emacs"), izle = zleactive && getkeyptr;
char *buf, *bptr, *firstarg, *zbuforig;
LinkList readll = newlinklist();
+ FILE *oshout = NULL;
if ((ops['k'] || ops['b']) && *args && idigit(**args)) {
if (!(nchars = atoi(*args)))
@@ -3385,8 +3386,11 @@
if (!zleactive) {
if (SHTTY == -1) {
/* need to open /dev/tty specially */
- SHTTY = open("/dev/tty", O_RDWR|O_NOCTTY);
- haso = 1;
+ if ((SHTTY = open("/dev/tty", O_RDWR|O_NOCTTY)) != -1) {
+ haso = 1;
+ oshout = shout;
+ init_shout();
+ }
}
/* We should have a SHTTY opened by now. */
if (SHTTY == -1) {
@@ -3403,6 +3407,7 @@
setcbreak();
readfd = SHTTY;
}
+ keys = 1;
} else if (ops['u'] && !ops['p']) {
/* -u means take input from the specified file descriptor. *
* -up means take input from the coprocess. */
@@ -3419,9 +3424,9 @@
for (readpmpt = firstarg;
*readpmpt && *readpmpt != '?'; readpmpt++);
if (*readpmpt++) {
- if (isatty(0)) {
- zputs(readpmpt, stderr);
- fflush(stderr);
+ if (keys || isatty(0)) {
+ zputs(readpmpt, (haso ? shout : stderr));
+ fflush(haso ? shout : stderr);
}
readpmpt[-1] = '\0';
}
@@ -3462,6 +3467,8 @@
settyinfo(&shttyinfo);
if (haso) {
close(SHTTY);
+ fclose(shout);
+ shout = oshout;
SHTTY = -1;
}
}
@@ -3493,6 +3500,8 @@
/* dispose of result appropriately, etc. */
if (haso) {
close(SHTTY);
+ fclose(shout);
+ shout = oshout;
SHTTY = -1;
}
}
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: PATCH: Re: Question
2000-04-12 8:30 Sven Wischnowsky
@ 2000-04-12 16:10 ` Bart Schaefer
0 siblings, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 2000-04-12 16:10 UTC (permalink / raw)
To: zsh-workers
On Apr 12, 10:30am, Sven Wischnowsky wrote:
} Subject: PATCH: Re: Question
}
} Peter Stephenson wrote:
}
} > Sven Wischnowsky wrote:
} > > Currently, if a completion list is too long, the completion system
} > > asks if onw wants to see all <n> matches.
} > >
} > > Should we change it to mention the number of lines needed?
}
} - qup = printfmt("zsh: do you wish to see all %n possibilities? ",
} - listdat.nlist, 1, 1);
} + qup = printfmt("zsh: do you wish to see all %n lines? ",
} + listdat.nlines, 1, 1);
Oh, I thought you were going to ADD the information about the number of
lines needed, not replace the number of matches with it. I want to see
the number of matches in there, at least when it's greater than zero.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* PATCH: Re: Question
@ 2000-04-12 8:30 Sven Wischnowsky
2000-04-12 16:10 ` Bart Schaefer
0 siblings, 1 reply; 4+ messages in thread
From: Sven Wischnowsky @ 2000-04-12 8:30 UTC (permalink / raw)
To: zsh-workers
Peter Stephenson wrote:
> Sven Wischnowsky wrote:
> > Currently, if a completion list is too long, the completion system
> > asks if onw wants to see all <n> matches. This is not only ugly in
> > cases like _complete_help with styles-output -- it askes if one wants
> > to see all `0' matches.
> >
> > Should we change it to mention the number of lines needed? I think it
> > would always be more interesting.
>
> Yes, it would. I suppose this is too deep to be able to use a style.
Yes, it is. In fact everything about this was always hard-coded,
including the prompt itself. Changing that would be easy, but is it
worth it?
Bye
Sven
Index: Src/Zle/compresult.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/compresult.c,v
retrieving revision 1.3
diff -u -r1.3 compresult.c
--- Src/Zle/compresult.c 2000/04/10 08:06:39 1.3
+++ Src/Zle/compresult.c 2000/04/12 08:27:38
@@ -1585,8 +1585,8 @@
(!complistmax && listdat.nlines >= lines))) {
int qup;
zsetterm();
- qup = printfmt("zsh: do you wish to see all %n possibilities? ",
- listdat.nlist, 1, 1);
+ qup = printfmt("zsh: do you wish to see all %n lines? ",
+ listdat.nlines, 1, 1);
fflush(shout);
if (getzlequery() != 'y') {
if (clearflag) {
Index: Src/Zle/zle_tricky.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_tricky.c,v
retrieving revision 1.3
diff -u -r1.3 zle_tricky.c
--- Src/Zle/zle_tricky.c 2000/04/10 09:29:09 1.3
+++ Src/Zle/zle_tricky.c 2000/04/12 08:27:38
@@ -1991,8 +1991,8 @@
int qup;
zsetterm();
- qup = printfmt("zsh: do you wish to see all %n possibilities? ",
- num, 1, 1);
+ qup = printfmt("zsh: do you wish to see all %n lines? ",
+ nlines, 1, 1);
fflush(shout);
if (getzlequery() != 'y') {
if (clearflag) {
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2000-04-13 8:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-04-13 7:59 PATCH: Re: Question Sven Wischnowsky
-- strict thread matches above, loose matches on Subject: below --
2000-04-13 8:40 Sven Wischnowsky
2000-04-12 8:30 Sven Wischnowsky
2000-04-12 16:10 ` 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).