@@ -172,18 +172,18 @@ protected override void OnPointerMoved(PointerEventArgs e)
172
172
173
173
protected override void OnPointerPressed ( PointerPressedEventArgs e )
174
174
{
175
+ var point = e . GetCurrentPoint ( this ) ;
176
+
175
177
if ( _lastHover != null )
176
178
{
179
+ var link = _lastHover . Link ;
177
180
e . Pointer . Capture ( null ) ;
178
181
179
182
if ( _lastHover . IsCommitSHA )
180
183
{
181
184
var parentView = this . FindAncestorOfType < CommitBaseInfo > ( ) ;
182
185
if ( parentView is { DataContext : ViewModels . CommitDetail detail } )
183
186
{
184
- var point = e . GetCurrentPoint ( this ) ;
185
- var link = _lastHover . Link ;
186
-
187
187
if ( point . Properties . IsLeftButtonPressed )
188
188
{
189
189
detail . NavigateTo ( _lastHover . Link ) ;
@@ -217,9 +217,6 @@ protected override void OnPointerPressed(PointerPressedEventArgs e)
217
217
}
218
218
else
219
219
{
220
- var point = e . GetCurrentPoint ( this ) ;
221
- var link = _lastHover . Link ;
222
-
223
220
if ( point . Properties . IsLeftButtonPressed )
224
221
{
225
222
Native . OS . OpenBrowser ( link ) ;
@@ -255,6 +252,49 @@ protected override void OnPointerPressed(PointerPressedEventArgs e)
255
252
return ;
256
253
}
257
254
255
+ if ( point . Properties . IsLeftButtonPressed && e . ClickCount == 3 )
256
+ {
257
+ var text = Inlines ? . Text ;
258
+ if ( string . IsNullOrEmpty ( text ) )
259
+ {
260
+ e . Handled = true ;
261
+ return ;
262
+ }
263
+
264
+ var position = e . GetPosition ( this ) - new Point ( Padding . Left , Padding . Top ) ;
265
+ var x = Math . Min ( Math . Max ( position . X , 0 ) , Math . Max ( TextLayout . WidthIncludingTrailingWhitespace , 0 ) ) ;
266
+ var y = Math . Min ( Math . Max ( position . Y , 0 ) , Math . Max ( TextLayout . Height , 0 ) ) ;
267
+ position = new Point ( x , y ) ;
268
+
269
+ var textPos = TextLayout . HitTestPoint ( position ) . TextPosition ;
270
+ var lineStart = 0 ;
271
+ var lineEnd = text . IndexOf ( '\n ' , lineStart ) ;
272
+ if ( lineEnd <= 0 )
273
+ {
274
+ lineEnd = text . Length ;
275
+ }
276
+ else
277
+ {
278
+ while ( lineEnd < textPos )
279
+ {
280
+ lineStart = lineEnd + 1 ;
281
+ lineEnd = text . IndexOf ( '\n ' , lineStart ) ;
282
+ if ( lineEnd == - 1 )
283
+ {
284
+ lineEnd = text . Length ;
285
+ break ;
286
+ }
287
+ }
288
+ }
289
+
290
+ SetCurrentValue ( SelectionStartProperty , lineStart ) ;
291
+ SetCurrentValue ( SelectionEndProperty , lineEnd ) ;
292
+
293
+ e . Pointer . Capture ( this ) ;
294
+ e . Handled = true ;
295
+ return ;
296
+ }
297
+
258
298
base . OnPointerPressed ( e ) ;
259
299
}
260
300
0 commit comments