zsh-users
 help / color / mirror / code / Atom feed
* how to get zsh to work with a screen reader
@ 2015-07-21 18:37 covici
  2015-07-21 22:56 ` Bart Schaefer
  0 siblings, 1 reply; 14+ messages in thread
From: covici @ 2015-07-21 18:37 UTC (permalink / raw)
  To: zsh-users

Hi.  Well, this is going to be a peculiar question, but I hope someone
on here can give me a hint.  I use speakup which is in the staging area
of the kernel as a screen reader because I am "visually impaired".  Now
when I use zsh, I hear the entire line repeated when I do a completion,
or after I type a carriage return, I hear the line I just typed, even
though there is not an extra copy on the screen.  So what I was
wondering, is if zsh is writing the whole line out under many conditions
-- whereas bash is not doing that.  I am willing to change the code if
necessary, because I want to keep using zsh, but this problem is very
annoying.  When the lines are  repeated, it repeats the prompt and the
whole command line, so if I am doing a completion and its a long file
name, you can see where this could get old very fast.  So, any
suggestions as to how to fix this?

Thanks in advance for any suggestions.

-- 
Your life is like a penny.  You're going to lose it.  The question is:
How do
you spend it?

         John Covici
         covici@ccs.covici.com


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

* Re: how to get zsh to work with a screen reader
  2015-07-21 18:37 how to get zsh to work with a screen reader covici
@ 2015-07-21 22:56 ` Bart Schaefer
  2015-07-21 23:02   ` covici
  0 siblings, 1 reply; 14+ messages in thread
From: Bart Schaefer @ 2015-07-21 22:56 UTC (permalink / raw)
  To: covici, zsh-users

On Jul 21,  2:37pm, covici@ccs.covici.com wrote:
} Subject: how to get zsh to work with a screen reader
}
} when I use zsh, I hear the entire line repeated when I do a completion,
} or after I type a carriage return, I hear the line I just typed, even
} though there is not an extra copy on the screen.  So what I was
} wondering, is if zsh is writing the whole line out under many conditions

The ZLE editor does not use the curses package for screen optimization,
so among other things if the cursor is at column X and needs to move
across some existing text to column X+10, ZLE may reprint the characters
rather than emit a cursor movement command.

It will also prefer to overstrike a region with the text that is meant
to appear there, rather than to assume the text is already visible and
simply move past it, because it does not attempt to maintain an internal
data structure that reflects the contents of the screen -- it only keeps
a data structure for the text of the prompt and the contents of the edit
buffer.  So any time it wants the screen and the buffer to match, the
only way it can be certain that is true is to reprint everything.

The assumption is that the terminal emulator will either optimize out
unnecessary redrawing, or be fast enough that it doesn't matter.  That's
obviously not the case for a text-to-speech translator that interposes
between the shell output and the terminal.

Sadly, there's no practical approach I can think of to rectify this.


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

* Re: how to get zsh to work with a screen reader
  2015-07-21 22:56 ` Bart Schaefer
