| 2055 | } |
| 2056 | |
| 2057 | void |
| 2058 | tty_curs( |
| 2059 | winid window, |
| 2060 | int x, int y) /* coordinates (and curx-x) must be signed */ |
| 2061 | { |
| 2062 | struct WinDesc *cw = 0; |
| 2063 | int cx = ttyDisplay->curx; |
| 2064 | int cy = ttyDisplay->cury; |
| 2065 | |
| 2066 | HUPSKIP(); |
| 2067 | if (window == WIN_ERR || (cw = wins[window]) == (struct WinDesc *) 0) |
| 2068 | ttywindowpanic(); |
| 2069 | ttyDisplay->lastwin = window; |
| 2070 | |
| 2071 | print_vt_code2(AVTC_SELECT_WINDOW, window); |
| 2072 | |
| 2073 | #if defined(TILES_IN_GLYPHMAP) && defined(MSDOS) |
| 2074 | adjust_cursor_flags(cw); |
| 2075 | #endif |
| 2076 | |
| 2077 | #ifdef DEBUG |
| 2078 | if (x < 1 || y < 0 || y >= cw->rows || x > cw->cols) { |
| 2079 | const char *s = "[unknown type]"; |
| 2080 | |
| 2081 | switch (cw->type) { |
| 2082 | case NHW_MESSAGE: |
| 2083 | s = "[topl window]"; |
| 2084 | break; |
| 2085 | case NHW_STATUS: |
| 2086 | s = "[status window]"; |
| 2087 | break; |
| 2088 | case NHW_MAP: |
| 2089 | s = "[map window]"; |
| 2090 | break; |
| 2091 | case NHW_MENU: |
| 2092 | s = "[corner window]"; |
| 2093 | break; |
| 2094 | case NHW_TEXT: |
| 2095 | s = "[text window]"; |
| 2096 | break; |
| 2097 | case NHW_BASE: |
| 2098 | s = "[base window]"; |
| 2099 | break; |
| 2100 | } |
| 2101 | /* avoid sending a line to the message window if we're complaining |
| 2102 | about cursor positioning in message window; perhaps raw_printf? |
| 2103 | this ought to be using impossible() so that someone might |
| 2104 | actually see it */ |
| 2105 | if (cw->type != NHW_MESSAGE) |
| 2106 | debugpline4("tty_curs: bad positioning win %d %s <%d,%d>", |
| 2107 | window, s, x, y); |
| 2108 | /* don't try to fix up x,y here because then tty_curs() would |
| 2109 | behave differently depending on whether DEBUG is defined; |
| 2110 | garbage in, garbage out is the order of the day... */ |
| 2111 | } |
| 2112 | #endif /* DEBUG */ |
| 2113 | cw->curx = --x; /* column 0 is not used */ |
| 2114 | cw->cury = y; |
no test coverage detected