diff --git a/src/buffer/out/textBuffer.cpp b/src/buffer/out/textBuffer.cpp index 76d127086..58de15c20 100644 --- a/src/buffer/out/textBuffer.cpp +++ b/src/buffer/out/textBuffer.cpp @@ -418,7 +418,6 @@ bool TextBuffer::InsertCharacter(const std::wstring_view chars, // Store character and double byte data CharRow& charRow = Row.GetCharRow(); - short const cBufferWidth = GetSize().Width(); try { @@ -1650,13 +1649,14 @@ const TextBuffer::TextAndColor TextBuffer::GetText(const bool includeCRLF, if (!cell.DbcsAttr().IsTrailing()) { - selectionText.append(cell.Chars()); + const auto chars = cell.Chars(); + selectionText.append(chars); if (copyTextColor) { const auto cellData = cell.TextAttr(); const auto [CellFgAttr, CellBkAttr] = GetAttributeColors(cellData); - for (const wchar_t wch : cell.Chars()) + for (size_t j = 0; j < chars.size(); ++j) { selectionFgAttr.push_back(CellFgAttr); selectionBkAttr.push_back(CellBkAttr); diff --git a/src/cascadia/TerminalApp/Pane.cpp b/src/cascadia/TerminalApp/Pane.cpp index cb8f4278a..2dda1a442 100644 --- a/src/cascadia/TerminalApp/Pane.cpp +++ b/src/cascadia/TerminalApp/Pane.cpp @@ -911,7 +911,6 @@ winrt::fire_and_forget Pane::_CloseChildRoutine(const bool closeFirst) auto removedChild = closeFirst ? _firstChild : _secondChild; auto remainingChild = closeFirst ? _secondChild : _firstChild; const bool splitWidth = _splitState == SplitState::Vertical; - const auto totalSize = splitWidth ? _root.ActualWidth() : _root.ActualHeight(); Size removedOriginalSize{ ::base::saturated_cast(removedChild->_root.ActualWidth()), diff --git a/src/cascadia/TerminalCore/Terminal.cpp b/src/cascadia/TerminalCore/Terminal.cpp index 9cc4aea47..68e8424ed 100644 --- a/src/cascadia/TerminalCore/Terminal.cpp +++ b/src/cascadia/TerminalCore/Terminal.cpp @@ -230,16 +230,10 @@ void Terminal::UpdateAppearance(const ICoreAppearance& appearance) } const auto dx = ::base::ClampSub(viewportSize.X, oldDimensions.X); - - const auto oldTop = _mutableViewport.Top(); - const short newBufferHeight = ::base::ClampAdd(viewportSize.Y, _scrollbackLines); COORD bufferSize{ viewportSize.X, newBufferHeight }; - // Save cursor's relative height versus the viewport - const short sCursorHeightInViewportBefore = ::base::ClampSub(_buffer->GetCursor().GetPosition().Y, _mutableViewport.Top()); - // This will be used to determine where the viewport should be in the new buffer. const short oldViewportTop = _mutableViewport.Top(); short newViewportTop = oldViewportTop; diff --git a/src/cascadia/UnitTests_Remoting/RemotingTests.cpp b/src/cascadia/UnitTests_Remoting/RemotingTests.cpp index 708653d01..28b502927 100644 --- a/src/cascadia/UnitTests_Remoting/RemotingTests.cpp +++ b/src/cascadia/UnitTests_Remoting/RemotingTests.cpp @@ -1656,7 +1656,7 @@ namespace RemotingUnitTests auto m0 = make_private(monarch0PID); auto p1 = make_private(peasant1PID); - auto p2 = make_private(peasant1PID); + auto p2 = make_private(peasant2PID); p1->WindowName(L"one"); p2->WindowName(L"two"); diff --git a/src/cascadia/UnitTests_TerminalCore/ConptyRoundtripTests.cpp b/src/cascadia/UnitTests_TerminalCore/ConptyRoundtripTests.cpp index 3421a8dea..1543ea632 100644 --- a/src/cascadia/UnitTests_TerminalCore/ConptyRoundtripTests.cpp +++ b/src/cascadia/UnitTests_TerminalCore/ConptyRoundtripTests.cpp @@ -1077,7 +1077,6 @@ void ConptyRoundtripTests::PassthroughClearAll() } auto verifyBuffer = [&](const TextBuffer& tb, const til::rectangle viewport, const bool afterClear = false) { - const auto firstRow = viewport.top(); const auto width = viewport.width(); // "~" rows @@ -1781,7 +1780,6 @@ void ConptyRoundtripTests::ClearHostTrickeryTest() END_TEST_METHOD_PROPERTIES(); constexpr int PaintEveryNewline = 0; constexpr int PaintAfterAllNewlines = 1; - constexpr int DontPaintAfterNewlines = 2; INIT_TEST_PROPERTY(int, paintEachNewline, L"Any of: manually PaintFrame after each newline is emitted, once at the end of all newlines, or not at all"); INIT_TEST_PROPERTY(bool, cursorOnNextLine, L"Either leave the cursor on the first line, or place it on the second line of the buffer"); @@ -2562,7 +2560,6 @@ void ConptyRoundtripTests::ResizeRepaintVimExeBuffer() sm.ProcessString(L"BBB"); sm.ProcessString(L"\r\n"); - const auto end = 2 * hostView.Height(); for (auto i = 2; i < hostView.BottomInclusive(); i++) { // IMPORTANT! The way vim writes these blank lines is as '~' followed by @@ -2581,10 +2578,6 @@ void ConptyRoundtripTests::ResizeRepaintVimExeBuffer() drawVim(); - const auto firstTextLength = TerminalViewWidth - 2; - const auto spacesLength = 3; - const auto secondTextLength = 1; - auto verifyBuffer = [&](const TextBuffer& tb, const til::rectangle viewport) { const auto firstRow = viewport.top(); const auto width = viewport.width(); @@ -2696,7 +2689,6 @@ void ConptyRoundtripTests::ClsAndClearHostClearsScrollbackTest() } auto verifyBuffer = [&](const TextBuffer& tb, const til::rectangle viewport, const bool afterClear = false) { - const auto firstRow = viewport.top(); const auto width = viewport.width(); // "~" rows @@ -2910,8 +2902,6 @@ void ConptyRoundtripTests::ResizeInitializeBufferWithDefaultAttrs() // { static_cast(XTERM_GREEN_ATTR) }); terminalGreenAttrs.SetIndexedBackground(XTERM_GREEN_ATTR); - const size_t width = static_cast(TerminalViewWidth); - // Use an initial ^[[m to start printing with default-on-default sm.ProcessString(L"\x1b[m"); @@ -3043,8 +3033,6 @@ void ConptyRoundtripTests::NewLinesAtBottomWithBackground() terminalBlueAttrs.SetIndexedForeground(XTERM_GREEN_ATTR); terminalBlueAttrs.SetIndexedBackground(XTERM_BLUE_ATTR); - const size_t width = static_cast(TerminalViewWidth); - // We're going to print 4 more rows than the entire height of the viewport, // causing the buffer to circle 4 times. This is 2 extra iterations of the // two lines we're printing per iteration. @@ -3162,7 +3150,6 @@ void ConptyRoundtripTests::WrapNewLineAtBottom() // timings for the frame affect the results. In this test we'll be printing // a bunch of paired lines. These values control when the PaintFrame calls // will occur: - constexpr int DontPaint = 0; // Only paint at the end of all the output constexpr int PaintAfterBothLines = 1; // Paint after each pair of lines is output constexpr int PaintEveryLine = 2; // Paint after each and every line is output. @@ -3343,7 +3330,6 @@ void ConptyRoundtripTests::WrapNewLineAtBottomLikeMSYS() // timings for the frame affect the results. In this test we'll be printing // a bunch of paired lines. These values control when the PaintFrame calls // will occur: - constexpr int DontPaint = 0; // Only paint at the end of all the output constexpr int PaintAfterBothLines = 1; // Paint after each pair of lines is output constexpr int PaintEveryLine = 2; // Paint after each and every line is output. diff --git a/src/cascadia/WindowsTerminal/IslandWindow.cpp b/src/cascadia/WindowsTerminal/IslandWindow.cpp index 90433a861..6278b6c20 100644 --- a/src/cascadia/WindowsTerminal/IslandWindow.cpp +++ b/src/cascadia/WindowsTerminal/IslandWindow.cpp @@ -287,8 +287,6 @@ LRESULT IslandWindow::_OnMoving(const WPARAM /*wParam*/, const LPARAM lParam) void IslandWindow::Initialize() { - const bool initialized = (_interopWindowHandle != nullptr); - _source = DesktopWindowXamlSource{}; auto interop = _source.as(); diff --git a/src/host/stream.cpp b/src/host/stream.cpp index 4b0ba6c67..9d5fe4e14 100644 --- a/src/host/stream.cpp +++ b/src/host/stream.cpp @@ -707,8 +707,6 @@ size_t RetrieveNumberOfSpaces(_In_ SHORT sOriginalCursorPositionX, return STATUS_BUFFER_TOO_SMALL; } - const size_t OutputBufferSize = buffer.size_bytes(); - if (readHandleState.IsInputPending()) { return _ReadPendingInput(inputBuffer, diff --git a/src/interactivity/base/EventSynthesis.cpp b/src/interactivity/base/EventSynthesis.cpp index 9d1c217d9..e73c06727 100644 --- a/src/interactivity/base/EventSynthesis.cpp +++ b/src/interactivity/base/EventSynthesis.cpp @@ -181,7 +181,6 @@ std::deque> Microsoft::Console::Interactivity::Synthes UNICODE_NULL, LEFT_ALT_PRESSED)); - const int radix = 10; std::wstring wstr{ wch }; const auto convertedChars = ConvertToA(codepage, wstr); if (convertedChars.size() == 1) diff --git a/src/interactivity/win32/windowproc.cpp b/src/interactivity/win32/windowproc.cpp index 649cc1f01..ad88dc7fa 100644 --- a/src/interactivity/win32/windowproc.cpp +++ b/src/interactivity/win32/windowproc.cpp @@ -181,7 +181,6 @@ using namespace Microsoft::Console::Types; // First retrieve the new DPI and the current DPI. DWORD const dpiProposed = (WORD)wParam; - DWORD const dpiCurrent = g.dpi; // Now we need to get what the font size *would be* if we had this new DPI. We need to ask the renderer about that. const FontInfo& fiCurrent = ScreenInfo.GetCurrentFont(); diff --git a/src/renderer/vt/state.cpp b/src/renderer/vt/state.cpp index 5fc185338..93ad4ade6 100644 --- a/src/renderer/vt/state.cpp +++ b/src/renderer/vt/state.cpp @@ -163,8 +163,6 @@ VtEngine::VtEngine(_In_ wil::unique_hfile pipe, // - S_OK or suitable HRESULT error from writing pipe. [[nodiscard]] HRESULT VtEngine::_WriteTerminalAscii(const std::wstring_view wstr) noexcept { - const size_t cchActual = wstr.length(); - std::string needed; needed.reserve(wstr.size()); diff --git a/src/til/ut_til/MathTests.cpp b/src/til/ut_til/MathTests.cpp index 056d03edc..6e031fb44 100644 --- a/src/til/ut_til/MathTests.cpp +++ b/src/til/ut_til/MathTests.cpp @@ -44,10 +44,7 @@ class MathTests _RunCases(til::math::truncating, cases); - const auto fn = []() { - const auto v = til::math::details::truncating_t::cast(NAN); - }; - VERIFY_THROWS_SPECIFIC(fn(), wil::ResultException, [](wil::ResultException& e) { return e.GetErrorCode() == E_ABORT; }); + VERIFY_THROWS_SPECIFIC(til::math::details::truncating_t::cast(NAN), wil::ResultException, [](wil::ResultException& e) { return e.GetErrorCode() == E_ABORT; }); } TEST_METHOD(Ceiling) @@ -65,10 +62,7 @@ class MathTests _RunCases(til::math::ceiling, cases); - const auto fn = []() { - const auto v = til::math::details::ceiling_t::cast(NAN); - }; - VERIFY_THROWS_SPECIFIC(fn(), wil::ResultException, [](wil::ResultException& e) { return e.GetErrorCode() == E_ABORT; }); + VERIFY_THROWS_SPECIFIC(til::math::details::ceiling_t::cast(NAN), wil::ResultException, [](wil::ResultException& e) { return e.GetErrorCode() == E_ABORT; }); } TEST_METHOD(Flooring) @@ -86,10 +80,7 @@ class MathTests _RunCases(til::math::flooring, cases); - const auto fn = []() { - const auto v = til::math::details::flooring_t::cast(NAN); - }; - VERIFY_THROWS_SPECIFIC(fn(), wil::ResultException, [](wil::ResultException& e) { return e.GetErrorCode() == E_ABORT; }); + VERIFY_THROWS_SPECIFIC(til::math::details::flooring_t::cast(NAN), wil::ResultException, [](wil::ResultException& e) { return e.GetErrorCode() == E_ABORT; }); } TEST_METHOD(Rounding) @@ -107,10 +98,7 @@ class MathTests _RunCases(til::math::rounding, cases); - const auto fn = []() { - const auto v = til::math::details::rounding_t::cast(NAN); - }; - VERIFY_THROWS_SPECIFIC(fn(), wil::ResultException, [](wil::ResultException& e) { return e.GetErrorCode() == E_ABORT; }); + VERIFY_THROWS_SPECIFIC(til::math::details::rounding_t::cast(NAN), wil::ResultException, [](wil::ResultException& e) { return e.GetErrorCode() == E_ABORT; }); } TEST_METHOD(NormalIntegers) diff --git a/src/til/ut_til/PointTests.cpp b/src/til/ut_til/PointTests.cpp index 00a25b193..a98531bd1 100644 --- a/src/til/ut_til/PointTests.cpp +++ b/src/til/ut_til/PointTests.cpp @@ -765,7 +765,6 @@ class PointTests Log::Comment(L"4.) Division by zero"); { - constexpr ptrdiff_t bigSize = std::numeric_limits().max(); const til::point pt{ 1, 1 }; const int scale = 0;