User Details
- User Since
- May 1 2012, 5:20 PM (756 w, 3 d)
- Availability
- Available
Sep 28 2015
As for the regex note that I am not the author of it,as stated in my comment above(maybe it has been overlooked because i didn't say that clearly),i have just taken it from stackoverflow(if that's ok) to provide a solution for this task as it seemed to be straightforward.As you said this regex looks really weird,I for myself would't even be able to form such an regex,but I am able to explain roughly in detail.
So mode contains in my case 2 blocks,one with sth others and the other with the headline containng CON,this regex looks for the first appearance of CON followed by an arbitary number of any characters following a : .As you have pointed it's better to use the con directly via mode con,i have added a patch that does it.The : is follwed by a sequence marked by ( ),this sequence is detected when a line break(\n occurs) followed by an arbitary number of characters without |,so every time a line break occurs it will trigger that sequence.THe 3 in the { specifies how many times this sequence should match in the text before the regex engine proceeds with the next statement(I bet you're aware of this),which is (?<cols>\d+).
I guess ?<cols> is to copy the matched contents of this sequence in to the key with cols in $matches,so it's redundant as basically every sequence marked with( is accessible by a number as key.The \d stands for digits,so as soon as the regex engine encounters a non-digit,it will abort.
Sep 26 2015
I think my suggested code from stackoverflow for Windows behaves like its unix counterpart,as it outputs the same numberm,namely 80, and does not rely on the actual size of the terminal window.However,note,that I have not tested the following code in conjunction with phutil,only tested the code stated in my comment above.
Sep 20 2015
preg_match('/CON.*:(\n[^|]+?){3}(?<cols>\d+)/', `mode`, $matches);
$cols = $matches['cols'];This outputs the number of columns of the terminal window according to http://stackoverflow.com/questions/263890/how-do-i-find-the-width-height-of-a-terminal-window (it's a weird trick),so I assume the width can be concluded in some way from the number of columns. Tested it ,but however when resizing the window by mouse the number of columns stays the same,don't know whether this behaves exactly as the non-Windows implementation.
Aug 14 2015
Hi,I have added some translations,those can be added into this paste here as well.But I haven't tested those with Umlaute like äüö because I didn't manage them to show up in my local phabricator windows installation(I've inserted those translations as a hack into PhabricatorVeryWowEnglishTranslation.php because putting this file into the xtensions folder will not show them up in them in settings>account>translation nad arc liberate fails seems to fail on windows)