@ 2015-07-21 23:02   ` covici
  2015-07-22  0:53     ` Bart Schaefer
  2015-07-22 10:34     ` Christoph (Stucki) von Stuckrad
  0 siblings, 2 replies; 14+ messages in thread
From: covici @ 2015-07-21 23:02 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-users

OK, thanks.  So what does bash do differently?  It does not give me the problem,
I wonder if it tries to do cursor movement instead of reprinting?

Thanks again for your response.

Bart Schaefer <schaefer@brasslantern.com> wrote:

> On Jul 21,  2:37pm, covici@ccs.covici.com wrote:
> } Subject: how to get zsh to work with a screen reader
> }
> } when I use zsh, I hear the entire line repeated when I do a completion,
> } or after I type a carriage return, I hear the line I just typed, even
> } though there is not an extra copy on the screen.  So what I was
> } wondering, is if zsh is writing the whole line out under many conditions
> 
> The ZLE editor does not use the curses package for screen optimization,
> so among other things if the cursor is at column X and needs to move
> across some existing text to column X+10, ZLE may reprint the characters
> rather than emit a cursor movement command.
> 
> It will also prefer to overstrike a region with the text that is meant
> to appear there, rather than to assume the text is already visible and
> simply move past it, because it does not attempt to maintain an internal
> data structure that reflects the contents of the screen -- it only keeps
> a data structure for the text of the prompt and the contents of the edit
> buffer.  So any time it wants the screen and the buffer to match, the
> only way it can be certain that is true is to reprint everything.
> 
> The assumption is that the terminal emulator will either optimize out
> unnecessary redrawing, or be fast enough that it doesn't matter.  That's
> obviously not the case for a text-to-speech translator that interposes
> between the shell output and the terminal.
> 
> Sadly, there's no practical approach I can think of to rectify this.

-- 
Your life is like a penny.  You're going to lose it.  The question is:
How do
you spend it?

         John Covici
         covici@ccs.covici.com


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

* Re: how to get zsh to work with a screen reader
  2015-07-21 23:02   ` covici
@ 2015-07-22  0:53     ` Bart Schaefer
  2015-07-22 10:34     ` Christoph (Stucki) von Stuckrad
  1 sibling, 0 replies; 14+ messages in thread
From: Bart Schaefer @ 2015-07-22  0:53 UTC (permalink / raw)
  To: zsh-users, covici

On Jul 21,  7:02pm, covici@ccs.covici.com wrote:
} Subject: Re: how to get zsh to work with a screen reader
}
} OK, thanks.  So what does bash do differently?

Pretty much everything.  It uses the GNU "readline" library.


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

* Re: how to get zsh to work with a screen reader
  2015-07-21 23:02   ` covici
  2015-07-22  0:53     ` Bart Schaefer
@ 2015-07-22 10:34     ` Christoph (Stucki) von Stuckrad
  2015-07-22 10:43       ` Peter Stephenson
  2015-07-22 15:22       ` covici
  1 sibling, 2 replies; 14+ messages in thread
From: Christoph (Stucki) von Stuckrad @ 2015-07-22 10:34 UTC (permalink / raw)
  To: covici; +Cc: Bart Schaefer, zsh-users

On Tue, 21 Jul 2015, covici@ccs.covici.com wrote:

> > The ZLE editor does not use the curses package for screen optimization,

It might be a strange idea, but what happenes in different
terminal-emulators? They might optimize output differently,
so you could try zsh 'behind unusual terminals' like:
- tmux
- screen
- puttyterm
- (( there also is a terminal-*test* in the 'mosh' project.
  I seem to remember a testing-scenario within it, but
  do not have the time just now to find out/remenber.
  It uses mosh's optimisations without remote connection))

Stucki

-- 
Christoph von Stuckrad      * * |nickname |Mail <stucki@mi.fu-berlin.de> \
Freie Universitaet Berlin   |/_*|'stucki' |Tel(Mo.,Mi.):+49 30 838-75 459|
Mathematik & Informatik EDV |\ *|if online|  (Di,Do,Fr):+49 30 77 39 6600|
Takustr. 9 / 14195 Berlin   * * |on IRCnet|Fax(home):   +49 30 77 39 6601/


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

* Re: how to get zsh to work with a screen reader
  2015-07-22 10:34     ` Christoph (Stucki) von Stuckrad
@ 2015-07-22 10:43       ` Peter Stephenson
  2015-07-22 16:08         ` covici
  2015-07-22 16:15         ` Bart Schaefer
  2015-07-22 15:22       ` covici
  1 sibling, 2 replies; 14+ messages in thread
From: Peter Stephenson @ 2015-07-22 10:43 UTC (permalink / raw)
  To: zsh-users

