Show HN: Tiled Text – a Different Approach to Editing Text
tiledtext.com
tiledtext.com
Someone get this man a job, even if it has nothing to do with this code.
"My studies at these times were very fruitfull and I think now that mathematics has a chance at contending with coding, and I have finally seen some glimpses of mathematical structures that should be called beautiful."
Could be an alternative path there.
Game controllers are not better. Excerpt from wikipedia: "RSI is also used as an umbrella term for non-specific illnesses popularly referred to as Blackberry thumb, iPod finger, gamer's thumb"
Something I've seen from speaking with a lot of people with overuse injuries is that what activates a person's injury tends to vary a lot. I'd heard elsewhere that touchscreens were terrible and didn't try them for quite a while as a result. But for me they ended up being better for a lot of things. Additionally, game controllers are a large improvement in my case simply because I can hold it in my lap instead of extending my arms, and in my case there is only limited finger pain (more arms, elbows, wrists).
The ideal here, however: are motion sensors--like the Kinect, but better. In fact I started out working with the Kinect, but it's not precise enough imo to create a nicely ergonomic coding system. However, things like The Leap (https://www.leapmotion.com/) may be: it could take very subtle cues as inputs and track light hand motion.
In hindsight this really makes sense. Mine was most likely activated by combination of low-profile keyboard and finnish keyboard layout (almost all programming related special characters are behind right alt combinations). So it's not suprise that all reaching motions are not good.
> The ideal here, however: are motion sensors--like the Kinect, but better.
Kinect depth sensor has really low resolution (640x480, if I remember correctly) which is way too low if you want to interpret precisely small movements. I also was interested about Kinect for exactly same purpose, but those specs were too "meh". For this reason I have been waiting for Leap to be released since its announcement.
What are the alternatives? Speech to text? DataHands? (http://www.datahand.com/products/proii.htm)?
Would you recommend a mechanical switch keyboard?
Personally, I have never needed code folding (I prefer to have my own map of the code in my head, and anything that obscures that map just gets in the way), or Sublime Text's minimap, nor have I ever needed the symbol sidebar that is found in some IDEs (Eclipse, Netbeans). What I really want is more efficient editing.
For example, text editors like Sublime have zero language-sensitive refactoring support. I can't rename (variables, methods etc.) or extract methods, for example. Even some really simple operations like "select entire current nesting level" are unavailable. I remember using Eclipse 7 years ago and really liking the intelligence of the incremental compiler backend, even though I hated Java; it seems that with backends such as Clang, those tools can once again be applied outside big, annoying IDEs like Eclipse and Xcode.
Not sure if this particular approach is useful except to a small niche, but it looks pretty slick. Good luck with the effort!
Sublime also has "Expand Selection to Scope", except it doesn't really work that well: First invocation it chooses the current symbol, on 2nd the current brace block except the braces, on 3rd the braces themselves, and so on.
And it also has "Expand Selection to Indentation", but I don't see use for it in cases where you want to manipulate blocks of code, since it nearly always doesn't select what you want.
What I'd like is a command, let's call it "Expand Selection to Statement or Block", that:
* On 1st invocation, selects the current line.
int foo(int bar) {
bar = mogrify(bar);
if (bar > 0) {
slartibartfast = 42;
[[baz = bar + 1;]] # <-- [[ selection ]]
print_report();
}
return bar;
}
* On 2nd invocation, expands to the current contiguous set of lines, bounded by either empty lines or language-specific block (usually braces, or in Ruby's case, "if/while/..." until "end"), but not including the boundary: int foo(int bar) {
bar = mogrify(bar);
if (bar > 0) {
slartibartfast = 42;
[[baz = bar + 1;
print_report();]]
}
return bar;
}
* On 3rd invocation, expands to the current contents of the block, excluding braces and excluding the lines containing the braces. int foo(int bar) {
bar = mogrify(bar);
if (bar > 0) {
[[slartibartfast = 42;
baz = bar + 1;
print_report();]]
}
return bar;
}
* On 4rd invocation, expands to the enveloping statement that uses the block: int foo(int bar) {
bar = mogrify(bar);
[[if (bar > 0) {
slartibartfast = 42;
baz = bar + 1;
print_report();
}]]
return bar;
}
* On 5th invocation, it would continue to step 2, ie., looking for more lines that are contiguous with the current selection: int foo(int bar) {
bar = mogrify(bar);
[[if (bar > 0) {
slartibartfast = 42;
baz = bar + 1;
print_report();
}
return bar;]]
}
* And so on. Eventually it will get to the entire function declaration.Combined with a "wrap selection in braces"-type command (that indented the selection, wrapped it in braces, and placed the caret at the beginning so you could start typing something like "if (...) {") you would have a fairly powerful block-manipulating shortcut.
It would probably be quite trivial to write such a plugin. I might try my hand at this. Not sure how much language sensitivity it would need, might be doable without anything at all.
Talking of contiguous lines. I like macros of the following form for quickly hopping around vertically in a file:
// .sublime-macro
[
{"command": "move", "args": {"by": "stops", "empty_line": true, "forward": false}}
]
// .sublime-macro
[
{"command": "move", "args": {"by": "stops", "empty_line": true, "forward": false, "extend": true}}
]
// .sublime-keymap
{ "keys": ["ctrl+up"], "command": "run_macro_file", "args": {"file": "Packages/User/HopUp.sublime-macro"} }
{ "keys": ["ctrl+shift+up"], "command": "run_macro_file", "args": {"file": "Packages/User/HopUpSelect.sublime-macro"} }, {"keys": ["alt+up"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": false}},
{"keys": ["alt+down"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": true}},
{"keys": ["shift+alt+up"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": false, "extend": true}},
{"keys": ["shift+alt+down"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": true, "extend": true}},
(Changed it to alt instead of ctrl because that's how I like it.)(IDEA is a Java/Swing app, and I'm very sensitive to apps that don't look or feel native on OS X. Yes, Sublime is crude in places, but at least looks and feels native. Being a Swing app it promotes certain GUI conventions that have not been relevant since the early 2000s. It's tabs and toolbar hell and looks like something out of a bad Windows nightmare. Sorry if that sounds snobby, but if I didn't like beautiful GUIs I would not be using a Mac.)
I don't know what others do, but I actually hide the toolbars in my IDEs (I use several JetBrains products: PyCharm and IntelliJ mostly, PHPStorm and RubyMine to a lesser extent.) PyCharm actually received a facelift recently that I hope finds its way to the other products as well.
All JetBrians products ship with several skins (ctrl+tilde brings up the menu) and I've never found any trouble getting them the way I want. I do find XCode (which is my go-to editor for C and C++ not being an ObjectiveC developer myself) to be a very good looking IDE but personally, I'd never sacrifice function. It's just too important. IMHO, of course.
Xcode is also native (although not very pretty), but it is a horrible IDE. I use Sublime for my ObjC coding, although I am forced to use Xcode for some things that ST cannot do, like adding files to a project, editing compilation flags or working with .xib and Core Data .momd files.
It's a compromise. IDEA is too ugly to use, Sublime lacks some features but is great in most areas.
Given that many of the features you're talking about actually do exist in IntelliJ, etc, doesn't that mean that yes, you are sacrificing function for form?
There are other factors at play such as speed; Sublime is lightning fast, IDEA is not. And afaik, IDEA does not support Sublime-style multiple carets.
The context-sensitivity is handled by having a list of expansion/contraction functions to try in sequence, so your region grows outwards by different units. Or you can specify a specific expansion function (like, er/mark-outside-python-string) upfront.
As an example, the expand function list I have for a python buffer open is:
(er/mark-word
er/mark-symbol
er/mark-symbol-with-prefix
er/mark-next-accessor
er/mark-method-call
er/mark-inside-pairs
er/mark-outside-pairs
er/mark-comment
er/mark-inside-python-string
er/mark-outside-python-string
er/mark-python-statement
er/mark-python-block
er/mark-python-block-and-decorator
er/mark-outer-python-block)
[1] https://github.com/magnars/expand-region.el or from ELPA vi{
v%On the other hand, I have colleagues who can't program without having pen and paper around -- people use whatever tools they like based on how their mind works.
For anyone else looking for exactly this, here's a great vim extension that gives you "indent" objects: http://www.vim.org/scripts/script.php?script_id=3037
Moving code around is not a difficult problem to solve. Drag to highlight, grab it and move it somewhere else. You've done that elegantly.
But writing massive amounts of code on a device without a traditional keyboard is awful and that's the difficult problem to solve. Until that's solved I don't think anyone can claim to have made real progress enabling development on keyboardless devices.
"What's not There (Yet): Text generation: with sufficiently structured text, the Tiled Text engine will narrow down the possibilities of what can be inserted at any given point so that the user can select textual constructs from a grid of options, rather than inserting everything one character at a time (this won't work for natural languages; it's for apps like shells and code editors, and perhaps some more exotic things). The engine for doing this is at ~(70% - 80%), but it has not been attached to the UI yet ..."
It'll be there soon!
PD: Apple please don't sue me for the patent and copyright violation this may contain; I have no money and this image is just a non-profit parody so it is covered by "fair use" under US trademark law.
I've come across occasional research projects in 'structural editors' which only allow semantically correct input (and, depending on the size of the input alphabet, can function through almost 100% autocomplete menu input)
Anastasia[1] is one that I know of, and this Modeless Structure Editing by Sufrin et al.[2] looks interesting.
The main issue I can see, apart from the effort involved, is how to deal with incomplete documents, since almost by creation or editing process will have interim invalid structures. Emacs paredit can be pretty infuriating if you don't use its specialised operations and try to edit your code in a way that malforms the structure.
I'm not sure how it would scale though, perhaps in a collapse/expand fashion similar to the current 'focus' mechanism, or some sort of level-of-detail aware zoom that progressively replaces chunks with higher level representations.
The author also notes on the main subtextual.org site about issues of mutable state, but it's definitely an interesting take on language design, and may (hopefully) not share the same death-by-layout-complexity fate most visual languages eventually suffer.
But the key complaint with these EMRs is that you need to type to use them, which is awkward and breaks the flow of conversation with a patient. Eye contact is important during patient interviews. Therefore, most doctors use paper and type them into the EMR later (waste of time).
A lot of people (and companies like drchrono) think that the way forward is to use tablets like the iPad mini or the Galaxy Tab, which balance the intrusiveness of the computer form factor against the ability to enter data. A pain point of tablet EMRs is text entry--but like I said, a lot of notes that doctors write have predefined structures, like code.
I think there is potentially a lot of money in elegantly solving this UI problem with a new interface like Tiled Text.
[1]: http://emacs-versor.sourceforge.net/
[2]: http://www.cb1.com/~john/computing/emacs/emacs-gamepad.html
The program looks awesome, but i believe it would be more productive to have this features on a regular IDE where you can actually use the keyboard... All the movement between nodes looks terrific.
But anyway...
He developed carpal tunnel or some other wrist aliment, and can't type for any real amount of time on a keyboard, apparently using an xbox controller is easier but really he wants to move to using the kinect.
I'm working on a non-plaintext programming language that just needs a structural editor like this. I'll drop you a line.
For example, in the video it was predetermined exactly what was going to be moving and where it was going to go to. From my observations, these sorts of large scale changes are rarely handled so easily. Context helps people map things cleanly, and the contextual change of zooming in and out forces you to constantly rebuild that map. It's an issue I've seen over and over again with any zoom-oriented interface.
Regardless, this is cool work. We need new and interesting interfaces for code - I'm hoping to show some fun things myself at the Live Programming Workshop [1] at ICSE[2].
[1]: http://liveprogramming.github.com/2013/ [2]: http://2013.icse-conferences.org/
Hadn't heard of those workshops -- will take a look.
I did stick around though and the video does look very nice, but I would recommend a more inviting first impression (I realize this is a library for developers, but still).
No one would ever call vim or emacs "slick", yet they own the market among the most expert users. That is not a coincidence.
The recently revamped PSN Store on PS3 has what I thought was quite a usable implementation of text entry. When searching the store, you select characters one at a time from a (vertical) strip, but that dynamic strip only contains characters for which there will continue to be search results after it's appended to your string. The current search results are shown as a live preview, so you need enter just enough to filter out the noise.
> ... I wrote Tiled Text to get around a mouse/keyboard injury I have ...
So this is not necessarily intended for everyone.
I actually like Vim Touch with Hacker Keyboard on my Nexus 7.
I've had an interesting experience using swype on nexus 7. I find my concept of spelling itself is changing'where creating a word is more about the shape than specific correct spelling. Using swype effectively still requires knowledge of how words are spelled and layed out on the QWERTY keyboard. But I see it pointing towards gestural text creation.
We will eventually see some growth in demand for text editing on tablets and phones. With some further research and innovation, you may be able to turn this into a tool (possibly commercial) that is useful for a larger audience.
Thanks for the comment -- reassuring to hear someone else envisioning that path.
I wonder if we'll have that at some point.
Often time I wish I can write some code on my phone but gave up after a while due to the painful editing process. It looks like it can help a lot. Looking forward to further development.