Luc GMail | 3 Jul 2009 16:14
Picon

Emulate Ctrl-Delete in mksh

Hi. I really like most of the default key bindings in mksh. I don't
need to set them manually like in other ports of the Korn shell. Even
the Delete key works fine: it deletes one character to the right of
the insertion point. So does Ctrl-d.

The difference is that Ctrl-d will close the session (exit) if no
characters are left to be deleted. The Delete key won't do that. But I
like the Delete key, I think that Ctrl-d is annoying to type. Is there
any way I can add that Ctrl-d feature to the Ctrl-Delete key
combination? I can map Delete or Ctrl-letter, but I cannot map
Ctrl-Delete. I can't find the right string that says "Ctrl-Delete".
Everything I try makes mksh complain that the string "is too long".
Any ideas?

TIA

--

-- 
Luc

Thorsten Glaser | 3 Jul 2009 18:58
Picon
Gravatar

Re: Emulate Ctrl-Delete in mksh

Luc GMail dixit:

>I can't find the right string that says "Ctrl-Delete".

It's terminal dependent. A GNU screen inside wscons does, for example,
not differentiate between these two at all. I think Ctrl-X only exists
for ' <at> ' <= X <= '_' at all.

>Everything I try makes mksh complain that the string "is too long".

Your terminal may have one of the strings like ^[[1;2D or something.
These aren't supported.

>Any ideas?

$ bind '^X3~=eot-or-delete'

This maps the ^D function to the Del key.

HTH, HAND
//mirabilos
--

-- 
“It is inappropriate to require that a time represented as
 seconds since the Epoch precisely represent the number of
 seconds between the referenced time and the Epoch.”
	-- IEEE Std 1003.1b-1993 (POSIX) Section B.2.2.2

Luc GMail | 3 Jul 2009 19:44
Picon

Re: Emulate Ctrl-Delete in mksh

On 7/3/09, Thorsten Glaser wrote:

> Your terminal may have one of the strings like ^[[1;2D or something.
> These aren't supported.

Yes, Ctrl-v tells me that Delete equals '^[[3~' and Ctrl-Delete equals
'^[[3;5~'.
:-(

> $ bind '^X3~=eot-or-delete'
> This maps the ^D function to the Del key.

Yeah, I had the same result with bind -m '^[[3~'=^d. But that's not
what I wanted, I wanted Ctrl-Delete.  :-(

Well, thanks for your attention anyway.

Best regards,

--

-- 
Luc

Thorsten Glaser | 3 Jul 2009 20:01
Picon
Gravatar

Re: Emulate Ctrl-Delete in mksh

Luc GMail dixit:

>Yes, Ctrl-v tells me that Delete equals '^[[3~' and Ctrl-Delete equals
>'^[[3;5~'.

I use cat(1) for that... anyway, this is a long string. mksh currently
(it _is_ on the rewrite-in-the-future list, but don't hold your breath
for it) uses a simple table of prefix (^X ^[ and ^[[), character and a
tilde (optional).

>Yeah, I had the same result with bind -m '^[[3~'=^d. But that's not
>what I wanted, I wanted Ctrl-Delete.  :-(

There's an alternative, from a Launchpad bug about Ctrl-CurLeft and
Ctrl-CurRight not working: it was suggested to tell the *terminal
emulator* to map these keys to Esc+b or Esc+f, respectively. So if
you can change your terminal emulator (probably via xresources) to
send ^D for Ctrl-Delete, you're set.

bye,
//mirabilos
--

-- 
“It is inappropriate to require that a time represented as
 seconds since the Epoch precisely represent the number of
 seconds between the referenced time and the Epoch.”
	-- IEEE Std 1003.1b-1993 (POSIX) Section B.2.2.2

Thorsten Glaser | 4 Jul 2009 22:21
Picon
Gravatar

Re: CVS: herc.mirbsd.org: src

Dixi quod:

>Commit ID:	1004A4E4AD759B5482B

>For total 8-bit transparency, there MUST NOT be any multibyte sequence
>matching (in CESU-8 encoding) U+EF80..U+EFFF in the multibyte stream
>converted as if it were CESU-8. Instead, treat these sequences, ranging
>from EE.BE.80..BF to EE.BF.80..BF, as raw octets and convert them to 3
>(three) instead of 1 (one) wide character (OPTU-16). To make it simple,
>there is no Unicode/PUA character whose OPTU-8 encoding begins with EEh
>followed by BEh or BFh.

This is not needed for mksh, because mksh does not use OPTU-16 inter-
nally. It does support using the woctet notation, but only for single
character conversions in base-1 digits.

I'd kind of like to rewrite mksh to use OPTU-16 internally though, as
the "cheap shot at WTF-8" I took at first helps a lot, but only real-
ly in the short term. (And make the parser recursive while there. And
fix all bugs in the command line editing code. Hell yeah.)

//mirabilos
--

-- 
“mysql is about as much database as ms access” – “MSSQL at least descends
from a database” “it's a rebranded SyBase” “MySQL however was born from a
flatfile and went downhill from there” – “at least jetDB doesn’t claim to
be a database”	-- myself, Tonnerre and psychoschlumpf in #nosec

Thorsten Glaser | 6 Jul 2009 17:10
Picon
Gravatar

pdksh/mksh 'stop () {' handling (was Re: CVS: herc.mirbsd.org: src)

Dixi quod…

>Commit ID:	1004A5212AD490123A5

>be more robust against things like Debian #535970
>reverts and rewrites the code from cid 10047C1EBA57E4F4AF0
>
>XXX find out if this is done right

Hi Robert,

I originally used the last_terminal_was_bracket patch from you in
mksh as well, after having encountered Debian initscripts doing
│stop() {
but now there are some which do
│stop () {
so I tried a different approach. As the author of the original
pdksh Debian-specific patch, do you think this is safe?

Index: src/bin/mksh/lex.c
diff -up src/bin/mksh/lex.c:1.88 src/bin/mksh/lex.c:1.89
--- src/bin/mksh/lex.c:1.88	Thu Jun 11 12:42:19 2009
+++ src/bin/mksh/lex.c	Mon Jul  6 15:06:23 2009
 <at>  <at>  -159,7 +159,6  <at>  <at>  yylex(int cf)
 	char *wp;		/* output word pointer */
 	char *sp, *dp;
 	int c2;
-	bool last_terminal_was_bracket;

  Again:
(Continue reading)

Thorsten Glaser | 7 Jul 2009 21:09
Picon
Gravatar

Re: CVS: herc.mirbsd.org: www

Dixi quod...

>Commit ID:	1004A53955F75A543E8

forgot: agreed bsiegert <at> 

//mirabilos
--

-- 
“It is inappropriate to require that a time represented as
 seconds since the Epoch precisely represent the number of
 seconds between the referenced time and the Epoch.”
	-- IEEE Std 1003.1b-1993 (POSIX) Section B.2.2.2

Thorsten Glaser | 7 Jul 2009 21:19
Picon
Gravatar

Re: CVS: herc.mirbsd.org: X11

Dixi quod...

>Commit ID:	1004A4F3D3510A8D45A

>maybe this will fix the EeePC’s [...]

Still don't get any output on it with the i810 driver. I think
it's an EeePC 701 or something, the colleagues say one of the
first models.

//mirabilos
--

-- 
“It is inappropriate to require that a time represented as
 seconds since the Epoch precisely represent the number of
 seconds between the referenced time and the Epoch.”
	-- IEEE Std 1003.1b-1993 (POSIX) Section B.2.2.2

Thorsten Glaser | 7 Jul 2009 22:14
Picon
Gravatar

Re: "$ <at> " vs. nounset

Hi Chet,

I found this via a Debian bug; you wrote:
|The interpretation process went back and forth, and we finally decided
|that set -u will apply to references to every variable, parameter, and
|special parameter *except* $ <at>  and $*.  That's going to be in the next
|revision of the standard.

I would like to get a confirmation that the next POSIX shell standard
will mandate this, because I maintain http://mirbsd.de/mksh which aims
to be at least pretty POSIX compatible (while not losing Korn Shell hi-
story though).

Hi David,

what will AT&T ksh93 do in this regard? Follow POSIX?

Thanks in advance to both of you for an answer.

Sincerely,
//mirabilos
--

-- 
I believe no one can invent an algorithm. One just happens to hit upon it
when God enlightens him. Or only God invents algorithms, we merely copy them.
If you don't believe in God, just consider God as Nature if you won't deny
existence.		-- Coywolf Qi Hunt

Thorsten Glaser | 8 Jul 2009 19:35
Picon
Gravatar

Re: "$ <at> " vs. nounset

Chet Ramey dixit:

>This was the working group consensus.  It will take time to get into
>the official standard:

But it will eventually make it? Okay.

>"Actually, $? and $! are the only special parameters other than $*
>and $ <at>  that can be used when unset if -u is on

Ah. I wonder what all the other special parameters do:

* $0, $1..$9, ${10}... (probably not special)
vs.
* $# (probably always set => uncritial)
* $$ (same)
* $- (in ksh: set -<letter> current value, same I think)

The next major release of mksh will thusly change the behaviour to
match future POSIX, unless there are major concerns, for example from
the AT&T ksh side.

Maybe it would have been better to agree to disagree (i.e. make the
behaviour wrt. $* and $ <at>  vendor-defined)?

bye,
//mirabilos
--

-- 
Sometimes they [people] care too much: pretty printers [and syntax highligh-
ting, d.A.] mechanically produce pretty output that accentuates irrelevant
(Continue reading)


Gmane