Changeset 2878
- Timestamp:
- Jan 14, 2018, 10:35:43 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/src/netlabs/macros/filelist.e ¶
r2797 r2878 430 430 431 431 ; --------------------------------------------------------------------------- 432 ; This won't add an entry while the CommandLine is open. 433 defproc AddToCommandBox( NewItem) 434 universal app_hini 435 436 MaxLength = 1599 -- for ETK strings 437 Delim = \0 438 MarkupString = '.** CommandBox'\0 439 LenMarkup = length( MarkupString) 440 -- History items are saved reversed, MarkupString''OldestItem -> NewestItem''MarkupString. 441 History = QueryProfile( app_hini, 'EPM', 'CommandBox') 442 LenHistory = length( History) 443 444 if History = '' then 445 -- nop 446 -- Check presence of markup string 447 elseif leftstr( History, LenMarkup) <> MarkupString | 448 rightstr( History, LenMarkup) <> MarkupString then 449 return 450 else 451 -- Strip MarkupString 452 History = substr( History, LenMarkup + 1, LenHistory - (2 * LenMarkup)) 453 endif 454 455 -- Append NewItem to History 456 History = History''NewItem''Delim 457 458 -- Reverse history string. 459 RevHistory = reverse( History) 460 461 -- Limit string to MaxLength, separate at history entries 462 rest = RevHistory 463 NewHistory = '' 464 do forever 465 if rest = '' then 466 leave 467 endif 468 -- Get next item 469 parse value rest with next (Delim) rest 470 if next = '' then 471 iterate 472 endif 473 -- Check length 474 if length( NewHistory) + 1 + length( next) > MaxLength - (2 * LenMarkup) then 475 leave 476 endif 477 if next = '' then 478 iterate 479 endif 480 -- Append delimiter and next item to reversed history 481 NewHistory = NewHistory''Delim''next 482 enddo 483 RevHistory = NewHistory 484 485 -- Reverse history string back 486 History = reverse( RevHistory) 487 488 -- Re-add MarkupString 489 History = MarkupString''History''MarkupString 490 491 -- Write to ini 492 call SetProfile( app_hini, 'EPM', 'CommandBox', History) 493 494 return 495 496 ; --------------------------------------------------------------------------- 432 497 ; Called by edit and save. 433 498 defproc AddToHistory( Listname, NewItem) 499 ListName = upcase( Listname) 500 501 if ListName = 'COMMANDLINE' then 502 call AddToCommandBox( NewItem) 503 return 504 endif 505 434 506 KeyPath = '\NEPMD\Var\History' 435 507 Enabled = QueryConfigKey( KeyPath) … … 442 514 MaxItems = 200 443 515 Delim = \1 444 445 ListName = upcase( Listname)446 516 447 517 fIgnore = 1
Note:
See TracChangeset
for help on using the changeset viewer.