Hacker News new | past | comments | ask | show | jobs | submit login
Disassembling Sublime Text (thume.ca)
419 points by trishume on Dec 4, 2016 | hide | past | web | favorite | 144 comments

Ah Sublime2 was my first binary-cracking project. After countless hours of debugging with GDB and trying to understand assembly in Hopper I managed to disable the nag and patch the binary. (Purely for fun. I bought a license shortly after, of course I did not distribute this in any way). Will never forget how proud and satisfied I felt when it finally worked.

While mostly using Jetbrains or Atom with VIM plugin for development these days I still value Sublime for being able to handle really big files a million times better than Java/Web based editors.

Ha, looks like a pattern: my first was TextMate. It didn't put up as much of a fight, though -- symbols weren't stripped, there was one named "is_registered", and it worked exactly like you might expect. That didn't stop me from feeling immensely pleased with myself, of course.

I too bought a license when I entered industry and the asking price went from 20 hours of yardwork to 2 hours of doing what TextMate had helped me learn to love.

These days I mostly use Jetbrains and Sublime, but I'll never forget how easy and powerful TextMate templates were. Two steps forward, one step back.

Do you make use of snippets in jetbrains? I thought they would actually accept a textmate template straight up?

If you use Atom with VIM plugins why not use NeoVim or vim directly? It opens huge files as fast as sublime does. You have plenty of plugins to adequate your needs, definitely not as advanced as IntelliJ but I would say better than Atom.

Let's be honest. There is an amount of time and energy needed to figure out how to setup Vim and make it look the way you want it, and work the way you want it to, that not everyone can or wants to invest.

I did spend a lot of time with Vim but never got to the point where I had all my plugin issues solved. Eventually I moved mostly back to Sublime with Vim emulation, and very recently have moved again to VS Code with Vim emulation, and I'm quite happy.

What's the current state of Vim emulation in VS Code? Last I tried it didn't support the c-i-<thingy> motions, nor a few other relatively basic ones that I use a lot.

This is the roadmap for the biggest VS Code plugin: https://github.com/VSCodeVim/Vim/blob/master/ROADMAP.md

Oh wow. Looks like they've implemented pretty much everything I use. Thanks for the info!

Other scenario:

Long time "lightweight" VIM user with gvim, using tabs, and often two windows (sessions)...

On OS X, MacVim was a delight.

Since I had to swiych back to Windows, and I use VirtualBox, gvim is really slow. It also has some nasty rendering issues due to its underlying gtk framework intercaction with the Virtual Box Guest Additions. The only work around I found was some obscure tweaks in the Compiz Comfing Settings Manager (CCSM) related to screen redraws. Spent hours and hours installing different VMs, Linux Mint, Ubuntu, etc. and trying to isolate the problem in Virtual Box.

Finally recently I heard about Sublime Text... it runs SO MUCH BETTER than gvim in a Ubuntu VM.

And.. icing on the cake... I discover it has a "vintage" mode that covers pretty much everything I used (ci" to replace inside strings, dt; to "delete till ;", vit to select visual inside tag, etc. It seems to support a lot more than the documentation says.

To top it off it appears to be very configurable as well.

All in all I genuinely wonder why you'd not want to use the editor? Because it's paid? It doesn't even enforce you to buy the software, which is prety gracious of the developer.

But honestly.. what started getting on my nerves.. is whenever I'd visit discussions about vim and you always have the same clique who point out how using the mouse is "inefficient" and how using vim inside terminal is the only true way of using vim, and how using tabs is "slow" compared to their way of switching buffers, etc. I suppose you can gleefully ignore these comments but it makes you question in the end if you are using an editor out of ideology. If I stick to Sublime Text I will definitely not miss those inane topics.

The main thing I don't like in Sublime Text so far are:

- the search replace UI... I much preferred the %s// way of doing things. ( but for multi file refactoring I much prefer a special tool for that like "regexxer" )

- the over abundance of auto completion. Unfortunately whenever a dev creates some autocomplete plugin they always feel as if it is the right thing to do to complete EVERYTHING. Well it makes "logical" sense to them, to scrape a source like mozilla MDN, or the specs sheets. And then they may even proudly describe how their plugin covers everything AND MORE .. including css properties or javascript syntax that isn't even implemented yet.

.. So TLDR I find out half the time I try to complete something I end up spending more time undoing the clusterfuck and it makes me wonder why I use it at all. I wish devs understood the 80/20 rule and make the completion work for the 80% case, so that the editor actually serves the user instead of slowing you down. How the heck do you remember everything that can be completed? THere is simply too many possibilities so you never know quite what will happen.

.. So now I need to find the setting in Sublime to auto complete only what is in all my open files and nothing else, and it's probably much more meaningful that way. Since when you add to a project, you'll end up reusing a lot of the functions both self made, and those often used from an API.

That's my rant for the day =)


But seriously Sublime + Vintage mode maeks it easy to switch from vim if necessary. The settings are:

    // (dont ignore "Vintage"

  "vintage_start_in_command_mode": true

> I need to find the setting in Sublime to auto complete only what is in all my open files and nothing else

that would be the AllAutocomplete plugin, it does exactly that :) afaik it's the only autocompletion I use, for pretty much the reasons you said.

