Giter VIP home page Giter VIP logo

xi-mac's Introduction

Xi editor

Maintenance status: *The xi-editor project is currently discontinued. Although we will happily accept bug fixes, no new features are currently planned. You may be interested in the Lapce editor, which can be considered a spiritual successor to the xi-editor. — The Editors

Note: This repo contains only the editor core, which is not usable on its own. For editors based on it, check out the list in Frontends.

The xi-editor project is an attempt to build a high quality text editor, using modern software engineering techniques. It is initially built for macOS, using Cocoa for the user interface. There are also frontends for other operating systems available from third-party developers.

Goals include:

  • Incredibly high performance. All editing operations should commit and paint in under 16ms. The editor should never make you wait for anything.

  • Beauty. The editor should fit well on a modern desktop, and not look like a throwback from the ’80s or ’90s. Text drawing should be done with the best technology available (Core Text on Mac, DirectWrite on Windows, etc.), and support Unicode fully.

  • Reliability. Crashing, hanging, or losing work should never happen.

  • Developer friendliness. It should be easy to customize xi editor, whether by adding plug-ins or hacking on the core.

Learn more with the creator of Xi, Raph Levien, in this Recurse Center Localhost talk.

Screenshot:

xi-mac screenshot

Getting started

This repository is the core only. You'll also need a front-end, from the list below.

Building the core

Xi-editor targets 'recent stable Rust'. We recommend installing via rustup. The current minimum supported version is 1.40.

To build the xi-editor core from the root directory of this repo:

> cd rust
> cargo build

Frontends

Here are some front-ends in various stages of development:

  • xi-mac, the official macOS front-end.

  • xi-gtk, a GTK+ front-end.

  • xi-term, a text UI.

  • xi-electron, a cross-platform front-end based on web-technologies.

  • Tau, a GTK+ front-end written in Rust. Forked from https://github.com/bvinc/gxi, which was abandoned.

  • xi-win, an experimental Windows front-end written in Rust.

  • kod, a terminal frontend written in Golang.

  • xi-qt, a Qt front-end.

  • vixi, a Vim like front-end in Rust.

The following are currently inactive, based on earlier versions of the front-end protocol, but perhaps could be revitalized:

There are notes (I wouldn’t call it documentation at this point) on the protocol at frontend.md. If you're working on a front-end, feel free to send a PR to add it to the above list.

Design decisions

Here are some of the design decisions, and motivation why they should contribute to the above goals:

  • Separation into front-end and back-end modules. The front-end is responsible for presenting the user interface and drawing a screen full of text. The back-end (also known as “core”) holds the file buffers and is responsible for all potentially expensive editing operations.

  • Native UI. Cross-platform UI toolkits never look and feel quite right. The best technology for building a UI is the native framework of the platform. On Mac, that’s Cocoa.

  • Rust. The back-end needs to be extremely performant. In particular, it should use little more memory than the buffers being edited. That level of performance is possible in C++, but Rust offers a much more reliable, and in many ways, higher level programming platform.

  • A persistent rope data structure. Persistent ropes are efficient even for very large files. In addition, they present a simple interface to their clients - conceptually, they're a sequence of characters just like a string, and the client need not be aware of any internal structure.

  • Asynchronous operations. The editor should never, ever block and prevent the user from getting their work done. For example, autosave will spawn a thread with a snapshot of the current editor buffer (the persistent rope data structure is copy-on-write so this operation is nearly free), which can then proceed to write out to disk at its leisure, while the buffer is still fully editable.

  • Plug-ins over scripting. Most text editors have an associated scripting language for extending functionality. However, these languages are usually both more arcane and less powerful than “real” languages. The xi editor will communicate with plugins through pipes, letting them be written in any language, and making it easier to integrate with other systems such as version control, deeper static analyzers of code, etc.

  • JSON. The protocol for front-end / back-end communication, as well as between the back-end and plug-ins, is based on simple JSON messages. I considered binary formats, but the actual improvement in performance would be completely in the noise. Using JSON considerably lowers friction for developing plug-ins, as it’s available out of the box for most modern languages, and there are plenty of the libraries available for the other ones.

Current status

This is still a project in its early stages. The Mac build has basic editing functionality (it was used to write this README), but looks very spare and is still missing essentials such as auto-indent. At the moment, it’s expected that its main community will be developers interested in hacking on a text editor.

Authors

The xi-editor project was started by Raph Levien but has since received contributions from a number of other people. See the AUTHORS file for details.

License

This project is licensed under the Apache 2 license.

Contributions

We gladly accept contributions via GitHub pull requests. Please see CONTRIBUTING.md for more details.

If you are interested in contributing but not sure where to start, there is an active Zulip channel at #xi-editor on https://xi.zulipchat.com. There is also a #xi channel on irc.mozilla.org. Finally, there is a subreddit at /r/xi_editor.

xi-mac's People

Contributors

adamnemecek avatar akxcv avatar aquageek avatar cbrewster avatar cmyr avatar divinedominion avatar gbear605 avatar jansol avatar jeremywiebe avatar liamrosenfeld avatar lukakerr avatar martinjrp avatar mmatoszko avatar modelorganism avatar nangtrongvuon avatar paulsmith avatar pocket7878 avatar rakaramos avatar raphlinus avatar rkusa avatar rlziii avatar rtsuk avatar ryanbloom avatar scdf avatar scholtzan avatar terhechte avatar tsekityam avatar tzvipm avatar vlovich avatar z11h avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xi-mac's Issues

Use a pinned version of xi-core

Right now xi-mac assumes xi-editor is cloned inside the base directory. This causes issues if xi-editor has any breaking changes. It would be nice if xi-mac used a pinned version.

I propose that we use Cargo to add xi-core-lib as a dependency and have this repo contain the code to create the xi-code binary. If we use Cargo to pull in xi-core-lib as a dependency through git, it will pin the dependency by its git hash, which means we wouldn't need to worry about versioning yet. This would also allow placing xi-editor in a separate directory. If you need to use a local version of xi-core-lib while developing you can use Cargo's replace.

Disadvantages:

  • Cargo only lets you use libs as dependencies, so the xi-core bin and any rust plugins cannot be fetched from Cargo (this means moving some rust code into this codebase)

Other ideas:

  • Use git submodules
  • Use a script to clone a specific hash of xi-editor

Any thoughts?

Improve tabbed window behaviour

Our current tab handling is a bit of a hack.

To fully address that, though, we should have a clearer sense of what our desired tabbing behaviour is. as of 10.12 there's the idea of user tabbing preferences; basically the user can choose to have cmd + N always open windows as tabs, if they change a setting in System Preferences -> Dock.

I suspect we desire behaviour more like safari, where cmd+N always opens a new window, and cmd+T always creates a new tab in that window. But: I haven't thought about it much.

In any case, there's one concrete annoyance I have, currently: restoration of windows on application launch does not preserve the previous tabbing state. Any windows that were open as tabs are opened as windows.

Choking on Long Lines

Using xi-mac, I opened a relatively large XML file (2.1MB) and was quickly met with the spinny beachball of death.

Given the rope data structure design decision, I thought I'd use this as a sort of ground-truth test for large file handling.

Let me know if this ticket isn't appropriate, or if it isn't in the appropriate place.

Including file for independent verification.

Relates to xi-editor/xi-editor#210
Jobe_142274871.txt

Window frames aren't auto restored

I'm not sure if this is handled automatically by Cocoa but,

  1. Should restarting Xi automatically re-open the same documents & document window (position + size) as when we quit?
  2. Should closing a document & opening it again restore the last frame it had? Right now it seems like all documents share the same initial frame size.

Build fails with Xcode 8.3.3 (build version 8E3004b)

I am using nightly Rust and here is my version of Swift:

swift --version
Apple Swift version 3.1 (swiftlang-802.0.53 clang-802.0.42)
Target: x86_64-apple-macosx10.9

