On 2/13/14, 12:03 PM, Andreas Schwab wrote: > Chet Ramey <chet.ra...@case.edu> writes: > >> On 2/13/14 11:29 AM, Andreas Schwab wrote: >> >>> AIUI there is no readline command the moves >>> vertically within the commandline (in readline a line always includes >>> any embedded newlines). >> >> That's true. How should such a command work? Move point forward and >> backward by a multiple of the screenwidth? > > It should work like previous-line/next-line in Emacs: move over the > previous/next newline and then forward to the same column as before.
That's kind of a problem. The editing and display engines in readline are more or less separate, and that has consequences on implementation. The editing engine sees the world as a character array of potentially infinite length. Text adds and deletes, and moving the location of point, all happen within this buffer. There are very few cases where a line has embedded newlines, so your previous message about a command to move between lines with embedded newlines would be relatively easy to do but of limited usefulness. The display engine takes this array of characters and handles all aspects of screen presentation: displaying the prompt, handling invisible and multibyte characters, and wrapping the line according to the current screen dimensions. The reason I mention this is that the much more frequently-encountered case is the one where a long line is wrapped at the screen width. How should a command that moves vertically between lines behave in such a situation? It looks to me like emacs, which handles line wrapping itself in shell mode, treats C-p and C-n very similarly to C-a and C-e. If you want this hypothetical future command to move vertically between lines that are wrapped at the screen width, which I believe is going to be the much more useful case, then we should talk about how you specify and implement that. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/