Re: recalculate LINES and COLUMNS

2007-08-22 Thread Mike Stroyan
On Mon, Aug 20, 2007 at 07:40:47AM +0200, thomas wrote:
 Sometimes I want to change the font of my terminal (urxvt): for
 instance, I am tired and want a bigger font. I can use a bash alias
 (or a keyboard shortcut) which runs these two lines:
 
 printf '\e]710;%s\007' 'xft:DejaVu Sans Mono:size=10'
 kill -WINCH $$
 
 Font is changed but the second line seems to have no effect: bash does
 not recompute the values of COLUMNS and LINES, thus I may type
 outside urxvt's window.
 
 There is a checkwinsize option but it does not seem to help.
 
 If I manually resize the window, the problem is fixed.
 
 How can I send a WINCH signal to bash so that it recalculates the
 correct values of LINES and COLUMNS after a font change?

  It works fine for me using rxvt-unicode 8.1 and bash 3.2.13(1) from
ubuntu 7.04.  If a urxvt window is maximized or grows large enough to exceed
the screen size, then the number of columns changes and $COLUMNS is
updated immediately without using any kill command.  (If the window is
not maximized and remains small enough fit the screen then the number of
lines and columns is not changed by the font change escape sequence.)

-- 
Mike Stroyan [EMAIL PROTECTED]




Re: recalculate LINES and COLUMNS

2007-08-21 Thread Chet Ramey
thomas wrote:

 Sometimes I want to change the font of my terminal (urxvt): for
 instance, I am tired and want a bigger font. I can use a bash alias
 (or a keyboard shortcut) which runs these two lines:
 
 printf '\e]710;%s\007' 'xft:DejaVu Sans Mono:size=10'
 kill -WINCH $$
 
 Font is changed but the second line seems to have no effect: bash does
 not recompute the values of COLUMNS and LINES, thus I may type
 outside urxvt's window.
 
 There is a checkwinsize option but it does not seem to help.
 
 If I manually resize the window, the problem is fixed.
 
 How can I send a WINCH signal to bash so that it recalculates the
 correct values of LINES and COLUMNS after a font change?

It appears that the escape sequence to change the terminal's font size
does not change the kernel's idea of the window size, whereas resizing
causes the terminal emulator to send the new dimensions to the kernel.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
   Live Strong.  No day but today.
Chet Ramey, ITS, CWRU[EMAIL PROTECTED]http://cnswww.cns.cwru.edu/~chet/