On Wed, 22 Jul 2015 12:34:49 +0200
"Christoph (Stucki) von Stuckrad" <stucki@mi.fu-berlin.de> wrote:
> On Tue, 21 Jul 2015, covici@ccs.covici.com wrote:
> 
> > > The ZLE editor does not use the curses package for screen optimization,
> 
> It might be a strange idea, but what happenes in different
> terminal-emulators?

Something else that might just be worth a look at is the shell parameter
BAUD, which indicates the terminal speed.  It's not much used these
days, and isn't set by default, but you can set it to an estimate of the
terminal speed in bits per second.  This changes the way the shell
decides to redisplay things.   In particular, if it's small but
non-zero, the shell knows updates to the output take a long time ---
which is exactly your case, in effect.  The code for this is still
there, though I don't think it's had much attention for some time.

pws


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

* Re: how to get zsh to work with a screen reader
  2015-07-22 10:34     ` Christoph (Stucki) von Stuckrad
  2015-07-22 10:43       ` Peter Stephenson
@ 2015-07-22 15:22       ` covici
  1 sibling, 0 replies; 14+ messages in thread
From: covici @ 2015-07-22 15:22 UTC (permalink / raw)
  To: Bart Schaefer, zsh-users

hmmm, interesting, because if I use orca and gnome-terminal, I do not
get the repeats, but I need to use it in a regular virtual console, so I
will check the mosh project and see, but I wanted to know if I could do
the optimizations right in zsh itself, maybe have an ifdef for speakup
or something.

Christoph (Stucki) von Stuckrad <stucki@mi.fu-berlin.de> wrote:

> On Tue, 21 Jul 2015, covici@ccs.covici.com wrote:
> 
> > > The ZLE editor does not use the curses package for screen optimization,
> 
> It might be a strange idea, but what happenes in different
> terminal-emulators? They might optimize output differently,
> so you could try zsh 'behind unusual terminals' like:
> - tmux
> - screen
> - puttyterm
> - (( there also is a terminal-*test* in the 'mosh' project.
>   I seem to remember a testing-scenario within it, but
>   do not have the time just now to find out/remenber.
>   It uses mosh's optimisations without remote connection))
> 
> Stucki
> 
> -- 
> Christoph von Stuckrad      * * |nickname |Mail <stucki@mi.fu-berlin.de> \
> Freie Universitaet Berlin   |/_*|'stucki' |Tel(Mo.,Mi.):+49 30 838-75 459|
> Mathematik & Informatik EDV |\ *|if online|  (Di,Do,Fr):+49 30 77 39 6600|
> Takustr. 9 / 14195 Berlin   * * |on IRCnet|Fax(home):   +49 30 77 39 6601/

-- 
Your life is like a penny.  You're going to lose it.  The question is:
How do
you spend it?

         John Covici
         covici@ccs.covici.com


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

* Re: how to get zsh to work with a screen reader
  2015-07-22 10:43       ` Peter Stephenson
@ 2015-07-22 16:08         ` covici
  2015-07-22 16:15         ` Bart Schaefer
  1 sibling, 0 replies; 14+ messages in thread
From: covici @ 2015-07-22 16:08 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: zsh-users

Peter Stephenson <p.stephenson@samsung.com> wrote:

> On Wed, 22 Jul 2015 12:34:49 +0200
> "Christoph (Stucki) von Stuckrad" <stucki@mi.fu-berlin.de> wrote:
> > On Tue, 21 Jul 2015, covici@ccs.covici.com wrote:
> > 
> > > > The ZLE editor does not use the curses package for screen optimization,
> > 
> > It might be a strange idea, but what happenes in different
> > terminal-emulators?
> 
> Something else that might just be worth a look at is the shell parameter
> BAUD, which indicates the terminal speed.  It's not much used these
> days, and isn't set by default, but you can set it to an estimate of the
> terminal speed in bits per second.  This changes the way the shell
> decides to redisplay things.   In particular, if it's small but
> non-zero, the shell knows updates to the output take a long time ---
> which is exactly your case, in effect.  The code for this is still
> there, though I don't think it's had much attention for some time.

