Xinqi Bao's Git
projects
/
st.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
Clarify some or exclusive expressions
[st.git]
/
st.c
diff --git
a/st.c
b/st.c
index
2ad13ef
..
9864442
100644
(file)
--- a/
st.c
+++ b/
st.c
@@
-96,8
+96,7
@@
enum cursor_movement {
enum cursor_state {
CURSOR_DEFAULT = 0,
enum cursor_state {
CURSOR_DEFAULT = 0,
- CURSOR_HIDE = 1,
- CURSOR_WRAPNEXT = 2
+ CURSOR_WRAPNEXT = 1,
};
enum glyph_state {
};
enum glyph_state {
@@
-115,7
+114,8
@@
enum term_mode {
MODE_MOUSEMOTION = 64,
MODE_MOUSE = 32|64,
MODE_REVERSE = 128,
MODE_MOUSEMOTION = 64,
MODE_MOUSE = 32|64,
MODE_REVERSE = 128,
- MODE_KBDLOCK = 256
+ MODE_KBDLOCK = 256,
+ MODE_HIDE = 512
};
enum escape_state {
};
enum escape_state {
@@
-1464,8
+1464,8
@@
tsetmode(bool priv, bool set, int *args, int narg) {
case 0: /* Error (IGNORED) */
case 12: /* att610 -- Start blinking cursor (IGNORED) */
break;
case 0: /* Error (IGNORED) */
case 12: /* att610 -- Start blinking cursor (IGNORED) */
break;
- case 25:
- MODBIT(term.
c.state, !set, CURSOR
_HIDE);
+ case 25:
/* DECTCEM -- Text Cursor Enable Mode */
+ MODBIT(term.
mode, !set, MODE
_HIDE);
break;
case 1000: /* 1000,1002: enable xterm mouse report */
MODBIT(term.mode, set, MODE_MOUSEBTN);
break;
case 1000: /* 1000,1002: enable xterm mouse report */
MODBIT(term.mode, set, MODE_MOUSEBTN);
@@
-1475,15
+1475,15
@@
tsetmode(bool priv, bool set, int *args, int narg) {
break;
case 1049: /* = 1047 and 1048 */
case 47:
break;
case 1049: /* = 1047 and 1048 */
case 47:
- case 1047:
- if(IS_SET(MODE_ALTSCREEN))
+ case 1047: {
+ bool alt = IS_SET(MODE_ALTSCREEN) != 0;
+ if(alt)
tclearregion(0, 0, term.col-1, term.row-1);
tclearregion(0, 0, term.col-1, term.row-1);
- if((set && !IS_SET(MODE_ALTSCREEN)) ||
- (!set && IS_SET(MODE_ALTSCREEN))) {
+ if(set ^ alt) /* set is always 1 or 0 */
tswapscreen();
tswapscreen();
- }
if(*args != 1049)
break;
if(*args != 1049)
break;
+ }
/* pass through */
case 1048:
tcursor((set) ? CURSOR_SAVE : CURSOR_LOAD);
/* pass through */
case 1048:
tcursor((set) ? CURSOR_SAVE : CURSOR_LOAD);
@@
-2505,7
+2505,7
@@
xdrawcursor(void) {
}
/* draw the new one */
}
/* draw the new one */
- if(!(
term.c.state & CURSOR_HIDE
)) {
+ if(!(
IS_SET(MODE_HIDE)
)) {
if(!(xw.state & WIN_FOCUSED))
g.bg = defaultucs;
if(!(xw.state & WIN_FOCUSED))
g.bg = defaultucs;
@@
-2546,9
+2546,9
@@
drawregion(int x1, int y1, int x2, int y2) {
int ic, ib, x, y, ox, sl;
Glyph base, new;
char buf[DRAW_BUF_SIZ];
int ic, ib, x, y, ox, sl;
Glyph base, new;
char buf[DRAW_BUF_SIZ];
- bool ena_sel = sel.bx != -1, alt = IS_SET(MODE_ALTSCREEN);
+ bool ena_sel = sel.bx != -1, alt = IS_SET(MODE_ALTSCREEN)
!= 0
;
- if((sel.alt
&& !alt) || (!sel.alt && alt)
)
+ if((sel.alt
!= 0) ^ alt
)
ena_sel = 0;
if(!(xw.state & WIN_VISIBLE))
return;
ena_sel = 0;
if(!(xw.state & WIN_VISIBLE))
return;