Commit Graph
100 Commits
Author SHA1 Message Date
josh 878b9aaf34 Make Cursor::is_start_of_line() and Cursor::is_end_of_line() safe for empty pieces 2016-10-26 22:03:28 -04:00
josh fd6ef8cab0 Make Cursor::go_start_of_line() and Cursor::go_end_of_line() safe for empty pieces 2016-10-26 21:20:42 -04:00
josh cd44deda9e add Iterator::piece_eol() 2016-10-26 20:46:50 -04:00
josh 8432e7f4b7 update comparison operators for Iterator/Cursor 2016-10-26 20:43:39 -04:00
josh 523eba81f5 update Window initial size to 800x800 for now 2016-10-25 21:31:12 -04:00
josh 66105dc88f Separate PieceTable::Cursor::go_*() into go_*() and check_go_*() 2016-10-25 21:13:47 -04:00
josh ef717faa16 fix Buffer::write_to_file() to preserve EOLs correctly 2016-10-25 20:47:54 -04:00
josh 1f59e4d042 update PieceTable::Iterator to allow empty pieces 2016-10-25 20:36:08 -04:00
josh b9c23084be shrink up the Change structure a bit 2016-10-18 21:53:18 -04:00
josh 14a3c17835 remove unused Change::insert field 2016-10-15 20:02:52 -04:00
josh c6a8d1597e insert-after-char should insert-before-char if char is EOL marker 2016-10-15 18:40:36 -04:00
josh 7557fc4c1e do not draw \n characters 2016-10-15 18:38:59 -04:00
josh 261cc9abf8 adjust cursor movement to optionally allow moving to EOL 2016-10-15 18:07:58 -04:00
josh 4ebe81c062 remove EOL Piece flag; use \n in memory to represent EOL
(cursor movement needs to be updated yet)
2016-10-15 09:42:38 -04:00
josh 85ab570ce5 remove some unused parameters 2016-10-14 22:22:21 -04:00
josh 4d5e3dc0ea continued insertion testing, not sure i like this method 2016-10-08 16:59:11 -04:00
josh 08dd616bef add unit tests for Encoding::encode() 2016-10-08 15:36:22 -04:00
josh 24e6eb7f04 add unit tests for Encoding module 2016-10-06 22:45:38 -04:00
josh ac439d30bc add Encoding::encode() 2016-10-06 20:45:16 -04:00
josh fdabf4432a add Encoding::num_bytes_to_encode_code_point() 2016-10-05 23:10:41 -04:00
josh 99bbe81f6b add PieceTable::begin_insert() 2016-10-05 22:47:08 -04:00
josh 807eba4448 avoid segfault when undoing to get back to empty buffer 2016-10-05 21:40:08 -04:00
josh fe9747390a Add PieceTable::apply_change() and an initial undo 2016-09-26 22:54:19 -04:00
josh 5b662b63e0 add PieceTable::apply_change() 2016-09-26 22:34:29 -04:00
josh 249fd87067 introduce a PieceTable::Change structure to record changes 2016-09-26 22:30:41 -04:00
josh 0a1bb6eb92 remove unused Window::m_start_piece 2016-09-26 20:24:16 -04:00
josh c2c0d6f042 add a piece table insertion test 2016-09-25 23:01:59 -04:00
josh bc4c5b5c98 fix PieceTable::Cursor::next_line() 2016-09-25 22:58:13 -04:00
josh 6e5489c88e do not allow cursor movements for non-valid cursors 2016-09-13 23:16:23 -04:00
josh 7e518cd27a rename draw_text() to draw_buffer() 2016-09-13 22:55:48 -04:00
josh b9d7e1f93e Show cursor position in status bar 2016-09-13 22:51:51 -04:00
josh f9fd1dc754 Add a status bar (empty for now) 2016-09-13 22:26:56 -04:00
josh 2289fe123e only set the clear color once 2016-09-13 22:21:30 -04:00
josh c852e9991b add a rectangle shader 2016-09-13 22:19:47 -04:00
josh 6d8c8e76a9 add colrow_to_xy() and refactor to use it 2016-09-13 21:46:31 -04:00
josh 980ec3a295 draw cursor crosshairs 2016-09-13 21:25:10 -04:00
josh cde71ac70a keep a target cursor column to move to when moving cursor up or down 2016-09-12 21:38:13 -04:00
josh 7d3b66fe84 do not attempt to draw tab characters 2016-09-11 20:48:21 -04:00
josh f876b68bd0 Add cursor movements to move to SOL and EOL. 2016-09-07 22:31:24 -04:00
josh c2166b4bd1 warp cursor within scroll range on window resize 2016-09-07 22:06:53 -04:00
josh 7df23e971e Unlock cursor from first screen row 2016-09-06 22:58:33 -04:00
josh 7784024af1 remove Window::scroll_{up,down}() 2016-09-06 21:42:38 -04:00
josh a68ccb52e4 Do not redraw screen on cursor move if the cursor didn't actually move 2016-09-06 21:18:14 -04:00
josh 86246385d4 Draw text based on new cursor movement system
The cursor row still locked to the first row for now
2016-09-06 21:05:24 -04:00
josh 01bf455e68 Use an OpenGL array object to draw the cursor 2016-08-27 21:38:48 -04:00
josh 33a190c495 complete cursor movement routines taking Encoding and tabs into account 2016-08-27 21:38:48 -04:00
josh b478d17e16 add Interator and Cursor constructors 2016-08-27 15:43:35 -04:00
josh d6b3810a3c Split some PieceTable::Cursor functionality into PieceTable::Iterator 2016-08-27 15:20:08 -04:00
josh f659c14242 add Encoding::decode() 2016-08-15 22:14:47 -04:00
josh b2bed71ee4 add Encoding::beginning_of_code_point() 2016-08-11 23:13:32 -04:00
josh 1aa9fb0c41 add Encoding::num_bytes_in_code_point() 2016-08-11 23:08:21 -04:00
josh 490505faa1 detect file encoding when loading it 2016-08-11 20:11:13 -04:00
josh c4253078a9 add Encoding class 2016-08-11 20:03:53 -04:00
josh 3c5a7b7341 add initial cursor movement support 2016-08-08 22:40:47 -04:00
josh 81e6a53c08 add PieceTable.tabstop attribute 2016-08-04 22:42:27 -04:00
josh f6338da8d0 add PieceTable::Cursor::operator*(), add unit test 2016-08-04 22:38:18 -04:00
josh abf853e1ba link from a piece table cursor object back to the containing piece table 2016-08-04 22:19:13 -04:00
josh 728e389c1e add column to a PieceTable::Cursor 2016-08-01 22:02:42 -04:00
josh 11cac3c8b5 add a PieceTable::Cursor to Window 2016-08-01 22:02:42 -04:00
josh e913c15212 remove number of characters from a Piece 2016-08-01 22:02:42 -04:00
josh b0553fdbd2 adjust font vertical position by baseline offset 2016-07-31 23:11:26 -04:00
josh 5a942a61a9 add FlatShader; draw a cursor 2016-07-31 23:08:26 -04:00
josh 8beea3461c Rework PieceTable cursor management
- rename PieceTable::Position -> PieceTable::Cursor
- remove built-in cursor
- add PieceTable::add_cursor()
2016-07-31 22:11:12 -04:00
josh a5bfcdd3c4 remove PieceTable::ChangeDescriptor 2016-07-31 20:51:06 -04:00
josh 887fb4b980 use scoped enum instead of #define 2016-07-30 09:54:30 -04:00
josh 7064afc1f1 rename PieceDescriptor to just Piece 2016-07-30 09:52:46 -04:00
josh cef49e9e6e rename OpenGL "programs" to "shaders" 2016-07-29 21:27:32 -04:00
josh b61513b97e add PieceTable::get_start_of_line() 2016-07-29 21:19:01 -04:00
josh d043137099 Window: calculate m_rows 2016-07-29 21:12:54 -04:00
josh 862b414c1d Window: rename m_chars_per_line -> m_columns 2016-07-29 21:06:28 -04:00
josh dc71520a88 PieceTable: rename m_cursor_position -> cursor_position 2016-07-29 21:04:48 -04:00
josh 89c0ca0bfa add a cursor position attribute to PieceTable 2016-07-28 21:48:18 -04:00
josh 26f8fb355e allow File::write() to take a Span 2016-07-26 22:40:04 -04:00
josh 382d155e40 add LineEndings module 2016-07-26 22:36:22 -04:00
josh cdae9e51ae add Span class and use it from TextLoader 2016-07-26 21:09:33 -04:00
josh b64b9bed23 begin restructuring keyboard event handling more permanently 2016-07-24 22:45:28 -04:00
josh 31422709e8 Wrap lines 2016-07-24 20:35:01 -04:00
josh 10a0b33dbe Add Buffer unit tests
- test that writing a buffer with no changes results in the identical
  file being written
