Inverse colours with a 256 palette don't work. Try this command
echo -e "\e[7m\e[38;5;240m\e[48;5;255m####\e[0m"

What's been done in the patch:
- the colours setting was rewritten;
- removed some repeated code:
- "if ((!cells) || (x >= w))" and "if (cells[j].att.invisible)" blocks were identical - moved the double width setting out a level, it was needlessly repeated in every block - in "if (!cells)" ch1 and ch2 weren't getting updated if inv and tc[x].bg == COL_INVIS
- moved tc[x] setting in a level next to ch1 and ch2 updating
- took out if codepoint is 0: fg = COL_INVIS. It doesn't do anything (there is no character to make invisible). Whitespace will get properly underlined this way.

As far as I've tested it, it works as it should.
Bold and faint affect only fg. If inverse is set then bold affects fg after the inversion and faint prior to it. Intense behaves as faint.

I also have some questions.
What is intense, what escape code is it? Also the colour table is missing either intense or faint. Right now it has 12 offset for bright/bold and 24 for intense by the comment in col.c or faint by the code in termio.c. There's nothing offset by 48 in the colour table. I'd comment out the intense setting but I'm not sure it's the right thing to do. The way it's set up now, it's possible to fall out of the colour table.
Why doesn't tc[x].bold = bold work?


I've also added a patch to ecore version checking in main.c. The way it's set up now it always comes out true.


