9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] file name completion
@ 2003-12-22  6:19 Rob 'Commander' Pike
  2003-12-22  5:48 ` mirtchov
  2003-12-22 16:12 ` [9fans] file name completion Sape Mullender
  0 siblings, 2 replies; 21+ messages in thread
From: Rob 'Commander' Pike @ 2003-12-22  6:19 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 3023 bytes --]

living with a foot in two worlds, i finally broke down and implemented
file name completion for rio and acme.  the sources are attached as a
gzipped bundle.  acme/look.c is just a bug fix that's already on sources.
i started on doing sam too and i mean to finish it but it will take a while
and may involve bumping the protocol version number, which is annoying.

i've been using it for about a week and am starting to like it, but i'm far
from convinced my solutions are the right ones, especially with regard to
user interface.  also, i think the rules about how to complete should be
decided by the plumber, but i don't have that figured out, either. since it's
done in a library, however, if i do figure it out it will be very easy to
slide in: just update the library.

it's done in the window system, which makes for some nice properties
such as uniformity and some less nice ones such as failure when the
namespaces differ.  but plumbing and other things break down in that
case, anyway, and if file name completion doesn't work you can always
just type the file name, so this doesn't bother me much. yet.

here's how it works: type control-F or the Insert key (Ins on some keyboards)
and the window manager will push the file name you're typing as far as
it unambiguously can.  if it can't do anything unambiguously, it will
present a list of options, either just before the host point (in rio) or in the
default Errors window (in acme).  keep that acme window up so it doesn't
pop up and steal the mouse; if you're like me, you'll get use to this fast.
but maybe there's a better way.  (the rio trick doesn't work because there's
no host point in acme.)

in the bundle i've included updated and new man pages, a new library
(libcomplete) and header file (complete.h) and small updates to acme and
rio.  if you're up to date with respect to sources, they should plug in and
compile.

i'm not sure this is worthwhile for plan 9 alone, but boy does it make life
easier across that 9fs boundary.

one known issue is that nothing is done for blanks in file names.  when
i see one i care about, i'll address the issue.  it's trivial - just quote the
blank in libcomplete.

one more thing, only partially related: this package also makes left and
right arrow keys move the selection left and right, makes Page Up and
Page Down keys work like up and down arrow, and Home and End keys
move to the beginning or end of the window, without changing the
selection.   End won't work for you because you'll need a fix to the
keyboard driver to map that key to the value in the current keyboard.h
rather than to carriage return.  i debated changing up and down arrows
to move the selection up or down a line, but as they are they behave
somewhat like most web browsers and many other applications, so i
left them as is. i'm debating making them scroll less and making Page
Up and Page Down scroll more, but not in this bundle.

enjoy if you want, ignore if you prefer.

-rob

[-- Attachment #2: complete.bun.gz --]
[-- Type: application/octet-stream, Size: 28753 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread
* RE: [9fans] file name completion
@ 2003-12-22  8:20 cej
  2003-12-22 11:38 ` Charles Forsyth
  0 siblings, 1 reply; 21+ messages in thread
From: cej @ 2003-12-22  8:20 UTC (permalink / raw)
  To: 9fans



>  A nice exercise in its usefulness is the breaking down of a huge, monolithic program such
>  as Links into smaller parts tied together by plumbing -- from an all-encompassing piece of
>  code that knows how to handle everything from rendering html tables to handling ftp and
>  samba protocols, into a simple html renderer that works with the plumber to give out work
>  to whichever external program is best suited for the job (and not having to know anything
>  about them)...

>  I have found that for day-to-day stuff, the plumber is one of the most-often used Plan 9
>   "features" that do not exist anywhere else, save Inferno.  Second only to private namespaces.

That's it!
++pac.


^ permalink raw reply	[flat|nested] 21+ messages in thread
* Re: [9fans] file name completion
@ 2003-12-23  0:32 Rob 'Commander' Pike
  0 siblings, 0 replies; 21+ messages in thread
From: Rob 'Commander' Pike @ 2003-12-23  0:32 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 826 bytes --]

evidence is that this didn't get out before, so here it is again.
there's a stupid mistake in the implementation of left and right
arrows.  the other change here is that i tweaked the parameters
so the up and down arrows go 1/3 page and page up and page
down arrows go 2/3 page.

i hope this is it for a while.

-rob

643c643,644
< 		if(t->q0 > 0)
---
> 		if(t->q0 > 0){
> 			textcommit(t, TRUE);
644a646
> 		}
647c649,650
< 		if(t->q1 < t->file->nc)
---
> 		if(t->q1 < t->file->nc){
> 			textcommit(t, TRUE);
648a652
> 		}
650a655,656
> 		n = t->maxlines/3;
> 		goto case_Down;
652c658,659
< 		n = t->maxlines/2;
---
> 		n = 2*t->maxlines/3;
> 	case_Down:
656a664,665
> 		n = t->maxlines/3;
> 		goto case_Up;
658c667,668
< 		n = t->maxlines/2;
---
> 		n = 2*t->maxlines/3;
> 	case_Up:

[-- Attachment #2: text.c.gz --]
[-- Type: application/octet-stream, Size: 8623 bytes --]

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

end of thread, other threads:[~2004-01-07 15:51 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-22  6:19 [9fans] file name completion Rob 'Commander' Pike
2003-12-22  5:48 ` mirtchov
2003-12-22 16:15   ` ron minnich
2003-12-23  1:17     ` boyd, rounin
2003-12-23  5:13       ` boyd, rounin
2003-12-24  3:32         ` okamoto
2003-12-23 23:54       ` Steve Kilbane
2003-12-27 17:56       ` Jack Johnson
2003-12-28 19:54         ` Scott Schwartz
2003-12-29  1:20           ` boyd, rounin
2003-12-22 23:02   ` rob pike, esq.
2004-01-06 14:35   ` rog
2004-01-06 15:01     ` rob pike, esq.
2004-01-07  0:16     ` Russ Cox
2004-01-07 12:47       ` [9fans] Newbie: rio help Chris Lamrock
2004-01-07 14:52         ` mirtchov
2004-01-07 15:51           ` Chris Lamrock
2003-12-22 16:12 ` [9fans] file name completion Sape Mullender
2003-12-22  8:20 cej
2003-12-22 11:38 ` Charles Forsyth
2003-12-23  0:32 Rob 'Commander' Pike

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).