Bug in kill-region? (not actually killing region)

2019-01-10 Thread John

Hello again!

It seems I might have come across an actual bug this time :-)

From the man page:

 kill-region: ^W
 Deletes the input between the cursor and the mark.

But for me, it doesn't do that.  For example, let | represent the cursor:


$ one |two three four   # set mark with ^[
$ one two three| four   # move forward
$ one two  four # invoke kill-region with ^W

As you can see, only "three" is killed, whereas it should have killed 
"two three" in its entirety.


Is this a bug?  Other commands, like evaluate-region, work fine.

Best regards,
John


Re: Bug in mksh when counting line length

2019-01-04 Thread John Ankarström

Hi Thorsten,


Hope this clears it up.

Massively.  Thank you!

Best regards,
John


Re: Bug in mksh when counting line length

2019-01-04 Thread John

Hi Thorsten, and thanks for your solution!


no, you’ve discovered you did not read the manpage ☺


I did read it, but I didn't understand it...!  Adding the \r and 
surrounding all escape sequences with \1 solves my problem, but I don't 
understand why (?).


Best regards,
John


Bug in mksh when counting line length

2019-01-04 Thread John

Hello,

I think I've discovered a bug in mksh.  According to the man page:

In these editing modes, if a line is longer than the
screen width (see the COLUMNS parameter), a ‘>’, ‘+’ or
‘<’ character is displayed in the last column indicating
that there are more characters after, before and after,
or before the current position, respectively.  The line
is scrolled horizontally as necessary.

Now, my prompt looks something like this:

PS1=$'\e[38;5;250m[$(echo $?)] \e[38;5;244m$(pwd)\e[0;0m $'

It turns out that the invisible ANSI escape sequences count towards the 
length of the line!  This means that mksh "breaks" the line much earlier 
than necessary, making it difficult to use colors in the prompt.


Is there any way to disable this behavior or to customize it?

Happy new year,
John


Re: 'rename' in mksh ?

2013-05-02 Thread John Chludzinski
 $(whence -p rename) .cpp .cc *.cpp

Works like a charm.  Thanks!

---John

On Wed, May 1, 2013 at 6:11 PM, Thorsten Glaser t...@mirbsd.de wrote:
 John Chludzinski dixit:

In Cygwin/bash 'rename' is available:

$ rename .cpp .cc *.cpp

 You probably installed some tool that runs as /usr/bin/rename[.exe]
 which is not normally shipped on Berkeley Unix systems.

Why was this necessary?

 The entire story involves an mv(1) dynamically linked against µClibc
 in a remote location on a production system and the attempt to upgrade
 µClibc with a UTF-8 capable (IIRC) version in situ.

 That very same day, mksh gained the following built-in command:
  rename [--] from to
 Renames the file from to to. Both must be complete pathnames and
 on the same device. This builtin is intended for emergency situa-
 tions where /bin/mv becomes unusable, and directly calls
 rename(2).

 The name was chosen as “rename” because it’s not exactly “mv”, nothing
 provided “rename” on MirBSD or FreeWRT (or other operating systems I’ve
 tried at that time), and it was deemed that others would not as easily
 conflict with this as with the shorter “ren”.

 I only became aware of the existence of a third-party tool called
 “rename” last year or so. But, SOL. mksh has had rename for ages
 (something like 2006).

 By the way, this would work:
 $(whence -p rename) .cpp .cc *.cpp

 Or probably:
 /usr/bin/rename .cpp .cc *.cpp

 You can even tabcomplete the latter.

 This is no different from other builtins, like true, false, [ and test,
 where the version the shell ships takes precedence over the version the
 OS ships (e.g. there’s a GNU false that takes --version and --help…).

 bye,
 //mirabilos
 --
 Sorry,  I’m annoyed today and you came by as an Arch user. These are the
 perfect victims for any crime against humanity, like  systemd,  feminism
 or social democracy.
 -- Christoph Lohmann on d...@suckless.org


MKSH on Apple's OS X?

2013-04-18 Thread John Chludzinski
Is MKSH easily available on Macs (a.k.a., OS X)?  I have some kids at
college (with MacBook Air) that are interested BUT the easier it is to
install the better.  They're not going to be interested in building it
from source + a cmake.

---John


Problem with print

2013-04-09 Thread John Chludzinski
I have a script with:

X=(1 2 3)
X+=(4 5 6)
print ${X[*]}

sh script.ksh results in: Unable to initialize device PRN.

What's the deal?

BTW, I'm using the latest Cygwin on Windows 7.

---John