Re: Multiline editing breaks if the previous output doesn't end in newline

2022-11-02 Thread Albert Vaca Cintora
On Mon, Oct 31, 2022 at 2:47 AM Greg Wooledge wrote: > > There's no 100% portable way to determine where the cursor is. On Mon, Oct 31, 2022 at 4:45 PM Chet Ramey wrote: > > There is no portable way to determine this. If only computers were general purpose programmable devices... :) Koichi's

Re: Multiline editing breaks if the previous output doesn't end in newline

2022-10-31 Thread Alex fxmbsw7 Ratchev
where the cursor is ? some tput ansi code returns it .. but i guess u mean bigger compatibility problems does, readline, export its cursor assumptations ? like for dev'ing On Mon, Oct 31, 2022, 16:46 Chet Ramey wrote: > On 10/30/22 9:40 PM, Oğuz wrote: > > > Yeah, or add a new prompt sequence

Re: Multiline editing breaks if the previous output doesn't end in newline

2022-10-31 Thread Chet Ramey
On 10/30/22 9:40 PM, Oğuz wrote: Yeah, or add a new prompt sequence (e.g. \N) that prints a newline only if the cursor is not at column 0. There is no portable way to determine this. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' -

Re: Multiline editing breaks if the previous output doesn't end in newline

2022-10-31 Thread Chet Ramey
On 10/28/22 8:21 AM, Albert Vaca Cintora wrote: Machine: All archs OS: All OSes Bash Version: All versions since I have memory Description: When there's leftover output before the prompt (ie: when the previous command output doesn't end in a new line), editing a multi-line command from

Re: Multiline editing breaks if the previous output doesn't end in newline

2022-10-30 Thread Oğuz
31 Ekim 2022 Pazartesi tarihinde Greg Wooledge yazdı: > > There's no 100% portable way to determine where the cursor is. Pity > Shells like zsh that show a special symbol in these cases use a hack > to do so. There's a good explanation in this answer: > >

Re: Multiline editing breaks if the previous output doesn't end in newline

2022-10-30 Thread Greg Wooledge
On Mon, Oct 31, 2022 at 03:40:34AM +0200, Oğuz wrote: > > Option B: Fix the line editor to take into account when the > > prompt doesn't start at column 0. > > > > > Yeah, or add a new prompt sequence (e.g. \N) that prints a newline only if > the cursor is not at column 0. There's no 100%

Re: Multiline editing breaks if the previous output doesn't end in newline

2022-10-30 Thread Oğuz
28 Ekim 2022 Cuma tarihinde Albert Vaca Cintora yazdı: > > Option A: If the previous command doesn't end in a newline, > add a newline manually. This is what most shells do. This sounds wrong. How are you going to know if the previous command ends in a newline or not then? >

Re: Multiline editing breaks if the previous output doesn't end in newline

2022-10-30 Thread Alex fxmbsw7 Ratchev
On Sun, Oct 30, 2022, 23:01 Dennis Williamson wrote: > > > On Sun, Oct 30, 2022 at 4:41 PM Alex fxmbsw7 Ratchev > wrote: > >> >> >> i coded a files tree to bash code via gawk reading and printing bash code >> i did noeol no newline at end >> logically , cause , who wants var='from file\n' >> >>

Re: Multiline editing breaks if the previous output doesn't end in newline

2022-10-30 Thread Dennis Williamson
On Sun, Oct 30, 2022 at 4:41 PM Alex fxmbsw7 Ratchev wrote: > > > i coded a files tree to bash code via gawk reading and printing bash code > i did noeol no newline at end > logically , cause , who wants var='from file\n' > > > > Because command substitution strips trailing newlines? $ echo -e

Re: Multiline editing breaks if the previous output doesn't end in newline

2022-10-30 Thread Alex fxmbsw7 Ratchev
On Sun, Oct 30, 2022, 21:21 Albert Vaca Cintora wrote: > On Sun, Oct 30, 2022 at 7:54 AM Martin D Kealey > wrote: > > > > This sounds like a bug in whatever is producing the output. POSIX text > files have a newline terminating every line; that description includes > streams going through pipes

Re: Multiline editing breaks if the previous output doesn't end in newline

2022-10-30 Thread Albert Vaca Cintora
On Sun, Oct 30, 2022 at 7:54 AM Martin D Kealey wrote: > > This sounds like a bug in whatever is producing the output. POSIX text files > have a newline terminating every line; that description includes streams > going through pipes and tty devices if they purport to be text. > There are many

Re: Multiline editing breaks if the previous output doesn't end in newline

2022-10-30 Thread Martin D Kealey
This sounds like a bug in whatever is producing the output. POSIX text files have a newline terminating every line; that description includes streams going through pipes and tty devices if they purport to be text. It's fairly simple to fix this by adding this to the end of your .bashrc (or the

Re: Multiline editing breaks if the previous output doesn't end in newline

2022-10-29 Thread Koichi Murase
> $ printf '%*s\rY' "$COLUMNS" X > | ... X| > |Y | P.S. Here I used `|' to represent the left and right boundaries of the terminal display area.

Re: Multiline editing breaks if the previous output doesn't end in newline

2022-10-29 Thread Koichi Murase
2022年10月29日(土) 15:44 Albert Vaca Cintora : > On Sat, Oct 29, 2022 at 7:28 AM Koichi Murase wrote: > > shopt -s checkwinsize > > { ! type -t tput || tput xenl || tput xn; } &>/dev/null; > > _prompt_xenl_offset=$? > > _prompt_newline() { (:); printf '\e[m%-*s\r\e[K' > >

Re: Multiline editing breaks if the previous output doesn't end in newline

2022-10-29 Thread Albert Vaca Cintora
On Sat, Oct 29, 2022 at 7:28 AM Koichi Murase wrote: > > 2022年10月28日(金) 21:24 Albert Vaca Cintora : > > Description: > > When there's leftover output before the prompt (ie: when the > > previous command output doesn't end in a new line), editing a > > multi-line command from history

Re: Multiline editing breaks if the previous output doesn't end in newline

2022-10-28 Thread Koichi Murase
2022年10月28日(金) 21:24 Albert Vaca Cintora : > Description: > When there's leftover output before the prompt (ie: when the > previous command output doesn't end in a new line), editing a > multi-line command from history doesn't correctly display what you > edit. > > [...] > Option

Multiline editing breaks if the previous output doesn't end in newline

2022-10-28 Thread Albert Vaca Cintora
Machine: All archs OS: All OSes Bash Version: All versions since I have memory Description: When there's leftover output before the prompt (ie: when the previous command output doesn't end in a new line), editing a multi-line command from history doesn't correctly display what you edit.