ec16e8ac6e
Led is building on stable rust! Woo hoo!
2015-07-06 19:20:25 -07:00
6823706d69
Working towards rust stable support.
2015-07-06 18:39:00 -07:00
9644a1aa03
Updated dependencies for stable rust.
...
Warning: doesn't compile. Haven't updated own code for stable
yet.
2015-07-06 18:14:12 -07:00
869cb187b6
Migrated code from std::old_io to std::io
2015-03-15 16:03:23 -07:00
57f013bd46
Updated to latest rustc and rustbox.
2015-03-15 14:47:16 -07:00
1d6a8cb107
Added ability for soft-wrapped lines to have additional indentation.
2015-03-08 19:58:18 -07:00
cbff82b462
Implemented word wrapping.
2015-03-08 19:47:30 -07:00
e1e06633c7
Added option to maintain indentation when wrapping lines.
...
Currently only exposed in code, not in UI. Enabled by default.
2015-03-08 12:18:22 -07:00
ed510cffbc
WIP more line wrapping options.
...
This commit just adds code to allow non-wrapping behavior.
2015-03-07 18:30:18 -08:00
b2f1044b48
Fixed bug resulting from API change in Ropey.
2015-03-03 16:27:38 -08:00
f4847a4f8e
Updated to latest Docopt and Ropey.
...
Also fixed bug resulting from a change in API behavior in Ropey.
2015-03-03 15:26:20 -08:00
cca7133264
Updated code to latest Ropey.
2015-03-03 00:08:52 -08:00
1ae3a01566
Updated code to work with the latest Ropey.
2015-03-02 16:08:50 -08:00
ada003b346
Split rope implementation off into external lib "Ropey".
...
Ropey can be found at https://github.com/cessen/ropey
2015-02-25 20:05:17 -08:00
82e6fca1dd
Updated code for latest rustc.
2015-02-23 20:50:55 -08:00
d3cd1c4b05
Fixed bug in Editor::move_view_to_cursor().
...
Was causing the view to move unecessarily when the cursor is at the end of
the buffer.
2015-02-22 20:35:41 -08:00
c532b10f22
Fixed bug in Editor::move_view_to_cursor()
...
It thought it was one line shorter than it actually was.
2015-02-22 20:30:33 -08:00
c348f252bb
Fixed bug in buffer drawing code.
...
It was causing the entire last line to be re-scanned to find the
cursor drawing position if the cursor was at the end of the buffer.
This was both slow and resulted in an incorrect position, since
all the rest of the drawing assumes line blocks.
2015-02-22 20:24:19 -08:00
ae26c5f873
Fixed bugs in LineFormatter that was causing weird cursor nav behavior.
...
They were two pretty much identical bugs in both index_offset_vertical_v2d()
and index_set_horizontal_v2d(). Neither method was checking for slipping
off the end of a line block.
2015-02-22 20:09:18 -08:00
1b3acfd29f
Fixed bug in LineFormatter::index_offset_vertical_v2d()
...
The bug was causing very incorrect behavior when a single line was long
enough to be split into multiple blocks.
2015-02-22 19:30:13 -08:00
9c462ee332
Finished converting codebase back to plain Rope's.
...
Everything appears to be working identically to how it was before converting
back.
2015-02-22 18:13:10 -08:00
fee6fc21a3
Removed line and node source files since they are no longer used.
2015-02-22 12:30:02 -08:00
dcfa3fe0d5
Got unit tests compiling again, and added a few more to Rope.
2015-02-22 12:28:31 -08:00
02f24e4e6f
WIP refactor to switch over to Rope from BufferNode.
2015-02-22 11:45:57 -08:00
0ee364f6ce
Added Rope methods for converting between grapheme indices and line/column indices.
2015-02-22 00:15:18 -08:00
759b23db4d
Added methods to Rope for finding the relationship between lines and graphemes.
2015-02-21 23:51:15 -08:00
c276117ac6
Rope now tracks line endings.
2015-02-21 22:55:14 -08:00
0da0b532d0
Forgot to set rope leaf size back to something reasonable.
2015-02-21 13:18:28 -08:00
d87dd9a343
Implemented efficient Rope splitting.
...
Rope::split() should now run in O(log N) time instead of O(N).
2015-02-21 13:12:26 -08:00
e082defad8
Added benchmarks for Rope::append() and Rope::split().
2015-02-21 11:44:32 -08:00
52cb5f9456
Improved Rope's text insertion performance for large insertion strings.
2015-02-21 11:16:21 -08:00
a37bc17289
Even further improved balance unit tests.
...
Now the ropes are directly checked for adhering to the AVL balance
invariants.
2015-02-19 23:39:24 -08:00
b3ba8acdf5
Significantly improved Rope::rebalance() unit tests.
...
Now they directly run rebalance() on hand-constructed trees that test
various situations.
2015-02-19 23:23:36 -08:00
fe0a7e48ca
Fixed bug in Rope::new_from_str().
...
The stragglers appended at the end were being appended at the top of
the tree, making it very unbalanced. Using proper appending now.
2015-02-19 22:52:21 -08:00
2df1302723
Fixed bug in Rope::rebalance(). Stats weren't updated after rebalance.
2015-02-19 22:46:30 -08:00
5500c845f5
Ropes can now generate graphviz of their tree. Useful for debugging.
2015-02-19 22:39:57 -08:00
de668c5ddf
Improved Rope::append()
...
Append no longer depends on a performant rebalance() operation in any
cases. Append is guaranteed O(log N) now.
2015-02-18 23:41:28 -08:00
d95161b88f
Improved Rope::rebalance() to actually rebalance properly in non-AVL cases.
...
The prior version worked fine for the typical single insertion/removal
cases. But when larger imbalances happened due to bulk insertion or
removal it wouldn't work correctly.
The new improved version works on any tree whose children are themselves
balanced, even if they are extremely different heights when compared to
each other. It works in O(log N) time.
2015-02-18 23:11:10 -08:00
535f219c41
Improved algorithm of Rope::append()
...
It doesn't use an intermediate conversion to a string anymore, and should
execute in O(log N) as long as the right-hand rope is equal length or
smaller than the left.
It may also be O(log N) for the left-hand rope being smaller, but that
depends on whether the rebalance code executes in O(log N) time when
the left and right hand side are individually balanced. I haven't
analysed it yet, so dunno.
2015-02-17 23:10:38 -08:00
d26c95ab1d
Fixed some bugs in the display code.
...
Everything seems to display correctly now.
2015-02-16 22:46:38 -08:00
311f8aca67
First attempt at making display code really take advantage of long line support.
...
It's not quite working right, but it does at least prevent performance
degradation.
2015-02-16 22:29:41 -08:00
86f3ada8ea
Small tweak to indentation style auto-detection.
...
Very slightly favor larger indentations, instead of very slight favor
smaller indentations. This is more likely to do the right thing on
very small files.
2015-02-16 22:06:48 -08:00
d3cbc7644f
Updates for latest rustc.
2015-02-16 22:01:22 -08:00
0bc809781d
WIP: fixes for long line support.
2015-02-15 23:23:17 -08:00
ecf91607ac
WIP long line support.
...
Got index_offset_vertical_v2d() partially working. Still seems to be a tad
buggy, though.
2015-02-15 23:09:13 -08:00
a1d636a4d8
WIP: handling extremely long lines with good performance.
...
The formatters now work on grapheme iterators instead of directly on
lines, which frees up the LineFormatter to break up long lines into
smaller blocks of text. This is partially taken advantage of right
now in various parts of the code, but more work is still needed to
get it both working properly and fast.
2015-02-15 22:41:11 -08:00
f4a70ba1ad
Made screen drawing a tad faster for long lines.
...
In preparation for much more major speed-ups with long lines.
2015-02-15 20:35:17 -08:00
6eed3fcc74
Improved file load times.
...
There was a regression after switching to ropes. Now it's pretty much
back to pre-rope load times.
2015-02-15 20:15:19 -08:00
de58f01b2f
Added some benchmarks for Rope, and improved new_from_str() for Rope.
...
The new new_from_str() uses an algorithm that should be linear time
complexity compared to the length of the string.
2015-02-15 19:42:07 -08:00
e1c9a6955d
Lines now internally use ropes to store their text.
...
The rope uses a large leaf-node text length, so in the vast majority of
cases this ends up being the same as directly storing the string data.
But in the case that the line becomes extremely long, this will allow
for reasonable performance
2015-02-15 14:56:56 -08:00
a89e505fb0
Beginnings of a Rope data structure for strings.
...
This will be used to hold the text of an individual line, for better
long-line handling.
2015-02-14 14:19:46 -08:00
902d93e957
Line numbers are now displayed in left-hand gutter.
2015-02-08 19:17:48 -08:00
9b24b2b4f2
Added rust-encoding as a dependency, in prep for text encoding support.
2015-02-08 00:19:37 -08:00
2d50906f43
Moved the rest of file loading/saving into Buffer.
2015-02-07 23:35:25 -08:00
8d76e3fb17
View scrolling seems to work properly now.
2015-02-07 23:14:56 -08:00
8f94b32953
Have view scrolling nearly working again.
...
Just doesn't *quite* work with wrapped lines. Need to investigate.
2015-02-07 22:57:25 -08:00
870818fec8
Cursor movement appears to be working properly again.
2015-02-07 22:07:48 -08:00
27959dadf8
WIP fixing cursor movement code.
2015-02-07 21:38:16 -08:00
6fc2f34053
Finished converting the term_ui drawing code over to the new formatting code.
2015-02-07 21:37:11 -08:00
e9462e4400
Silencing some rustc warnings.
2015-02-07 19:55:25 -08:00
26965417f3
WOrking on getting cursor movement working again.
2015-02-07 19:46:08 -08:00
e9c06615f9
Silenced some compiler warnings.
2015-02-07 00:52:52 -08:00
6f2cbe5b87
Basic text buffer drawing is working again.
2015-02-07 00:45:28 -08:00
3ae51f7f7e
Formatters are now primarily factories for iterators.
...
This is a big shift in the formatter API's. It simplifies the
responsibilities of the implementers so that pretty much all they
have to do it implement an iterator. Everything else will be
automatically derived from that. (Or, at least, that's the hope.)
2015-02-06 23:58:19 -08:00
8319033ae5
First step in pulling formatters out of the text buffer.
...
This commit pulls the formatter out of the text buffer and
puts it in the editor instead. However, there is a lot of
commented code utlizing the buffer and formatter that still
needs to be updated.
In short, the editor is pretty non-functional in this commit.
2015-02-06 19:47:52 -08:00
e29777e33c
Improved file loading.
...
File loading is now the responsibility of the Buffer, which allows
it to do some weird internal stuff to make it faster.
Also, using custom code for scanning the text, so all line endings
are handled now, not just LF and CRLF.
2015-02-01 23:17:43 -08:00
4d114162ee
Improved window resizing responsiveness.
...
The reformat code was being run on every resize event,
which chokes on most resizes which end up emitting a lot
of resize events. Now it waits and processes a bunch of
resize events until there aren't any left, and only does
the actual reformat on the last one.
2015-02-01 13:50:47 -08:00
c9d09f6f98
Moved line_ending_type out of Buffer and into Editor.
2015-01-31 15:06:04 -08:00
67e4495d83
Minor tweak to console formatting code.
...
Made it so that the line-height can be easily changed in one
place, for experimentation.
2015-01-31 13:53:07 -08:00
afa1a8f67c
Fixed nasty bug in reformatting code.
...
It was not actually reformatting things...
2015-01-31 13:41:41 -08:00
7b87db4e41
Line wrapping width is now determined by terminal width.
2015-01-31 13:19:14 -08:00
8701ebbba7
Tweaked code to avoid warnings from latest rustc compiler.
2015-01-29 21:03:56 -08:00
c6cfebdb75
Commented out the GUI modules until I can figure out how to get it working again.
...
The rust SDL2 bindings have changed in a way that makes the lifetimes
very strict. This is probably a good thing from a safety standpoint,
but means I'll likely need to re-architect the GUI drawing code.
For now I'm going to leave that on the back-burner and focus on getting
the console version working.
2015-01-29 20:35:19 -08:00
5652b62fc8
Misc code cleanup.
2015-01-28 00:09:07 -08:00
f222cd6a54
Fixed remaining cursor navigation bugs (I think...?).
2015-01-27 23:58:45 -08:00
bde11e6c7b
Spoke too soon... still bugs in cursor nav. This fixes one of them.
2015-01-27 22:57:50 -08:00
40bf2460a9
Fixed line wrapping cursor nav.
2015-01-27 22:44:01 -08:00
04816ebe84
Beginnings of line wrapping for terminal ui.
2015-01-26 22:55:47 -08:00
83fa6a72cb
Tabs working again.
2015-01-25 22:07:06 -08:00
109e46a027
WIP: moving GUI code over to use LineFormatter.
2015-01-25 14:00:45 -08:00
8d83fe77d2
Re-enabled the GUI code.
2015-01-25 13:30:15 -08:00
352e5370ce
Fully updated unit tests. All passing again.
2015-01-25 13:28:04 -08:00
0557f5f6ce
Reorganized the code a bit, and started updating unit tests.
2015-01-25 13:20:16 -08:00
518b9a7e42
Console editor appears to be back up to snuff again!
2015-01-24 21:38:13 -08:00
a69f89d238
Fixed bug in v2d_to_index code that was causing cursor nav issues.
2015-01-24 21:15:32 -08:00
4caad17e56
Console drawing is almost back up to snuff.
...
Just missing drawing the cursors if it's at the end of the text buffer.
2015-01-24 21:00:30 -08:00
c69ebc240f
WIP: making Buffers so they can be given LineFormatters.
...
A LineFormatter determines how a line of text is visually displayed in
2d space. This allows both the Console and GUI version of the editor
to share the same buffer code whilst still handling the differing ways
in which both handle visual display.
2015-01-24 14:35:49 -08:00
97b2f18870
Source Code Pro is now embedded in the executable as the default font.
2015-01-21 20:21:34 -08:00
b4e0a2e234
Cleaned up GUI rendering code a bit.
2015-01-21 20:13:20 -08:00
ea6d1c56d1
A feeble attempt to overcome flickering issues on window resize.
...
It really seems insurmountable at this point. Not sure what SDL is doing
that's causing this. But I'm leaving this code in, because it makes
things a little cleaner and serves as a good example to myself for how
to render to textures.
2015-01-20 21:55:11 -08:00
6c6e8896a1
GUI actually displays the text of the loaded buffer now. Woo hoo!
...
To make this performant, the Font struct caches rendered glyphs as
sdl textures. Without caching, performance is abysmal.
2015-01-19 22:47:43 -08:00
463911e5b3
Beginnings of a GUI.
2015-01-18 22:52:35 -08:00
ac784077f0
Split cursor code into separate file.
...
There is now a CursorSet type that handles multiple cursors, and makes
it convenient to maintain the necessary invariants expected by the rest
of the code for multi-cursor editing.
2015-01-18 15:11:49 -08:00
30ad0c2ea4
Added SDL2 and Freetype as dependencies, in preparation for a GUI.
...
Also wrapped Freetype functionality in a Font struct.
2015-01-18 13:12:01 -08:00
e726b2d0f8
Fixed some bugs in new multi-cursor code.
2015-01-13 00:15:26 -08:00
9a22812cf1
First steps towards multiple cursor support.
2015-01-13 00:03:16 -08:00
d80586e262
Fixed bug in cursor movement code that would result in crashes.
2015-01-11 11:36:34 -08:00
9156f5cf47
Passing a filename that doesn't exist will now open a buffer that will be saved to a new file of that name.
2015-01-11 01:25:23 -08:00
d6e28b02a3
Fixed some warnings.
2015-01-11 01:16:21 -08:00
d02459f647
Undo/redo should mark buffer as dirty.
2015-01-11 01:04:24 -08:00
f56d3f0ad4
Split remove_text() into remove_text_before() and remove_text_after().
...
This is useful so that undo knows where to put the cursor.
2015-01-11 00:59:02 -08:00
dfcf9fc6a5
A simple implementation of move_text.
...
This should probably be replaced by a more efficient implementation in
the future, as this version will be slow and require large allocations
when moving large pieces of text. But let's wait and see if it's a
problem in practice first.
2015-01-11 00:26:39 -08:00
8a51a796ce
Stub and unit tests for a move_text implementation.
2015-01-11 00:16:59 -08:00
f8cf8e620b
Moved tab_width to Buffer, and misc cleanup related to that.
2015-01-10 23:42:59 -08:00
8b1f1b1e96
Renamed and documented the buffer position conversion functions.
2015-01-10 16:34:28 -08:00
6b5b63dba1
Added full undo/redo functionality.
2015-01-10 12:29:58 -08:00
e61149e514
Organized the code in buffer/mode.rs a bit more nicely.
2015-01-10 12:02:29 -08:00
8fd1659292
Better unit test hygiene, and renamed buffer len() to grapheme_count().
2015-01-10 11:48:20 -08:00
6c659a17dc
Switched undo stack to use a linked list instead of a vector.
...
This makes sure there aren't pathological cases where the user has been
typing for a very long time, and the undo stack needs to change capacity.
2015-01-09 22:40:41 -08:00
b837d488a5
Basic undo functionality.
2015-01-09 22:02:32 -08:00
0fb338f05b
Updated code to compile with Rust 1.0 alpha.
2015-01-09 18:50:27 -08:00
2785c3821b
Updated code to compile with the most recent Rust nightly.
2015-01-04 16:29:19 -08:00
ff6c763821
Soft tabs and user-settable tab-widths are now supported.
...
Also, indentation style is automatically detected on file load.
2015-01-04 00:09:34 -08:00
0941339906
Basic line-ending detection when opening files.
...
Buffers now store what line-ending type they consider themselves to be,
and the ui uses that when adding new lines while editing.
2015-01-03 15:15:14 -08:00
f760d6078d
Added jump-to-line functionality and fixed some display bugs.
2015-01-03 13:09:12 -08:00
a85a3bf8fa
Added status/info line at top of terminal UI.
2015-01-02 17:41:08 -08:00
250a1f94ef
Implemented delete key.
2015-01-02 16:52:29 -08:00
940068a4dd
Fixed some bugs relating to text and cursor printing.
2015-01-02 16:47:17 -08:00
fc78fbeb3e
Non-uniform-width characters are now properly handled (modulo bugs).
2015-01-02 15:05:21 -08:00
74edf72cde
First attempt at support for variable-width graphemes.
...
Doesn't completely work, but it's on the right track.
2015-01-01 17:35:34 -08:00
a205dce9dd
Added unit tests for Line::new_from_string_unchecked().
2015-01-01 13:25:10 -08:00
378012d799
Fixed bug in file loading where line text would still contain line endings.
2015-01-01 13:16:33 -08:00
7099e4d0d3
Sped up file loading and saving.
2015-01-01 13:14:32 -08:00
02fdbcf027
Files loading/saving is working again.
2014-12-31 20:36:23 -08:00
cb5b79ec9c
Changed editor drawing to use line iterators.
...
This makes the code easier to follow, and will make it easier to
accomodate non-uniform width graphenes later on.
2014-12-31 20:19:12 -08:00
49b34e78d5
Got basic editing functionality up and running again after the refactor.
2014-12-31 18:39:01 -08:00
71913eed31
Got grapheme iterators and 1d/2d position translation working.
2014-12-31 17:55:20 -08:00
95d6d3fd3e
Got remove_text() working.
...
At least, based on the unit tests so far.
2014-12-31 17:05:24 -08:00
28a4da97a7
More WIP remove_text().
2014-12-31 13:15:58 -08:00
0794d5c6ec
WIP remove_text()
2014-12-31 01:20:51 -08:00
f0f6980b6d
Added a bunch more tests for Buffer, and fixed line removal code.
2014-12-31 00:31:42 -08:00
720246142e
WIP refactor: text can now be inserted into empty buffers.
2014-12-30 22:55:23 -08:00
c88ba48b6d
WIP refactor: change text buffer to use the Line struct for storing text.
...
Most of the UI and editor code is either commented out or not included
in the compile right now. This is temporary while I get the basic
text code working again.
2014-12-29 16:17:53 -08:00
370d8a315e
WIP refactor: changing internal text representation to be line-based.
...
This will make some of the internals a little more complex, but should
simplify things on the balance.
2014-12-28 20:53:25 -08:00
e3e2c866b9
We now store character widths in TextBlocks.
...
This is the first step towards supporting proportional fonts
and tabs characters.
2014-12-28 13:44:38 -08:00
9e35085573
Fixed some minor behavior problems in cursor movement and pageup/pagedown.
2014-12-27 17:01:57 -08:00
eb035b66c7
Added pageup/pagedown functionality.
2014-12-27 16:11:00 -08:00
74cd79745f
Scrolling in the editor by following the cursor now works.
2014-12-27 13:59:41 -08:00
833e92c5a0
Added a some text manipulation methods, and made backspace work properly.
2014-12-26 21:03:13 -08:00
c1c33ae618
Minor fix for cursor movement.
2014-12-26 19:37:55 -08:00
bf099d0f6d
Basic cursor movement is now working properly.
2014-12-26 19:29:52 -08:00
5105622dcb
Fixed bug in pos_2d_to_closest_1d() code.
2014-12-26 17:49:42 -08:00
d979b2cfdc
Cleaned up UI display code.
2014-12-26 17:42:16 -08:00
16945f4183
Updated code to work with new versions of libraries.
...
Also added backspace support.
2014-12-26 17:15:20 -08:00
f469240860
Misc bug fixes on the way towards a proper editing interface.
2014-12-20 18:45:01 -08:00
a56ff95221
WIP: building a proper UI for editing a file.
...
Some things don't quite work properly yet...
2014-12-20 17:23:47 -08:00
421b5288a4
Split buffer.rs into various sub-modules for better organization.
2014-12-19 23:22:30 -08:00
a31a0a2c41
Basic file loading/saving.
2014-12-19 22:43:31 -08:00
fec361ad29
Refactored event loop.
...
This allows large numbers of events to be handled in bulk, but without
the program eating up CPU when idle.
2014-12-19 21:10:03 -08:00
ef64bd8f1c
Fixed bug in tree balancing. Text rope is now fully self-balancing.
2014-12-19 00:23:08 -08:00