| 179 | } |
| 180 | |
| 181 | void DoAnsiCSI(char ch){ |
| 182 | switch(ch){ |
| 183 | case ANSI_CSI_SGR: |
| 184 | DoAnsiSGR(); // Set Graphics Rendition |
| 185 | break; |
| 186 | case ANSI_CSI_CUU: |
| 187 | { |
| 188 | int amount = 1; |
| 189 | if(strlen(escBuf)){ |
| 190 | amount = atoi(escBuf); |
| 191 | } |
| 192 | curPos.y -= amount; |
| 193 | if(curPos.y < 0) curPos.y = 0; |
| 194 | break; |
| 195 | } |
| 196 | case ANSI_CSI_CUD: |
| 197 | { |
| 198 | int amount = 1; |
| 199 | if(strlen(escBuf)){ |
| 200 | amount = atoi(escBuf); |
| 201 | } |
| 202 | curPos.y += amount; |
| 203 | Scroll(); |
| 204 | break; |
| 205 | } |
| 206 | case ANSI_CSI_CUF: |
| 207 | { |
| 208 | int amount = 1; |
| 209 | if(strlen(escBuf)){ |
| 210 | amount = atoi(escBuf); |
| 211 | } |
| 212 | curPos.x += amount; |
| 213 | if(curPos.x > wSize.ws_col) { |
| 214 | curPos.x = 0; |
| 215 | curPos.y++; |
| 216 | Scroll(); |
| 217 | } |
| 218 | break; |
| 219 | } |
| 220 | case ANSI_CSI_CUB: |
| 221 | { |
| 222 | int amount = 1; |
| 223 | if(strlen(escBuf)){ |
| 224 | amount = atoi(escBuf); |
| 225 | } |
| 226 | curPos.x -= amount; |
| 227 | if(curPos.x < 0) { |
| 228 | curPos.x = wSize.ws_col - 1; |
| 229 | curPos.y--; |
| 230 | } |
| 231 | if(curPos.y < 0) curPos.y = 0; |
| 232 | break; |
| 233 | } |
| 234 | case ANSI_CSI_CUP: // Set cursor position |
| 235 | { |
| 236 | char* scolon = strchr(escBuf, ';'); |
| 237 | if(scolon){ |
| 238 | *scolon = 0; |