I guess it's too late now, but the solution to your Problem would have been to run an X server on your host and connect the gvim in your VM to that.

I've given up on evimgelists, their way is always the best way to do something and nothing will change that in their head.

Could we not have the editor wars?

Aside from that: I love vim and use it any time I work remotely (via ssh). But I spend good chunks of my time in Linux (Mint), Windows, and Mac. And Vim is great for the first and the last, but is awkward for Windows. And even if I don't mind the gui that looks like it came out of a dog's derriere, it makes synchronizing my settings a pain in the same region just because I need to change filenames (.vimrc becomes _vimrc, if memory serves), add a bunch of conditionals to handle different features, and possibly also change line endings (I forget if that is needed). Whereas atom is easily synced with a single mostly automated plugin that pushes everything I need to a gist.

I still prefer vim on my primary work station, but I am also eagerly following atom development in the hopes of filetype specific tab/indent/linelength rules to be better supported and various improvements to performance.

And on a less usability note: Atom looks REALLY good when you are doing a code demo or a presentation.

I am switching languages and frameworks quite often, always trying new stuff. So I don't have the time and patience to learn how to configure vim to work with all of them. For me it is mostly about navigation/searching/editing without leaving the home-row anyways, not so much about vim as the editor per-se.

Atom has a better GUI than VIM.

Another alternative: http://spacemacs.org

Vim is still a lot better at handling window splits.

People don't use VIM for its GUI.

Because vim is a UI disaster


Inability to distinguish between easy to use and overly complicated app to use is a disaster too.

I also tried to figure out how some parts of the editor work and why they are so fast, but I couldn’t figure out much from the assembly.

Those who are interested in text editor design may find this series and the links therein useful:


Yah I'd read that, so I looked for signs of a piece table, but couldn't find any. Which doesn't necessarily mean that it isn't using one.

I suspect that Sublime Text either doesn't use a piece table, or uses one that only breaks pieces at line boundaries. The reason being that the highlighting relies on running regexes on one line at a time, and it uses oniguruma for this sometimes, and oniguruma requires the entire haystack to be in one array. However, Sublime doesn't highlight super long lines because it would be too slow, so it could break its piece table on incredibly long lines so that editing them could still be fast.

I was also looking for fancy rendering and highlighting tricks, but couldn't decipher any.

Re: data structures, ST could also use ropes, or gap buffers.

Or the classic The Craft of Text Editing from 1999:


> If I spent an entire day I might be able to reverse engineer one function

Yep, that's kind of the way it works, when you start out. Then you get used to some of the patterns that the compiler uses, and you can get through several in a day, if you're lucky!

I recently installed VSCode just to try and was pleasantly surprised. For Sublime users there's a plugin to remap all keyboard shortcuts to Sublime ones (when available ex. multi-line edit isn't just yet). VSCode is getting updates on a monthly basis it seems and I have no doubt it'll catch up to Sublime in the next 6-12 months.

