Skip to content

Commit

Permalink
Merge pull request #203 from scholtzan/add-next-to-selection
Browse files Browse the repository at this point in the history
Add next to selection
  • Loading branch information
cmyr authored Jun 29, 2018
2 parents 80e6723 + b9873c4 commit ea87386
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
18 changes: 12 additions & 6 deletions XiEditor/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="14109" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14109"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13771"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
<capability name="stacking Non-gravity area distributions on NSStackView" minToolsVersion="7.0" minSystemVersion="10.11"/>
</dependencies>
Expand Down Expand Up @@ -191,7 +191,7 @@ Gw
<rect key="frame" x="8" y="0.0" width="464" height="38"/>
<subviews>
<searchField wantsLayer="YES" focusRingType="none" verticalHuggingPriority="750" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="yjF-1R-sp7" customClass="FindSearchField" customModule="XiEditor" customModuleProvider="target">
<rect key="frame" x="0.0" y="8" width="365" height="22"/>
<rect key="frame" x="0.0" y="8" width="363" height="22"/>
<searchFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" borderStyle="bezel" focusRingType="none" bezelStyle="round" recentsAutosaveName="xi-editor-find" id="4a0-aC-Kre">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
Expand All @@ -207,7 +207,7 @@ Gw
</connections>
</searchField>
<segmentedControl verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="usm-aH-bgF">
<rect key="frame" x="372" y="9" width="41" height="20"/>
<rect key="frame" x="370" y="9" width="43" height="20"/>
<segmentedCell key="cell" borderStyle="border" alignment="left" style="roundRect" trackingMode="momentary" id="53c-PL-hc5">
<font key="font" metaFont="cellTitle"/>
<segments>
Expand Down Expand Up @@ -510,11 +510,17 @@ Gw
<action selector="performCustomFinderAction:" target="7er-QZ-amI" id="NCr-C4-VFL"/>
</connections>
</menuItem>
<menuItem title="Jump to Selection" keyEquivalent="j" id="CkI-7q-fng">
<menuItem title="Add Next to Selection" tag="7" keyEquivalent="d" id="R9c-gO-Jhe" userLabel="Add Next to Selection">
<connections>
<action selector="centerSelectionInVisibleArea:" target="7er-QZ-amI" id="cSm-kk-Scc"/>
<action selector="addNextToSelection:" target="7er-QZ-amI" id="dcA-Ho-qnI"/>
</connections>
</menuItem>
<menuItem title="Add Next and Remove Current..." tag="7" keyEquivalent="D" id="9DI-GT-19Y" userLabel="Add Next and Remove Current Selection">
<connections>
<action selector="addNextToSelectionRemoveCurrent:" target="7er-QZ-amI" id="3aA-qn-leZ"/>
</connections>
</menuItem>
<menuItem title="Jump to Selection" keyEquivalent="j" id="CkI-7q-fng"/>
</items>
</menu>
</menuItem>
Expand Down
10 changes: 10 additions & 0 deletions XiEditor/Search.swift
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,16 @@ extension EditViewController {
(findViewController.searchField as? FindSearchField)?.resultCount = resultCount
}
}

@IBAction func addNextToSelection(_ sender: AnyObject?) {
document.sendRpcAsync("selection_for_find", params: ["case_sensitive": false])
document.sendRpcAsync("find_next", params: ["allow_same": true, "add_to_selection": true, "modify_selection": "add"])
}

@IBAction func addNextToSelectionRemoveCurrent(_ sender: AnyObject?) {
document.sendRpcAsync("selection_for_find", params: ["case_sensitive": false])
document.sendRpcAsync("find_next", params: ["allow_same": true, "add_to_selection": true, "modify_selection": "add_removing_current"])
}

@IBAction func performCustomFinderAction(_ sender: Any?) {
guard let tag = (sender as AnyObject).value(forKey: "tag") as? Int,
Expand Down

0 comments on commit ea87386

Please sign in to comment.