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

Function HLS_process_changes

src/HLSelection.c:432–600  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

430
431
432BOOL HLS_process_changes ( UINT opt )
433{
434 int old_ind;
435 int new_len = 0;
436 int k = 0;
437 int doc_len = SendMessage ( hwndEdit , SCI_GETTEXTLENGTH, 0, 0 );
438 BOOL out = TRUE;
439 BOOL work = TRUE;
440 BOOL cur_se = FALSE;
441 BOOL rollback = opt & SEO_ROLLBACK ;
442 char *old_word = 0;
443 struct Sci_TextRange tr;
444 int cur_pos = SendMessage ( hwndEdit , SCI_GETCURRENTPOS , 0 , 0 );
445 int delta_len = 0;
446 //
447 tr.lpstrText = 0;
448 old_ind = SendMessage ( hwndEdit , SCI_GETINDICATORCURRENT , 0 , 0 );
449 //
450 if ( cur_pos < _hl_se_tr.chrg.cpMin || cur_pos > _hl_se_tr.chrg.cpMax ) {
451 HL_TRACE ( "OUT OF BOUND SE exit (applied) %d %d %d" , cur_pos , _hl_se_tr.chrg.cpMin , _hl_se_tr.chrg.cpMax );
452 out = FALSE;
453 goto _EXIT;
454 }
455 //
456 if ( _hl_se_tr.chrg.cpMax < _hl_se_tr.chrg.cpMin ) {
457 HL_TRACE ( "critical SE exit" );
458 out = FALSE;
459 goto _EXIT;
460 }
461 //
462 new_len = _hl_se_tr.chrg.cpMax - _hl_se_tr.chrg.cpMin;
463 old_word = HL_Alloc ( _hl_se_old_len + 1 );
464 tr.lpstrText = HL_Alloc ( _hl_se_old_len + 1 );
465 //
466 /*
467 SET EDIT INDOCATOR
468 */
469 SendMessage ( hwndEdit , SCI_SETINDICATORCURRENT , HL_SELECT_INDICATOR_EDIT , 0 );
470 //
471 assert ( _hl_se_tr.lpstrText );
472 strcpy ( old_word , _hl_se_tr.lpstrText );
473 if ( rollback ) {
474 if ( 0 == _hl_se_orig_word ) {
475 //
476 HL_TRACE ( "NO original word ????????????????" );
477 goto _EXIT;
478 }
479 HL_TRACE ( "ROLLBACK to TR '%s' (%d - %d) " , _hl_se_orig_word , _hl_se_tr.chrg.cpMin , _hl_se_tr.chrg.cpMax );
480 new_len = strlen ( _hl_se_orig_word );
481 if ( _hl_se_tr.lpstrText && new_len != strlen ( _hl_se_tr.lpstrText ) ) {
482 _hl_se_tr.lpstrText = HL_Realloc ( _hl_se_tr.lpstrText , strlen ( _hl_se_orig_word ) + 1 );
483 }
484#if 0 == HL_CASE_SENSITIVE_ROLLBACK
485 strcpy ( _hl_se_tr.lpstrText , _hl_se_orig_word );
486#endif
487 } else {
488 if ( _hl_se_tr.lpstrText && ( _hl_se_tr.chrg.cpMax - _hl_se_tr.chrg.cpMin ) != _hl_se_old_len ) {
489 _hl_se_tr.lpstrText = HL_Realloc ( _hl_se_tr.lpstrText , _hl_se_tr.chrg.cpMax - _hl_se_tr.chrg.cpMin + 1 );

Callers 2

HLS_Edit_selection_stopFunction · 0.85
HLS_Update_selectionFunction · 0.85

Calls 5

HL_AllocFunction · 0.85
HL_ReallocFunction · 0.85
case_compareFunction · 0.85
HLS_Sci_event_maskFunction · 0.85
HL_FreeFunction · 0.85

Tested by

no test coverage detected