if(c == 0) return;
if(c == 0 && k != KeyEvent.VK_DELETE) return;
    public void keyPressed(KeyboardEvent e) {        int k = e.getKeyCode();        if(e.isControlDown())            switch (k) {                case KeyEvent.VK_UP: {if(fy > 0) fy --; break;}                case KeyEvent.VK_DOWN: {if(fy < my() - cym) fy ++; break;}                case KeyEvent.VK_LEFT: {if(fx > 0) fx --; break;}                case KeyEvent.VK_RIGHT: {if(fx < mx()) fx ++; break;}                case KeyEvent.VK_HOME: {cx = fx = cy = fy = 0; break;}                case KeyEvent.VK_END: { if(my() < cym) cy = my(); else {cy = cym; fy = my() - cy;}; end(); break;}                case KeyEvent.VK_Y: { ls.remove(oy()); if(oy() > my()) cy --; break;}                case KeyEvent.VK_S: { saveFile(); break;}                case KeyEvent.VK_X: { console.getManager().unregisterConsole(console); break;}            }        else        out: switch (k) {                case KeyEvent.VK_UP: { cursorUp(); break;}                case KeyEvent.VK_DOWN: {cursorDown();break;}                case KeyEvent.VK_LEFT: {if(cx > 0) cx--; else if(fx > 0) fx --; else if(cursorUp()) end(); break;}                case KeyEvent.VK_RIGHT: {if(ox() < mx()) if(cx < cxm) cx++; else fx ++; else if(cursorDown()) {cx = 0; fx = 0; } break;}                case KeyEvent.VK_HOME: {cx = fx = 0; break;}                case KeyEvent.VK_END: { end(); break;}                case KeyEvent.VK_PAGE_UP: {if(fy > cym) fy -= cym; else fy = 0; break;}                case KeyEvent.VK_PAGE_DOWN: {if(my() - fy > cym) fy +=cym; break;}                default:                    char c = e.getKeyChar();                    if(c == 0) return;                    if(cy == ls.size()) ls.add(new StringBuilder());                    StringBuilder l = ls.get(oy());                    switch(k){                        case KeyEvent.VK_ENTER: {c = '\n';ls.add(oy() + 1, new StringBuilder()); break;}                        case KeyEvent.VK_DELETE: {                            if(cx == mx()) {                                if(cy < my()){                                    l.deleteCharAt(l.length() - 1).append(ls.remove(oy() + 1));                                }                            } else if(cx < mx())                                l.deleteCharAt(ox());                            break out;                        }                        case KeyEvent.VK_BACK_SPACE: {                            if(ox() == 0) {                                if(cy > 0){                                    StringBuilder l2 = ls.get(oy() - 1);                                    cx = l2.length() - 1;                                    l2.deleteCharAt(l2.length() - 1).append(ls.remove(oy()));                                    cy --;                                }                            } else if(cx > 0){                                cx --;                                l.deleteCharAt(ox());                            } else {                                fx --;                                l.deleteCharAt(ox());                            }                            break out;                        }                    }                    if(cx == l.length()) l.append(c); else l.insert(ox(), c);                    if(c == '\n' ) {                        if(cy < cym) cy ++; else fy ++;                        if(cx < l.length() + 1){                            StringBuilder l2 = ls.get(oy());                            l2.append(l, ox() + 1, l.length());                            l.delete(ox() + 1, l.length());                        }                        cx = fx = 0;                    } else {                        if(cx == cxm) fx ++; else cx ++;                    }        }        if(oy() > cym && cy < 0){            cy = cym;            fy = my() - cy;        }        if(oy() > my()){            fy -= oy() - my();        }        if(ox() > mx()) {            if(mx() > cxm){                cx = cxm;                fx = mx() - cx;            } else {                cx = mx();                fx = 0;            }        }        updateScreen();    }