autocomplete - Where are these spaces coming from? -


I can not see here ... The user is trying to create a simple script to get input, only regular With the tab autocomplete for the defined list of phrases (Az, AZ, 0-9 and -) limited to characters ... this works, little ...

  #! / Usr / local / scripts / packages {{channel stdin}} {exec / bin / stty raw -echo & lt; @ $ Channel} proc disableRaw {channel stdin}} {exec / bin / stty -raw echo & lt; @ $ Channel} proc complete {partial} {sets global full index [lsearch $ completes "$ {partial} *"] If {$ index! = -1} {return [lindex $ integer index]} and {return $ partial}} enable set c [read studine] Scan $ c% c ascii set word "" while {$ ascii! = 10} {switch $ ascii {9 {# tab puts the word [full $ word] - -Ninwayline "\ n $ word"} 127 {puts a # backspace -nline $ c set word [string category $ word 0 [Expressing [string longitude word] - 2]]} default {switch -regcode "$ c" {"[a-zA-Z0-9 \ -]" {puts -none $ c set word "$ word $ c" } Default {}}}} Scans flush stdout set c [read stdin 1] $ c% c ascii} disableRaw "\ n & gt; $ word & lt;"  

But the output is throwing a load of extra spaces which I did not understand where they are coming from !!!

I hope:

  bash -3.2 $ ./complete_on_tab.exp red & lt; - Tabs in red & gt; Red A & lt; Bash-3.2 $  

but I see:

  bash-3.2 $ ./complete_on_tab.exp red & lt; - Tab entered the red one & lt; - Why indent? & Gt; Red A & lt; Bash-3.2 $  

Where is the empty space before the arrival of the second line ??


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

javascript - amcharts makechart not working -

java - Algorithm negotiation fail SSH in Jenkins -