vqn
12e0634f9c
fix cursors positions when deleting multiple selections ( #1393 )
...
* correctly handle overlapping selections merge cursors in Doc:raw_remove
2023-08-19 12:39:33 +08:00
Guldoman
b029f5993e
Don't sort in `Doc:get_selection_idx` with an invalid index
2022-11-02 21:11:41 +01: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
5c2c95765e
Add IME support ( #991 )
2022-10-15 19:58:51 -04:00
Guldoman
e7c4bdfe8e
Make `Doc:get_selection[s]` return if the selection was actually sorted
2022-07-11 05:39:55 +02:00
Guldoman
d6ce9e1ac6
Don't indent empty lines in a selection
2022-06-25 03:32:47 +02:00
jgmdev
3f206db69a
initial documentation for better code completion
2022-06-07 22:09:34 -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
Guldoman
f92f56d42e
Manage return values from "replacer" function in `Doc:replace`
...
Before the addition of multi-cursor support, we just returned the second
return value of the "replacer" function to the caller.
With the introduction of multi-cursors, we naively summed the second
return values for each cursor.
In some cases the "replacer" function doesn't return any second value,
so we tried to do math with `nil`, thus throwing errors.
Now the second return value is added to a table which is then returned
to the caller.
2022-04-27 21:53:35 +02:00
Guldoman
9763701cbf
Reset syntax when a filename is provided
2022-03-18 00:36:25 -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
Francesco Abbate
f6a0e12e31
Merge branch 'master-2.0'
2022-01-19 20:31:33 +01:00
Francesco Abbate
fd074ff39a
Fix problem when opening project's module document
...
It wasn't fine to call core.open_doc without filename argument
and later call Doc:save without providing both the filename and
the absolute filename. It was giving a Doc in an inconsistent
status where self.filename was set but not self.abs_filename.
Added an asset to detect early the problem if ever happens again.
In turn the problem prevented the project's module hook to work if the
file was newly created.
2021-12-30 15:26:40 +01:00
Jipok
4a563ddea1
Delete old forgotten self.cursor_clipboard
2021-12-10 19:23:49 +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
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
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
Guldoman
b77b1c0221
Add `Doc:get_indent_info`
...
It returns the indentation type, size and confirmation status, used by
the `Doc`.
2021-11-20 04:36:58 +01:00
Guldoman
d0a2c913f5
Pre-populate the highlighter
...
This avoids problems with calls to `[insert,remove]_notify` on lines
that the highlighter has not yet added.
2021-11-20 01:18:37 +01:00
Guldoman
f24aa64cd5
Add `soft_reset` to highlighter
...
This allows clearing the `lines` table without removing entries.
2021-11-20 01:15:13 +01:00
Takase
8e6f594790
Merge branch 'master' into replace-unpack
2021-11-17 08:42:08 +08:00
Francesco
228d6ff101
Merge pull request #466 from Guldoman/new_not_dirty
...
Avoid setting a new file as dirty if it is empty
2021-10-10 10:05:19 +02:00
Francesco Abbate
92362586df
Improve highlither for document edits
...
The syntax highlighter keep a cache of the documents like tokenization.
In order to minimize the amount of tokenize re-computations we insert some
emtty lines or remove some lines in the highlither lines corresponding to
the lines added or removed to the document.
2021-10-08 21:28:27 +02:00
Francesco Abbate
44d7f3738f
Improve highlither for document edits
...
The syntax highlighter keep a cache of the documents like tokenization.
In order to minimize the amount of tokenize re-computations we insert some
emtty lines or remove some lines in the highlither lines corresponding to
the lines added or removed to the document.
2021-10-07 19:19:08 +02:00
Guldoman
db3643653e
Sanitize selections after redo
2021-10-02 22:03:52 +02:00
Guldoman
0a52861129
Revert horizontal scroll implementation
2021-09-08 07:11:50 +02:00
Guldoman
a920e5b0e6
Avoid setting a new file as dirty if it is empty
2021-08-31 23:16:02 +02:00
Adam Harrison
e541236c22
Forgot to return an 'n'.
2021-08-31 16:21:40 -04:00
Adam Harrison
1c4a4e763e
Fixed replace to make it multicursor-aware.
2021-08-30 22:56:33 -04:00
Guldoman
235b1f0385
Avoid recreating `line_numbers` table when a recalc is needed
2021-08-30 17:58:22 +02:00
Guldoman
4d0656ad7e
Avoid recreating tables when calculating the longest lines
2021-08-30 17:58:22 +02:00
Guldoman
f106993d0e
Fix discrepancy in max line length
...
The line length calculated in `Doc:load` didn't account for the newline
that gets added.
2021-08-30 17:58:22 +02:00
Guldoman
3e6afeccc0
Remove line from longest lines table only if needed
...
Checking if a line needs to be removed is faster than just trying to
remove it.
2021-08-30 17:58:22 +02:00
Guldoman
e52362e55f
Make `Doc` keep track of max line length
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
4ae16615e8
Fixed cursor movement.
2021-08-29 20:05:58 -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
takase1121
30ccde896d
replace unpack() with table.unpack()
...
I have no idea unpack() is still used and how it still worked.
2021-08-29 09:14:12 +08:00
Takase
816ceb4493
increase code readibility
2021-08-24 11:35:53 +02:00
takase1121
cf7ebdad1f
add doc:get_selection_text()
2021-08-24 11:35:53 +02:00
Adam Harrison
acd122bc34
Small fix.
2021-08-11 18:38:36 -04:00
Adam Harrison
71e62ce84f
Added in a hash check to the system clipboard.
2021-08-10 21:25:40 -04:00
Adam Harrison
c461cfae93
Removed unecessary duplicates.
2021-07-20 14:50:40 -04:00
Adam Harrison
0777a6f0b8
Merged dev to master.
2021-07-20 14:39:50 -04:00
jgmdev
1a51dad23c
Added Doc:on_close() for plugins
2021-06-20 00:13:07 -04:00
Adam Harrison
292c98935c
Fixed recursion error.
2021-06-18 17:33:55 -04:00
Adam Harrison
0210264552
Made get_selections a bit more flexible.
2021-06-18 17:33:55 -04:00