Skip to content

Commit

Permalink
Add frontend handling for move line
Browse files Browse the repository at this point in the history
  • Loading branch information
nangtrongvuon committed Sep 13, 2018
1 parent 3512b71 commit 900723f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
8 changes: 8 additions & 0 deletions XiEditor/EditViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,14 @@ class EditViewController: NSViewController, EditViewDataSource, FindDelegate, Sc
document.sendRpcAsync("outdent", params: [])
}

@objc func moveLineUp(_ sender: AnyObject?) {
document.sendRpcAsync("move_line_up", params: [])
}

@objc func moveLineDown(_ sender: AnyObject?) {
document.sendRpcAsync("move_line_down", params: [])
}

fileprivate func cutCopy(_ method: String) {
if let result = document?.sendRpc(method, params: []) {
switch result {
Expand Down
23 changes: 18 additions & 5 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="13771" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13771"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14113"/>
<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 @@ -214,7 +214,7 @@ Gw
<rect key="frame" x="408" y="0.0" width="176" height="22"/>
<subviews>
<segmentedControl verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="usm-aH-bgF">
<rect key="frame" x="-1" y="1" width="57" height="20"/>
<rect key="frame" x="-1" y="1" width="56" height="20"/>
<segmentedCell key="cell" borderStyle="border" alignment="left" style="roundRect" trackingMode="momentary" id="53c-PL-hc5">
<font key="font" metaFont="cellTitle"/>
<segments>
Expand All @@ -227,7 +227,7 @@ Gw
</connections>
</segmentedControl>
<button verticalHuggingPriority="750" tag="9" translatesAutoresizingMaskIntoConstraints="NO" id="OLd-3g-GU4" userLabel="Find All Button">
<rect key="frame" x="61" y="1" width="56" height="19"/>
<rect key="frame" x="60" y="1" width="56" height="19"/>
<buttonCell key="cell" type="roundRect" title="Find All" bezelStyle="roundedRect" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="wFY-L9-Tvu">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="cellTitle"/>
Expand All @@ -237,7 +237,7 @@ Gw
</connections>
</button>
<button verticalHuggingPriority="750" tag="11" translatesAutoresizingMaskIntoConstraints="NO" id="5rw-0w-Suw">
<rect key="frame" x="123" y="1" width="53" height="19"/>
<rect key="frame" x="122" y="1" width="54" height="19"/>
<buttonCell key="cell" type="roundRect" title="Done" bezelStyle="roundedRect" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="FOD-1e-hKW">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="cellTitle"/>
Expand Down Expand Up @@ -533,6 +533,19 @@ Gw
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="HU9-QD-3rl"/>
<menuItem title="Move Line Up" keyEquivalent="" id="RLx-eh-Dve" userLabel="Move Line Up">
<modifierMask key="keyEquivalentModifierMask" option="YES"/>
<connections>
<action selector="moveLineUp:" target="7er-QZ-amI" id="DfR-xs-esy"/>
</connections>
</menuItem>
<menuItem title="Move Line Down" keyEquivalent="" id="AuB-DE-f4W">
<modifierMask key="keyEquivalentModifierMask" option="YES"/>
<connections>
<action selector="moveLineDown:" target="7er-QZ-amI" id="l3R-s9-H0m"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="tV1-Yv-95y"/>
<menuItem title="Cut" keyEquivalent="x" id="Alj-56-nPN">
<connections>
<action selector="cut:" target="7er-QZ-amI" id="aKl-vW-7DZ"/>
Expand Down

0 comments on commit 900723f

Please sign in to comment.