Compiling xi-plugin-lib v0.1.0 (file:///Users/rajanikanth.j/xi-mac/xi-editor/rust/plugin-lib)
warning: unused std::result::Result which must be used
--> /Users/rajanikanth.j/xi-mac/xi-editor/rust/plugin-lib/src/state_cache.rs:116:5
|
116 | plugin_base::mainloop(&mut my_handler);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: #[warn(unused_must_use)] on by default

Compiling xi-syntect-plugin v0.0.0 (file:///Users/rajanikanth.j/xi-mac/xi-editor/rust/syntect-plugin)
Finished release [optimized] target(s) in 70.4 secs

=== BUILD TARGET XiEditor OF PROJECT XiEditor WITH THE DEFAULT CONFIGURATION (Release) ===

Check dependencies
“Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.

** BUILD FAILED **

The following build commands failed:
Check dependencies
(1 failure)

Holding key doesn't bring up character accent menu

OSX for the longest time (6+ years?) has had the UI of bringing up a character accent menu when a key is held instead of doing key repeat. All applications I've tried have had this behaviour. Xi-mac appears to instead do key repeat when I'm holding down a key instead of bringing up the accent menu. Likely has to do with the custom view doing text handling.

Investigating on markdown rendering issues

Hi, I'm trying to debug some issues in xi-gtk's markdown syntax highlighting and I'd like to compare it to xi-mac's.
Can I have a screenshot of this document please?
Right now it looks like this in xi-gtk:
image
There are some issues at line 52 because there is a list and backticks. I believe the document should look like this
Thanks

Support theming

xi-mac should be themeable. In the simplest case, this should involve support for the themes provided by syntect, and ultimately it should also provide a UI for loading, editing, and saving new textmate / sublimetext theme files.

Font menu missing

From README.md

It will look better if you have InconsolataGo installed, a customized version of Inconsolata tuned for code editing. You can change fonts per window in the Font menu or with Cmd-Shift-T. To choose another default font, edit the CTFontCreateWithName() call in EditView.swift.

I followed the command line build instructions but don't have a Font menu in the menu bar, Cmd-Shift-T doesn't seem to do anything.

screen shot 2017-11-21 at 16 12 48

Double call of close()

Repro steps: open new editor, type "abc", ⌘-Q to quit, say "don't save".

thread 'main' panicked at 'missing buffer id when closing view', /Users/rustbuild/src/rust-buildbot/slave/stable-dist-rustc-mac/build/src/libcore/option.rs:715

Doing a little debugging, it looks like the close() method in Document.swift is being called twice. I don't know whether this is expected behavior (in which it should null out some of its own state on the first call and skip the second), or whether the NSDocument lifecycle is doing something dodgy to make this double call happen.

Should be an easy issue for someone who understands Cocoa.

Scrolling beyond the ends of a file is differen from TextEdit (trackpad)

In TextEdit, scrolling with the trackpad is possible even when the content fits entirely in the window or is already scrolled all the way to either end. It will overscroll and then bounce back.

Xi-mac only overscrolls when hitting the start or end of the file while scrolling. When all content fits in the window or is already scrolled to the start/end it will not scroll past the end at all. Continuing scrolling at slow speed also stops moving the view when hitting the edge of the view contents.

failed to run custom build command for `onig_sys v63.0.2`

I've followed the build instructions, I have
XCode 9,
macOS High Sierra 10.13 (17A365),
CMake 3.9.3,

and when I xcodebuild,
I got the this error: Failed to run custom build command for 'onig_sys v63.0.2'
here are the logs:

ExternalBuildToolExecution xicore
    cd /Users/bluemix/Rust/xi-mac/xi-editor/rust
    export ACTION=
    export ALTERNATE_GROUP=staff
    export ALTERNATE_MODE=u+w,go-w,a+rX
    export ALTERNATE_OWNER=bluemix
    export ALWAYS_SEARCH_USER_PATHS=NO
    export APPLE_INTERNAL_DEVELOPER_DIR=/AppleInternal/Developer
    export APPLE_INTERNAL_DIR=/AppleInternal
    export APPLE_INTERNAL_DOCUMENTATION_DIR=/AppleInternal/Documentation
    export APPLE_INTERNAL_LIBRARY_DIR=/AppleInternal/Library
    export APPLE_INTERNAL_TOOLS=/AppleInternal/Developer/Tools
    export APPLICATION_EXTENSION_API_ONLY=NO
    export APPLY_RULES_IN_COPY_FILES=NO
    export ARCHS=x86_64
    export AVAILABLE_PLATFORMS="appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator"
    export BITCODE_GENERATION_MODE=marker
    export BUILD_ACTIVE_RESOURCES_ONLY=NO
    export BUILD_COMPONENTS="headers build"
    export BUILD_DIR=/Users/bluemix/Library/Developer/Xcode/DerivedData/XiEditor-elbmzpzgzwfvnbcktbixyfavdjxt/Build/Products
    export BUILD_ROOT=/Users/bluemix/Library/Developer/Xcode/DerivedData/XiEditor-elbmzpzgzwfvnbcktbixyfavdjxt/Build/Products
    export BUILD_STYLE=
    export BUILD_VARIANTS=normal
    export BUILT_PRODUCTS_DIR=/Users/bluemix/Library/Developer/Xcode/DerivedData/XiEditor-elbmzpzgzwfvnbcktbixyfavdjxt/Build/Products/Debug
    export CACHE_ROOT=/var/folders/rn/3f94c14x1bv1dr5ncmcv0phr0000gn/C/com.apple.DeveloperTools/9.0-9A235/Xcode
    export CLANG_CXX_LANGUAGE_STANDARD=gnu++0x
    export CLANG_CXX_LIBRARY=libc++
    export CLANG_ENABLE_MODULES=YES
    export CLANG_ENABLE_OBJC_ARC=YES
    export CLANG_MODULES_BUILD_SESSION_FILE=/Users/bluemix/Library/Developer/Xcode/DerivedData/ModuleCache/Session.modulevalidation
    export CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING=YES
    export CLANG_WARN_BOOL_CONVERSION=YES
    export CLANG_WARN_COMMA=YES
    export CLANG_WARN_CONSTANT_CONVERSION=YES
    export CLANG_WARN_DIRECT_OBJC_ISA_USAGE=YES_ERROR
    export CLANG_WARN_EMPTY_BODY=YES
    export CLANG_WARN_ENUM_CONVERSION=YES
    export CLANG_WARN_INFINITE_RECURSION=YES
    export CLANG_WARN_INT_CONVERSION=YES
    export CLANG_WARN_NON_LITERAL_NULL_CONVERSION=YES
    export CLANG_WARN_OBJC_LITERAL_CONVERSION=YES
    export CLANG_WARN_OBJC_ROOT_CLASS=YES_ERROR
    export CLANG_WARN_RANGE_LOOP_ANALYSIS=YES
    export CLANG_WARN_STRICT_PROTOTYPES=YES
    export CLANG_WARN_SUSPICIOUS_MOVE=YES
    export CLANG_WARN_UNREACHABLE_CODE=YES
    export CLANG_WARN__DUPLICATE_METHOD_MATCH=YES
    export CLASS_FILE_DIR=/Users/bluemix/Library/Developer/Xcode/DerivedData/XiEditor-elbmzpzgzwfvnbcktbixyfavdjxt/Build/Intermediates.noindex/XiEditor.build/Debug/xicore.build/JavaClasses
    export CLONE_HEADERS=NO
    export CODE_SIGNING_ALLOWED=NO
    export CODE_SIGN_IDENTITY=-
    export COLOR_DIAGNOSTICS=NO
    export COMPILER_INDEX_STORE_ENABLE=Default
    export CONFIGURATION=Debug
    export CONFIGURATION_BUILD_DIR=/Users/bluemix/Library/Developer/Xcode/DerivedData/XiEditor-elbmzpzgzwfvnbcktbixyfavdjxt/Build/Products/Debug
    export CONFIGURATION_TEMP_DIR=/Users/bluemix/Library/Developer/Xcode/DerivedData/XiEditor-elbmzpzgzwfvnbcktbixyfavdjxt/Build/Intermediates.noindex/XiEditor.build/Debug
    export COPYING_PRESERVES_HFS_DATA=NO
    export COPY_HEADERS_RUN_UNIFDEF=NO
    export COPY_PHASE_STRIP=NO
    export CREATE_INFOPLIST_SECTION_IN_BINARY=NO
    export DEAD_CODE_STRIPPING=NO
    export DEBUGGING_SYMBOLS=YES
    export DEBUG_INFORMATION_FORMAT=dwarf
    export DEFAULT_COMPILER=com.apple.compilers.llvm.clang.1_0
    export DEFAULT_KEXT_INSTALL_PATH=/Library/Extensions
    export DEFINES_MODULE=NO
    export DEPLOYMENT_LOCATION=NO
    export DEPLOYMENT_POSTPROCESSING=NO
    export DERIVED_FILES_DIR=
    export DERIVED_FILE_DIR=/Users/bluemix/Library/Developer/Xcode/DerivedData/XiEditor-elbmzpzgzwfvnbcktbixyfavdjxt/Build/Intermediates.noindex/XiEditor.build/Debug/xicore.build/DerivedSources
    export DERIVED_SOURCES_DIR=/Users/bluemix/Library/Developer/Xcode/DerivedData/XiEditor-elbmzpzgzwfvnbcktbixyfavdjxt/Build/Intermediates.noindex/XiEditor.build/Debug/xicore.build/DerivedSources
    export DEVELOPER_APPLICATIONS_DIR=/Applications/Xcode.app/Contents/Developer/Applications
    export DEVELOPER_BIN_DIR=/Applications/Xcode.app/Contents/Developer/usr/bin
    export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
    export DEVELOPER_FRAMEWORKS_DIR=/Applications/Xcode.app/Contents/Developer/Library/Frameworks
    export DEVELOPER_FRAMEWORKS_DIR_QUOTED=/Applications/Xcode.app/Contents/Developer/Library/Frameworks
    export DEVELOPER_LIBRARY_DIR=/Applications/Xcode.app/Contents/Developer/Library
    export DEVELOPER_SDK_DIR=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
    export DEVELOPER_TOOLS_DIR=/Applications/Xcode.app/Contents/Developer/Tools
    export DEVELOPER_USR_DIR=/Applications/Xcode.app/Contents/Developer/usr
    export DEVELOPMENT_LANGUAGE=English
    export DO_HEADER_SCANNING_IN_JAM=NO
    export DSTROOT=/tmp/XiEditor.dst
    export DT_TOOLCHAIN_DIR=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
    export DWARF_DSYM_FILE_NAME=.dSYM
    export DWARF_DSYM_FILE_SHOULD_ACCOMPANY_PRODUCT=NO
    export DWARF_DSYM_FOLDER_PATH=/Users/bluemix/Library/Developer/Xcode/DerivedData/XiEditor-elbmzpzgzwfvnbcktbixyfavdjxt/Build/Products/Debug
    export EMBEDDED_PROFILE_NAME=embedded.provisionprofile
    export EMBED_ASSET_PACKS_IN_PRODUCT_BUNDLE=NO
    export ENABLE_BITCODE=NO
    export ENABLE_DEFAULT_HEADER_SEARCH_PATHS=YES
    export ENABLE_HEADER_DEPENDENCIES=YES
    export ENABLE_ON_DEMAND_RESOURCES=NO
    export ENABLE_STRICT_OBJC_MSGSEND=YES
    export ENABLE_TESTABILITY=YES
    export EXCLUDED_INSTALLSRC_SUBDIRECTORY_PATTERNS=".DS_Store .svn .git .hg CVS"
    export EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES="*.nib *.lproj *.framework *.gch *.xcode* *.xcassets (*) .DS_Store CVS .svn .git .hg *.pbproj *.pbxproj"
    export FILE_LIST=/Users/bluemix/Library/Developer/Xcode/DerivedData/XiEditor-elbmzpzgzwfvnbcktbixyfavdjxt/Build/Intermediates.noindex/XiEditor.build/Debug/xicore.build/Objects/LinkFileList
    export FRAMEWORK_VERSION=A
    export GCC3_VERSION=3.3
    export GCC_C_LANGUAGE_STANDARD=gnu99
    export GCC_DYNAMIC_NO_PIC=NO
    export GCC_NO_COMMON_BLOCKS=YES
    export GCC_OPTIMIZATION_LEVEL=0
    export GCC_PREPROCESSOR_DEFINITIONS="DEBUG=1 "
    export GCC_VERSION=com.apple.compilers.llvm.clang.1_0
    export GCC_WARN_64_TO_32_BIT_CONVERSION=YES
    export GCC_WARN_ABOUT_RETURN_TYPE=YES_ERROR
    export GCC_WARN_UNDECLARED_SELECTOR=YES
    export GCC_WARN_UNINITIALIZED_AUTOS=YES_AGGRESSIVE
    export GCC_WARN_UNUSED_FUNCTION=YES
    export GCC_WARN_UNUSED_VARIABLE=YES
    export GENERATE_MASTER_OBJECT_FILE=NO
    export GENERATE_PKGINFO_FILE=NO
    export GENERATE_PROFILING_CODE=NO
    export GENERATE_TEXT_BASED_STUBS=NO
    export GID=20
    export GROUP=staff
    export HEADERMAP_INCLUDES_FLAT_ENTRIES_FOR_TARGET_BEING_BUILT=YES
    export HEADERMAP_INCLUDES_FRAMEWORK_ENTRIES_FOR_ALL_PRODUCT_TYPES=YES
    export HEADERMAP_INCLUDES_NONPUBLIC_NONPRIVATE_HEADERS=YES
    export HEADERMAP_INCLUDES_PROJECT_HEADERS=YES
    export HEADERMAP_USES_FRAMEWORK_PREFIX_ENTRIES=YES
    export HEADERMAP_USES_VFS=NO
    export HIDE_BITCODE_SYMBOLS=YES
    export HOME=/Users/bluemix
    export INFOPLIST_EXPAND_BUILD_SETTINGS=YES
    export INFOPLIST_OUTPUT_FORMAT=same-as-input
    export INFOPLIST_PREPROCESS=NO
    export INLINE_PRIVATE_FRAMEWORKS=NO
    export INSTALLHDRS_COPY_PHASE=NO
    export INSTALLHDRS_SCRIPT_PHASE=NO
    export INSTALL_DIR=/tmp/XiEditor.dst
    export INSTALL_GROUP=staff
    export INSTALL_MODE_FLAG=u+w,go-w,a+rX
    export INSTALL_OWNER=bluemix
    export INSTALL_ROOT=/tmp/XiEditor.dst
    export JAVA_APP_STUB=/System/Library/Frameworks/JavaVM.framework/Resources/MacOS/JavaApplicationStub
    export JAVA_ARCHIVE_CLASSES=YES
    export JAVA_ARCHIVE_TYPE=JAR
    export JAVA_COMPILER=/usr/bin/javac
    export JAVA_FRAMEWORK_RESOURCES_DIRS=Resources
    export JAVA_JAR_FLAGS=cv
    export JAVA_SOURCE_SUBDIR=.
    export JAVA_USE_DEPENDENCIES=YES
    export JAVA_ZIP_FLAGS=-urg
    export KEEP_PRIVATE_EXTERNS=NO
    export LD_DEPENDENCY_INFO_FILE=//xicore_dependency_info.dat
    export LD_GENERATE_MAP_FILE=NO
    export LD_MAP_FILE_PATH=/Users/bluemix/Library/Developer/Xcode/DerivedData/XiEditor-elbmzpzgzwfvnbcktbixyfavdjxt/Build/Intermediates.noindex/XiEditor.build/Debug/xicore.build/xicore-LinkMap--.txt
    export LD_NO_PIE=NO
    export LD_QUOTE_LINKER_ARGUMENTS_FOR_COMPILER_DRIVER=YES
    export LEGACY_DEVELOPER_DIR=/Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer
    export LIBRARY_FLAG_NOSPACE=YES
    export LIBRARY_KEXT_INSTALL_PATH=/Library/Extensions
    export LINKER_DISPLAYS_MANGLED_NAMES=NO
    export LINK_WITH_STANDARD_LIBRARIES=YES
    export LOCAL_ADMIN_APPS_DIR=/Applications/Utilities
    export LOCAL_APPS_DIR=/Applications
    export LOCAL_DEVELOPER_DIR=/Library/Developer
    export LOCAL_LIBRARY_DIR=/Library
    export MACOSX_DEPLOYMENT_TARGET=10.11
    export MAC_OS_X_PRODUCT_BUILD_VERSION=17A365
    export MAC_OS_X_VERSION_ACTUAL=101300
    export MAC_OS_X_VERSION_MAJOR=101300
    export MAC_OS_X_VERSION_MINOR=1300
    export METAL_LIBRARY_FILE_BASE=default
    export METAL_LIBRARY_OUTPUT_DIR=/Users/bluemix/Library/Developer/Xcode/DerivedData/XiEditor-elbmzpzgzwfvnbcktbixyfavdjxt/Build/Products/Debug/
    export MODULE_CACHE_DIR=/Users/bluemix/Library/Developer/Xcode/DerivedData/ModuleCache
    export MTL_ENABLE_DEBUG_INFO=YES
    export OBJECT_FILE_DIR=/Users/bluemix/Library/Developer/Xcode/DerivedData/XiEditor-elbmzpzgzwfvnbcktbixyfavdjxt/Build/Intermediates.noindex/XiEditor.build/Debug/xicore.build/Objects
    export OBJROOT=/Users/bluemix/Library/Developer/Xcode/DerivedData/XiEditor-elbmzpzgzwfvnbcktbixyfavdjxt/Build/Intermediates.noindex
    export ONLY_ACTIVE_ARCH=YES
    export OS=MACOS
    export PATH_PREFIXES_EXCLUDED_FROM_HEADER_DEPENDENCIES="/usr/include /usr/local/include /System/Library/Frameworks /System/Library/PrivateFrameworks /Applications/Xcode.app/Contents/Developer/Headers /Applications/Xcode.app/Contents/Developer/SDKs /Applications/Xcode.app/Contents/Developer/Platforms"
    export PLATFORM_NAME=macosx
    export PLIST_FILE_OUTPUT_FORMAT=same-as-input
    export PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR=YES
    export PRECOMP_DESTINATION_DIR=/Users/bluemix/Library/Developer/Xcode/DerivedData/XiEditor-elbmzpzgzwfvnbcktbixyfavdjxt/Build/Intermediates.noindex/XiEditor.build/Debug/xicore.build/PrefixHeaders
    export PRESERVE_DEAD_CODE_INITS_AND_TERMS=NO
    export PRODUCT_MODULE_NAME=xicore
    export PRODUCT_NAME=xicore
    export PROFILING_CODE=NO
    export PROJECT=XiEditor
    export PROJECT_DERIVED_FILE_DIR=/Users/bluemix/Library/Developer/Xcode/DerivedData/XiEditor-elbmzpzgzwfvnbcktbixyfavdjxt/Build/Intermediates.noindex/XiEditor.build/DerivedSources
    export PROJECT_DIR=/Users/bluemix/Rust/xi-mac
    export PROJECT_FILE_PATH=/Users/bluemix/Rust/xi-mac/XiEditor.xcodeproj
    export PROJECT_NAME=XiEditor
    export PROJECT_TEMP_DIR=/Users/bluemix/Library/Developer/Xcode/DerivedData/XiEditor-elbmzpzgzwfvnbcktbixyfavdjxt/Build/Intermediates.noindex/XiEditor.build
    export PROJECT_TEMP_ROOT=/Users/bluemix/Library/Developer/Xcode/DerivedData/XiEditor-elbmzpzgzwfvnbcktbixyfavdjxt/Build/Intermediates.noindex
    export REMOVE_CVS_FROM_RESOURCES=YES
    export REMOVE_GIT_FROM_RESOURCES=YES
    export REMOVE_HEADERS_FROM_EMBEDDED_BUNDLES=YES
    export REMOVE_HG_FROM_RESOURCES=YES
    export REMOVE_SVN_FROM_RESOURCES=YES
    export SCAN_ALL_SOURCE_FILES_FOR_INCLUDES=NO
    export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk
    export SEPARATE_STRIP=NO
    export SEPARATE_SYMBOL_EDIT=NO
    export SHARED_DERIVED_FILE_DIR=/Users/bluemix/Library/Developer/Xcode/DerivedData/XiEditor-elbmzpzgzwfvnbcktbixyfavdjxt/Build/Products/Debug/DerivedSources
    export SHARED_PRECOMPS_DIR=/Users/bluemix/Library/Developer/Xcode/DerivedData/XiEditor-elbmzpzgzwfvnbcktbixyfavdjxt/Build/Intermediates.noindex/PrecompiledHeaders
    export SKIP_INSTALL=YES
    export SOURCE_ROOT=/Users/bluemix/Rust/xi-mac
    export SRCROOT=/Users/bluemix/Rust/xi-mac
    export STRINGS_FILE_OUTPUT_ENCODING=UTF-16
    export STRIP_BITCODE_FROM_COPIED_FILES=NO
    export STRIP_INSTALLED_PRODUCT=YES
    export STRIP_STYLE=all
    export STRIP_SWIFT_SYMBOLS=YES
    export SUPPORTED_PLATFORMS=macosx
    export SUPPORTS_TEXT_BASED_API=NO
    export SWIFT_OPTIMIZATION_LEVEL=-Onone
    export SYMROOT=/Users/bluemix/Library/Developer/Xcode/DerivedData/XiEditor-elbmzpzgzwfvnbcktbixyfavdjxt/Build/Products
    export SYSTEM_ADMIN_APPS_DIR=/Applications/Utilities
    export SYSTEM_APPS_DIR=/Applications
    export SYSTEM_CORE_SERVICES_DIR=/System/Library/CoreServices
    export SYSTEM_DEMOS_DIR=/Applications/Extras
    export SYSTEM_DEVELOPER_APPS_DIR=/Applications/Xcode.app/Contents/Developer/Applications
    export SYSTEM_DEVELOPER_BIN_DIR=/Applications/Xcode.app/Contents/Developer/usr/bin
    export SYSTEM_DEVELOPER_DEMOS_DIR="/Applications/Xcode.app/Contents/Developer/Applications/Utilities/Built Examples"
    export SYSTEM_DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
    export SYSTEM_DEVELOPER_DOC_DIR="/Applications/Xcode.app/Contents/Developer/ADC Reference Library"
    export SYSTEM_DEVELOPER_GRAPHICS_TOOLS_DIR="/Applications/Xcode.app/Contents/Developer/Applications/Graphics Tools"
    export SYSTEM_DEVELOPER_JAVA_TOOLS_DIR="/Applications/Xcode.app/Contents/Developer/Applications/Java Tools"
    export SYSTEM_DEVELOPER_PERFORMANCE_TOOLS_DIR="/Applications/Xcode.app/Contents/Developer/Applications/Performance Tools"
    export SYSTEM_DEVELOPER_RELEASENOTES_DIR="/Applications/Xcode.app/Contents/Developer/ADC Reference Library/releasenotes"
    export SYSTEM_DEVELOPER_TOOLS=/Applications/Xcode.app/Contents/Developer/Tools
    export SYSTEM_DEVELOPER_TOOLS_DOC_DIR="/Applications/Xcode.app/Contents/Developer/ADC Reference Library/documentation/DeveloperTools"
    export SYSTEM_DEVELOPER_TOOLS_RELEASENOTES_DIR="/Applications/Xcode.app/Contents/Developer/ADC Reference Library/releasenotes/DeveloperTools"
    export SYSTEM_DEVELOPER_USR_DIR=/Applications/Xcode.app/Contents/Developer/usr
    export SYSTEM_DEVELOPER_UTILITIES_DIR=/Applications/Xcode.app/Contents/Developer/Applications/Utilities
    export SYSTEM_DOCUMENTATION_DIR=/Library/Documentation
    export SYSTEM_KEXT_INSTALL_PATH=/System/Library/Extensions
    export SYSTEM_LIBRARY_DIR=/System/Library
    export TAPI_VERIFY_MODE=ErrorsOnly
    export TARGETNAME=xicore
    export TARGET_BUILD_DIR=/Users/bluemix/Library/Developer/Xcode/DerivedData/XiEditor-elbmzpzgzwfvnbcktbixyfavdjxt/Build/Products/Debug
    export TARGET_NAME=xicore
    export TARGET_TEMP_DIR=/Users/bluemix/Library/Developer/Xcode/DerivedData/XiEditor-elbmzpzgzwfvnbcktbixyfavdjxt/Build/Intermediates.noindex/XiEditor.build/Debug/xicore.build
    export TEMP_DIR=/Users/bluemix/Library/Developer/Xcode/DerivedData/XiEditor-elbmzpzgzwfvnbcktbixyfavdjxt/Build/Intermediates.noindex/XiEditor.build/Debug/xicore.build
    export TEMP_FILES_DIR=/Users/bluemix/Library/Developer/Xcode/DerivedData/XiEditor-elbmzpzgzwfvnbcktbixyfavdjxt/Build/Intermediates.noindex/XiEditor.build/Debug/xicore.build
    export TEMP_FILE_DIR=/Users/bluemix/Library/Developer/Xcode/DerivedData/XiEditor-elbmzpzgzwfvnbcktbixyfavdjxt/Build/Intermediates.noindex/XiEditor.build/Debug/xicore.build
    export TEMP_ROOT=/Users/bluemix/Library/Developer/Xcode/DerivedData/XiEditor-elbmzpzgzwfvnbcktbixyfavdjxt/Build/Intermediates.noindex
    export TOOLCHAIN_DIR=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
    export TREAT_MISSING_BASELINES_AS_TEST_FAILURES=NO
    export UID=501
    export USER=bluemix
    export USER_APPS_DIR=/Users/bluemix/Applications
    export USER_LIBRARY_DIR=/Users/bluemix/Library
    export USE_HEADERMAP=YES
    export WATCH_BUILT_PRODUCTS_DIR=/Users/bluemix/Library/Developer/Xcode/DerivedData/XiEditor-elbmzpzgzwfvnbcktbixyfavdjxt/Build/Products/Debug-watchos
    export WRAP_ASSET_PACKS_IN_SEPARATE_DIRECTORIES=NO
    export XCODE_APP_SUPPORT_DIR=/Applications/Xcode.app/Contents/Developer/Library/Xcode
    export XCODE_PRODUCT_BUILD_VERSION=9A235
    export XCODE_VERSION_ACTUAL=0900
    export XCODE_VERSION_MAJOR=0900
    export XCODE_VERSION_MINOR=0900
    export arch=x86_64
    export variant=normal
    /bin/bash /Users/bluemix/Rust/xi-mac/build-rust-xcode.sh

   Compiling num-traits v0.1.39
   Compiling bytecount v0.1.6
   Compiling unicode-xid v0.0.4
   Compiling xi-unicode v0.1.0 (file:///Users/bluemix/Rust/xi-mac/xi-editor/rust/unicode)
   Compiling dtoa v0.4.1
   Compiling itoa v0.3.1
   Compiling byteorder v1.0.0
   Compiling bitflags v0.8.2
   Compiling serde v1.0.8
   Compiling same-file v0.1.3
   Compiling lazy_static v0.2.8
   Compiling crossbeam v0.2.10
   Compiling bitflags v0.7.0
   Compiling plist v0.2.2
   Compiling quote v0.3.15
   Compiling libc v0.2.24
   Compiling synom v0.11.3
   Compiling libflate v0.1.9
   Compiling base64 v0.5.2
   Compiling walkdir v1.0.7
   Compiling xml-rs v0.4.1
   Compiling time v0.1.37
   Compiling memchr v1.0.1
   Compiling syn v0.11.11
   Compiling num-integer v0.1.34
   Compiling num-iter v0.1.33
   Compiling num v0.1.39
   Compiling chrono v0.3.1
   Compiling serde_derive_internals v0.15.1
   Compiling bincode v0.8.0
   Compiling serde_json v1.0.2
   Compiling serde_derive v1.0.8
   Compiling xi-rpc v0.2.0 (file:///Users/bluemix/Rust/xi-mac/xi-editor/rust/rpc)
   Compiling xi-rope v0.2.0 (file:///Users/bluemix/Rust/xi-mac/xi-editor/rust/rope)
   Compiling syntect v1.7.0
   Compiling xi-core-lib v0.2.0 (file:///Users/bluemix/Rust/xi-mac/xi-editor/rust/core-lib)
   Compiling xi-core v0.2.0 (file:///Users/bluemix/Rust/xi-mac/xi-editor/rust)
    Finished dev [unoptimized + debuginfo] target(s) in 43.92 secs
   Compiling plist v0.2.2
   Compiling byteorder v1.0.0
   Compiling same-file v0.1.3
   Compiling itoa v0.3.1
   Compiling libc v0.2.24
   Compiling regex-syntax v0.4.1
   Compiling serde v1.0.8
   Compiling pkg-config v0.3.9
   Compiling bytecount v0.1.7
   Compiling bitflags v0.7.0
   Compiling quote v0.3.15
   Compiling dtoa v0.4.1
   Compiling crossbeam v0.2.10
   Compiling unicode-xid v0.0.4
   Compiling fnv v1.0.5
   Compiling num-traits v0.1.39
   Compiling lazy_static v0.2.8
   Compiling yaml-rust v0.3.5
   Compiling gcc v0.3.51
   Compiling bitflags v0.8.2
   Compiling walkdir v1.0.7
   Compiling base64 v0.5.2
   Compiling xml-rs v0.4.1
   Compiling rand v0.3.16
   Compiling time v0.1.37
   Compiling synom v0.11.3
   Compiling num-integer v0.1.34
   Compiling syn v0.11.11
   Compiling num-iter v0.1.33
   Compiling miniz-sys v0.1.9
   Compiling cmake v0.1.24
   Compiling num v0.1.39
   Compiling chrono v0.3.1
   Compiling flate2 v0.2.19
   Compiling onig_sys v63.0.2
error: failed to run custom build command for `onig_sys v63.0.2`
process didn't exit successfully: `/Users/bluemix/Rust/xi-mac/xi-editor/rust/syntect-plugin/target/debug/build/onig_sys-c65daa63de8e3c35/build-script-build` (exit code: 101)
--- stdout
running: "cmake" "/Users/bluemix/.cargo/registry/src/github.com-1ecc6299db9ec823/onig_sys-63.0.2/oniguruma" "-DBUILD_SHARED_LIBS=OFF" "-DCMAKE_INSTALL_PREFIX=/Users/bluemix/Rust/xi-mac/xi-editor/rust/syntect-plugin/target/x86_64-apple-darwin/debug/build/onig_sys-04ccfc111fa07bcf/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_C_COMPILER=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_CXX_COMPILER=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++" "-DCMAKE_BUILD_TYPE=Debug"

--- stderr
dyld: Symbol not found: __cg_jpeg_resync_to_restart
  Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
  Expected in: /usr/local/lib/libJPEG.dylib
 in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
thread 'main' panicked at '
command did not execute successfully, got: signal: 6

build script failed, must exit now', /Users/bluemix/.cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.24/src/lib.rs:593:4
note: Run with `RUST_BACKTRACE=1` for a backtrace.

warning: build failed, waiting for other jobs to finish...
error: build failed

thanks in advance :)

Screen flickers when open a file in new tab

Repro steps:

  1. Open XiEditor, there will be an open file named Untitled.
  2. Command+O to open a file.
  3. Click around (or use arrow key) to move the cursor in the edit window.

Or reproduced by:

  1. Open XiEditor, there will be an open file named Untitled.
  2. Command+W or click the close button to close this window.
  3. Command+O to open a file named a.txt, this will be in a new window.
  4. Command+T to open a new tab in this window.
  5. Command+O to open another file named b.txt.
  6. Click around (or use arrow key) to move the cursor in the edit window.

Actual result:
Looks like the window is refreshing and there is flash/flickering every time you move the cursor.

Expected result:
No flash/flickering

Build does not work with zsh-only features in zshrc

Because bash is specified at the top of build-rust-xcode.sh, any time a user has something not supported by bash in their zshrc, the script will error and the build will hang. Below is some sample output while using my zshrc.

    export variant=normal
    /bin/bash /Users/k.elwert/Code/xi-mac/build-rust-xcode.sh
/Users/k.elwert/.zshrc: line 4: typeset: -U: invalid option
typeset: usage: typeset [-afFirtx] [-p] name[=value] ...
/Users/k.elwert/.zshrc: line 13: zstyle: command not found
/Users/k.elwert/.zshrc: line 14: zstyle: command not found
/Users/k.elwert/.zshrc: line 15: zstyle: command not found
/Users/k.elwert/.zshrc: line 16: zstyle: command not found
/Users/k.elwert/.zshrc: line 17: zstyle: command not found
/Users/k.elwert/.zshrc: line 18: zstyle: command not found
/Users/k.elwert/.zshrc: line 19: zstyle: command not found
/Users/k.elwert/.zshrc: line 20: zstyle: command not found
/Users/k.elwert/.zshrc: line 21: zstyle: command not found
/Users/k.elwert/.antigen/antigen.zsh: line 2: /bin/antigen.zsh: No such file or directory
/Users/k.elwert/.zshrc: line 40: antigen: command not found
/Users/k.elwert/.zshrc: line 43: antigen: command not found
/Users/k.elwert/.zshrc: line 44: antigen: command not found
/Users/k.elwert/.zshrc: line 45: antigen: command not found
/Users/k.elwert/.zshrc: line 47: antigen: command not found
/Users/k.elwert/.zshrc: line 50: unsetopt: command not found
/Users/k.elwert/.zshrc: line 55: chruby_auto: command not found
^C** BUILD INTERRUPTED **

I believe this was caused by #56. Although it may fall victim to the same pitfalls, using something like ~/.zshenv or ~/.zprofile would be a little less risky.

Could not compile `xi-core-lib` - config_files.for_each

I got an error when building xi-mac. My Rust: rustup 1.7.0 (813f7b7a8 2017-10-30)

   Compiling xi-core-lib v0.2.0 (file:///Users/vietlq/projects/xi-mac/xi-editor/rust/core-lib)
error: use of unstable library feature 'iterator_for_each' (see issue #42986)
   --> core-lib/src/tabs.rs:680:22
    |
680 |         config_files.for_each(|p| self.load_file_based_config(&p));
    |                      ^^^^^^^^

error: aborting due to previous error

error: Could not compile `xi-core-lib`.

To learn more, run the command again with --verbose.

** BUILD FAILED **


The following build commands failed:
	ExternalBuildToolExecution xicore
(1 failure)

Find UI magnifier icon not shown

The magnifier icon in the Find bar is not shown anymore.

screen shot 2018-01-26 at 14 50 30

I was able to track this issue back to the changes in Main.stroyboard in dc4840e.

Unfortunately, I have no idea how to fix this. Maybe the NSSearchField itself is buggy?

UI for find/replace

From an earlier discussion:

UI side of "find". Should pop up a little text box, and maybe have a status field ("1 of 3"). Will need to scale to replace as well, but can start with find. Obviously, implementation (in core) is highly nontrivial (just dealing with Unicode case folding is a fairly major effort), but I think I can get something ASCII-only and not very efficient done pretty quickly.

This is a fun/non-trivial UI exercise, and I can think of at least three possible implementations off the bat: a panel to the side of the window (Xcode) a panel at the bottom or top (sublime) or a new window/popup of some kind.

a full-featured find & replace (especially "find in project") might be best served by a UI distinct from a simple find command.

Clicking only un-highlights visible area

Steps to reproduce:

  • open large document
  • press mouse button to start dragging
  • move cursor above or below window to quickly select more than one screen of document
  • click the cursor in the window to de-select the large selection
  • scroll down or up: lines outside the viewport you clicked on will still have blue highlight
  • enter a character to invalidate line cache
  • scroll down or up: lines outside the viewport you clicked on will no longer have blue highlight

I think the line cache is only un-validated for the visible area when the user clicks to de-select after selecting text, when it should be invalidated for the entire area of selection.

Another minor bug: multi-line selections have ugly 1 pixel (or maybe 0.5 pixel) seams.

cc @raphlinus @cmyr

Shell Script Invocation Error - Xcode 8

I followed the compilation instructions but when I went to compile and run the project in Xcode 8.3.2, I get a "Shell Script Invocation Error"

The weird part is, when I use xcodebuild in the terminal it compiles just fine.

I'm running macOS 10.12.4 and Xcode 8.3.2, any ideas?

Stack trace from Xcode:

ExternalBuildToolExecution xicore
    cd "/Volumes/Work HDD/Programming/xi-mac/xi-editor/rust"
    export ACTION=
    export ALTERNATE_GROUP=staff
    export ALTERNATE_MODE=u+w,go-w,a+rX
    export ALTERNATE_OWNER=cm
    export ALWAYS_SEARCH_USER_PATHS=NO
    export APPLE_INTERNAL_DEVELOPER_DIR=/AppleInternal/Developer
    export APPLE_INTERNAL_DIR=/AppleInternal
    export APPLE_INTERNAL_DOCUMENTATION_DIR=/AppleInternal/Documentation
    export APPLE_INTERNAL_LIBRARY_DIR=/AppleInternal/Library
    export APPLE_INTERNAL_TOOLS=/AppleInternal/Developer/Tools
    export APPLICATION_EXTENSION_API_ONLY=NO
    export APPLY_RULES_IN_COPY_FILES=NO
    export ARCHS=x86_64
    export AVAILABLE_PLATFORMS="appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator"
    export BITCODE_GENERATION_MODE=marker
    export BUILD_ACTIVE_RESOURCES_ONLY=NO
    export BUILD_COMPONENTS="headers build"
    export BUILD_DIR=/Users/corbinmatschull/Library/Developer/Xcode/DerivedData/XiEditor-cexvionayyjltvcilakqqseongpd/Build/Products
    export BUILD_ROOT=/Users/corbinmatschull/Library/Developer/Xcode/DerivedData/XiEditor-cexvionayyjltvcilakqqseongpd/Build/Products
    export BUILD_STYLE=
    export BUILD_VARIANTS=normal
    export BUILT_PRODUCTS_DIR=/Users/corbinmatschull/Library/Developer/Xcode/DerivedData/XiEditor-cexvionayyjltvcilakqqseongpd/Build/Products/Debug
    export CACHE_ROOT=/var/folders/__/rc6_2n_1697gf0ryddl1qqdh0000gn/C/com.apple.DeveloperTools/8.3.2-8E2002/Xcode
    export CLANG_CXX_LANGUAGE_STANDARD=gnu++0x
    export CLANG_CXX_LIBRARY=libc++
    export CLANG_ENABLE_MODULES=YES
    export CLANG_ENABLE_OBJC_ARC=YES
    export CLANG_MODULES_BUILD_SESSION_FILE=/Users/corbinmatschull/Library/Developer/Xcode/DerivedData/ModuleCache/Session.modulevalidation
    export CLANG_WARN_BOOL_CONVERSION=YES
    export CLANG_WARN_CONSTANT_CONVERSION=YES
    export CLANG_WARN_DIRECT_OBJC_ISA_USAGE=YES_ERROR
    export CLANG_WARN_EMPTY_BODY=YES
    export CLANG_WARN_ENUM_CONVERSION=YES
    export CLANG_WARN_INFINITE_RECURSION=YES
    export CLANG_WARN_INT_CONVERSION=YES
    export CLANG_WARN_OBJC_ROOT_CLASS=YES_ERROR
    export CLANG_WARN_SUSPICIOUS_MOVE=YES
    export CLANG_WARN_UNREACHABLE_CODE=YES
    export CLANG_WARN__DUPLICATE_METHOD_MATCH=YES
    export CLASS_FILE_DIR=/Users/corbinmatschull/Library/Developer/Xcode/DerivedData/XiEditor-cexvionayyjltvcilakqqseongpd/Build/Intermediates/XiEditor.build/Debug/xicore.build/JavaClasses
    export CLONE_HEADERS=NO
    export CODE_SIGNING_ALLOWED=NO
    export CODE_SIGN_IDENTITY=-
    export COLOR_DIAGNOSTICS=NO
    export CONFIGURATION=Debug
    export CONFIGURATION_BUILD_DIR=/Users/corbinmatschull/Library/Developer/Xcode/DerivedData/XiEditor-cexvionayyjltvcilakqqseongpd/Build/Products/Debug
    export CONFIGURATION_TEMP_DIR=/Users/corbinmatschull/Library/Developer/Xcode/DerivedData/XiEditor-cexvionayyjltvcilakqqseongpd/Build/Intermediates/XiEditor.build/Debug
    export COPYING_PRESERVES_HFS_DATA=NO
    export COPY_HEADERS_RUN_UNIFDEF=NO
    export COPY_PHASE_STRIP=NO
    export CREATE_INFOPLIST_SECTION_IN_BINARY=NO
    export DEAD_CODE_STRIPPING=NO
    export DEBUGGING_SYMBOLS=YES
    export DEBUG_INFORMATION_FORMAT=dwarf
    export DEFAULT_COMPILER=com.apple.compilers.llvm.clang.1_0
    export DEFAULT_KEXT_INSTALL_PATH=/Library/Extensions
    export DEFINES_MODULE=NO
    export DEPLOYMENT_LOCATION=NO
    export DEPLOYMENT_POSTPROCESSING=NO
    export DERIVED_FILES_DIR=
    export DERIVED_FILE_DIR=/Users/corbinmatschull/Library/Developer/Xcode/DerivedData/XiEditor-cexvionayyjltvcilakqqseongpd/Build/Intermediates/XiEditor.build/Debug/xicore.build/DerivedSources
    export DERIVED_SOURCES_DIR=/Users/corbinmatschull/Library/Developer/Xcode/DerivedData/XiEditor-cexvionayyjltvcilakqqseongpd/Build/Intermediates/XiEditor.build/Debug/xicore.build/DerivedSources
    export DEVELOPER_APPLICATIONS_DIR=/Applications/Xcode.app/Contents/Developer/Applications
    export DEVELOPER_BIN_DIR=/Applications/Xcode.app/Contents/Developer/usr/bin
    export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
    export DEVELOPER_FRAMEWORKS_DIR=/Applications/Xcode.app/Contents/Developer/Library/Frameworks
    export DEVELOPER_FRAMEWORKS_DIR_QUOTED=/Applications/Xcode.app/Contents/Developer/Library/Frameworks
    export DEVELOPER_LIBRARY_DIR=/Applications/Xcode.app/Contents/Developer/Library
    export DEVELOPER_SDK_DIR=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
    export DEVELOPER_TOOLS_DIR=/Applications/Xcode.app/Contents/Developer/Tools
    export DEVELOPER_USR_DIR=/Applications/Xcode.app/Contents/Developer/usr
    export DEVELOPMENT_LANGUAGE=English
    export DO_HEADER_SCANNING_IN_JAM=NO
    export DSTROOT=/tmp/XiEditor.dst
    export DT_TOOLCHAIN_DIR=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
    export DWARF_DSYM_FILE_NAME=.dSYM
    export DWARF_DSYM_FILE_SHOULD_ACCOMPANY_PRODUCT=NO
    export DWARF_DSYM_FOLDER_PATH=/Users/corbinmatschull/Library/Developer/Xcode/DerivedData/XiEditor-cexvionayyjltvcilakqqseongpd/Build/Products/Debug
    export EMBEDDED_PROFILE_NAME=embedded.provisionprofile
    export EMBED_ASSET_PACKS_IN_PRODUCT_BUNDLE=NO
    export ENABLE_BITCODE=NO
    export ENABLE_DEFAULT_HEADER_SEARCH_PATHS=YES
    export ENABLE_HEADER_DEPENDENCIES=YES
    export ENABLE_ON_DEMAND_RESOURCES=NO
    export ENABLE_STRICT_OBJC_MSGSEND=YES
    export ENABLE_TESTABILITY=YES
    export EXCLUDED_INSTALLSRC_SUBDIRECTORY_PATTERNS=".DS_Store .svn .git .hg CVS"
    export EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES="*.nib *.lproj *.framework *.gch *.xcode* *.xcassets (*) .DS_Store CVS .svn .git .hg *.pbproj *.pbxproj"
    export FILE_LIST=/Users/corbinmatschull/Library/Developer/Xcode/DerivedData/XiEditor-cexvionayyjltvcilakqqseongpd/Build/Intermediates/XiEditor.build/Debug/xicore.build/Objects/LinkFileList
    export FRAMEWORK_VERSION=A
    export GCC3_VERSION=3.3
    export GCC_C_LANGUAGE_STANDARD=gnu99
    export GCC_DYNAMIC_NO_PIC=NO
    export GCC_NO_COMMON_BLOCKS=YES
    export GCC_OPTIMIZATION_LEVEL=0
    export GCC_PREPROCESSOR_DEFINITIONS="DEBUG=1 "
    export GCC_VERSION=com.apple.compilers.llvm.clang.1_0
    export GCC_WARN_64_TO_32_BIT_CONVERSION=YES
    export GCC_WARN_ABOUT_RETURN_TYPE=YES_ERROR
    export GCC_WARN_UNDECLARED_SELECTOR=YES
    export GCC_WARN_UNINITIALIZED_AUTOS=YES_AGGRESSIVE
    export GCC_WARN_UNUSED_FUNCTION=YES
    export GCC_WARN_UNUSED_VARIABLE=YES
    export GENERATE_MASTER_OBJECT_FILE=NO
    export GENERATE_PKGINFO_FILE=NO
    export GENERATE_PROFILING_CODE=NO
    export GENERATE_TEXT_BASED_STUBS=NO
    export GID=20
    export GROUP=staff
    export HEADERMAP_INCLUDES_FLAT_ENTRIES_FOR_TARGET_BEING_BUILT=YES
    export HEADERMAP_INCLUDES_FRAMEWORK_ENTRIES_FOR_ALL_PRODUCT_TYPES=YES
    export HEADERMAP_INCLUDES_NONPUBLIC_NONPRIVATE_HEADERS=YES
    export HEADERMAP_INCLUDES_PROJECT_HEADERS=YES
    export HEADERMAP_USES_FRAMEWORK_PREFIX_ENTRIES=YES
    export HEADERMAP_USES_VFS=NO
    export HIDE_BITCODE_SYMBOLS=YES
    export HOME=/Users/corbinmatschull
    export INFOPLIST_EXPAND_BUILD_SETTINGS=YES
    export INFOPLIST_OUTPUT_FORMAT=same-as-input
    export INFOPLIST_PREPROCESS=NO
    export INLINE_PRIVATE_FRAMEWORKS=NO
    export INSTALLHDRS_COPY_PHASE=NO
    export INSTALLHDRS_SCRIPT_PHASE=NO
    export INSTALL_DIR=/tmp/XiEditor.dst
    export INSTALL_GROUP=staff
    export INSTALL_MODE_FLAG=u+w,go-w,a+rX
    export INSTALL_OWNER=cm
    export INSTALL_ROOT=/tmp/XiEditor.dst
    export JAVA_APP_STUB=/System/Library/Frameworks/JavaVM.framework/Resources/MacOS/JavaApplicationStub
    export JAVA_ARCHIVE_CLASSES=YES
    export JAVA_ARCHIVE_TYPE=JAR
    export JAVA_COMPILER=/usr/bin/javac
    export JAVA_FRAMEWORK_RESOURCES_DIRS=Resources
    export JAVA_JAR_FLAGS=cv
    export JAVA_SOURCE_SUBDIR=.
    export JAVA_USE_DEPENDENCIES=YES
    export JAVA_ZIP_FLAGS=-urg
    export KEEP_PRIVATE_EXTERNS=NO
    export LD_DEPENDENCY_INFO_FILE=//xicore_dependency_info.dat
    export LD_GENERATE_MAP_FILE=NO
    export LD_MAP_FILE_PATH=/Users/corbinmatschull/Library/Developer/Xcode/DerivedData/XiEditor-cexvionayyjltvcilakqqseongpd/Build/Intermediates/XiEditor.build/Debug/xicore.build/xicore-LinkMap--.txt
    export LD_NO_PIE=NO
    export LD_QUOTE_LINKER_ARGUMENTS_FOR_COMPILER_DRIVER=YES
    export LEGACY_DEVELOPER_DIR=/Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer
    export LIBRARY_FLAG_NOSPACE=YES
    export LIBRARY_KEXT_INSTALL_PATH=/Library/Extensions
    export LINKER_DISPLAYS_MANGLED_NAMES=NO
    export LINK_WITH_STANDARD_LIBRARIES=YES
    export LOCAL_ADMIN_APPS_DIR=/Applications/Utilities
    export LOCAL_APPS_DIR=/Applications
    export LOCAL_DEVELOPER_DIR=/Library/Developer
    export LOCAL_LIBRARY_DIR=/Library
    export MACOSX_DEPLOYMENT_TARGET=10.11
    export MAC_OS_X_PRODUCT_BUILD_VERSION=16E195
    export MAC_OS_X_VERSION_ACTUAL=101204
    export MAC_OS_X_VERSION_MAJOR=101200
    export MAC_OS_X_VERSION_MINOR=1204
    export METAL_LIBRARY_FILE_BASE=default
    export METAL_LIBRARY_OUTPUT_DIR=/Users/corbinmatschull/Library/Developer/Xcode/DerivedData/XiEditor-cexvionayyjltvcilakqqseongpd/Build/Products/Debug/
    export MODULE_CACHE_DIR=/Users/corbinmatschull/Library/Developer/Xcode/DerivedData/ModuleCache
    export MTL_ENABLE_DEBUG_INFO=YES
    export OBJECT_FILE_DIR=/Users/corbinmatschull/Library/Developer/Xcode/DerivedData/XiEditor-cexvionayyjltvcilakqqseongpd/Build/Intermediates/XiEditor.build/Debug/xicore.build/Objects
    export OBJROOT=/Users/corbinmatschull/Library/Developer/Xcode/DerivedData/XiEditor-cexvionayyjltvcilakqqseongpd/Build/Intermediates
    export ONLY_ACTIVE_ARCH=YES
    export OS=MACOS
    export PATH_PREFIXES_EXCLUDED_FROM_HEADER_DEPENDENCIES="/usr/include /usr/local/include /System/Library/Frameworks /System/Library/PrivateFrameworks /Applications/Xcode.app/Contents/Developer/Headers /Applications/Xcode.app/Contents/Developer/SDKs /Applications/Xcode.app/Contents/Developer/Platforms"
    export PLATFORM_NAME=macosx
    export PLIST_FILE_OUTPUT_FORMAT=same-as-input
    export PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR=YES
    export PRECOMP_DESTINATION_DIR=/Users/corbinmatschull/Library/Developer/Xcode/DerivedData/XiEditor-cexvionayyjltvcilakqqseongpd/Build/Intermediates/XiEditor.build/Debug/xicore.build/PrefixHeaders
    export PRESERVE_DEAD_CODE_INITS_AND_TERMS=NO
    export PRODUCT_MODULE_NAME=xicore
    export PRODUCT_NAME=xicore
    export PROFILING_CODE=NO
    export PROJECT=XiEditor
    export PROJECT_DERIVED_FILE_DIR=/Users/corbinmatschull/Library/Developer/Xcode/DerivedData/XiEditor-cexvionayyjltvcilakqqseongpd/Build/Intermediates/XiEditor.build/DerivedSources
    export PROJECT_DIR="/Volumes/Work HDD/Programming/xi-mac"
    export PROJECT_FILE_PATH="/Volumes/Work HDD/Programming/xi-mac/XiEditor.xcodeproj"
    export PROJECT_NAME=XiEditor
    export PROJECT_TEMP_DIR=/Users/corbinmatschull/Library/Developer/Xcode/DerivedData/XiEditor-cexvionayyjltvcilakqqseongpd/Build/Intermediates/XiEditor.build
    export PROJECT_TEMP_ROOT=/Users/corbinmatschull/Library/Developer/Xcode/DerivedData/XiEditor-cexvionayyjltvcilakqqseongpd/Build/Intermediates
    export REMOVE_CVS_FROM_RESOURCES=YES
    export REMOVE_GIT_FROM_RESOURCES=YES
    export REMOVE_HEADERS_FROM_EMBEDDED_BUNDLES=YES
    export REMOVE_HG_FROM_RESOURCES=YES
    export REMOVE_SVN_FROM_RESOURCES=YES
    export SCAN_ALL_SOURCE_FILES_FOR_INCLUDES=NO
    export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk
    export SEPARATE_STRIP=NO
    export SEPARATE_SYMBOL_EDIT=NO
    export SHARED_DERIVED_FILE_DIR=/Users/corbinmatschull/Library/Developer/Xcode/DerivedData/XiEditor-cexvionayyjltvcilakqqseongpd/Build/Products/Debug/DerivedSources
    export SHARED_PRECOMPS_DIR=/Users/corbinmatschull/Library/Developer/Xcode/DerivedData/XiEditor-cexvionayyjltvcilakqqseongpd/Build/Intermediates/PrecompiledHeaders
    export SKIP_INSTALL=YES
    export SOURCE_ROOT="/Volumes/Work HDD/Programming/xi-mac"
    export SRCROOT="/Volumes/Work HDD/Programming/xi-mac"
    export STRINGS_FILE_OUTPUT_ENCODING=UTF-16
    export STRIP_BITCODE_FROM_COPIED_FILES=NO
    export STRIP_INSTALLED_PRODUCT=YES
    export STRIP_STYLE=all
    export SUPPORTED_PLATFORMS=macosx
    export SUPPORTS_TEXT_BASED_API=NO
    export SWIFT_OPTIMIZATION_LEVEL=-Onone
    export SYMROOT=/Users/corbinmatschull/Library/Developer/Xcode/DerivedData/XiEditor-cexvionayyjltvcilakqqseongpd/Build/Products
    export SYSTEM_ADMIN_APPS_DIR=/Applications/Utilities
    export SYSTEM_APPS_DIR=/Applications
    export SYSTEM_CORE_SERVICES_DIR=/System/Library/CoreServices
    export SYSTEM_DEMOS_DIR=/Applications/Extras
    export SYSTEM_DEVELOPER_APPS_DIR=/Applications/Xcode.app/Contents/Developer/Applications
    export SYSTEM_DEVELOPER_BIN_DIR=/Applications/Xcode.app/Contents/Developer/usr/bin
    export SYSTEM_DEVELOPER_DEMOS_DIR="/Applications/Xcode.app/Contents/Developer/Applications/Utilities/Built Examples"
    export SYSTEM_DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
    export SYSTEM_DEVELOPER_DOC_DIR="/Applications/Xcode.app/Contents/Developer/ADC Reference Library"
    export SYSTEM_DEVELOPER_GRAPHICS_TOOLS_DIR="/Applications/Xcode.app/Contents/Developer/Applications/Graphics Tools"
    export SYSTEM_DEVELOPER_JAVA_TOOLS_DIR="/Applications/Xcode.app/Contents/Developer/Applications/Java Tools"
    export SYSTEM_DEVELOPER_PERFORMANCE_TOOLS_DIR="/Applications/Xcode.app/Contents/Developer/Applications/Performance Tools"
    export SYSTEM_DEVELOPER_RELEASENOTES_DIR="/Applications/Xcode.app/Contents/Developer/ADC Reference Library/releasenotes"
    export SYSTEM_DEVELOPER_TOOLS=/Applications/Xcode.app/Contents/Developer/Tools
    export SYSTEM_DEVELOPER_TOOLS_DOC_DIR="/Applications/Xcode.app/Contents/Developer/ADC Reference Library/documentation/DeveloperTools"
    export SYSTEM_DEVELOPER_TOOLS_RELEASENOTES_DIR="/Applications/Xcode.app/Contents/Developer/ADC Reference Library/releasenotes/DeveloperTools"
    export SYSTEM_DEVELOPER_USR_DIR=/Applications/Xcode.app/Contents/Developer/usr
    export SYSTEM_DEVELOPER_UTILITIES_DIR=/Applications/Xcode.app/Contents/Developer/Applications/Utilities
    export SYSTEM_DOCUMENTATION_DIR=/Library/Documentation
    export SYSTEM_KEXT_INSTALL_PATH=/System/Library/Extensions
    export SYSTEM_LIBRARY_DIR=/System/Library
    export TAPI_VERIFY_MODE=ErrorsOnly
    export TARGETNAME=xicore
    export TARGET_BUILD_DIR=/Users/corbinmatschull/Library/Developer/Xcode/DerivedData/XiEditor-cexvionayyjltvcilakqqseongpd/Build/Products/Debug
    export TARGET_NAME=xicore
    export TARGET_TEMP_DIR=/Users/corbinmatschull/Library/Developer/Xcode/DerivedData/XiEditor-cexvionayyjltvcilakqqseongpd/Build/Intermediates/XiEditor.build/Debug/xicore.build
    export TEMP_DIR=/Users/corbinmatschull/Library/Developer/Xcode/DerivedData/XiEditor-cexvionayyjltvcilakqqseongpd/Build/Intermediates/XiEditor.build/Debug/xicore.build
    export TEMP_FILES_DIR=
    export TEMP_FILE_DIR=/Users/corbinmatschull/Library/Developer/Xcode/DerivedData/XiEditor-cexvionayyjltvcilakqqseongpd/Build/Intermediates/XiEditor.build/Debug/xicore.build
    export TEMP_ROOT=/Users/corbinmatschull/Library/Developer/Xcode/DerivedData/XiEditor-cexvionayyjltvcilakqqseongpd/Build/Intermediates
    export TOOLCHAIN_DIR=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
    export TREAT_MISSING_BASELINES_AS_TEST_FAILURES=NO
    export UID=501
    export USER=cm
    export USER_APPS_DIR=/Users/corbinmatschull/Applications
    export USER_LIBRARY_DIR=/Users/corbinmatschull/Library
    export USE_HEADERMAP=YES
    export WATCH_BUILT_PRODUCTS_DIR=/Users/corbinmatschull/Library/Developer/Xcode/DerivedData/XiEditor-cexvionayyjltvcilakqqseongpd/Build/Products/Debug-watchos
    export WRAP_ASSET_PACKS_IN_SEPARATE_DIRECTORIES=NO
    export XCODE_APP_SUPPORT_DIR=/Applications/Xcode.app/Contents/Developer/Library/Xcode
    export XCODE_PRODUCT_BUILD_VERSION=8E2002
    export XCODE_VERSION_ACTUAL=0832
    export XCODE_VERSION_MAJOR=0800
    export XCODE_VERSION_MINOR=0830
    export arch=x86_64
    export variant=normal
    /bin/bash /Volumes/Work\ HDD/Programming/xi-mac/build-rust-xcode.sh

error: An unknown error occurred

To learn more, run the command again with --verbose.

occluded window still renders

Even if the window is fully occluded the code will still still go through the entire rendering path which seems wasteful. The problem will presumably get worse as there are more edit views although I guess there could be simple fixes for scaling it. The primary concern I think would be the power impact on mobile. Or I could be misunderstanding that this is an intentional & fundamental part of the design.

Error while editing a file

Typing in text works for a while and then it stops responding. Latest master.

thread '<unnamed>' panicked at 'self must cover all 0-regions of other', src/libcore/option.rs:794
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
   1: std::panicking::default_hook::{{closure}}
   2: std::panicking::default_hook
   3: std::panicking::rust_panic_with_hook
   4: std::panicking::begin_panic
   5: std::panicking::begin_panic_fmt
   6: rust_begin_unwind
   7: core::panicking::panic_fmt
   8: core::option::expect_failed
   9: xi_rope::multiset::Subset::transform
  10: xi_rope::engine::Engine::gc
  11: <xi_core_lib::internal::editor::Editor<W>>::dec_revs_in_flight
  12: <xi_core_lib::internal::plugins::manager::PluginManager<W>>::update_plugins::{{closure}}
  13: <F as xi_rpc::Callback>::call
  14: xi_rpc::ResponseHandler::invoke
  15: <F as crossbeam::FnBox>::call_box
  16: __rust_maybe_catch_panic
  17: <F as alloc::boxed::FnBox<A>>::call_box
  18: std::sys::imp::thread::Thread::new::thread_start
  19: _pthread_body
  20: _pthread_start
send error on send_rpc_notification method update_spans: Broken pipe (os error 32)
send error on send_rpc_notification method update_spans: Broken pipe (os error 32)
send error on send_rpc_notification method update_spans: Broken pipe (os error 32)
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "PoisonError { inner: .. }"', src/libcore/result.rs:859
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
   1: std::panicking::default_hook::{{closure}}
   2: std::panicking::default_hook
   3: std::panicking::rust_panic_with_hook
   4: std::panicking::begin_panic
   5: std::panicking::begin_panic_fmt
   6: rust_begin_unwind
   7: core::panicking::panic_fmt
   8: core::result::unwrap_failed
   9: <xi_core_lib::internal::tabs::Documents<W>>::do_rpc
  10: <xi_core_lib::MainState<W> as xi_rpc::Handler<W>>::handle_notification
  11: xi_core::main
  12: __rust_maybe_catch_panic
  13: std::rt::lang_start

Add repo description

Add a GitHub repo description:

A modern editor with a backend written in Rust

or

A modern editor for macOS with a backend written in Rust

IME support

I use XiEditor along with chinese input method, but the window of input method didn't follow the cursor.
2017-04-18_12-38-10

one more refactor? (NSDocument reconsiderations)

Should we ultimately be using the NSDocument Architecture?

Whether or not it was a good fit has come up various times, e.g xi-editor/xi-editor#88 (comment) & xi-editor/xi-editor#171 (comment). My initial motivation for merging the NSDocument changes was the built in support for tabbing, and my preference for moving more of the model logic out of the EditView, and introducing a per-document controller class.

I like those changes.

The NSDocument model has a few problems though: one of the most pressing of these is that it tightly couples a document to an individual window, and its tabbing model is on a per-document basis. This means that implementing split views, where we have multiple buffers open in a given window, will necessarily be a hack.

Similarly, the API around interacting with the file system does not represent how xi actually functions, where all file system interactions are the responsibility of ``xi-core`. If we're going to want to be doing our own window management and we're already handling file system interactions, the arguments in favour of NSDocument are starting to look a little threadbare.

That said, the overall architecture of the NSDocument model—that is, of having a singleton which is responsible for managing a collection of document/buffers—feels to me like an appropriate abstraction. If I were to move away from NSDocument then my replacement would probably keep that overall structure.

How I would imagine that replacement, in loose term:

  • rename Document to something like CoreProxyBuffer, no longer a subclass of NSDocument. This class will be explicitly responsible for the various 'edit' RPC commands, as well as for maintaining the line cache.
  • Add a new class which will serve the role currently performed by the NSDocumentController, that is of managing open / close / new / other editor-global commands, (currently in the app delegate) as well as (perhaps) things like window state restore on launch.
  • Add some subclass of NSWindowController, which will handle tabbing and splits, and
  • keep everything else more or less as-is, with the EditViewController still being responsible for the display of a given buffer, etc.
  • manually implement various open/close/save/tabbing functionality.

When this is done, I can go ahead and implement splits.

Are there any other thoughts/concerns here? One thing I think would be a responsible step would be to see exactly how hard hacking splits into NSDocument actually is.

horizontal scrolling?

Currently, text which doesn't fit within the window is clipped, and there is no support for horizontal scrolling.

I can think of two general approaches:

  1. Introduce support for horizontal scrolling if lines overflow the view. This is Sublime's behaviour. In this case, we would also want to think about how the gutter view behaves during scrolling; options are to either treat it as part of the content and allow it to scroll as well, or to float it over the content and keep it visible. I'm inclined towards keeping it visible.

  2. Always wrap lines, don't support scrolling. This is the behaviour (afaict) of Xcode. I think it's appropriate there, but I wouldn't particularly want this feature if I were writing python, say. But I don't really feel like a zealot on this point.

Highlights misaligned with bold text

Background-color highlights like are used for find matches and selection and the source text don't align properly in the presence of bold text. I assume because the rendering takes into account the style but the measurement doesn't.

I discovered this while playing around with xi-editor/xi-editor#335 and noticing that the highlights weren't aligned correctly in Rust function definitions which are bolded. Notice in the screenshot below the "self" highlight in &mut self is aligned without taking into account the wider bold characters.

screen shot 2017-06-06 at 2 44 27 pm

Print Function?

When I try to print some markdown document that I opened from the editor, the result was two blank page. I don't see this issue raised in anywhere else, so I post it here.

Is this a known bug? or there's something wrong with my build.

display lag while modifying selection

Currently, dragging and modifying a selection causes a perceptible display lag. This shouldn't happen. It might be simply that the calculation of deltas when sending updates hasn't been particularly optimized, and we're just invalidating big swathes of the line cache? If not then this is something to improve.

.xirc

Has there been any thought to have a .xirc file to have as a configuration file?

Missing lines requested and send multiple times on fast scrolling

Example console output:

requesting missing: 6232..6297
requesting missing: 6598..6663
requesting missing: 6767..6832
requesting missing: 7222..7287
requesting missing: 7489..7554
requesting missing: 7612..7677
requesting missing: 7939..8004
requesting missing: 8033..8098
requesting missing: 8121..8186
requesting missing: 8279..8344
requesting missing: 8414..8479
requesting missing: 8473..8538
requesting missing: 8473..8538
requesting missing: 8473..8538
requesting missing: 8473..8538
requesting missing: 8473..8538
requesting missing: 8473..8538
requesting missing: 8473..8538
requesting missing: 8473..8538
requesting missing: 8473..8538
requesting missing: 8473..8538
requesting missing: 8473..8538
requesting missing: 8473..8538
requesting missing: 8473..8538
requesting missing: 8473..8538
requesting missing: 8473..8538
requesting missing: 8473..8538
requesting missing: 8473..8538
requesting missing: 8473..8538
requesting missing: 8473..8538
requesting missing: 8473..8538
requesting missing: 8473..8538
requesting missing: 8473..8538
requesting missing: 8473..8538
requesting missing: 8473..8538
requesting missing: 8473..8538
requesting missing: 8480..8538
requesting missing: 8480..8538

Since a request of missing lines is send on each draw call, requests for the same or overlapping ranges are sometimes send multiple times, because the response for the previous request has not arrived yet.

My initial expectation was, that even though the core receives requests for the same range multiple times, it only sends the lines once (due to its cache of valid_lines). However, subsequent request_lines requests to the same range seem to invalidate the range and, thus, the lines are resend.

Possible solutions are: Send scroll area and have the core push the lines instead of requesting lines, or make the FE to keep track of in-flight requests.

Build failed

Got this error message while trying to build xi-mac:

The following build commands failed:
	     ExternalBuildToolExecution xicore
    (1 failure)

Spamming cmd+z and cmd+shift+z only shows on release

Steps to reproduce

  • Set key repeat rate to maximum in System Preferences
  • Do a bunch of separate edits in a document (I do this by a,left,a,left,...)
  • Hold down cmd+z, notice "Edit" menu flashing quickly but not all edits immediately dissapearing
  • Release cmd+z, notice all undos immediately take effect
  • Do same for cmd+shift+z, notice re-do doesn't take effect until release

This seems like it might be some Cocoa event loop thing? Spamming it manually by tapping as fast as I can works fine, it's only when I use my high key repeat rate to spam it that it gets stuck.

open XiEditor from the command line

We'd like this eventually. In the interim, I currently have a teeny bash script at /usr/local/bin/xi:

#! /bin/sh
open -a XiEditor $@

This requires XiEditor to be installed somewhere, like /Applications. You can also replace XiEditor with a path to the app bundle.

edit: simplified script

Terminal command enhancement.

Hi, xi is a very good thing. I used to using sublime and it provides a subl command, so that I can open any txt files in terminal which is really convenient.

Is xi also provide such a function? If not, maybe we should add this feature?

High resource usage and freezing with `syntect` plugin

When opening a file, the syntect plugin is always active, regardless if I disabled it before. This seems to lead to a very high resource usage, curiously in the XiEditor.app process, not in the xi-syntect-plugin process (According to ActivityMonitor).

The memory rises to something that seems to be proportional to the file size, and the UI is freezing (beachballing) for quite some time (up to a minute), CPU goes to 100% on all (2) cores.
After that, memory consumption goes back to a reasonable amount (113 MB) and the UI is becoming reactive again.

  • 67 MB file -> 370 MB memory
  • 175 MB file -> 860 MB memory
  • 2.75 GB file -> The computer became totally unresponsive and only with a big portion of patience I was able to kill the processes.

The same happens if I deactivate and re-activate the syntect plugin.

The files are (harmless) log files that lie on a network drive. I'm using an 10 year old iMac with OS X 10.11.6 (el Capitan).

insertion point flicker on paragraph movement

The paragraph movement commands (⌥↑ & ⌥↓) cause the insertion point to flicker to the start or end of the line before being drawn at the end or the start of the line, respectively. In other words: wherever they're supposed to be drawn, they're first drawn for a frame in the wrong place.

Stepping through in the debugger, it looks like this action sends two RPCs; in the case of ⌥↓, it's move_forward followed by move_to_end_of_paragraph. This doesn't immediately strike me as expected behaviour? Anyway I'm not sure exactly what's going on.

Use NSDictionary instead of swift types when dealing with JSON

Some profiling suggests that copying from NSDictionary (which is the type produced by the builtin JSONSerialization class) into swift types like [String: AnyObject] is a significant performance bottleneck.

We've also played around a bit with the new Decodable protocol for handling JSON, and it doesn't have particularly impressive performance yet either; so staying in NSDictionary will be an immediate near-term improvement.

I'll get around to this in the next little bit, but if someone is interested it's a good intro issue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.