- Timestamp:
- Dec 30, 2012, 1:02:33 AM (13 years ago)
- Location:
- trunk/src/kernel32
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/conbuffer.cpp
r21916 r22052 309 309 310 310 case 8: /* Backspace */ 311 // not correct if deleting expanded tab character 311 { 312 BOOL go = FALSE; 312 313 if (pConsoleBuffer->coordCursorPosition.X > 0) 314 { 313 315 pConsoleBuffer->coordCursorPosition.X--; 314 315 //@@@PH overwrite old character 316 *(pConsoleBuffer->ppszLine[pConsoleBuffer->coordCursorPosition.Y] + 317 pConsoleBuffer->coordCursorPosition.X * 2) = 0x20; 316 go = TRUE; 317 } 318 else if (pConsoleBuffer->coordCursorPosition.Y > 0) 319 { 320 pConsoleBuffer->coordCursorPosition.Y--; 321 pConsoleBuffer->coordCursorPosition.X = pConsoleBuffer->coordBufferSize.X - 1; 322 go = TRUE; 323 } 324 if (go) 325 { 326 *(pConsoleBuffer->ppszLine[pConsoleBuffer->coordCursorPosition.Y] + 327 pConsoleBuffer->coordCursorPosition.X * 2) = 0x20; 328 } 318 329 break; 330 } 319 331 320 332 case 9: /* Tab */ … … 328 340 pConsoleBuffer->coordBufferSize.X) 329 341 { 330 pConsoleBuffer->coordCursorPosition.X = 0;342 pConsoleBuffer->coordCursorPosition.X %= pConsoleBuffer->coordBufferSize.X; 331 343 pConsoleBuffer->coordCursorPosition.Y++; 332 344 -
trunk/src/kernel32/conbuffervio.cpp
r21916 r22052 112 112 register UCHAR ucChar; 113 113 APIRET rc; 114 U LONGRow;114 USHORT Row; 115 115 USHORT Column; 116 116 int numchar; … … 179 179 pConsoleGlobals->Options.ulSpeakerDuration); 180 180 break; 181 #if 0 181 182 182 case 8: /* Backspace */ 183 // not correct if deleting expanded tab character 184 rc = VioGetCurPos(&Row, &Column, 0); 185 if(!rc) { 186 187 } 183 { 184 BOOL go = FALSE; 188 185 if (pConsoleBuffer->coordCursorPosition.X > 0) 186 { 189 187 pConsoleBuffer->coordCursorPosition.X--; 190 191 //@@@PH overwrite old character 192 *(pConsoleBuffer->ppszLine[pConsoleBuffer->coordCursorPosition.Y] + 193 pConsoleBuffer->coordCursorPosition.X * 2) = 0x20; 188 go = TRUE; 189 } 190 else if (pConsoleBuffer->coordCursorPosition.Y > 0) 191 { 192 pConsoleBuffer->coordCursorPosition.Y--; 193 pConsoleBuffer->coordCursorPosition.X = pConsoleBuffer->coordBufferSize.X - 1; 194 go = TRUE; 195 } 196 if (go) 197 { 198 *(pConsoleBuffer->ppszLine[pConsoleBuffer->coordCursorPosition.Y] + 199 pConsoleBuffer->coordCursorPosition.X * 2) = 0x20; 200 VioWrtCharStr((PCH)" ", 1, pConsoleBuffer->coordCursorPosition.Y, pConsoleBuffer->coordCursorPosition.X, 0); 201 VioSetCurPos(pConsoleBuffer->coordCursorPosition.Y, pConsoleBuffer->coordCursorPosition.X, 0); 202 } 194 203 break; 204 } 195 205 196 206 case 9: /* Tab */ 197 {198 rc = VioWrite199 207 pConsoleBuffer->coordCursorPosition.X = 200 208 (pConsoleBuffer->coordCursorPosition.X … … 206 214 pConsoleBuffer->coordBufferSize.X) 207 215 { 208 pConsoleBuffer->coordCursorPosition.X = 0;216 pConsoleBuffer->coordCursorPosition.X %= pConsoleBuffer->coordBufferSize.X; 209 217 pConsoleBuffer->coordCursorPosition.Y++; 210 218 … … 214 222 if (pConsoleBuffer->dwConsoleMode & ENABLE_WRAP_AT_EOL_OUTPUT) 215 223 { 216 iConsoleBufferScrollUp(pConsoleBuffer, /* scroll one line up */217 1);218 pConsoleBuffer->coordCursorPosition.Y --;224 VioScrollUp(0, 0, pConsoleBuffer->coordWindowSize.Y-1, pConsoleBuffer->coordWindowSize.X-1, 225 1, &filler[0], 0); 226 pConsoleBuffer->coordCursorPosition.Y = pConsoleBuffer->coordWindowSize.Y-1; 219 227 } 220 228 } 221 229 } 222 break; 223 #endif 230 VioSetCurPos(pConsoleBuffer->coordCursorPosition.Y, pConsoleBuffer->coordCursorPosition.X, 0); 231 break; 232 224 233 case 13: /* CARRIAGE RETURN */ 225 234 dprintf(("CR")); -
trunk/src/kernel32/conin.cpp
r10471 r22052 221 221 if (ulCounter > 0) 222 222 { 223 //@@@PH erase character on screen!224 223 ulCounter--; 225 224 pszTarget--; 226 225 /* local echo enabled ? */ 227 226 if (pConsoleInput->dwConsoleMode & ENABLE_ECHO_INPUT) 227 { 228 ULONG repeat = 1; 229 if (*pszTarget == 0x09) // tab 230 { 231 // detect the expanded width of the deleted tab 232 ULONG cnt = 0; 233 PSZ psz = (PSZ)lpBuffer; 234 ULONG p = 0, ulTabSize = pConsoleGlobals->Options.ulTabSize; 235 for (; cnt < ulCounter; cnt++, psz++) 236 { 237 if (*psz == 0x09) 238 p += ulTabSize - p % ulTabSize; 239 else 240 { 241 if (*psz == 0x0d && cnt < ulCounter && *(psz + 1) == 0x0a) 242 psz++; 243 p++; 244 } 245 } 246 // this will give us the expanded width 247 repeat = ulTabSize - p % ulTabSize; 248 249 } 250 while (repeat--) 251 HMWriteFile(pConsoleGlobals->hConsoleBuffer, 252 &InputRecord.Event.KeyEvent.uChar.AsciiChar, 253 1, 254 &ulPostCounter, /* dummy result */ 255 NULL, NULL); 256 } 257 } 258 break; 259 260 case 0x09: // tab 261 /* local echo enabled ? */ 262 if (pConsoleInput->dwConsoleMode & ENABLE_ECHO_INPUT) 263 { 264 // expand tabs (not rely on HMWriteFile since we calculate tabs from the 265 // beginning of the whole buffer, not the current line) 266 ULONG repeat = 1; 267 // detect the expanded width of the new tab 268 ULONG cnt = 0; 269 PSZ psz = (PSZ)lpBuffer; 270 ULONG p = 0, ulTabSize = pConsoleGlobals->Options.ulTabSize; 271 for (; cnt < ulCounter; cnt++, psz++) 272 { 273 if (*psz == 0x09) 274 p += ulTabSize - p % ulTabSize; 275 else 276 { 277 if (*psz == 0x0d && cnt < ulCounter && *(psz + 1) == 0x0a) 278 psz++; 279 p++; 280 } 281 } 282 // this will give us the expanded width 283 repeat = ulTabSize - p % ulTabSize; 284 285 while (repeat--) 228 286 HMWriteFile(pConsoleGlobals->hConsoleBuffer, 229 &InputRecord.Event.KeyEvent.uChar.AsciiChar,287 " ", 230 288 1, 231 289 &ulPostCounter, /* dummy result */ 232 290 NULL, NULL); 233 291 } 292 293 *pszTarget = InputRecord.Event.KeyEvent.uChar.AsciiChar; 294 pszTarget++; 295 ulCounter++; 234 296 break; 235 297
Note:
See TracChangeset
for help on using the changeset viewer.