aboutsummaryrefslogtreecommitdiff
path: root/data/core/doc/init.lua
AgeCommit message (Collapse)Author
2025-03-15add a __tostring method to every object (#1534)ThaCuber
* added a stupid __tostring to every object * moved every __tostring to just after the :extend() call --------- Co-authored-by: Adam <adamdharrison@gmail.com>
2025-03-15Project Rework (#1455)Adam
* Initial commit to clean up projects; spun off find-file to its own plugin, removed project limit, removed the concept of a project maintaining an ordered list of files, and allowed treeview to see things like hidden files and files not actually in the project. Normalizing things, fixed typo. Abstracted root project, and made things more in line with current master behaviour. Removed unused legacy code, as well as ensured that we use absolute paths. Fixed issue with backslahes on linux, will look at windows at some point. Removed stray print. Removed orphaned function. Removed extraneous command. Fixed the ability to close project folders. Removed superceded function. Applied jgm's suggestions. * Bump modversion. * Bumped modversion and changed a few minor things. * Added in handling of ignored files. * Fixed small issue. * Fixed issue with absolute arguments. * Removed home encoding; may revert this if I can find out why it was done. * Fixed minor issue with file suggestions. * Cleaned up treeview. * Typo. * Added in visible. * Ensured that the appropriate project module is loaded. * Fixed improper rebase. * Abstracted out the storage system of the workspace plugin so other plugins can use it. * Fixed double return. * Fixed functional issue. * Added documentation. * Sumenko reports duplicate function definitions, unsure why. * Fixed minor bug with workspace. * Fixed switching projects on restart. * Harmonized spacing around asserts, and fixed an issue forgetting to set has_restarted. * Made project an object. * Removing unecessary yields. * Removed unecessary fallback. * Removed unecessary line. * Reveted backslash handling, as it doesn't seem to make any difference. * Spacing. * Only stonks. * Removed uneeded error handling. * Added in function to determine project by path, and added in deprecation warnings for legacy interface. * Removed storage module. * Typo. * Changed to use deprecation log instead of regular warn so as to not spam logs. * Fixed small bug with saving workspaces on project change. * Update data/core/init.lua ---------
2024-10-22Add `inclusive` parameter to `Doc:get_text` (#1586)Guldoman
This is needed to get the last character of the "selection". For example: ```lua doc:get_text(1, 1, #doc.lines, math.huge) ``` will return everything but the last newline, while ```lua doc:get_text(1, 1, #doc.lines, math.huge, true) ``` will return the last newline too.
2024-10-22Add support for relative `require`s (#1634)Guldoman
2024-10-22Allow writing to hidden files on Windows (#1653)Takase
* feat(system): add system.ftruncate * fix: EPERM writing to hidden files on Windows * chore(doc): fix capitalization * refactor(system): make ftruncate length optional * refactor(doc): don't specify length
2024-06-24core/doc: fix wrong table index in Doc:merge_cursorstakase1121
it was off by 1
2024-06-24fix(doc): convert `Doc:merge_cursors` parameter from "selection index" to ↵Guldoman
table index
2023-11-30Use `\r\n` for new files on Windows (#1596)Guldoman
* Use `\r\n` for new files on Windows * Add `config.line_endings`
2023-11-29Text overwriting (#1495)ThaCuber
* added text overwriting * rewrote `DocView:draw_caret` to not use the order of draws * forgot to delete some old code in `DocView:draw_overlay` also added a temporary solution to overwriting and added the missing arguments in `DocView:draw_ime_decoration` and fixed `DocView:draw_caret` * accidentally broke the `draw_caret` call in `draw_overlay` in the process * multiline * fixed calling `Doc:get_char` as a function that, in turn, crashed the editor because "can't index a number" * move and rename some stuff * remove unneeded extra check I just had to change the `~=` to `<` in the second condition * overwrite disregards pasting text * disregard overwrite on selections; doc only removes selection * Fixed error where `doc` was used, instead of `self`. --------- Co-authored-by: ThaCuber <70547062+ThaCuber@users.noreply.github.com> Co-authored-by: Adam Harrison <adamdharrison@gmail.com>
2023-11-29Fix editing after undo not clearing the change id (#1574)Guldoman
2023-10-18Mark unsaved named files as dirty (#1598)Guldoman
2023-07-03Skip checking `files` if no filename was provided to `syntax.get`Guldoman
2023-06-09Make `Doc:sanitize_position` return a more appropriate `col` (#1469)Guldoman
If `line` is out of range, return the `col` "closest" to the original values.
2023-06-09Revert "core syntax: strip the path from filename on syntax.get (#1168)" (#1322)Guldoman
* Revert "core syntax: strip the path from filename on syntax.get (#1168)" This reverts commit af6c4bc152234e13f3e12819e361e1b92a387013. The previous behavior was correct and allowed access to the full path for path-dependant syntaxes. * Use `Doc.abs_filename` to obtain syntax when possible This allows matching full paths in language syntaxes, but we lose the possibility of matching the project root.
2023-04-10#1393 followup (#1463)vqn
* Fix incorrect check in doc:raw_remove Restore caret position on command doc:cut * merge cursors and fix new line in clipboard * add new line to the last copied line
2023-04-07fix cursors positions when deleting multiple selections (#1393)vqn
* correctly handle overlapping selections merge cursors in Doc:raw_remove
2022-11-02Don't sort in `Doc:get_selection_idx` with an invalid indexGuldoman
2022-11-01Improvements to multicursor copy/paste (#1123)Guldoman
* 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-10-15Add IME support (#991)Guldoman
2022-07-11Make `Doc:get_selection[s]` return if the selection was actually sortedGuldoman
2022-06-25Don't indent empty lines in a selectionGuldoman
2022-06-07initial documentation for better code completionjgmdev
2022-05-15Split out reload functionality to actual document, and added in a thread to ↵Adam Harrison
check the document, in the cases where it wouldn't be covered by dirwatch.
2022-04-27Manage return values from "replacer" function in `Doc:replace`Guldoman
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-03-18Reset syntax when a filename is providedGuldoman
2022-03-17Fixed a bunch of problems. Fixed left+click not allowing for square ↵Adam Harrison
selections, fixed esc not exiting multicursor mode, and allowed cntrl+click to remove a cursor.
2022-01-19Merge branch 'master-2.0'Francesco Abbate
2021-12-30Fix problem when opening project's module documentFrancesco Abbate
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-10Delete old forgotten self.cursor_clipboardJipok
2021-12-08Make cursor_clipboard globa, not per docJipok
2021-12-06Correct paste after 'Cut/copy whole line'Jipok
2021-11-27Merge pull request #682 from Guldoman/indent_refactorAdam
Refactor how to get the indentation of a `Doc`
2021-11-23Added in cut, copy and paste to the context menu. Also removed find pattern, ↵Adam Harrison
as that's no longer a valid command. Also made it so commands only show up if their predicates are valid.
2021-11-23Manual merge of into .Adam Harrison
2021-11-20Use the new `Doc:get_indent_info` throughout `core`Guldoman
2021-11-20Add `Doc:get_indent_info`Guldoman
It returns the indentation type, size and confirmation status, used by the `Doc`.
2021-11-20Pre-populate the highlighterGuldoman
This avoids problems with calls to `[insert,remove]_notify` on lines that the highlighter has not yet added.
2021-11-20Add `soft_reset` to highlighterGuldoman
This allows clearing the `lines` table without removing entries.
2021-11-17Merge branch 'master' into replace-unpackTakase
2021-10-10Merge pull request #466 from Guldoman/new_not_dirtyFrancesco
Avoid setting a new file as dirty if it is empty
2021-10-08Improve highlither for document editsFrancesco Abbate
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-07Improve highlither for document editsFrancesco Abbate
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-02Sanitize selections after redoGuldoman
2021-09-08Revert horizontal scroll implementationGuldoman
2021-08-31Avoid setting a new file as dirty if it is emptyGuldoman
2021-08-31Forgot to return an 'n'.Adam Harrison
2021-08-30Fixed replace to make it multicursor-aware.Adam Harrison
2021-08-30Avoid recreating `line_numbers` table when a recalc is neededGuldoman
2021-08-30Avoid recreating tables when calculating the longest linesGuldoman
2021-08-30Fix discrepancy in max line lengthGuldoman
The line length calculated in `Doc:load` didn't account for the newline that gets added.