zsh-users
 help / color / mirror / code / Atom feed
* visual line movement
@ 2018-07-27  7:10 ` Anthony Heading
  2018-07-27  8:30   ` Peter Stephenson
  2018-07-27  9:53   ` Mikael Magnusson
  0 siblings, 2 replies; 6+ messages in thread
From: Anthony Heading @ 2018-07-27  7:10 UTC (permalink / raw)
  To: zsh-users

Is there a good way to make zle up-/down-line etc operate visually, i.e. have the cursor position move across wrapped lines on the screen rather than considering only embedded '\n's in the buffer?   I'm guessing not, but would like to be sure.



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

* Re: visual line movement
  2018-07-27  7:10 ` visual line movement Anthony Heading
@ 2018-07-27  8:30   ` Peter Stephenson
  2018-07-27  9:13     ` Daniel Shahaf
  2018-07-27  9:53   ` Mikael Magnusson
  1 sibling, 1 reply; 6+ messages in thread
From: Peter Stephenson @ 2018-07-27  8:30 UTC (permalink / raw)
  To: zsh-users

On Fri, 27 Jul 2018 03:10:37 -0400
Anthony Heading <anthony@ajrh.net> wrote:
> Is there a good way to make zle up-/down-line etc operate visually,
> i.e. have the cursor position move across wrapped lines on the screen
> rather than considering only embedded '\n's in the buffer?   I'm
> guessing not, but would like to be sure.

Unless I'm missing something, it's not possible without adding a
separate calculation of where the lines on screen will go.  The
function that redraws the screen keeps its information separately from
the body of ZLE and, although it does remember what it's put where,
there's no mapping between the screen lines and the logical data to
refer to.

pws


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

* Re: visual line movement
  2018-07-27  8:30   ` Peter Stephenson
@ 2018-07-27  9:13     ` Daniel Shahaf
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Shahaf @ 2018-07-27  9:13 UTC (permalink / raw)
  To: zsh-users

Peter Stephenson wrote on Fri, 27 Jul 2018 09:30 +0100:
> On Fri, 27 Jul 2018 03:10:37 -0400
> Anthony Heading <anthony@ajrh.net> wrote:
> > Is there a good way to make zle up-/down-line etc operate visually,
> > i.e. have the cursor position move across wrapped lines on the screen
> > rather than considering only embedded '\n's in the buffer?   I'm
> > guessing not, but would like to be sure.
> 
> Unless I'm missing something, it's not possible without adding a
> separate calculation of where the lines on screen will go.  The
> function that redraws the screen keeps its information separately from
> the body of ZLE and, although it does remember what it's put where,
> there's no mapping between the screen lines and the logical data to
> refer to.

A workaround is to use edit-command-line:

http://zsh.sourceforge.net/FAQ/zshfaq03.html#l45


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

* Re: visual line movement
  2018-07-27  7:10 ` visual line movement Anthony Heading
  2018-07-27  8:30   ` Peter Stephenson
@ 2018-07-27  9:53   ` Mikael Magnusson
  2018-07-27 11:50     ` Anthony Heading
  1 sibling, 1 reply; 6+ messages in thread
From: Mikael Magnusson @ 2018-07-27  9:53 UTC (permalink / raw)
  To: Anthony Heading; +Cc: Zsh Users

On Fri, Jul 27, 2018 at 9:10 AM, Anthony Heading <anthony@ajrh.net> wrote:
> Is there a good way to make zle up-/down-line etc operate visually, i.e. have the cursor position move across wrapped lines on the screen rather than considering only embedded '\n's in the buffer?   I'm guessing not, but would like to be sure.

If you make a custom widget that moves $COLUMNS characters left/right,
the effect should be approximately the same.

-- 
Mikael Magnusson


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

* Re: visual line movement
  2018-07-27  9:53   ` Mikael Magnusson
@ 2018-07-27 11:50     ` Anthony Heading
  2018-07-27 12:48       ` Peter Stephenson
  0 siblings, 1 reply; 6+ messages in thread
From: Anthony Heading @ 2018-07-27 11:50 UTC (permalink / raw)
  To: Zsh Users

On Fri, Jul 27, 2018, at 5:53 AM, Mikael Magnusson wrote:
> If you make a custom widget that moves $COLUMNS characters left/right, the effect
> should be approximately the same.

Agreed, though that loses the '\n' handling that the base widget does perfectly, and
it would be nice to think about Unicode, and maybe there are additional sources of
infelicities too.

For my education, I'll try to find the drawing code that Peter mentions and see what
it aims to handle.  The COMBINING_CHARS option looks instructive.

It being 2018 and all, I wonder if reading the cursor position from the terminal
after each character is a workable option.






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

* Re: visual line movement
  2018-07-27 11:50     ` Anthony Heading
@ 2018-07-27 12:48       ` Peter Stephenson
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Stephenson @ 2018-07-27 12:48 UTC (permalink / raw)
  To: Zsh Users

On Fri, 27 Jul 2018 07:50:31 -0400
Anthony Heading <anthony@ajrh.net> wrote:
> It being 2018 and all, I wonder if reading the cursor position from
> the terminal after each character is a workable option.

Experience suggests terminals all have a wide array of different
limitations --- so I wouldn't be surprised if you can find one
terminal where this works.

pws


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

end of thread, other threads:[~2018-07-27 12:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20180727072228epcas5p35fc9a81df04715c148d0b7a9cf582efd@epcas5p3.samsung.com>
2018-07-27  7:10 ` visual line movement Anthony Heading
2018-07-27  8:30   ` Peter Stephenson
2018-07-27  9:13     ` Daniel Shahaf
2018-07-27  9:53   ` Mikael Magnusson
2018-07-27 11:50     ` Anthony Heading
2018-07-27 12:48       ` Peter Stephenson

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