But it's very slow in comparison to ST. For sure related to the Electron framework beneath VSCode. (Yes, I'm that type of person that opens 25MB logfiles with such an editor)

Sublime isn't fast either. For opening gigantic log files less works good. (not editor though, but why edit log files?

I definitely envy VSCode's nice debugging interface. I wish there was a standalone debugging app that integrated with Sublime (and other editors) to provide multi-language debugging like VSCode.

For now, Sublime's plugin ecosystem is still better. And Sublime has more polish on a ton of little things.

It will never catch up to Sublime on performance though. Not only because it is written in JS but also because a ton of the work that went into Sublime was writing custom systems for fast text editing.

> It will never catch up to Sublime...because a ton of the work that went into Sublime was writing custom systems for fast text editing.

Why couldn't the creators of VSCode and the open source community catch up to Sublime's systems for fast text editing -- especially considering Sublime was written by a single developer who seems to not work continuously on the project.

The JS issue is another story.

In theory they could do some of them, but they'd have to be done in asm.js or WebAssembly. Both for speed, and because otherwise the lack of statically sized structs will kill you on memory overhead.

For other things (like a very nice minimap that actually renders based on the shape of characters) you are limited by what the DOM is capable of in terms of custom rendering. You can get around this by doing what https://www.figma.com/ does and rendering everything with WebGL from asm.js, but that would be a total rewrite and you lose all advantages of using Electron and you might as well just use C++ and OpenGL directly, and at that point you are just cloning Sublime.

Also Jon Skinner is a performance-obsessed wizard who does things like write a custom regex engine just to make the fastest syntax highlighting engine even faster. Whereas the VSCode team is the kind of team that wrote a text editor in JS. I will hand it to them that they did pretty well at optimizing and VSCode is the fastest JS-based text editor, but they don't seem to have the kind of performance-at-all-costs approach it would take to match Sublime.

It's not so much that it's impossible, just that I'd bet at high confidence that VSCode will never match or exceed Sublime's performance on most text editor operations.

Well Atom and VSCode are both electron based, but Atom already has a minimap-scrollbar implemented so it is possible.


Maybe it isn't as 'technically good', but it does the job and imo looks good. 3M+ downloads.