Sasha
Index: src/bin/main.c
===================================================================
--- src/bin/main.c	(revision 81717)
+++ src/bin/main.c	(working copy)
@@ -458,7 +458,8 @@ static const Ecore_Getopt options = {
    "Terminal emulator written with Enlightenment Foundation Libraries.",
    EINA_TRUE,
    {
-#if (ECORE_VERSION_MAJOR >= 1) || (ECORE_VERSION_MINOR >= 8)
+#if ((ECORE_VERSION_MAJOR == 1) && (ECORE_VERSION_MINOR >= 8)) || \
+    (ECORE_VERSION_MAJOR > 1)
       ECORE_GETOPT_BREAK_STR ('e', "exec",
 #else
       ECORE_GETOPT_STORE_STR ('e', "exec",
@@ -542,11 +543,13 @@ elm_main(int argc, char **argv)
    Eina_Bool maximized = EINA_FALSE;
    Eina_Bool nowm = EINA_FALSE;
    Eina_Bool quit_option = EINA_FALSE;
-#if (ECORE_VERSION_MAJOR >= 1) || (ECORE_VERSION_MINOR >= 8)
+#if ((ECORE_VERSION_MAJOR == 1) && (ECORE_VERSION_MINOR >= 8)) || \
+    (ECORE_VERSION_MAJOR > 1)
    Eina_Bool cmd_options = EINA_FALSE;
 #endif   
    Ecore_Getopt_Value values[] = {
-#if (ECORE_VERSION_MAJOR >= 1) || (ECORE_VERSION_MINOR >= 8)
+#if ((ECORE_VERSION_MAJOR == 1) && (ECORE_VERSION_MINOR >= 8)) || \
+    (ECORE_VERSION_MAJOR > 1)
      ECORE_GETOPT_VALUE_BOOL(cmd_options),
 #else
      ECORE_GETOPT_VALUE_STR(cmd),
@@ -615,7 +618,8 @@ elm_main(int argc, char **argv)
 
    if (quit_option) goto end;
 
-#if (ECORE_VERSION_MAJOR >= 1) || (ECORE_VERSION_MINOR >= 8)
+#if ((ECORE_VERSION_MAJOR == 1) && (ECORE_VERSION_MINOR >= 8)) || \
+    (ECORE_VERSION_MAJOR > 1)
    if (cmd_options)
      {
         int i;
@@ -906,7 +910,8 @@ elm_main(int argc, char **argv)
 
    elm_run();
  end:
-#if (ECORE_VERSION_MAJOR >= 1) || (ECORE_VERSION_MINOR >= 8)
+#if ((ECORE_VERSION_MAJOR == 1) && (ECORE_VERSION_MINOR >= 8)) || \
+    (ECORE_VERSION_MAJOR > 1)
    free(cmd);
 #endif
    



Index: src/bin/termio.c
===================================================================
--- src/bin/termio.c	(revision 81717)
+++ src/bin/termio.c	(working copy)
@@ -388,7 +388,7 @@ _smart_apply(Evas_Object *obj)
 {
    Termio *sd = evas_object_smart_data_get(obj);
    Evas_Coord ox, oy, ow, oh;
-   int j, x, y, w, ch1 = 0, ch2 = 0, inv = 0;
+   int x, y, w, ch1 = 0, ch2 = 0, inv = 0;
 
    if (!sd) return;
    evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
@@ -399,144 +399,92 @@ _smart_apply(Evas_Object *obj)
         Termcell *cells;
         Evas_Textgrid_Cell *tc;
 
-        w = 0; j = 0;
+        w = 0;
         cells = termpty_cellrow_get(sd->pty, y - sd->scroll, &w);
         tc = evas_object_textgrid_cellrow_get(sd->grid.obj, y);
         if (!tc) continue;
         ch1 = -1;
         for (x = 0; x < sd->grid.w; x++)
           {
-             if ((!cells) || (x >= w))
+             if ((!cells) || (x >= w) || (cells[x].att.invisible))
                {
-                  if ((tc[x].codepoint != 0) ||
-                      (tc[x].bg != COL_INVIS) ||
-                      (tc[x].bg_extended))
+                  if ((tc[x].codepoint) || (tc[x].bg_extended) ||
+                      (!(((!inv) && (tc[x].bg == COL_INVIS)) ||
+                         ((inv) && (tc[x].bg == COL_INVERSEBG)))))
                     {
                        if (ch1 < 0) ch1 = x;
                        ch2 = x;
+                       tc[x].codepoint = 0;
+                       tc[x].bg_extended = 0;
+                       if (inv) tc[x].bg = COL_INVERSEBG;
+                       else tc[x].bg = COL_INVIS;
                     }
-                  tc[x].codepoint = 0;
-                  if (inv) tc[x].bg = COL_INVERSEBG;
-                  else tc[x].bg = COL_INVIS;
-                  tc[x].bg_extended = 0;
-#if defined(SUPPORT_DBLWIDTH)
-                  tc[x].double_width = cells[j].att.dblwidth;
-#endif
-                  if ((tc[x].double_width) && (tc[x].codepoint == 0) &&
-                      (ch2 == x - 1))
-                    ch2 = x;
                }
              else
                {
-                  if (cells[j].att.invisible)
+                  int bold, fg, bg, fgext, bgext, codepoint;
+                  
+                  // colors
+                  bold = cells[x].att.bold;
+                  codepoint = cells[x].codepoint;
+                  fgext = cells[x].att.fg256;
+                  bgext = cells[x].att.bg256;
+                  fg = cells[x].att.fg;
+                  bg = cells[x].att.bg;
+
+                  if (!fgext)
                     {
-                       if ((tc[x].codepoint != 0) ||
-                           (tc[x].bg != COL_INVIS) ||
-                           (tc[x].bg_extended))
+                       if (cells[x].att.inverse ^ inv)
                          {
-                            if (ch1 < 0) ch1 = x;
-                            ch2 = x;
+                            if (fg == COL_DEF) fg = COL_INVERSEBG;
                          }
-                       tc[x].codepoint = 0;
-                       if (inv) tc[x].bg = COL_INVERSEBG;
-                       else tc[x].bg = COL_INVIS;
-                       tc[x].bg_extended = 0;
-#if defined(SUPPORT_DBLWIDTH)
-                       tc[x].double_width = cells[j].att.dblwidth;
-#endif
-                       if ((tc[x].double_width) && (tc[x].codepoint == 0) &&
-                           (ch2 == x - 1))
-                         ch2 = x;
+                       else if (bold) fg += 12;
+                       if (cells[x].att.faint) fg += 24;
+                       if (cells[x].att.fgintense) fg += 48;
                     }
-                  else
+                  if (!bgext)
                     {
-                       int bold, fg, bg, fgext, bgext, codepoint;
-                       
-                       // colors
-                       bold = cells[j].att.bold;
-                       fgext = cells[j].att.fg256;
-                       bgext = cells[j].att.bg256;
-                       codepoint = cells[j].codepoint;
-                       
-                       if (cells[j].att.inverse ^ inv)
+                       if (cells[x].att.inverse ^ inv)
                          {
-                            int t;
-                            
-                            fgext = 0;
-                            bgext = 0;
-                            fg = cells[j].att.fg;
-                            bg = cells[j].att.bg;
-                            if (fg == COL_DEF) fg = COL_INVERSEBG;
                             if (bg == COL_DEF) bg = COL_INVERSE;
-                            t = bg; bg = fg; fg = t;
-                            if (bold)
-                              {
-                                 fg += 12;
-                                 bg += 12;
-                              }
-                            if (cells[j].att.faint)
-                              {
-                                 fg += 24;
-                                 bg += 24;
-                              }
-                            if (cells[j].att.fgintense) fg += 48;
-                            if (cells[j].att.bgintense) bg += 48;
+                            if (bold) bg += 12;
                          }
-                       else
-                         {
-                            fg = cells[j].att.fg;
-                            bg = cells[j].att.bg;
-                            
-                            if (!fgext)
-                              {
-                                 if (bold) fg += 12;
-                              }
-                            if (!bgext)
-                              {
-                                 if (bg == COL_DEF) bg = COL_INVIS;
-                              }
-                            if (cells[j].att.faint)
-                              {
-                                 if (!fgext) fg += 24;
-                                 if (!bgext) bg += 24;
-                              }
-                            if (cells[j].att.fgintense) fg += 48;
-                            if (cells[j].att.bgintense) bg += 48;
-                            if (((codepoint == ' ') || (codepoint == 0)) &&
-                                (!cells[j].att.strike) &&
-                                (!cells[j].att.underline))
-                              fg = COL_INVIS;
-                         }
-                       if ((tc[x].codepoint != codepoint) ||
-                           (tc[x].fg != fg) ||
-                           (tc[x].bg != bg) ||
-                           (tc[x].fg_extended != fgext) ||
-                           (tc[x].bg_extended != bgext) ||
-                           (tc[x].underline != cells[j].att.underline) ||
-                           (tc[x].strikethrough != cells[j].att.strike))
-                         {
-                            if (ch1 < 0) ch1 = x;
-                            ch2 = x;
-                         }
+                       else if (bg == COL_DEF) bg = COL_INVIS;
+                    }
+                  if (cells[x].att.inverse ^ inv)
+                    {
+                       int t;
+                       t = fgext; fgext = bgext; bgext = t;
+                       t = fg; fg = bg; bg = t;
+                    }
+                  if ((tc[x].codepoint != codepoint) ||
+                      (tc[x].fg != fg) ||
+                      (tc[x].bg != bg) ||
+                      (tc[x].fg_extended != fgext) ||
+                      (tc[x].bg_extended != bgext) ||
+                      (tc[x].underline != cells[x].att.underline) ||
+                      (tc[x].strikethrough != cells[x].att.strike))
+                    {
+                       if (ch1 < 0) ch1 = x;
+                       ch2 = x;
                        tc[x].fg_extended = fgext;
                        tc[x].bg_extended = bgext;
-                       tc[x].underline = cells[j].att.underline;
-                       tc[x].strikethrough = cells[j].att.strike;
+                       tc[x].underline = cells[x].att.underline;
+                       tc[x].strikethrough = cells[x].att.strike;
                        tc[x].fg = fg;
                        tc[x].bg = bg;
                        tc[x].codepoint = codepoint;
+                       // cells[x].att.italic // never going 2 support
+                       // cells[x].att.blink
+                       // cells[x].att.blink2
+                    }
+               }
 #if defined(SUPPORT_DBLWIDTH)
-                       tc[x].double_width = cells[j].att.dblwidth;
+             tc[x].double_width = cells[x].att.dblwidth;
 #endif
-                       if ((tc[x].double_width) && (tc[x].codepoint == 0) &&
-                           (ch2 == x - 1))
-                         ch2 = x;
-                       // cells[j].att.italic // never going 2 support
-                       // cells[j].att.blink
-                       // cells[j].att.blink2
-                    }
-               }
-             j++;
+             if ((tc[x].double_width) && (tc[x].codepoint == 0) &&
+                 (ch2 == x - 1))
+               ch2 = x;
           }
         evas_object_textgrid_cellrow_set(sd->grid.obj, y, tc);
         /* only bothering to keep 1 change span per row - not worth doing


------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to