X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=st.c;h=504239ea6ac121ec512a4e738e72b916a828015e;hb=88d8293fb4ba150a5f19d58d133b5db93d9dcfa5;hp=3ebf8c6947e69086dfb51541600d5320f8ce7466;hpb=33201ac65f74e45b4fa60822ba9a538c3cfa9b25;p=st.git diff --git a/st.c b/st.c index 3ebf8c6..504239e 100644 --- a/st.c +++ b/st.c @@ -42,6 +42,7 @@ #define STR_ARG_SIZ ESC_ARG_SIZ /* macros */ +#define IS_SET(flag) ((term.mode & (flag)) != 0) #define NUMMAXLEN(x) ((int)(sizeof(x) * 2.56 + 0.5) + 1) #define ISCONTROLC0(c) (BETWEEN(c, 0, 0x1f) || (c) == '\177') #define ISCONTROLC1(c) (BETWEEN(c, 0x80, 0x9f)) @@ -51,6 +52,17 @@ /* constants */ #define ISO14755CMD "dmenu -w \"$WINDOWID\" -p codepoint: ': /* DECPNM -- Normal keypad */ - term.mode &= ~MODE_APPKEYPAD; + xsetmode(0, MODE_APPKEYPAD); break; case '7': /* DECSC -- Save Cursor */ tcursor(CURSOR_SAVE); @@ -2521,14 +2529,31 @@ resettitle(void) } void -redraw(void) +drawregion(int x1, int y1, int x2, int y2) { - tfulldirt(); - draw(); + int y; + for (y = y1; y < y2; y++) { + if (!term.dirty[y]) + continue; + + term.dirty[y] = 0; + xdrawline(term.line[y], x1, y, x2); + } } void -numlock(const Arg *dummy) +draw(void) { - term.numlock ^= 1; + if (!xstartdraw()) + return; + drawregion(0, 0, term.col, term.row); + xdrawcursor(); + xfinishdraw(); +} + +void +redraw(void) +{ + tfulldirt(); + draw(); }