Commit Graph

111 Commits

Author SHA1 Message Date
vqn 46ea86e28c fix cursors positions when deleting multiple selections (#1393)
* correctly handle overlapping selections merge cursors in Doc:raw_remove
2023-08-07 14:50:58 +01:00
Jefferson González 84039331a5 NagView: properly rescale on scale change (#1379)
* drop font option since style.font is always used
2023-08-07 14:50:58 +01:00
sammyette e13f265fac
feat: alert user via nagview if file cannot be saved (#1230)
* feat: alert user via nagview if file cannot be saved
it will prompt the user to choose whether they
want to save to another location and perform
the save as command
* refactor: change defer draw call to thread
* feat: log error when attempting to save doc
2022-12-11 21:38:58 -04:00
Guldoman c6c485feb0
Use subsyntax info in `doc:toggle-{line,block}-comments` 2022-11-15 16:11:37 +01:00
Guldoman 03cc5ffcd1
Add `config.keep_newline_whitespace` option (#1184)
This option will avoid removing line content when pressing enter in 
lines with only whitespace.
2022-11-03 12:40:27 -04:00
Guldoman 0f160e614e
Improvements to multicursor copy/paste (#1123)
* Add `Doc:get_selection_idx`

* Make multicursor paste add a cursor at the end of each paste

* Better manage paste of multicursor whole line copy

* Document `Doc:get_selection_idx`

* Keep track of last added selection in `Doc`

* Make use of `doc.last_selection` in `Doc` commands

* Make `Doc:get_selection` return the `Doc.last_selection` if possible
2022-11-01 18:16:39 -04:00
Guldoman 715411061b
Apply `doc` commands to anything that extends `DocView`
This fixes a regression caused by 
cf29a6a45f.
2022-10-24 04:47:26 +02:00
Guldoman cf29a6a45f
Allow command predicates to manage parameters passed to the commands
When a command is performed with parameters, those are now passed to the
predicate.
The predicate can then return, after the validity boolean, any other
value that will then be passed to the actual command.
If the predicate only returns the validity boolean, the original
parameters are passed through to the actual command.

This allows predicates to manipulate the received parameters, and allows
them to pass the result of an expensive computation to the actual
command, which won't have to recalculate it.

String and table predicates will now also return `core.active_view`.
2022-08-16 22:13:16 +02:00
Adam 6ccc5f6dde
Steps to generalize toolbar and treeview. (#1088) 2022-08-09 14:53:30 -04:00
Guldoman c792b13666
On `doc:newline` remove line content if it contains only whitespace 2022-06-25 03:57:47 +02:00
Guldoman 9cd47aa12e
Fix full line cut when only a single line remains 2022-06-24 05:49:20 +02:00
Guldoman ec58b1f0bd
Add `text` and `select_text` to `CommandView` options 2022-06-02 19:30:51 +02:00
Guldoman 11e27c6fda
Use new `CommandView:enter` options table 2022-05-30 22:08:13 +02:00
jgmdev b9bb64a2f0 Merge branch 'master' into master-2.1 2022-05-22 22:26:47 -04:00
Adam Harrison 173370694e Split out reload functionality to actual document, and added in a thread to check the document, in the cases where it wouldn't be covered by dirwatch. 2022-05-15 15:24:17 -04:00
Adam 36c4d5d9ed
Autoreload Nagview (#942)
* Modified autoreload to use new dirwatch infrastructure, and added in nagview to verify that fs changes don't stomp on our changes, unless you want them to.

* Split out reload functionality to actual document, and added in a thread to check the document, in the cases where it wouldn't be covered by dirwatch.

* As per request from jgmdev, added in ability to show nagview always.

* Changed things over to use dirwatch.

* Made sure we redrew things, added in a contingency in 'save' for times when we load a non-existent file, and added some checks.
2022-05-15 15:21:26 -04:00
jgmdev 1d1b3e0a09 Add utf8 support on doc lower and upper commands 2022-05-12 18:33:56 -04:00
Adam 3479890ce5 Soft Line Wrapping (#636)
Added in soft line wrapping.
2022-04-03 16:44:02 -04:00
Guldoman 3765ef1d7a
Move cursor to the beginning or the end of its selection
When using `doc:move-to-{previous,next}-char` in a selection, we were 
moving the cursor to the character before the initial/after the last 
character of the selection.
Now we follow what other editors do and move it to just before the 
initial/just after the final character.
2022-03-20 04:28:26 +01:00
Adam Harrison ba5289dc75 Typo. 2022-03-17 16:57:18 -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
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
Guldoman 59ba759167
Don't scroll DocView when executing `doc:select-all` 2022-02-11 06:00:38 +01:00
Guldoman f23cb33f7c
Ignore empty lines in `line_comment` 2022-02-07 19:22:43 +01:00
Adam 0a70b13a73
Merge pull request #809 from lite-xl/merge-master-2.0
Merge master 2.0
2022-01-28 14:38:22 -05:00
Adam Harrison b523bd5cee Fixed end of block-style line comments. 2022-01-20 22:17:21 -05:00
Francesco Abbate f6a0e12e31 Merge branch 'master-2.0' 2022-01-19 20:31:33 +01:00
Adam Harrison cdbfecc5ce Streamlined, and fixed guldo's problem. 2022-01-18 21:38:43 -05:00
Adam Harrison 30cc205cd4 Fixed issue first mentioned in #771. 2022-01-18 21:38:38 -05:00
Francesco Abbate 2456452f65 Fix error to close view when deleting a file 2022-01-13 16:38:20 +01:00
takase1121 fc809b3172
comment the entire line when using block comment 2022-01-08 18:45:38 +08:00
takase1121 df0f6fb94c
make set_selections consistent 2022-01-02 19:18:08 +08:00
takase1121 e079ddfa37
refactor toggle-block-comments, make command spaces aware, set selections correctly 2022-01-02 19:14:03 +08:00
takase1121 33f7fe4fda
toggle comment for whole line if nothing is selected 2021-12-26 15:12:28 +08:00
takase1121 69a857bbbf
fallback to toggle-line-comment and vice versa if needed 2021-12-26 15:05:27 +08:00
takase1121 4d31b1bc40
add toggle-block-comment 2021-12-25 12:57:00 +08:00
Adam Harrison 978550d2a2 Restores external pastes to be normal pastes. 2021-12-21 16:23:34 -05:00
Jipok 7381a13d6f Revert "Make pasting multiple lines from clipboard same way as a single line"
This reverts commit 6a135f7c06.
2021-12-12 02:23:47 +05:00
Jipok 6a135f7c06 Make pasting multiple lines from clipboard same way as a single line 2021-12-10 19:25:28 +05:00
Jipok 4eee123eff Make cursor_clipboard globa, not per doc 2021-12-08 17:34:10 +05:00
Jipok acc7ceefd4 Correct paste after 'Cut/copy whole line' 2021-12-06 17:59:49 +05:00
Jipok 93d9e61a03 Copy/cut whole line if selection empty 2021-12-05 20:30:03 +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 64f66e5d1e Added in cut, copy and paste to the context menu. Also removed find pattern, as that's no longer a valid command. Also made it so commands only show up if their predicates are valid. 2021-11-23 21:03:38 -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 Harrison c04dc648de Refactored things out. 2021-11-14 15:41:28 -05:00
Adam Harrison 1968d31b7c Keymap. 2021-11-14 15:41:28 -05:00
Adam Harrison 6bdcfc824d Rearranged things to make a bit more sense. 2021-11-14 15:41:28 -05:00
Adam Harrison ce2ec9f442 Moved commands out to the outer event loop. 2021-11-14 15:41:28 -05:00