Commit Graph

38 Commits

Author SHA1 Message Date
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
cukmekerb 63f406773b align line numbers to right 2021-07-28 13:02:38 -07:00
Adam 2486f253eb
Abstracted out draw caret, so that the line guide can draw under it. (#287)
* Abstracted out draw caret, so that the line guide can draw under it.

* Moved caret drawing out to draw_overlay.
2021-06-20 22:16:35 +02:00
Adam Harrison 704e04396f Rebased, and added the ability for ctrl to just create new cursors. 2021-06-18 17:33:55 -04:00
Adam Harrison 6915d86d59 Introduced the constraint that all cursors must be in order. 2021-06-18 17:33:55 -04:00
Adam Harrison b42708fe56 Cleaned up functions. 2021-06-18 17:33:55 -04:00
Adam Harrison 6c0d124410 Allows for rectangular selections with ctrl; also fixed tabbing. 2021-06-18 17:33:55 -04:00
Adam Harrison a7f39017ff Fixed undo stack. 2021-06-18 17:33:55 -04:00
Adam Harrison 37a3884ee2 Initial commit of multicursor. Next step is to investigate how multicursor works on various other IDEs and ape those. 2021-06-18 17:33:55 -04:00
liquidev cb610055d0
support for font changing in the syntax highlighter 2021-05-26 19:16:56 +02:00
Francesco Abbate 9f7f55926b Use home_encode when setting window title to filename 2021-05-05 10:35:19 +02:00
Adam e4da235f7e
Made it so that you can continue clicking and still select things. (#166) 2021-05-01 22:32:50 +02:00
Francesco Abbate 032018ec48 More aggressive wait_event timeout when window has focus
Adopt a time based logic for cursor blinking and wait for event

when idle with a timeout equal to blink remaining time.
2021-04-17 14:57:28 -07:00
Francesco Abbate 3b040aabc7 Implement unicode character replacements
Useful to draw whitespaces with alternate characters and colors
without slowing down the text rendering.

A new API is implemented. A renderer.replacements object can be created
to list the replacements.

In turns the function renderer.draw_text and draw_text_subpixel now accept
two optional arguments for replacements.
2021-04-01 18:05:59 +02:00
Francesco Abbate 88bec172a1 Fix problem with tab size and subpixel positioning
Solve github issue https://github.com/franko/lite-xl/issues/109
2021-03-18 13:54:33 +01:00
Francesco Abbate 3426bc5d73 Introduce subpixel text positioning within rencache
In order to fix the issue with cursor positioning a subpixel-aware draw
text operation within rencache was required.

With this modification the cursor positioning problem is completely
resolved.

A new function renderer.draw_text_subpixel is introduced to perform
consecutive, inline, text drawings with subpixel accuracy.
2021-03-06 18:12:02 +01:00
Francesco Abbate 9ff6a0325e Mostly fix problem of offset with cursor positioning when using mouse
In order to get right the cursor position on text on mouse clicks it is
needed to take into account text's subpixel positioning.

This fix mostly corrects the problem but cursor positioning is still
somewhat inaccurate for long lines due to repeated commands to draw a text
along a line. Repeated draw text calls make the subpixel information
lost and small errors will add-up.
2021-03-06 16:18:24 +01:00
daubaris 0cb594aaf2
Enable customizing cursor speed (#80)
Addresses issue #65
2021-03-06 11:03:12 +01:00
Francesco Abbate 6c84913f6a Do not set window's title to unsaved for command view 2021-02-28 18:54:32 +01:00
Francesco Abbate de1afb3391 Add full filename path in window's title
Optimal implementation to limite computations in core.step.
2021-02-18 00:26:19 +01:00
Francesco Abbate 3b30bfa18b Improve left/right scrolling behavior for DocView
With the new behavior when moving right and triggering a scroll in the
right direction a subsequent movement left do not longer triggers a
scrolling to the left.
The scrolling to the left happens only when needed for the visibility of
the current position.

In other terms with the old behavior the scrolling was purely a function
of the position and was adjusted even when not strictly needed for the
visibility of the cursor.
Now the scrolling is no longer a pure function of the position but it
has a "memory" behavior. The scrolling will be adjusted only if needed
to accommodate the position of the cursor.

Reduce also the width of the margin when the scrolling will be
triggered and calculate as a function of the font character width.

With the modification now Lite behaves like the other editors. In
addition the selection of text with the mouse is much more easy when
a scrolling of the line is needed.
2020-12-12 20:26:27 +01:00
rxi 094cf0cc2c Fixed shift+click select behavior 2020-06-26 10:44:56 +01:00
rxi 53d555b362 Added support for mouse double/triple click+drag selection
Resolves #159
Resolves #161
2020-06-25 13:41:46 +01:00
rxi ef53453246 Fixed x-offset of text in `DocView:draw_line_gutter` 2020-05-14 13:26:21 +01:00
rxi bcd1b3a081 Fixed gutter text jittering when horizontal scrolling on docview 2020-05-14 10:06:47 +01:00
rxi e4ae088bb5 Added support for shift+click selecting
Resolves #71
Resolves #59
2020-05-13 16:12:20 +01:00
rxi 1f55fec94b Fixed triple-clicking on last line not selecting the line 2020-05-13 09:29:53 +01:00
rxi 95bdb07d49 Removed unused variables 2020-05-07 22:40:34 +01:00
rxi f5025efbb8 Moved highlighter code from `DocView` to `Doc`
* Only one highlighter state is kept per-document as opposed
  to one per-docview
* Fixes a bug with retaining older highlighter state as a
  DocView wasn't able to detect lines changing above it's viewport
* Renames `highlighter` module to more descriptive `tokenizer`
2020-05-07 21:14:46 +01:00
rxi 9fc185af2f Added scroll bounds
Resolves #9
Resolves #6
Resolves #3
2020-05-02 00:21:04 +01:00
rxi 503d5101b5 Reorganising of DocView's draw functions
* Renamed `draw_line_body` => `draw_line_main`
* Renamed `draw_gutter_text` => `draw_line_gutter`
* Added `draw_line_text` for *just* the line text
2020-04-18 15:27:18 +01:00
rxi 33ad329f24 Changed DocView not to strip trailing `\n` character on line's final token 2020-02-05 20:09:58 +00:00
rxi d8c4bfa6ba Initial commit 2019-12-28 11:17:56 +00:00