MCPcopy Create free account
hub / github.com/ProgerXP/Notepad2e / HLS_Get_word

Function HLS_Get_word

src/HLSelection.c:363–399  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

361}
362
363VOID HLS_Get_word()
364{
365 int sel_len = 0 , cpos = 0 ;
366 //
367 if ( _hl_se_tr.lpstrText ) {
368 HL_Free ( _hl_se_tr.lpstrText );
369 _hl_se_tr.lpstrText = 0;
370 }
371 //
372 cpos = SendMessage ( hwndEdit , SCI_GETCURRENTPOS , 0 , 0 );
373 //
374 if ( _hl_se_init ) {
375 _hl_se_tr.chrg.cpMin = SendMessage ( hwndEdit , SCI_GETSELECTIONSTART , 0 , 0 );
376 _hl_se_tr.chrg.cpMax = SendMessage ( hwndEdit , SCI_GETSELECTIONEND , 0 , 0 );
377 sel_len = _hl_se_tr.chrg.cpMax - _hl_se_tr.chrg.cpMin;
378 _hl_se_mode_whole_word = FALSE;
379 //
380 if ( sel_len < 1 ) {
381 sel_len = 0;
382 }
383 }
384 if ( 0 == sel_len ) {
385 _hl_se_tr.chrg.cpMin = SendMessage ( hwndEdit , SCI_WORDSTARTPOSITION , cpos , TRUE );
386 _hl_se_tr.chrg.cpMax = SendMessage ( hwndEdit , SCI_WORDENDPOSITION , cpos , TRUE );
387 sel_len = _hl_se_tr.chrg.cpMax - _hl_se_tr.chrg.cpMin;
388 _hl_se_mode_whole_word = TRUE;
389 }
390 //
391 if ( sel_len > ( !_hl_se_init || _hl_se_mode_whole_word ) ? 1 : 0 ) {
392 _hl_se_tr.lpstrText = HL_Alloc ( sel_len + 1 );
393 SendMessage ( hwndEdit, SCI_GETTEXTRANGE , 0 , ( LPARAM ) &_hl_se_tr );
394 // HL_TRACE_TR(_hl_se_tr);
395 } else {
396 _hl_se_tr.chrg.cpMin = 0;
397 _hl_se_tr.chrg.cpMax = 0;
398 }
399}
400
401VOID HLS_Highlight_turn ( )
402{

Callers 1

HLS_Highlight_turnFunction · 0.85

Calls 2

HL_FreeFunction · 0.85
HL_AllocFunction · 0.85

Tested by

no test coverage detected