screen-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[screen-devel] Statusline showencoding patch


From: Yi-Jheng Lin
Subject: [screen-devel] Statusline showencoding patch
Date: Wed, 28 May 2008 15:34:15 +0800
User-agent: Mutt/1.5.17 (2007-11-01)

Dear,
    I'm so glad that screen supports the encoding transformation. That's really 
a great function for me to switch between Big5 & UTF-8 environment! But 
sometimes I may be confused "What encoding am I using?". Although, I can use 
"Ctrl-a i" to get the information of current window (including the encoding 
info).  I was wondering if the statusline could show the encoding of current 
window, so I patch it!

    With this patch, I could add a new parameter "%e" to statusline for showing 
the encoding of current window. This might not be a good solution, but it does 
work!

    The following is the patch.

--- screen.c.orig       2008-05-08 02:37:22.000000000 +0800
+++ screen.c    2008-05-20 20:34:37.000000000 +0800
@@ -2584,6 +2584,18 @@
            }
          p += strlen(p) - 1;
          break;
+#ifdef ENCODINGS
+       case 'e':
+         *p = 0;
+         D_encoding = nwin_options.encoding > 0 ? nwin_options.encoding : 0;
+         if (win && win->w_encoding)
+           {
+             *p++ = ' ';
+             strcpy(p, EncodingName(win->w_encoding));
+           }
+         p += strlen(p) - 1;
+         break;
+#endif
        case '{':
           {
            char rbuf[128];
    
--- process.c.orig      2008-05-08 02:37:33.000000000 +0800
+++ process.c   2008-05-08 02:37:49.000000000 +0800
@@ -3422,6 +3422,7 @@
            {
              WinSwitchEncoding(fore, n);
              ResetCharsets(fore);
+             RedisplayDisplays(0);
            }
          else if (i && display)
            D_encoding  = n;

    I would like to see this function in future version. :)

    BRs,
    yzlin


-- 
__   ________     ___ _   _     Name:   林宜政 Yi-Jheng, Lin
\ \ / /__  / |   |_ _| \ | |    E-Mail: address@hidden, address@hidden
 \ V /  / /| |    | ||  \| |    MSN:    address@hidden
  | |  / /_| |___ | || |\  |    Web:    http://blog.yzlin.org
  |_| /____|_____|___|_| \_|    Flickr: http://www.flickr.com/photos/yzlin1985/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]