Thanks much for your response.
I tried BAUD=110 and it slowed down the display of each character, but I
still got the repeats, but maybe I can find something in the code around
there to dink with -- thanks a lot.  I also tried 300 and 1200, but I
didn't notice any change.


-- 
Your life is like a penny.  You're going to lose it.  The question is:
How do
you spend it?

         John Covici
         covici@ccs.covici.com


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

* Re: how to get zsh to work with a screen reader
  2015-07-22 10:43       ` Peter Stephenson
  2015-07-22 16:08         ` covici
@ 2015-07-22 16:15         ` Bart Schaefer
  2015-07-22 23:47           ` covici
  1 sibling, 1 reply; 14+ messages in thread
From: Bart Schaefer @ 2015-07-22 16:15 UTC (permalink / raw)
  To: zsh-users

On Jul 22, 11:43am, Peter Stephenson wrote:
}
} Something else that might just be worth a look at is the shell parameter
} BAUD, which indicates the terminal speed.

I tried this.  I captured the output with "script" and examined what was
written both before and after assigning BAUD=1 .

As an aside, the main effect of BAUD seems to be that ZLE waits a really
long time after executing a command and before printing the next prompt.
I connected with strace and found it sitting here:

select(0, NULL, NULL, NULL, {112, 800000}) = 0 (Timeout)

That is, the prompt wasn't printed until the timeout occurred.  I suspect
that it's checking for type-ahead.

Anyway, except for my backspacing over a couple of typos, the typescript
was identical in both cases.  Based on covici's follow-up, the terminfo
definition seems to make the only discernable difference.


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

* Re: how to get zsh to work with a screen reader
  2015-07-22 16:15         ` Bart Schaefer
@ 2015-07-22 23:47           ` covici
  2015-07-23  1:16             ` Bart Schaefer
  0 siblings, 1 reply; 14+ messages in thread
From: covici @ 2015-07-22 23:47 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-users

Bart Schaefer <schaefer@brasslantern.com> wrote:

> On Jul 22, 11:43am, Peter Stephenson wrote:
> }
> } Something else that might just be worth a look at is the shell parameter
> } BAUD, which indicates the terminal speed.
> 
> I tried this.  I captured the output with "script" and examined what was
> written both before and after assigning BAUD=1 .
> 
> As an aside, the main effect of BAUD seems to be that ZLE waits a really
> long time after executing a command and before printing the next prompt.
> I connected with strace and found it sitting here:
> 
> select(0, NULL, NULL, NULL, {112, 800000}) = 0 (Timeout)
> 
> That is, the prompt wasn't printed until the timeout occurred.  I suspect
> that it's checking for type-ahead.
> 
> Anyway, except for my backspacing over a couple of typos, the typescript
> was identical in both cases.  Based on covici's follow-up, the terminfo
> definition seems to make the only discernable difference.

Which terminfo definition did you try and did it make any difference?

-- 
Your life is like a penny.  You're going to lose it.  The question is:
How do
you spend it?

         John Covici
         covici@ccs.covici.com


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

* Re: how to get zsh to work with a screen reader
  2015-07-22 23:47           ` covici
@ 2015-07-23  1:16             ` Bart Schaefer
  2015-07-23 14:22               ` covici
  0 siblings, 1 reply; 14+ messages in thread
From: Bart Schaefer @ 2015-07-23  1:16 UTC (permalink / raw)
  To: zsh-users, covici

On Jul 22,  7:47pm, covici@ccs.covici.com wrote:
} Subject: Re: how to get zsh to work with a screen reader
}
} Bart Schaefer <schaefer@brasslantern.com> wrote:
} 
} > Based on covici's follow-up, the terminfo
} > definition seems to make the only discernable difference.
} 
} Which terminfo definition did you try and did it make any difference?

