mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
ADD: support Finder Tag - step 7: fix the issue about text selection
This commit is contained in:
parent
4807910fd7
commit
c470b315a6
1 changed files with 15 additions and 4 deletions
|
|
@ -297,24 +297,35 @@ end;
|
|||
procedure TCocoaTokenField.textViewDidChangeSelection( notification: NSNotification);
|
||||
var
|
||||
range: NSRange;
|
||||
i: NSUInteger;
|
||||
beginIndex: NSUInteger;
|
||||
endIndex: NSUInteger;
|
||||
i: NSUInteger;
|
||||
tokenNames: NSArray;
|
||||
editor: NSText;
|
||||
begin
|
||||
if _selectedTokenObjects = nil then
|
||||
_selectedTokenObjects:= NSMutableSet.new
|
||||
else
|
||||
_selectedTokenObjects.removeAllObjects;
|
||||
|
||||
self.currentEditor.setNeedsDisplay_( True );
|
||||
editor:= self.currentEditor;
|
||||
if editor = nil then
|
||||
Exit;
|
||||
|
||||
editor.setNeedsDisplay_( True );
|
||||
|
||||
range:= self.currentEditor.selectedRange;
|
||||
if range.length = 0 then
|
||||
Exit;
|
||||
|
||||
tokenNames:= NSArray( objectValue );
|
||||
beginIndex:= range.location;
|
||||
endIndex:= range.location + range.length - 1;
|
||||
for i:= range.location to endIndex do begin
|
||||
|
||||
if editor.string_.characterAtIndex(beginIndex) <> NSAttachmentCharacter then
|
||||
Exit;
|
||||
|
||||
tokenNames:= NSArray( objectValue );
|
||||
for i:= beginIndex to endIndex do begin
|
||||
_selectedTokenObjects.addObject( tokenNames.objectAtIndex(i) );
|
||||
end;
|
||||
end;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue