Commit Graph

82 Commits

Author SHA1 Message Date
vqn 9b45c9bdbd fix incorrect x_offset if opened docs have different tab sizes (#1383) 2023-08-07 15:25:06 +01:00
Guldoman a0c05791b1 Improve `DocView:get_visible_line_range` precision (#1382) 2023-08-07 15:02:19 +01:00
Guldoman 920d3ef1e3 Avoid drawing hidden text in `DocView:draw_line_text` (#1298)
* Stop drawing text past the `DocView` edge in `DocView:draw_line_text`

* Don't add draw commands if they fall outside the latest clip

The check was previously done with the window rect, so this will reduce 
a bit more the number of commands sent.
2023-08-07 15:01:50 +01:00
Guldoman c42f01ed1f
Improve IME location updates (#1170)
* Avoid updating IME input rect if it hasn't changed
* Update the IME input rect even when the composition didn't change
* Apply IME input blocking workaround to non-Linux only
2022-12-20 20:11:13 -04:00
Jefferson González 69bccf6fcf
docview: support gutter click selection, fixes #1116 (#1169)
* docview: support gutter click selection, fixes #1116

* Added missing call to parent on_mouse_pressed

Also fixed call to selections when `shift` is pressed.

* change to arrow instead of hand

Co-authored-by: Adam <adamdharrison@gmail.com>
2022-11-01 19:34:23 -04:00
Guldoman ed226c476e
Add more options to `Scrollbar` (#1174)
* Make `Scrollbar` accept a table for its options

* Add `force_status`, `{expanded,shrinked}_size` options to `Scrollbar`

* Add `Scrollbar:set_forced_status`

* Add `config.force_scrollbar_status` to force `DocView` scrollbars status
2022-11-01 18:38:50 -04:00
jgmdev 3da6833249 docview: do not render newline fixes #1164 2022-10-21 13:56:23 -04:00
Guldoman 6b754eb628
Refactor scrollbar into its own file (#1124)
* Move scrollbar to its own file
* Don't call `Scrollbar` functions if `View` is not scrollable
* Allow horizontal scrolling in `Scrollbar`
* Add horizontal scrollbar to `View`
* Add `root:horizontal-scroll` command with `shift+wheel` keymap
* Prioritize vertical scrollbar hover
* Don't send mouse movement to vertical scrollbar when dragging horizontal one
* Fix clicking on horizontal scrollbar track
* Implement `start` scrollbar alignment
* Add documentation to `Scrollbar`
* Make `DocView` infinitely scrollable horizontally
* Handle horizontal scroll SDL event
2022-10-15 20:12:15 -04:00
Guldoman 5c2c95765e
Add IME support (#991) 2022-10-15 19:58:51 -04:00
jgmdev 3f206db69a initial documentation for better code completion 2022-06-07 22:09:34 -04:00
Guldoman 11e27c6fda
Use new `CommandView:enter` options table 2022-05-30 22:08:13 +02:00
Joshua Barretto b3278f6360 Made moving to a line beyond the end of a document move the caret column to the end of the line 2022-05-30 15:40:46 +01:00
Adam 5df1640595
Merge branch 'master' into master-2.1 2022-04-24 13:42:24 -04:00
Guldoman 4f434d1a41
Show `arrow` cursor when hovering `DocView` scrollbar track 2022-04-12 02:56:41 +02:00
Guldoman 052c140787
Fix `DocView:on_mouse_released` not considering all parameters 2022-04-12 02:38:30 +02:00
Guldoman 202e42b568
Avoid calling `View:scrollbar_overlaps_point` uselessly
`View:on_mouse_moved` already updated `self.hovered_scrollbar`, so use 
that instead.
2022-04-12 02:37:21 +02:00
Adam Harrison 11dfb5b1ca Apparenlty these were issues? What? 2022-04-03 16:44:02 -04:00
Adam 3479890ce5 Soft Line Wrapping (#636)
Added in soft line wrapping.
2022-04-03 16:44:02 -04:00
Adam Harrison 82325b6a08 Fixed a bunch of problems. Fixed left+click not allowing for square selections, fixed esc not exiting multicursor mode, and allowed cntrl+click to remove a cursor. 2022-03-17 16:55:52 -04:00
Adam 61e712db12
Fixed rendering computations for y offset. (#843)
* Fixed rendering computations for y offset.

* Force monospacing if every ascii character has the same integer advance.

* Added in explanatory comment.

* Fixed issues.

* Made lines less long.
2022-02-15 15:57:07 -05:00
Guldoman 5526041da3
Check entire selection to trigger `DocView:scroll_to_make_visible`
This is needed for example when a selection has both `line1` and `col1`
at 1, and the left arrow is pressed: `line2` and `col2` change, while
`line1` and `col1` don't, but we still want to scroll.
2022-02-11 06:16:29 +01:00
Jipok c353dd6eda Add for config.highlight_current_line new variant: no_selection 2021-12-20 16:23:01 +05:00
Adam a607ef95f9
Merge pull request #682 from Guldoman/indent_refactor
Refactor how to get the indentation of a `Doc`
2021-11-27 11:55:36 -05:00
Adam Harrison 96db380c73 Manual merge of into . 2021-11-23 15:57:22 -05:00
Guldoman 3d9901695b
Use the new `Doc:get_indent_info` throughout `core` 2021-11-20 04:37:15 +01:00
Joshua Minor 4f55555ca9 Selection expands by word or line on double or triple click followed by drag. 2021-11-19 09:46:13 -08:00
Adam c58029df8b
Merge pull request #589 from adamharrison/clicks-keymap
Added in clicks to keymap.
2021-11-16 15:49:52 -05:00
Adam Harrison 6bdcfc824d Rearranged things to make a bit more sense. 2021-11-14 15:41:28 -05:00
Adam Harrison 6f53ee1b69 Added in double, and triple clicking. 2021-11-14 15:41:28 -05:00
Adam Harrison 612818ca05 Added in clicks to keymap. 2021-11-14 15:41:28 -05:00
Guldoman b3eef15e7a
Highlight any line that contains a caret
Now lines with selections can be highlighted if they contain a caret.
2021-11-09 21:33:47 +01:00
Francesco Abbate 0d2166c9ce Correct Node's clipping rectangle
Fixing the Node's clipping rectangle make the clipping in DocView:draw()
partially redundant. This latter is now no longer needed to clip
on the right when drawing the document's lines but it still serves to
the purpose of clipping on the left, before the gutter region.
2021-10-11 09:25:38 +02:00
Francesco Abbate c7aa3ebe01 Fix clipping error in docview 2021-10-10 21:44:16 +02:00
Francesco eb79381c89
Merge pull request #521 from adamharrison/remove-font-renderer
Remove Font Renderer + CP Replace + libagg
2021-10-02 18:45:31 +02:00
Guldoman 57bfb67f6a Add option to disable caret blinking (#572) 2021-10-02 18:39:23 +02:00
Guldoman f6b9d9ab67 Add option to disable scrolling past the end (#566) 2021-10-02 18:39:22 +02:00
Guldoman b5f0b340d2
Add option to disable caret blinking (#572) 2021-10-02 16:38:10 +02:00
Guldoman ab0ca031fa
Add option to disable scrolling past the end (#566) 2021-09-30 13:10:38 -07:00
Adam Harrison e25f2e9c5c Removed font renderer. 2021-09-24 11:22:39 -04:00
Guldoman 0a52861129 Revert horizontal scroll implementation 2021-09-08 07:11:50 +02:00
Guldoman e559afaefc
Add a simple cache to `DocView:get_h_scrollable_size`
This function gets called at every `core.step`, so we should avoid
having to recalculate the scrollable size every time, as it could get
very expensive on long lines.
2021-09-03 00:55:10 +02:00
Guldoman 92bbb30d06 Split vertical and horizontal scrollbar-related functions and variables 2021-08-30 17:58:22 +02:00
Guldoman 4a03aec073 Set horizontal scroll size to be more in line with other editors
Only scroll enough to see the whole line.
2021-08-30 17:58:22 +02:00
Guldoman 2d33fdc656 Show correct mouse cursor when hovering the horizontal scrollbar 2021-08-30 17:58:22 +02:00
Guldoman c16145d562 Define horizontal scrollable size for `DocView` 2021-08-30 17:58:22 +02:00
Adam 3eb6f1dbd4
Merge pull request #430 from adamharrison/vsc-multicursor-shortcuts
Added in two new VSC-style multicursor shortcuts.
2021-08-30 10:52:09 -04:00
Adam Harrison bbe4e21f52 Fixed cursors moving around with removal and inserts with cursors. Also fixed drawing line highlights with multicursors. 2021-08-29 17:54:57 -04:00
Francesco Abbate d46475532f Introduce View objects context property
Used to determine if an instance of the given class should
be closed or not when a project session is terminated.
2021-08-27 23:55:17 +02:00
Francesco Abbate 135ad072bd Move gutter width calculation out of loop 2021-07-28 13:02:38 -07:00
cukmekerb 4ad353eb4b fix line number align bug 2021-07-28 13:02:38 -07:00