I tried only xterm -- I was referring to your message in which you said
that orca and gnome-terminal produced different results.  Zsh doesn't
care what the terminal emulator is except in so far as it selects the
terminfo definition, so that must be why gnome-terminal is different.


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

* Re: how to get zsh to work with a screen reader
  2015-07-23  1:16             ` Bart Schaefer
@ 2015-07-23 14:22               ` covici
  2015-07-23 17:48                 ` Bart Schaefer
  0 siblings, 1 reply; 14+ messages in thread
From: covici @ 2015-07-23 14:22 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-users

Bart Schaefer <schaefer@brasslantern.com> wrote:

> On Jul 22,  7:47pm, covici@ccs.covici.com wrote:
> } Subject: Re: how to get zsh to work with a screen reader
> }
> } Bart Schaefer <schaefer@brasslantern.com> wrote:
> } 
> } > Based on covici's follow-up, the terminfo
> } > definition seems to make the only discernable difference.
> } 
> } Which terminfo definition did you try and did it make any difference?
> 
> I tried only xterm -- I was referring to your message in which you said
> that orca and gnome-terminal produced different results.  Zsh doesn't
> care what the terminal emulator is except in so far as it selects the
> terminfo definition, so that must be why gnome-terminal is different.
Well, I tried something weird, I got mosh and connected to
myid@localhost and it worked!  It set TERM to xterm, but when I did this
manually, it did not work, very strange, but this is a good temporary
solution.

Thanks for all your help, I think someone on here mentioned most, so I
tried it.



-- 
Your life is like a penny.  You're going to lose it.  The question is:
How do
you spend it?

         John Covici
         covici@ccs.covici.com


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

* Re: how to get zsh to work with a screen reader
  2015-07-23 14:22               ` covici
@ 2015-07-23 17:48                 ` Bart Schaefer
  2015-07-24 22:35                   ` Vincent Lefevre
  0 siblings, 1 reply; 14+ messages in thread
From: Bart Schaefer @ 2015-07-23 17:48 UTC (permalink / raw)
  To: Zsh Users

On Thu, Jul 23, 2015 at 7:22 AM,  <covici@ccs.covici.com> wrote:
> Well, I tried something weird, I got mosh and connected to
> myid@localhost and it worked!  It set TERM to xterm, but when I did this
> manually, it did not work, very strange, but this is a good temporary
> solution.

It's possible that mosh is optimizing out the redundant screen updates
before the output reaches speakup.


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

* Re: how to get zsh to work with a screen reader
  2015-07-23 17:48                 ` Bart Schaefer
@ 2015-07-24 22:35                   ` Vincent Lefevre
  0 siblings, 0 replies; 14+ messages in thread
From: Vincent Lefevre @ 2015-07-24 22:35 UTC (permalink / raw)
  To: zsh-users

On 2015-07-23 10:48:14 -0700, Bart Schaefer wrote:
> It's possible that mosh is optimizing out the redundant screen updates
> before the output reaches speakup.

The optimizations done by mosh are based on traces provided by some
users, including one or several zsh users:

  https://mosh.mit.edu/#techinfo

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


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

end of thread, other threads:[~2015-07-24 22:35 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-21 18:37 how to get zsh to work with a screen reader covici
2015-07-21 22:56 ` Bart Schaefer
2015-07-21 23:02   ` covici
2015-07-22  0:53     ` Bart Schaefer
2015-07-22 10:34     ` Christoph (Stucki) von Stuckrad
2015-07-22 10:43       ` Peter Stephenson
2015-07-22 16:08         ` covici
2015-07-22 16:15         ` Bart Schaefer
2015-07-22 23:47           ` covici
2015-07-23  1:16             ` Bart Schaefer
2015-07-23 14:22               ` covici
2015-07-23 17:48                 ` Bart Schaefer
2015-07-24 22:35                   ` Vincent Lefevre
2015-07-22 15:22       ` covici

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