As for performance, they try to keep up with electron, which keeps up with Chrome, which is currently being retrofitted with a new blazing fast javascript engine (https://v8project.blogspot.com), so it will only get better :)

Yah I'm aware of Atom's minimap, hence why I wrote "that actually renders based on the shape of characters". Atom's renders with blocks instead of tiny characters because the DOM couldn't handle full rendering. With Sublime on a Retina display I can even read some of the text. Not a huge deal, but I like it better and it's indicative of the kind of things Sublime can do.

As for V8 it gets faster but is still far from C++. The main issue being it's impossible to make memory-efficient data structures, which are super important for editing large files.

I'm pretty sure that it's rendered in a canvas, not with the DOM, but I may be mistaken. Either way it's simply because of laziness or complexity-avoidance that the minimap uses blocks, not a restriction of the medium.

The minimap could be on par with sublimes, but for whatever reason the dev who made the plugin hasn't made it so. That doesn't mean that it's impossible or impractical due to some restriction of atom itself.

You're right that it does use a canvas, but I'm not sure that it could do full rendering at decent speeds. The trick is scrolling at 60fps. I'm not sure JS Canvas can draw 100,000 characters in 16ms. I think you could do it with WebGL but it's gonna be a while/forever before anyone does that, and then the JS preparation of the data might bog your CPU.

if you open even a 10mb file in atom or vscode, they grind to a stand still. sublime can pretty easily handle hundreds of mb, AND can do regex search over them.

on performance, they aren't even in the same league.

Debugging will even get better. Honestly that's one of the major reasons I like vscode. It integrates deeply with the language and runtimes. It has debug adapters and language services for most major languages.

As for performance. When I need to open large log files, I still go for sublime text. If some core parts of sublime were open sourced, it would be a huge.

I've found Notepad++ very good with opening huge files. I'm not sure how it compares to Sublime Text, but Notepad++ is already open source: https://github.com/notepad-plus-plus/notepad-plus-plus

IMHO the performance of VSCode is good enough. At least for most of my coding. Inspecting huge, archived logs from 3rd parties is the exception. I think nothing can beat sublime in that.

It's not mature yet, but xi can apparently already handle files of several hundred MB with no tearing or lag at all: https://github.com/google/xi-editor. It completely separates the (Rust) back-end process that manages the whole file from the front-end windows, which only render the on-screen sections.

Part of what you lose other than large files is little features that need high performance to work.

For example Sublime's fuzzy finder previews files behind it as you type, VSCode/Atom/Emacs can't load files fast enough to do that.

Sublime's minimap beautifully renders each character in the correct shape (at small size) using the same renderer as the main body. The DOM memory usage and thrashing when you type an unclosed quote and the whole file gets re-highlighted would kill Atom/VSCode if it did that.

Also the little things just have far lower latency. Opening a file, typing in the fuzzy finding window in a large project, deleting a closing quote that re-highlights the rest of the file, etc...

You could use a canvas or an SVG to avoid "DOM thrashing" so there's no legitimate restriction that has led to minimap being implemented in the way it is.

From their FAQ:

How to disable telemetry reporting

VS Code collects usage data and sends it to Microsoft to help improve our products and services. Read our privacy statement to learn more.

If you don’t wish to send usage data to Microsoft, you can set the telemetry.enableTelemetry setting to false.

From File > Preferences > User Settings, add the following option to disable telemetry reporting:

    "telemetry.enableTelemetry": false
Note: VS Code gives you the option to install Microsoft and third party extensions. These extensions may be collecting their own usage data and are not controlled by the telemetry.enableTelemetry setting. Consult the specific extension’s documentation to learn about its telemetry reporting.

Serious question: is there a legitimate reason I should care?

Well you should always care about your privacy. I think the better question is do you need to worry? My personal opinion is no, not for things like telemetry in VSCode. It is used to make the product better (hopefully) and I can't see the data collected on startup time or crashes are a massive invasion of privacy.

Is there a legitimate reason a _text editor_ developer should be allowed to make their software call home?

I've only seen Electron-based editors doing metrics, perhaps web developers are less offended by the idea thanks to pervasive usage of things like Google Analytics.

There's a lot of information developers could use for the benefit of their users, if they had access to it, some of only very mildly privacy invading, some of it extremely so.

Collecting call stacks from crashing threads or executables can be incredibly useful for fixing them.

Measuring what functionality gets used and what not can help direct feature development (should that checkbox be as visible as it is?)

Collecting statistics on Unicode code point usage may direct development of core data structures (UTF-16 might be the best choice for the basic character unit)

Collecting CPU/memory/disk stats similarly may direct development (if most of your users have gigabytes of free RAM, that change that takes 20% more memory but speeds up things may be useful; if they have plenty of idling CPU! But no memory, things are different)

Knowing what percentage of your users run on a 80386 may help making the decision to compile for at least a 80486.

Knowing internet connection speed and amount of free disk space may help make the decision to move all help online.

Knowing the default browser can help direct testing of the help system, if that system uses the default browser.

Knowing the locale of your users may give hints as to what spell checking languages or UI translations to support.

Having access to the custom dictionaries of all your users may be helpful in improving the ones you ship with the editor.

Having access to every edit made (we are deeply into 'extremely privacy invading' territory now) may also be helpful. For example, you may discover that most of your users don't seem to know about a shortcut that combines five other actions.

Etc, etc.

Everything here can be solved by an Apple like pop-up whenever something crashes that ask you if it's okay to send the crash informarion plus machine information.

Telemetry doesn't bring anything more to the table. When I see an app with telemtry, I am just thinking they don't know what they are doing.

Except for everything that didn't involve a crash (which was everything in that list except the first thing)

An example of how they use telemetry can be seen in their issue tracker.

Here is an example: https://github.com/Microsoft/vscode/issues/707

Pretty much all commercially developed software has usage collection. Why is a text editor any different?

Exactly. No piece of software should be calling home, except to the degree that its core operation depends on it, and even then, that data should be easily available to the user.

So developers should be shooting in the dark on what their users are actually doing with the software and have no data with which to better allocate resources to the features that will cover the most users?

Bold move, Cotton.

Developers built great software just fine without constant data spying.... on the other hand all that great "important" data collection somehow doesn't assist in making modern Electron apps any less of a CPU, battery and RAM hogging arse of a software.

Most of analytics data never gets looked at and never provides any useful insight because it's setup poorly.

Well, comparing VSCode to Atom I can say that VSCode runs circles around Atom even though both of them are electron based editors.

Yes, developers should have to put some thought into designing their own products. If they're curious how their product is being used, they should do the footwork and ask, and open channels for voluntary feedback. They can collect data with permission. End users' control over their own data is more important than making it easier for developers.

Developers should ask users to opt-in and help with the development. Programs should not send a single byte without users's consent.

When they don't provide a method for their user to audit and/or disable telemetry? Yes, I'd prefer them to be blind. I don't expect that this would be a particularly popular position, and that if I kept it as a strict requirement for software I use, it would make it essentially impossible for me to find options in whole classes of software.

Disappointed by these other answers.

Whether you should care comes down to your ideology. My view: I totally see the value in tracking your users, but I also believe there should always be an option to opt out. Tracking becomes insidious when you lose the right to not participate.

By choosing to opt out, you're showing Microsoft that there are people that genuinely care about being able to not be tracked, making it more likely for them to keep this option for the future.

> By choosing to opt out, you're showing Microsoft that there are people that genuinely care about being able to not be tracked, making it more likely for them to keep this option for the future.

How is Microsoft supposed to know you disabled telemetry? VSCode can't tell them you did, that would be a form of telemetry :P

They still get update requests (_something_ keeps telling me once a month that there's a new version out, even with telemetry off); that can be compared to the number of unique users with actual telemetry to find the number with it off.

This presumes that MS tracks the fact that you've opted out of tracking, which is not obviously the case.

I don't know of a better open source IDE for front-end development right now. Performance isn't up to ST3 but it's more than acceptable, and the built-in tools and robust extensions more than outweigh that cost.

Except VSCode is not an IDE but a code editor. For an open source IDE check Netbeans out. Or another code editor Brackets.

Agree/disagree. Netbeans has a ton of features VSCode doesn't but VSCode does include a lot of IDE-like features, especially OOTB compared to ST3.

Out of interest, what would you say is the difference between a text editor and an IDE?

IDE's usually offer much more features than text editors. This sounds kind of anecdotal because it is and the line between the two is getting blurrier as text editors get more powerful. Typically, strong auto-complete, debugger tools & project management were differentiating factors but those are becoming more available at the text editor level as well.

By multi-line edit do you mean multiple cursors at once? Does it have a fancy regular expressions generator to replace it? Otherwise that's a non-starter for me, simultaneous editing is too valuable.

It's there, it's just bound to alt-click instead of ctrl-click. And currently you can't rebind any keybinding with a mouse click on it, so you have to use alt-click.

What are the main use cases of multiple cursors? It seemed like an interesting feature, and I'm curious why it would be considered essential.

I use them very often in Emacs instead of keyboard macros. They are useful whenever you have to perform the exact same operations in several places simultaneously visible on the screen[0]. By operations I mean both simple ones, like writing something, and more complex ones, like navigating/deleting whole words (of different length), etc.

Mostly I use it for quick renaming of variables, string fixes, and some structural changes in code.


[0] - multiple cursors, at least in Emacs, can work off-screen too, but I don't like not seeing what's going on when I do changes.

I also do this, though I use iedit-mode rather than multiple-cursor-mode.

However, I do like to point out that it's really just eye-candy for stuff I was already able to do in emacs. Previously, I would have used either keyboard macros or query-replace-regexp to do the same things.

I second it. I too used either keyboard macros or query-replace- commands before. Multiple cursors is just nicer for these particular things.

It's basically a visual regular expressions. So I'll caveat my original statement that if you don't know regex, you need it. I never learned regex because I came from a self-taught, web development oriented background. So if I need to replace all instances of a variable, then go to the end of the line they were on and type in a different variable name or add a semi-colin, that's what I use.

Lots of little things. Select a multiple lines of an object/hash/dict, break into multiple cursors, rewrite line (copying and pasting as needed, it works that out as well) to change to variable declarations, or to add a comma, or to... whatever.

I often use "multiple cursors" as vertical cursors, to indent or dedent a whole block of code 1 space at a time. Often useful for contexts when shift+tab/tab doesn't work.

For me it's mainly part of this sequence:

Ctrl-F <search query> SelectAll <edit with multiple cursors>

Do it all the time.

I love the CTRL+CMD+G route as well. Use it constantly when refactoring.

I desperately want to switch editors (been using slickedit since 93)

I tried VSCode only to find it is hardcoded to only support 3 panes at once. I often have 5-7 panes open.

It was also not clear how much work it would be to add modal selection. I tried the most popular vim emu looking for an example on how to do it only to find that feature has not been emulated yet.

I use VSCode for a few tasks and enjoy it, but Sublime is just so much more polished than anybody else. In addition, Atom/VSCode/ETC all have panes as an afterthought. Sublime's tabs/panes work far better and behave the way I expect them to.

If I already have a Sublime license, and I'm happy and it fulfils my needs perfectly, what would I gain in spending the time to try to get my workflow working in VSCode if it still hasn't caught up, as you say?

If it fulfills your needs perfectly then there's no need to change. It may be still worth playing with a bit and doing tooling investigation to find out if there are some super useful features for your case.

I switched to vscode from sublime recently, because it has much better autocompletion and "goto definition" especially when working with JS and TypeScript code, which is exactly what I need. Other than that I was able to replicate all features from Sublime (e.g. multipoint editing) and I'm not aware of any missing feature from what I used in Sublime. One con is that vscode is slower to start and slower to open up a file.

> I'm happy and it fulfils my needs perfectly

Have you not answered your own question?

Up-to-date plugin ecosystem, especially if you write code in trendy languages.

But if your workflow ain't broke, don't fix it, right?

It's closer to an actual IDE for JS than Sublime is (even once you install a bunch of ST plugins). Especially for TypeScript. That said, if Sublime is working for you, stick with it.

having a multi language debugger integrated into my editor was a huge game changer for me.

I heard that about Atom around 12 months ago.

Atom had many more performance issues. VSCode is not on par with Sublime but very close.

Keymaps were my number one reason for abandoning vscode so I'm glad they've got a sublime/atom keymap now. I might give it another go.

I switched to VSCode just for my Typescript projects, and really like it. Main reason I switched was that in Sublime you can hide JS and map files, but it always hides them. With VSCode you can have logic in your config, so you can hide JS files, only if a TS file with the same name exists, that way I don't have to switch config when I'm looking for a js file particularly, and can keep my sidebar clean and show only files I need to edit.

What is a modern disassembler on windows nowadays if I'm too cheap for IDA?

I'm surprised that radare[1][2] hasn't been already mentioned. It can support basically any architecture you can think of, runs on all major OSes, and has bindings for a ton of popular languages.

[1]: http://radare.org/

[2]: https://github.com/radare/radare2

I think that x64dbg is pretty good http://x64dbg.com/

That looks pretty good! It's really similar to OllyDbg. Is that just a UI theme?

>"I’m the main developer of x64dbg, which is heavily influenced by OllyDbg and offers similar features but on the 64-bit platform."

Source: http://mrexodia.cf/x64dbg/2016/01/31/OllyDbg

Binary Ninja

I think Binary Ninja may support Windows but would need to double check

There's torrent... If it's for personal use, there are many countries where it is not illegal to torrent software. Yours might be one of them.

Torrenting involves uploading data, which is considered distributing content you don't own. So I think torrenting copyrighted content is illegal most places. A regular http download might be legal though more places.

    "draw_shadows": false
Fuck yes. I run into this as a (minor) problem all the time. Should be exposed by default.

What a cool exercise in general.

I don't understand what the 'shadow effect' is, I'm staring at my unmodified ST window, and am not sure what to look for.

What I really want is to make ST3 sidebar menu look like it did in ST2!

`draw_shadows` effects the shadow cast by the Sublime "minimap" -- the code shape outline on the right side of the window.

You can see the effect of turning it off by comparing the right sides of the single pair of (before/after) screenshots in the article.

before: http://thume.ca/assets/postassets/sublimesecrets/debug_rende...

after: http://thume.ca/assets/postassets/sublimesecrets/configs.png

Aha, the first thing I do in ST is turn off the minimap completely, so that explains that! Thanks!

You need a file with a line longer than your window is wide. Then whichever side(s) of your window have content scrolled off the side of them will have a slight shadow effect on them. It's actually quite cool and I think indicative of the kind of polish present in Sublime but not other editors. But I can see some finding it annoying in some circumstances.

Also, after discovering this I Googled it and saw that some other people mentioning it (no hits for the other settings) in connection to the Soda theme, so maybe if you are using that it might already be disabled? I'm not sure.

Yah the work day before I did this I actually was using Sublime on a portrait monitor where the line length limit in our source guidelines fit at my font size, but since the shadow kicks in slightly before the line actually goes off screen, it created a shadow. So I was pleased to find that as well.

The sregex the page mentions is most likely this one:


Its distinguishing feature is that it's a regex library that matches streams (hence 's'regex).

This is not the same library, although they do share a name.

> draw_debug

> A boolean that if true enables a special debugging text renderer. It seems to turn sections of the document either blue or red, and within the sections it turns tokens alternating light and dark shades of those colours. Note you have to set the setting to false to turn it off, not just delete it. These change sometimes when scrolling and editing but I can’t figure out when and why.

That sounds exactly like GPU layers in web development - green is GPU accelerated, red is unaccelerated.

Slightly OT: I've never heard of Skia before, but a few years ago I was trying to find a good vector graphics solution for realtime video games... can it be used for that?

Depends how complex your video game is.

It has a GPU back end so it can be pretty fast, but it is still focused on very high quality antialiased rendering so it isn't crazy fast. Apps like Chrome and Sublime don't repaint the entire screen every frame or when scrolling, only the parts that change, so they can afford high quality.

You probably could but you're having a bad time compiling and building Skia. It uses a peculiar build system (that is used throughout the chromium ecosystem). It does have a performance in mind and even comes with a tool (nanobench) to measure perf.

That being said for a game you'd probably be better off with a higher level engine that also manages the scene graph, spatial sorting etc things for you unless you want to work on that part yourself.

It definitely could, as far as I understand it's the underpinning for all of Chrome's graphics for instance, including Canvas.

About once a year I get a hankering to mess with disassembling something but usually after countless screenshots, open tabs, notes, etc. I remember that I am terribly slow with assembly.

> snappy: Fast compression, not sure what it is used for

Quite possibly leveldb, listed immediately above snappy, which can optionally compress content with snappy.

Wow, in a happy coincidence syntect is exactly what I was looking for all last week! Now I just need to figure out Rust.

Cool, email me if you need any help with it. In fact, email me regardless of if you need help telling me what your project is and how syntect might help.

Is this legal?

AFAIK yes. It's not illegal to look at how something works. There are some dumb laws in the US about circumventing and changing things, but I didn't actually touch anything.

I would also be more skittish if I was looking at the license key validation code, but I didn't since I bought a license a long time ago (it was totally worth it).

Most EULAs forbid reverse-engineering, decompiling, or disassembly. In the USA, EULAs are legally binding contracts per Vernor v. Autodesk, so disassembling a program in violation of the EULA could make you civilly or criminally liable for copyright infringement.

Generally probably worth keeping in mind but it seems extremely unlikely someone developing a tool for developers is going to make a stink about reverse engineering anything except for license validation code.

It is actually illogical. If you paid for a program and later do not accept EULA then what have you paid for? I think if you have bought a program you get the right to use it without any EULAs because that's what a purchase is. I hope other countries have more reasonable laws.

This is the exact issue under law in Vernor, to wit: whether or not a customer who purchased AutoCAD had the right to resell his copy under the "first sale doctrine" (AutoCAD licenses are nontransferable per the EULA). Most proprietary software comes with a statement "This software is licensed, not sold" or words to that effect. You are not buying a copy of the software; you are buying a license to use the software. Because you must make a copy of the software (in memory) in order to use it, you are in violation of copyright by using the software without a license. So any use of the software is subject to the terms of the EULA and by using the software you agree to those terms. Violating the terms = no license = no right to use the software.

Pretty standard contract law really, and the 9th circuit agreed, finding in favor of Autodesk in Vernor. But hire a lawyer if you need to know for sure.

> You are not buying a copy of the software; you are buying a license to use the software.

And you generally cannot use software without first installing it to a hard drive so obviously it should be treated as a part of "usage", not "making a copy". Like playing a DVD is just usage, not making a copy. But of course the law doesn't always follow common sense.

I think that making copies for oneself (as long as one doesn't distribute them) should not be regulated by copyright too.

The Berne Convention says:

> Authors of literary and artistic works protected by this Convention shall have the exclusive right of authorizing the reproduction of these works, in any manner or form.

> It shall be a matter for legislation in the countries of the Union to permit the reproduction of such works in certain special cases, provided that such reproduction does not conflict with a normal exploitation of the work and does not unreasonably prejudice the legitimate interests of the author.

So it is possible to permit making copies for oneself under Berne Convention if the lawmakers wanted that. For example, law allows to record TV programs.

Most EULAs prohibit it, probably not.

Most EULAs aren't legally binding either.

Vernor v. Autodesk. Look it up. EULAs are legally binding contracts in the USA.

And plenty of people don't live in the USA. :)

e.g. Sublime HQ Pty Ltd, which is Australian: https://www.sublimetext.com/buy?v=3

Nice, but I wonder how much time has Sublime left now that VSCode, which is better and free, is out.

VS Code is very good for what it is but there are still some telltale web app cracks and gaps scattered about, and of course its resource usage is considerably higher than Sublime's (I'm seeing ~240MB RAM usage on a fresh install with no documents open). I suspect that until these two factors are fixed there will still be those who prefer Sublime.

I've tried firing up VSCode in a VM and found it unusably slow, whereas Sublime is fine.

What OS are you using that has no native VS code support?

He could also be _working_ in a VM, when his host OS supports it but he's not using the host at the time.

Plenty of time as long as VSCode is running on Electron.

VSCode is better in some ways for a couple languages that it has nice debuggers for. Otherwise Sublime has a lot on it.

Sublime is faster and is crazy polished. It also has a larger plugin ecosystem.

"Better" if you don't care for performance. Or memory usage. Or GC pauses.

For the time being, nothing beats the polish that went into Sublime Text.

> which is better and free

Please backup claims with evidence.

Well, you got one of the three right.

I am wondering why someone even want to disassemble any editor these days...

There is no mystery in principle. Take Scintilla if you want to study editor in source code. That is straightforward implementation but works well enough.

As of syntax highlighting ...

You can use either regexp'es or, which is better, some predefined tokenizers.

Pretty much all programming languages have concepts of NMTOKENs (keywords variable names), string literals, numbers, comments. You can write very fast tokeneizers/scanners that will give you basic blocks. If needed you can pass these blocks to regexp for further processing. That will give you very fast processing.

If to deal with markup languages then use separate tokenizer. Almost 10 years ago I've written this: https://www.codeproject.com/Articles/14076/Fast-and-Compact-... , tens of megabytes of XML/HTML processing per second...

If you look at the article, you'll see that I wrote a full clone of Sublime Text's syntax highlighter before even opening a disassembler. I do in fact know how to do syntax highlighting.

And yes I read lots of Scintilla's code years ago.

I did a couple hours of disassembly reading purely out of curiosity and to find exactly the kind of hidden goodies that I ended up finding.

Applications are open for YC Summer 2019

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact