Commit Graph

314 Commits (62eb8c6b407c61d21dbee83c4b4e78c4e6cb87c3)

Author SHA1 Message Date
Blaž Hrastnik 62eb8c6b40 mouse: Remove verify_screen_coords, refactor primary selection modification 3 years ago
Dmitry Sharshakov 8361de45dc
Mouse selection support (#509)
* Initial mouse selection support

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* Disable mouse event capture if editor crashes

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* Translate screen coordinates to view position

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* Select full lines by dragging on line numbers

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* editor: don't register dragging as a jump

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* Count graphemes correctly

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* Do not select lines when dragging on the line number bar

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* Split out verify_screen_coords

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* Do not iterate over the graphemes twice

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* Switch view by clicking on it

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* Add disable-mouse config option

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* Support multiple selections with mouse

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* Remove unnecessary check

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* Refactor using match expression

Co-authored-by: Gokul Soumya <gokulps15@gmail.com>
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* Rename local variable

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* Rename mouse option

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* Refactor code

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* Fix dragging selection

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* Fix crash when clicking past last line

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* Count characters better

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* Remove comparison not needed anymore

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* Validate coordinates before resolving position

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* Tidy up references to editor tree

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* Better way to determine line end and avoid overflow

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* Fix for last line

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* Add unit tests for text_pos_at_screen_coords

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

Co-authored-by: Gokul Soumya <gokulps15@gmail.com>
3 years ago
Nathan Vegdahl f88d4c1e20 Move indent-style code into `helix_core::indent`. 3 years ago
Nathan Vegdahl e191a75e33 Give default document a single line ending. 3 years ago
Blaž Hrastnik 05d20e196f
Merge pull request #376 from cessen/great_line_ending_and_cursor_range_cleanup
The Great Line Ending & Cursor Range Cleanup
3 years ago
Gokul Soumya 8a2fa692f2 Refactor case where key event is solely a character 3 years ago
Nathan Vegdahl cd7302ffd3 Enforce cursor/selection invariants in one place.
Rather than per-command like before.
3 years ago
Nathan Vegdahl a873e719d5 Merge branch 'master' into great_line_ending_and_cursor_range_cleanup 3 years ago
Rust & Python 581a3d42c8
Update keyboard.rs (#516)
Fix doc comment typo
3 years ago
Nathan Vegdahl f62ec6e51e Merge branch 'master' into great_line_ending_and_cursor_range_cleanup 3 years ago
Nathan Vegdahl 5ee6ba5b38 Address some PR comments. 3 years ago
Gokul Soumya 88d6f65239
Allow multi key remappings in config file (#454)
* Use tree like structure to store keymaps

* Allow multi key keymaps in config file

* Allow multi key keymaps in insert mode

* Make keymap state self contained

* Add keymap! macro for ergonomic declaration

* Add descriptions for editor commands

* Allow keymap! to take multiple keys

* Restore infobox display

* Fix keymap merging and add infobox titles

* Fix and add tests for keymaps

* Clean up comments and apply suggestions

* Allow trailing commas in keymap!

* Remove mode suffixes from keymaps

* Preserve order of keys when showing infobox

* Make command descriptions smaller

* Strip infobox title prefix from items

* Strip infobox title prefix from items
3 years ago
Nathan Vegdahl 0883b4fae0 Collect some common patterns into methods on `Range`. 3 years ago
Nathan Vegdahl 43594049dd Merge branch 'master' into great_line_ending_and_cursor_range_cleanup 3 years ago
Shafkath Shuhan 25103833b2 mark reloaded buffers as unchanged 3 years ago
Nathan Vegdahl 198fe40951 Don't insert a final line ending on file load/reload. 3 years ago
Nathan Vegdahl c848ed7abc Fixes for misc bugs with view movement. 3 years ago
Nathan Vegdahl d5534a6d10 Merge branch 'master' into great_line_ending_and_cursor_range_cleanup 3 years ago
Ivan Tham 17f9dfce7e Fix typo 3 years ago
Nathan Vegdahl b0311f4fc2 Fixed primary cursor position calculation to use 1-width semantics.
This had a bunch of knock-on effects that were buggy, such as bracket
match highlighting.
3 years ago
Nathan Vegdahl 079d4ed86d Properly fix `last_line` view calculation.
Turned out to be simpler than I thought.  Didn't even need to change the
other use-sites.
3 years ago
Nathan Vegdahl a77274e8bb Merge branch 'master' into great_line_ending_and_cursor_range_cleanup 3 years ago
Cor 9fcbbfa467 Changed startup behaviour to only open a single view when multiple files are specified on the commandline.
Changed the behaviour; the first argument on the commandline is the file on display
3 years ago
Kirawi 0b1ed8656d
Fix #442 (#446)
* fix #442

fix #442

fmt

* create Rope from default line ending

* Fix use of encoding in Document::open()
3 years ago
Blaž Hrastnik d530d6e39d Further simplify error handling in :commands 3 years ago
Lionel Flandrin 9c02a1b070 Make command implementation return a Result<()>
The error message is displayed with cx.editor.set_error.
3 years ago
Nathan Vegdahl 85d5b399de Merge branch 'master' into great_line_ending_and_cursor_range_cleanup 3 years ago
Blaž Hrastnik fc34efea12 appease clippy 3 years ago
Blaž Hrastnik 48481db8ca fix: Make path absolute before normalizing
:open ../file.txt failed before because .. would be stripped
3 years ago
Blaž Hrastnik b72c6204e5 fix: When calculating relative path, expand tilde last 3 years ago
Ivan Tham 916362d3a9 Info box add horizontal padding 3 years ago
Ivan Tham 5977b07e19 Reduce calculation and improve pattern in infobox
- switch to use static OnceCell to calculate Info once
- pass Vec<(&[KeyEvent], &str)> rather than Vec<(Vec<KeyEvent>, &str)>
- expr -> tt to allow using | as separator, make it more like match
3 years ago
Ivan Tham 9effe71b7d Apply suggestions from blaz for infobox 3 years ago
Ivan Tham 8985c58fd3 Add infobox 3 years ago
Kirawi c5b2973739
`:reload` (#374)
* reloading functionality

* fn with_newline_eof()

* fmt

* wip

* wip

* wip

* wip

* moved to core, added simd feature for encoding_rs

* wip

* rm

* .gitignore

* wip

* local wip

* wip

* wip

* no features

* wip

* nit

* remove simd

* doc

* clippy

* clippy

* address comments

* add indentation & line ending change
3 years ago
Nathan Vegdahl 28627f97e9 Fix empty document test. 3 years ago
Nathan Vegdahl 7961a13007 Make new documents empty, rather than starting with a line ending. 3 years ago
Nathan Vegdahl 22dca3b111 Allow last line in file to lack a line break character. 3 years ago
Nathan Vegdahl 7c7be6d583 Make `Selection`'s normalize and transform methods self-consuming only. 3 years ago
Nathan Vegdahl 0ae522f3df Clean up `Selection` to not use so many allocations. 3 years ago
Jakub Bartodziej 79f096963c
Color palettes (#393)
* Enable using color palettes in theme files.

* Add an example theme defined using a gruvbox color palette.

* Fix clippy error.

* Small style improvement.

* Add documentation for the features to themes.md.

* Update runtime/themes/gruvbox.toml

Fix the value of purple0.

Co-authored-by: DrZingo <DrZingo@users.noreply.github.com>

Co-authored-by: DrZingo <DrZingo@users.noreply.github.com>
3 years ago
Kirawi acaf22d005
Added native Windows clipboard support (#373)
* Added native Windows clipboard support

* make conditional

wip

better conditional

wip

wip

wip

wip

make conditional
3 years ago
Joe Neeman 2902a10a3e Make Document's format API a little nicer. 3 years ago
Joe Neeman c9be480bf8 Make formatting happen asynchronously. 3 years ago
Blaž Hrastnik 057bd630d8 Simplify selection rendering by injecting highlight scopes 3 years ago
Blaž Hrastnik 44566ea812 Release 0.3.0 3 years ago
Nathan Vegdahl d534d6470f Detect file language before file indent style.
Fixes #378.  The issue was that because indent style detection
ran before language detection, there was no language indent
style to fall back on if indent style detection failed, so it
would just default to 2 spaces.
3 years ago
teenjuna c688288881
Move helix-view/tests/*txt files to txts subdirectory (#372)
* Move helix-view/tests/*txt files to txts subdirectory

* Rename tests/txts to tests/encoding
3 years ago
Blaž Hrastnik 8e277ad8ba fix: crossterm -> input key conversion 3 years ago
Keith Simmons 4418e17547
reverse the dependency between helix-tui and helix-view (#366)
* reverse the dependency between helix-tui and helix-view by moving a fiew types to view

* fix tests

* clippy and format fixes

Co-authored-by: Keith Simmons <keithsim@microsoft.com>
3 years ago