-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chunk Selection Expansion for Double/Triple Click Selection (#2184)
Double/Triple click create a selection expanding beyond one cell. This PR makes it so that when you're dragging your mouse to expand the selection, you expand to the next delimiter defined by double/triple click. So, double click expands by doubleClickDelimiter ranges. Triple click expands by line. When you double/triple click, a word/line is selected. When you drag, that word/line will remain selected after the expansion occurs. Closes #1933 ## Details Rather than resizing the selection when the mouse event occurs, I figured I'd do what I did with wide glyph selection: expand at render time. We needed an enum `multiClickSelectionMode` to keep track of which expansion mode we're in. Minor modifications to `_ExpandDoubleClickSelection*(COORD)` had to be made so that we can re-use them. Actual expansion occurs in `_GetSelectionRects()` ## Validation Steps Performed - generic double click test - `dir` or `ls` - double click a word - drag up - Works! ✔ - double click on delimiter test - `dir` or `ls` - double click a word delimiter (i.e.: space between words) - drag up - Works! ✔ - generic triple click test - `dir` or `ls` - triple click a line - drag up - Works! ✔ - ALT + double click test - `dir` or `ls` - hold ALT - double click a word - drag up - Works! ✔ repeat above tests in following scenarios: - when at top of scrollback - drag down instead of up
- Loading branch information
1 parent
82de43b
commit 1f41fd3
Showing
6 changed files
with
320 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#pragma once | ||
|
||
#include "precomp.h" | ||
#include <WexTestClass.h> | ||
|
||
#include "DefaultSettings.h" | ||
|
||
#include "winrt/Microsoft.Terminal.Settings.h" | ||
|
||
using namespace winrt::Microsoft::Terminal::Settings; | ||
|
||
namespace TerminalCoreUnitTests | ||
{ | ||
class MockTermSettings : public winrt::implements<MockTermSettings, ICoreSettings> | ||
{ | ||
public: | ||
MockTermSettings(int32_t historySize, int32_t initialRows, int32_t initialCols) : | ||
_historySize(historySize), | ||
_initialRows(initialRows), | ||
_initialCols(initialCols) | ||
{ | ||
} | ||
|
||
// property getters - all implemented | ||
int32_t HistorySize() { return _historySize; } | ||
int32_t InitialRows() { return _initialRows; } | ||
int32_t InitialCols() { return _initialCols; } | ||
uint32_t DefaultForeground() { return COLOR_WHITE; } | ||
uint32_t DefaultBackground() { return COLOR_BLACK; } | ||
bool SnapOnInput() { return false; } | ||
uint32_t CursorColor() { return COLOR_WHITE; } | ||
CursorStyle CursorShape() const noexcept { return CursorStyle::Vintage; } | ||
uint32_t CursorHeight() { return 42UL; } | ||
winrt::hstring WordDelimiters() { return winrt::to_hstring(DEFAULT_WORD_DELIMITERS.c_str()); } | ||
|
||
// other implemented methods | ||
uint32_t GetColorTableEntry(int32_t) const { return 123; } | ||
|
||
// property setters - all unimplemented | ||
void HistorySize(int32_t) {} | ||
void InitialRows(int32_t) {} | ||
void InitialCols(int32_t) {} | ||
void DefaultForeground(uint32_t) {} | ||
void DefaultBackground(uint32_t) {} | ||
void SnapOnInput(bool) {} | ||
void CursorColor(uint32_t) {} | ||
void CursorShape(CursorStyle const&) noexcept {} | ||
void CursorHeight(uint32_t) {} | ||
void WordDelimiters(winrt::hstring) {} | ||
|
||
// other unimplemented methods | ||
void SetColorTableEntry(int32_t /* index */, uint32_t /* value */) {} | ||
|
||
private: | ||
int32_t _historySize; | ||
int32_t _initialRows; | ||
int32_t _initialCols; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.