DlangUI 0.9.0: Console backend added

ketmar via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Wed Sep 14 06:07:44 PDT 2016


On Wednesday, 14 September 2016 at 13:04:40 UTC, ketmar wrote:
> On Wednesday, 14 September 2016 at 05:58:51 UTC, Vadim Lopatin 
> CSI-with-modifier codes: \e[1;<mod><char>
this is common format for keys with modifiers, actually. let me 
quote my rawtty2:

   bool xtermMods (uint mci) @nogc {
     switch (mci) {
       case 2: key.shift = true; return true;
       case 3: key.alt = true; return true;
       case 4: key.alt = true; key.shift = true; return true;
       case 5: key.ctrl = true; return true;
       case 6: key.ctrl = true; key.shift = true; return true;
       case 7: key.alt = true; key.ctrl = true; return true;
       case 8: key.alt = true; key.ctrl = true; key.shift = true; 
return true;
       default:
     }
     return false;
   }

   void xtermSpecial (char ch) @nogc {
     switch (ch) {
       case 'A': key.key = TtyKey.Key.Up; break;
       case 'B': key.key = TtyKey.Key.Down; break;
       case 'C': key.key = TtyKey.Key.Right; break;
       case 'D': key.key = TtyKey.Key.Left; break;
       case 'E': key.key = TtyKey.Key.Pad5; break;
       case 'H': key.key = TtyKey.Key.Home; break;
       case 'F': key.key = TtyKey.Key.End; break;
       case 'P': key.key = TtyKey.Key.F1; break;
       case 'Q': key.key = TtyKey.Key.F2; break;
       case 'R': key.key = TtyKey.Key.F3; break;
       case 'S': key.key = TtyKey.Key.F4; break;
       case 'Z': key.key = TtyKey.Key.Tab; key.ch = 9; if 
(!key.shift && !key.alt && !key.ctrl) key.shift = true; break;
       default: badCSI(); break;
     }
   }


More information about the Digitalmars-d-announce mailing list