2016-07-24 17:25:21 -04:00
josh 63b3848424 Preserve whether there is a EOL at EOF when writing the file 2016-07-24 17:24:00 -04:00
josh e66130b603 fix File::open() when opening for writing 2016-07-24 17:16:05 -04:00
josh a416a47b29 add Buffer::write_to_file() 2016-07-24 12:50:27 -04:00
josh 1730838921 add File::write() 2016-07-24 12:37:34 -04:00
josh 0aad4fd779 GUI: avoid segfault when trying to scroll an empty buffer 2016-07-24 12:28:58 -04:00
josh 0780659c8c Buffer: keep track of eol_at_eof flag from TextLoader 2016-07-24 12:27:15 -04:00
josh 7093560a94 Support loading files that do not end with a EOL sequence
- do not drop the last line of such files from TextLoader
- add a flag to TextLoader to indicate if the loaded file ended with a
  EOL sequence
2016-07-24 12:22:03 -04:00
josh 89e8dc5de3 add TextLoader::get_eol_at_eof() 2016-07-24 12:06:50 -04:00
josh 500a6891d4 remove Text module 2016-07-19 22:35:51 -04:00
josh 20a2786755 Render from the piece table! 2016-07-19 22:34:11 -04:00
josh e52710b47c add PieceTable::append_initial_line_piece() 2016-07-19 21:31:06 -04:00
josh 8fcbad02f8 Update PieceDescriptor structure - use direct pointers for list links 2016-07-18 22:32:45 -04:00
josh ebf92f07ac drop const in TextLoader line pointer 2016-07-18 22:07:29 -04:00
josh aa45f6d6dc Add a PieceTable to Buffer 2016-07-18 22:04:57 -04:00
josh 2805ac36d3 add PieceTable::start_descriptor and PieceTable::end_descriptor 2016-07-18 22:02:56 -04:00
josh 793bc46293 add PieceTable::add_piece_descriptor() and set up start/end descriptors 2016-07-18 22:01:33 -04:00
josh b30b6eb202 Start on PieceTable 2016-07-17 23:05:02 -04:00
josh 7e8b5c0b64 Allow PagedBuffer to hold non-power-of-2-sized objects 2016-07-17 21:55:29 -04:00
josh cab874305f add PagedBuffer; use own main() for tests 2016-07-17 20:43:18 -04:00
josh 3be19dbf81 implement TextLoader tests, add TestSupport module 2016-07-16 21:28:29 -04:00
josh 181d3ad64a Avoid signed and unsigned comparison 2016-07-15 19:58:01 -04:00
josh f9b42b4079 add "test" Makefile target 2016-07-15 19:42:48 -04:00