@@ -179,12 +179,14 @@ bool Viewport::IsInBounds(const Viewport& other) const noexcept
179
179
// - Determines if the given coordinate position lies within this viewport.
180
180
// Arguments:
181
181
// - pos - Coordinate position
182
- // - allowBottomExclusive - if true, allow the X position to be on the BottomExclusive boundary
182
+ // - allowEndExclusive - if true, allow the EndExclusive COORD as a valid position.
183
+ // Used in accessibility to signify that the exclusive end
184
+ // includes the last COORD in a given viewport.
183
185
// Return Value:
184
186
// - True if it lies inside the viewport. False otherwise.
185
- bool Viewport::IsInBounds (const COORD& pos, bool allowBottomExclusive ) const noexcept
187
+ bool Viewport::IsInBounds (const COORD& pos, bool allowEndExclusive ) const noexcept
186
188
{
187
- if (allowBottomExclusive && pos. X == Left () && pos. Y == BottomExclusive ())
189
+ if (allowEndExclusive && pos == EndExclusive ())
188
190
{
189
191
return true ;
190
192
}
@@ -274,12 +276,14 @@ bool Viewport::MoveInBounds(const ptrdiff_t move, COORD& pos) const noexcept
274
276
// - Increments the given coordinate within the bounds of this viewport.
275
277
// Arguments:
276
278
// - pos - Coordinate position that will be incremented, if it can be.
277
- // - allowBottomExclusive - if true, allow the X position to be on the BottomExclusive boundary
279
+ // - allowEndExclusive - if true, allow the EndExclusive COORD as a valid position.
280
+ // Used in accessibility to signify that the exclusive end
281
+ // includes the last COORD in a given viewport.
278
282
// Return Value:
279
283
// - True if it could be incremented. False if it would move outside.
280
- bool Viewport::IncrementInBounds (COORD& pos, bool allowBottomExclusive ) const noexcept
284
+ bool Viewport::IncrementInBounds (COORD& pos, bool allowEndExclusive ) const noexcept
281
285
{
282
- return WalkInBounds (pos, { XWalk::LeftToRight, YWalk::TopToBottom }, allowBottomExclusive );
286
+ return WalkInBounds (pos, { XWalk::LeftToRight, YWalk::TopToBottom }, allowEndExclusive );
283
287
}
284
288
285
289
// Method Description:
@@ -299,12 +303,14 @@ bool Viewport::IncrementInBoundsCircular(COORD& pos) const noexcept
299
303
// - Decrements the given coordinate within the bounds of this viewport.
300
304
// Arguments:
301
305
// - pos - Coordinate position that will be incremented, if it can be.
302
- // - allowBottomExclusive - if true, allow the X position to be on the BottomExclusive boundary
306
+ // - allowEndExclusive - if true, allow the EndExclusive COORD as a valid position.
307
+ // Used in accessibility to signify that the exclusive end
308
+ // includes the last COORD in a given viewport.
303
309
// Return Value:
304
310
// - True if it could be incremented. False if it would move outside.
305
- bool Viewport::DecrementInBounds (COORD& pos, bool allowBottomExclusive ) const noexcept
311
+ bool Viewport::DecrementInBounds (COORD& pos, bool allowEndExclusive ) const noexcept
306
312
{
307
- return WalkInBounds (pos, { XWalk::RightToLeft, YWalk::BottomToTop }, allowBottomExclusive );
313
+ return WalkInBounds (pos, { XWalk::RightToLeft, YWalk::BottomToTop }, allowEndExclusive );
308
314
}
309
315
310
316
// Method Description:
@@ -325,19 +331,21 @@ bool Viewport::DecrementInBoundsCircular(COORD& pos) const noexcept
325
331
// Arguments:
326
332
// - first- The first coordinate position
327
333
// - second - The second coordinate position
328
- // - allowBottomExclusive - if true, allow the COORD's Y value to be BottomExclusive when X = Left
334
+ // - allowEndExclusive - if true, allow the EndExclusive COORD as a valid position.
335
+ // Used in accessibility to signify that the exclusive end
336
+ // includes the last COORD in a given viewport.
329
337
// Return Value:
330
338
// - Negative if First is to the left of the Second.
331
339
// - 0 if First and Second are the same coordinate.
332
340
// - Positive if First is to the right of the Second.
333
341
// - This is so you can do s_CompareCoords(first, second) <= 0 for "first is left or the same as second".
334
342
// (the < looks like a left arrow :D)
335
343
// - The magnitude of the result is the distance between the two coordinates when typing characters into the buffer (left to right, top to bottom)
336
- int Viewport::CompareInBounds (const COORD& first, const COORD& second, bool allowBottomExclusive ) const noexcept
344
+ int Viewport::CompareInBounds (const COORD& first, const COORD& second, bool allowEndExclusive ) const noexcept
337
345
{
338
346
// Assert that our coordinates are within the expected boundaries
339
- FAIL_FAST_IF (!IsInBounds (first, allowBottomExclusive ));
340
- FAIL_FAST_IF (!IsInBounds (second, allowBottomExclusive ));
347
+ FAIL_FAST_IF (!IsInBounds (first, allowEndExclusive ));
348
+ FAIL_FAST_IF (!IsInBounds (second, allowEndExclusive ));
341
349
342
350
// First set the distance vertically
343
351
// If first is on row 4 and second is on row 6, first will be -2 rows behind second * an 80 character row would be -160.
@@ -364,13 +372,15 @@ int Viewport::CompareInBounds(const COORD& first, const COORD& second, bool allo
364
372
// Arguments:
365
373
// - pos - Coordinate position that will be adjusted, if it can be.
366
374
// - dir - Walking direction specifying which direction to go when reaching the end of a row/column
367
- // - allowBottomExclusive - if true, allow the X position to be on the BottomExclusive boundary
375
+ // - allowEndExclusive - if true, allow the EndExclusive COORD as a valid position.
376
+ // Used in accessibility to signify that the exclusive end
377
+ // includes the last COORD in a given viewport.
368
378
// Return Value:
369
379
// - True if it could be adjusted as specified and remain in bounds. False if it would move outside.
370
- bool Viewport::WalkInBounds (COORD& pos, const WalkDir dir, bool allowBottomExclusive ) const noexcept
380
+ bool Viewport::WalkInBounds (COORD& pos, const WalkDir dir, bool allowEndExclusive ) const noexcept
371
381
{
372
382
auto copy = pos;
373
- if (WalkInBoundsCircular (copy, dir, allowBottomExclusive ))
383
+ if (WalkInBoundsCircular (copy, dir, allowEndExclusive ))
374
384
{
375
385
pos = copy;
376
386
return true ;
@@ -388,19 +398,21 @@ bool Viewport::WalkInBounds(COORD& pos, const WalkDir dir, bool allowBottomExclu
388
398
// Arguments:
389
399
// - pos - Coordinate position that will be adjusted.
390
400
// - dir - Walking direction specifying which direction to go when reaching the end of a row/column
391
- // - allowBottomExclusive - if true, allow the X position to be on the BottomExclusive boundary
401
+ // - allowEndExclusive - if true, allow the EndExclusive COORD as a valid position.
402
+ // Used in accessibility to signify that the exclusive end
403
+ // includes the last COORD in a given viewport.
392
404
// Return Value:
393
405
// - True if it could be adjusted inside the viewport.
394
406
// - False if it rolled over from the final corner back to the initial corner
395
407
// for the specified walk direction.
396
- bool Viewport::WalkInBoundsCircular (COORD& pos, const WalkDir dir, bool allowBottomExclusive ) const noexcept
408
+ bool Viewport::WalkInBoundsCircular (COORD& pos, const WalkDir dir, bool allowEndExclusive ) const noexcept
397
409
{
398
410
// Assert that the position given fits inside this viewport.
399
- FAIL_FAST_IF (!IsInBounds (pos, allowBottomExclusive ));
411
+ FAIL_FAST_IF (!IsInBounds (pos, allowEndExclusive ));
400
412
401
413
if (dir.x == XWalk::LeftToRight)
402
414
{
403
- if (allowBottomExclusive && pos.X == Left () && pos.Y == BottomExclusive ())
415
+ if (allowEndExclusive && pos.X == Left () && pos.Y == BottomExclusive ())
404
416
{
405
417
pos.Y = Top ();
406
418
return false ;
@@ -412,7 +424,7 @@ bool Viewport::WalkInBoundsCircular(COORD& pos, const WalkDir dir, bool allowBot
412
424
if (dir.y == YWalk::TopToBottom)
413
425
{
414
426
pos.Y ++;
415
- if (allowBottomExclusive && pos.Y == BottomExclusive ())
427
+ if (allowEndExclusive && pos.Y == BottomExclusive ())
416
428
{
417
429
return true ;
418
430
}
0 commit comments