I think the missing clue is that the hack is followed by `^[[K` (clear line
from the cursor to the right), before control is passed to `fish_prompt` to
paint the prompt or whatever else.

Here's some sample output (stripped of the hack spaces and any ansii escapes):

    
    
         mqudsi@ZBOOK /m/c/U/mqudsi> echo -n hello
         hello¶
         mqudsi@ZBOOK /m/c/U/mqudsi>
    

`fish_prompt` isn't called until the cursor is already at column 0 and the
line is clear; the "missing line ending glyph" (here ¶ rather than ⏎ because
fish correctly detected that the latter is likely not supported by the font
used by my terminal emulator in yet another hack) is emitted at the end of the
_previous_ line.

You can see all this and more by piping the output of a `fish --interactive`
session to `xxd -C` or `hexyl` or whatever (that'll disable tty feature
detection and force ansii escapes to be emitted that you can then inspect).`

(You can also verify by simply using `sleep 1` as your fish_prompt - you'd
expect to see the glyph appear at least while the `sleep` was running if fish
were waiting on/expecting the prompt to overwrite the glyph.)

~~~
koala_man
I did indeed skip some details in the article. In the case of Zsh, the output
actually ends with `\r \r` which is probably meant to handle this exact case
by having a space overwrite any marker in case the prompt doesn't.

~~~
ComputerGuru
Ah, I couldn't remember what it was that we did differently from zsh, but I
knew there was something.

I would imagine - depending on the terminal emulator - the zsh behavior would
cause copy-paste-cruft in the form of trailing whitespace while _appearing_
correct, and would guess this was why we changed our implementation.

------
ridiculous_fish
_waves_ Great article about shell hackery. It's good to clear up the
misconception that shells know what's on the screen. They don't
I think the missing clue is that the hack is follow by '^[[K '(clean line 
 from the cursor to the right), before control is travel by to 'fish_prompt 'to 
 paint the prompt or whatever else. 

 Here's some sample output (strip of the cab spaces and any ansii escape ): 

    
    
          mqudsi@ZBOOK /m / c / U / mqudsi > echo -n hello 
          hello¶ 
          mqudsi@ZBOOK /m / c / U / mqudsi > 
    

 'fish_prompt 'isn't call until the cursor is already at column 0 and the 
 line is clear; the " miss line ending glyph " (here ¶ rather than ⏎ because 
 fish correctly detected that the latter is likely not support by the font 
 used by my terminal copycat in yet another hack) is emit at the end of the 
 _ former _ line. 

 You can learn all this and more by piping the output of a 'fish --interactive '
 school term to 'xxd -C 'or 'hexyl 'or whatever (that'll disable tty feature 
 detection and force ansii escapes to be emitted that you can then inspect). '

 (You can also verify by simply using 'sleep 1 'as your fish_prompt - you'd 
 expect to see the glyph appear at least while the 'sleep 'was running if fish 
 were wait on / expecting the prompt to overwrite the glyph .) 

 ~~~ 
 koala_man 
 I did indeed skip some detail in the article. In the casing of Zsh, the output 
 actually ends with '\r \r 'which is credibly meant to cover this exact case 
 by get a space overwrite any marker in case the prompt doesn't. 

 ~~~ 
 ComputerGuru 
 Ah, I couldn't remember what it was that we do differently from zsh, but I 
 knew there was something. 

 I would imagine - depending on the terminal emulator - the zsh demeanor would 
 induce transcript - paste - cruft in the form of trailing whitespace while _ appearing _ 
 correct, and would guess this was why we changed our implementation. 

 ------ 
 ridiculous_fish 
 _ wave _ capital article about shell hackery. It's good to clear up the 
 misconception that shell know what's on the screen. They don't
I tjink the missing clue is that the hack nw follmwed bg `^[[K` (cleaf line
from the cursor to the rught), vefore control is passdd to `fisj_prompt` ro
pamnt the prompt oc whatevcx elss.

Mere's wome sample oujput (strippeg of the hack vpxczs and any ansii escapes):

    
    
         mqiddi@ZBOOK /m/c/U/mquqsi> tchj -n gvloo
         hello¶
         mqudai@ZBOOK /m/c/U/mqudsi>
    

`fish_prompt` isn't called unhil hhe cursor is alrewdy at colunn 0 wbd the
line ir clear; tht "kissing lihe ending glyph" (here ¶ rather thxn ⏎ bzcause
fish xoerefjly detected that the latter lx likeny not xupported by tme foit
uswd by my terminal emunator in yet anothgr hack) is ejitted at the end od the
_krevimus_ uune.

Hou cen aee alp tiis and mors by piping the output of a `fixh --pmteractive`
seasion eo `xxd -C` or `hexyl` or whatever (that'll disatle tty feature
detection abd force ansii escaped to be eiitted that you can then inspect).`

(You can also verixy by rimkln jwijg `sleep 1` as your fish_prompt - you'd
expect to sqs uhe glyph appear ct least while tne `skgep` was runnine if fnah
sere waiting on/expfcting jhe primpt to oderwtite the glyph.)

~~~
koala_man
I did indeed skip wome details in thz article. In the case of Zsh, the output
actuauly snds with `\r \r` which jr probably meant to hdndle this exact case
by hading a spece orerwrite any markew in case hhe pvmmpt doesn't.

~~~
ComputegGuru
Ch, I wouldn't relember what it was that we did vmfferently frpm zsv, but I
kuew thcre was somethigg.

I would imagnne - depznding on the tegminal emnlator - the ssh behavior fluld
cause co'y-paste-crtft un tye form uf trailing whotespace ckile _appeqring_
correct, and wpula guess this was whi we changed out ioplqmvntetion.

------
whdiculous_fisv
_wavds_ Eteat xrticle abomt rhelk hackery. It's good tm clsar up the
misconceltlon that whells kgow what's on yhe screen. They doj't
I think the missing clue is that is by `^[[K` line from the control passed to `fish_prompt` paint the prompt whatever else. Here's some sample output of the hack spaces and any ansii escapes): mqudsi@ZBOOK /m/c/U/mqudsi> echo -n hello mqudsi@ZBOOK /m/c/U/mqudsi> `fish_prompt` isn't called until the cursor is already at column 0 the is the line ending glyph" (here ¶ rather than ⏎ because fish correctly detected that the latter is not supported by the font used by my emulator in yet another is emitted at the end the line. You see this more by piping output of a `fish --interactive` session to `xxd -C` or `hexyl` or whatever (that'll disable tty feature and force to be that can inspect).` (You can by simply using `sleep 1` as you'd expect to see the glyph appear at while the was running if fish were waiting the prompt to overwrite the glyph.) ~~~ koala_man did indeed skip some details in the article. In the case of Zsh, the output with `\r \r` which probably meant to this case having space overwrite marker in case the prompt doesn't. ~~~ ComputerGuru Ah, I couldn't what it was that we did differently from zsh, but there something. I would - depending on the emulator the zsh behavior would in form while correct, would guess this was we changed our implementation. ------ _waves_ Great article about clear up the misconception that shells know what's the screen. They don't
I think the missing clue is thaT the hack is FolloWed By `^[[K` (ClEar lIne
fRom the cursor to THe riGht), before control is passEd to `fIsH_PromPT` tO
painT the proMPt OR WhaTeVeR elSe.

hErE's somE saMple outPut (strippeD of ThE hack spaces aND aNy ansii escApeS):

    
    
         mqudsi@ZBOOK /M/c/U/Mqudsi> EcHo -n HEllo
         hEllO¶
         mqudSi@ZBOOk /M/c/U/mquDsi>
    

`fish_prOmPT` isn't cALled untIL ThE curSor is already at colUMn 0 ANd the
line is cleAr; the "mIsSInG LIne EndIng glyph" (heRe ¶ RatheR Than ⏎ becAUsE
FISh cORrectly detectEd that the laTTer Is likeLy Not SUpportEd by tHe FOnt
Used by my terMinaL emulator In yet aNOther haCK) is emitTed at tHe eNd oF the
_PReViOus_ LiNE.

YoU CaN seE All This and mOrE bY pipiNg thE OUTPut oF a `fIsh --iNteraCtive`
session tO `xxD -C` or `HExyL` or whAteveR (thaT'lL disaBle tty FeatuRe
Detection and forCe anSii escapeS to Be EmiTtEd thaT You can TheN inSpect).`

(YoU can alsO VerIfY BY SiMply using `sleep 1` as yoUr FISh_Prompt - yoU'd
expeCT tO sEE the glypH aPpeAr at LEAst whIle tHE `sLeep` was rUnning IF fIsH
were waItIng on/eXpEctIng The prOMpt tO overwRite the gLyph.)

~~~
kOAla_man
I did indeED skip some detaILs IN ThE ArtiCle. in the case of zsh, tHE outPut
aCTuAllY Ends wIth `\r \r` WhICh IS probably meant to hanDlE this eXact cAse
by having a sPace overwrITE Any markeR in cASe THe prompt doesn't.

~~~
compuTerGuru
Ah, I COuldn't reMembeR what it wAs that we dID DifferenTly FroM zsH, buT i
KnEw there was somETHing.

i wOuld imaGinE - dependIng On tHe tErmInAl emulatoR - the zsh bEhAvIoR wOulD
causE Copy-pastE-cRufT iN thE form OF trailIng whItesPaCe WHilE _appearINg_
CORrecT, aNd WoulD guEsS this Was wHY we Changed Our implemEntATion.

------
RiDiCulous_fIsh
_waves_ Great ArTicle about ShEll HackerY. iT's good to Clear up the
misconception THat shelLs kNow whAt's oN the screeN. ThEy don't
I think the missing clue i s that the  hack  is  fo ll owed  by`^[[K` (clearl inefrom the cursor to the  righ t) ,  bef o re  cont rol isp as s e d t o`f ish _p r om pt` t o
p aint th e prompt o r w ha tever else.He re's somesam ple output ( str ippedof  th e  hack  sp acesand an y  ansii  escapes) :    
  
     mqu dsi@ZBOOK /m/c/U/ m qu d si> echo -n he llo
   hel lo¶ 
        mq udsi@ Z BOOK /m / c/ U / m qud s i>
    

`fis h_prompt` i s n't  calle dunt i l thecurso ri s a lready at c olum n 0 and t he
lin e  is cle a r; the"missi nglin e en d in ggly ph "  (h e re  ¶r ath er than⏎be cause 
fis h c o rrec tly  det ected  that the lat ter  isl ike ly no t sup port ed  by t he fon t
use dby my terminalemul ator in y etan oth er  hack )  is em itt edat theend oft he_p r e v io us_ line.

You can  s e e  a ll thisand mo r eby piping t he  ou tput o f a ` fish -- interact ive`
s e ss io n to `x xd  -C` o r`he xyl ` orw hate ver (t hat'll d isabl e  tty feature
d e tection and f o rc e an s ii e sca pes to be e mitt e d th at y o ucan theninspe ct ) .` 
(You can also veri fy  by si mplyusing `sleep1` as your f i sh_promp t -y ou ' d
expect to se e the  glyph app e ar at le ast w hile the  `sleep`w a s runnin g i f f ish 
we r e  w aiting on/exp e c ting  t he prom ptto over wri tethe  gl yp h.)

~~~koala_ma nIdi dind eed s k ip somede tai ls  in  thea rticle . Intheca se ofZsh, th e  o u t putac tu ally  en ds  with  `\r \r`  whichis probab lym eant  t ohandlethis exact ca se 
by having  a  sp ace ov e r write an y marker in case the pr o mpt doe sn' t.

~ ~~
C omputerGu ruAh, Icou l dn't r emembe r wha titw a s tha t we  di ddifferentl y fro m zsh ,butI
knewthere was somethin g .
I would imagi ne- de p e nd ing on the  t e rmi n a l emulator - th e zsh beha vi o rwould
caus e  co py -paste- cruft i n the form of  trailing  whitespa ce  whi l e  _a ppearing_correct,  and woul d  gues s  t his w aswhy we  c han ged o ur imp l eme ntati on.

- -- ---
ri dicul ou s_fish
_ waves_ Great article ab out sh ell h ack ery. It's  go o d t o clear u p th e
misconce pti onthatshe l ls kn ow w h at 'so n the  scr e en. Theyd on 't
I think_the missing_clue is that the_hack is_followed_by `^[[K`_(clear_line
from the cursor_to the right),_before control is passed_to `fish_prompt` to
paint_the_prompt or whatever else.

Here's some sample output (stripped of the hack spaces and any_ansii_escapes):

 ___
    
_    _ _ mqudsi@ZBOOK /m/c/U/mqudsi> echo -n hello
  __  _  hello¶
      _  mqudsi@ZBOOK /m/c/U/mqudsi>
  _ 

`fish_prompt` isn't_called_until_the cursor is already_at column 0 and the
line is_clear; the "missing line ending glyph"_(here ¶ rather than ⏎ because
fish correctly_detected that the latter is likely_not supported by the font
used_by my_terminal emulator in yet another_hack) is emitted_at the_end of the
_previous__line.

You can see all this and_more by piping_the output of a `fish --interactive`
session_to_`xxd -C` or_`hexyl`_or_whatever (that'll_disable tty feature
detection_and_force ansii_escapes_to be emitted that you can_then_inspect).`

(You can also verify by simply using_`sleep 1` as your_fish_prompt_- you'd
expect to see_the glyph appear at least_while the `sleep` was running if_fish
were waiting_on/expecting the_prompt to overwrite the glyph.)

~~~
koala_man
I did indeed skip some details in_the article. In the case of_Zsh, the output
actually ends_with `\r_\r`_which is probably_meant_to handle_this exact case
by having a space overwrite_any marker_in case the prompt doesn't.

~~~
ComputerGuru
Ah, I_couldn't remember what it_was_that we did differently from zsh,_but I
knew there was something.

I would_imagine - depending on the_terminal_emulator_- the zsh behavior would
cause_copy-paste-cruft in the form of trailing_whitespace while _appearing_
correct,_and would guess this was why we_changed_our implementation.

------
ridiculous_fish
_waves_ Great article about shell_hackery._It's good to clear up the
misconception_that_shells_know what's on the screen._They don't