Sublime Forum

Disassembling Sublime Text

#1

Something interesting and fun to read :slightly_smiling:

3 Likes

Non elevated subl does not open a file if the existing sublime_text process is elevated on windows
Why minihtml and not HTML5?
#2

I chuckled when I saw @trishume submit this to reddit and HN. He had contacted me earlier in the year inquiring about the way in which Jon was able to make the syntax highlighting system so fast.

There are a few bits of information that aren’t entirely correct. For instance, in no build do we use CryptoPP and libtomcrypt. The later replaced the former. We don’t use libyaml since it doesn’t support YAML 1.2, but rather yaml-cpp. Skyline is a name used on the text control, but there isn’t a distinct widget library. We use Skia, but not in the typical fashion. The interface is composited via Skia, but then how the composited chunks are combined or split and sent to the screen varies per operating system.

I understand the desire for things to be open source since I’ve done a lot of that myself, however my experience has been that the amount of effort for something to be a useful distinct from the original project is usually on the order of 3x. Not to mention that specialized implementations used for performance result in tighter coupling, making the process of extracting all the more complicated, or resulting in reduced performance.

13 Likes

#3

@wbond thanks for the info! I’ve updated the post with little notes about the libraries.

Indeed I tried to figure out why the syntax highlighting system was so fast by looking at the assembly, but I couldn’t figure any of it out enough to know what tricks are used. I also emailed Jon a long time ago, but didn’t get a response.

Indeed I totally understand about things being super-specialized and not directly useful as open source. However, I still yearn for even a source dump without even build files for the px or sregex directories so I could take the tricks and turn them into a usable open source library myself. But I also get it if you want to keep it as a competitive advantage because of all the work that went into it.

0 Likes

#4

Hi @trishume, the --debug command line options you talk seems to do nothing here when I launch Sublime Text from the terminal:

./sublime_text.exe --debug

Sublime Text just start normally and I do not see anything on the console output.

0 Likes

#5

Not sure what I can say other than “works for me”. It looks like you are using Windows though so maybe the command line flags have a different syntax? Or maybe you can’t use command line flags with Sublime on Windows?

0 Likes

#6

I can use ./sublime_text.exe --help to output:

Sublime Text build 3126

Usage: sublime_text [arguments] [files]         edit the given files
   or: sublime_text [arguments] [directories]   open the given directories

Arguments:
  --project <project>: Load the given project
  --command <command>: Run the given command
  -n or --new-window:  Open a new window
  -a or --add:         Add folders to the current window
  -w or --wait:        Wait for the files to be closed before returning
  -b or --background:  Don't activate the application
  -s or --stay:        Keep the application activated after closing the file
  -h or --help:        Show help (this message) and exit
  -v or --version:     Show version and exit

Filenames may be given a :line or :line:column suffix to open at a specific
location.

At least what is listed works. Seems there is not --debug option for the Windows binary distribution :sob:.

0 Likes