Commit graph

51 commits

Author SHA1 Message Date
Andreas Kling
b4da451c9a WindowServer+LibGUI: Implement automatic cursor tracking.
When a mouse button is pressed inside a window, put that window into an
automatic mouse tracking state where all mouse events are sent to that
window until all mouse buttons are released.

This might feel even better if it only cared about the mouse buttons you
actually pressed while *inside* the windows to get released, I don't know.
I'll have to use it for a while and see how it's like.
2019-03-24 15:01:56 +01:00
Andreas Kling
ed2303e2d8 TextEditor: The delete key should work even when there's no selection. 2019-03-20 23:11:00 +01:00
Andreas Kling
daa1dcb5e8 FileManager: Use a GTextEditor for the location bar + tweak icons. 2019-03-20 18:12:56 +01:00
Andreas Kling
46577a6948 GTextEditor: Fix invalidation glitches in single-line mode. 2019-03-19 02:45:49 +01:00
Andreas Kling
a6538feed1 LibGUI: Add GInputBox for getting a string from a modal dialog.
Use this to implement some of the toolbar actions in IRCClient. :^)
2019-03-19 01:41:00 +01:00
Andreas Kling
ec8bffb06d LibGUI: Let GTextEditor deal with its horizontal padding internally.
I originally wanted to have the padding concept in GScrollableWidget
but it's really finicky with the ruler and everything.
2019-03-16 23:16:37 +01:00
Andreas Kling
3854e752cb LibGUI: Make GTextEditor inherit from GScrollableWidget.
This is quite nice, now we can share a ton of logic. :^)
2019-03-16 16:54:51 +01:00
Andreas Kling
7e3673f710 GTextEditor: Disable the ruler in single-line mode.
Also make it possible to hide the ruler in multi-line mode, if you should
want to do that. :^)
2019-03-15 17:54:05 +01:00
Andreas Kling
1fc283ed7d IRCClient+LibGUI: Add an input box so we can send messages to channels.
Implement this using a GTextEditor with a special single-line mode.
This new mode needs some polishing, but it's already very useful.
2019-03-15 17:37:13 +01:00
Andreas Kling
10dcd3a47f GTextEditor: Make sure the scroll corner helper widget is filled in. 2019-03-11 12:52:07 +01:00
Andreas Kling
5d69bf06d2 LibGUI: Don't fill widgets with background color by defualt. 2019-03-10 13:16:36 +01:00
Andreas Kling
8017c1e17c GTextEditor: Let the Tab key insert up to 4 spaces. 2019-03-10 11:08:36 +01:00
Andreas Kling
b4a099d212 GTextEditor: Allow jumping lines by hitting Left/Right at start/end of line. 2019-03-09 22:02:35 +01:00
Andreas Kling
0a7137617d GTextEditor: Simplify painting of the ruler. 2019-03-09 21:30:16 +01:00
Andreas Kling
3c2139b824 GTextEditor: Use Painter save/restore to simplify. 2019-03-09 16:48:43 +01:00
Andreas Kling
5a28392660 GTextEditor: Use a subwidget for the scrollbar corner and tighten clipping. 2019-03-08 18:58:40 +01:00
Andreas Kling
ccda716028 GTextEditor: Backspace and Delete should work regardless of modifier state. 2019-03-08 18:50:14 +01:00
Andreas Kling
032549d7bf GTextEditor: Refactor selection into a GTextRange class.
This is a bit more expressive than "selection start + current cursor".
2019-03-08 18:28:24 +01:00
Andreas Kling
f40d11f06d LibGUI+WindowServer: Implement drag-to-select behavior in GTextEditor.
To make this feel right, I needed to start passing keyboard modifiers along
with mouse events. That allows shift-clicking to extend the selection. :^)
2019-03-08 17:53:02 +01:00
Andreas Kling
6d172725c0 GTextEditor: Fix text_position_at() behavior when passed negative values. 2019-03-08 17:13:31 +01:00
Andreas Kling
c4937f01d8 GTextEditor: Simplify delete_selection(). 2019-03-08 15:55:58 +01:00
Andreas Kling
5602f3be6c GTextEditor: Ctrl+A should select the entire document. 2019-03-08 14:12:41 +01:00
Andreas Kling
220c7b5f75 GTextEditor: Replace selection on input or Backspace/Delete. 2019-03-08 14:10:34 +01:00
Andreas Kling
48d48679b0 GTextEditor: Work on cut/copy/paste operations. 2019-03-08 14:08:15 +01:00
Andreas Kling
6576ac8332 GTextEditor: Add selected_text() function.
I don't have a clipboard to actually put the copied selection onto yet,
so just print the selected text to stdout so we can see what it is.
2019-03-08 01:59:59 +01:00
Andreas Kling
b5521e1b0d GTextEditor: Add basic selection support. 2019-03-08 00:49:45 +01:00
Andreas Kling
27b0aab13e GTextEditor: Unbreak forward merge with Delete. 2019-03-07 20:15:05 +01:00
Andreas Kling
9867fe1025 GTextEditor: Add a ruler column that always shows the line numbers. 2019-03-07 20:05:05 +01:00
Andreas Kling
f13c62f225 GTextEditor: Fix double effect of backspace/delete in some cases. 2019-03-07 17:18:22 +01:00
Andreas Kling
f8b72ab3ab GTextEditor: Add basic PageUp/PageDown navigation support. 2019-03-07 17:11:17 +01:00
Andreas Kling
187d7cb400 GTextEditor: Add write_to_file(String path) :^) 2019-03-07 17:06:11 +01:00
Andreas Kling
a5bc20c733 GTextEditor: Support starting with an empty document. 2019-03-07 16:51:47 +01:00
Andreas Kling
43d56b6f3a GTextEditor: Support splitting lines at the cursor with the Return key. 2019-03-07 16:49:21 +01:00
Andreas Kling
a64b71fb3d GTextEditor: Support forward delete/merge with the Delete key. 2019-03-07 16:33:20 +01:00
Andreas Kling
38662f884d GTextEditor: Merge with previous line if backspacing at column 0. 2019-03-07 16:15:25 +01:00
Andreas Kling
6094f592a9 GTextEditor: More work on basic line editing. Insert/remove characters. 2019-03-07 16:04:21 +01:00
Andreas Kling
8425ea971a GTextEditor: Start working on editing, starting with inserting newlines. 2019-03-07 15:52:11 +01:00
Andreas Kling
b4df33e453 GTextEditor: Only paint lines inside the dirty rect.
This dramatically improves performance in large documents. :^)
2019-03-07 15:03:38 +01:00
Andreas Kling
ce35cddb1b GTextEditor: Let's use a Vector for the line backing store.
I'm eventually gonna want to replace this with something more clever,
like a automagically splicing vector or something, but for now, at least
we move away from immutable Strings.
2019-03-07 14:35:32 +01:00
Andreas Kling
a21ecd440a GTextEditor: Allow moving the cursor by clicking. 2019-03-07 14:02:10 +01:00
Andreas Kling
9997992907 GTextEditor: Make the cursor invalidation work with the padding(). 2019-03-07 13:54:02 +01:00
Andreas Kling
60c1ab5fbe GTextEditor: Scroll the cursor into view before updating it. 2019-03-07 13:34:00 +01:00
Andreas Kling
9591acc212 GTextEditor: Remove some debug spam. 2019-03-07 13:26:02 +01:00
Andreas Kling
77198ef735 GTextEditor: Simplify update_cursor(). 2019-03-07 13:23:17 +01:00
Andreas Kling
6a6bcc5daf GTextEditor: Add Home/End and Ctrl+Home/Ctrl+End navigation shortcuts.
For start/end of line and start/end of document respectively.
2019-03-07 13:21:51 +01:00
Andreas Kling
1ac71d1fb1 GTextEditor: Improvements to cursor rendering.
The view now scrolls along with you as you move the cursor around.
2019-03-07 13:13:25 +01:00
Andreas Kling
dff57909a7 GTextEditor: Only draw the cursor line background shade when focused. 2019-03-07 02:26:44 +01:00
Andreas Kling
6db132069f GTextEditor: Draw the cursor line in a slightly darker shade. 2019-03-07 02:24:46 +01:00
Andreas Kling
1f92636c6d GTextEditor: Make the cursor blink while the editor is focused. 2019-03-07 01:05:35 +01:00
Andreas Kling
ca65ca2f2d TextEditor: Show the current cursor position in the statusbar. 2019-03-07 00:46:29 +01:00