But how can I detect when the width is less than 20 characters?

On Fri, Sep 1, 2017 at 11:21 AM, Myrddin Emrys <myrd...@gmail.com> wrote:

> The general reason for this is terminals that fail to correctly set a
> width are more common that terminals less than 20 characters wide. I think
> the current behavior (using a default width if the reported width seems
> incorrect) will help more people than it hurts.
>
> On Fri, Sep 1, 2017 at 8:45 AM Mark Volkmann <r.mark.volkm...@gmail.com>
> wrote:
>
>> I'm trying to make my fish_prompt function intelligent enough to handle
>> any width.
>> When wide enough, I'm outputting the current directory path and the Git
>> branch if I'm in a Git repo.
>> If the window too narrow to display all of that on one line, I display
>> them on two lines.
>> If the directory won't fit, I output the result of prompt_pwd instead.
>> Below 20 columns I want to just display a fish icon.
>> That's why I need to be able to detect whether the window is less than 20
>> columns.
>>
>> I use tmux and sometimes have narrow panes from lots of splitting.
>> Typically I won't have panes that narrow, but when I do I want to handle
>> it
>> and not just have a ">" prompt.
>>
>> On Fri, Sep 1, 2017 at 8:38 AM, David Adam <zanc...@ucc.gu.uwa.edu.au>
>> wrote:
>>
>>> On Fri, 1 Sep 2017, Dave Cottlehuber wrote:
>>> > On Fri, 1 Sep 2017, at 14:52, Mark Volkmann wrote:
>>> > > I'm working in iTerm2 on a Mac.
>>> > > Entering "echo $COLUMNS" gives the correct value at most window
>>> widths.
>>> > > However, if the width is less than 20, it always reports 80.
>>> >
>>> > On OSX Sierra, with fish 2.6.0, I get the same as you. However if you
>>> > try under Terminal.app you are unable to resize the terminal less than
>>> > 20 columns anyway...
>>> >
>>> > On FreeBSD 12.0-CURRENT & fish 2.5.0, things work as you'd expect.
>>> > terminal is urxvt in i3wm.
>>>
>>> This behaviour was introduced in commit
>>> 2be1288cacab7ddeee407d22e752b0a3bfa16e63 which is included in 2.6.0 (and
>>> 2.6b1).
>>>
>>> Does anyone use a terminal less than 20 columns wide?
>>>
>>> David Adam
>>> fish committer
>>> zanc...@ucc.gu.uwa.edu.au
>>>
>>> ------------------------------------------------------------
>>> ------------------
>>> Check out the vibrant tech community on one of the world's most
>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>> _______________________________________________
>>> Fish-users mailing list
>>> Fish-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/fish-users
>>>
>>
>>
>>
>> --
>> R. Mark Volkmann
>> Object Computing, Inc.
>> ------------------------------------------------------------
>> ------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot______
>> _________________________________________
>> Fish-users mailing list
>> Fish-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/fish-users
>>
>


-- 
R. Mark Volkmann
Object Computing, Inc.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to